[Gluster-devel] Suggestion to optimize posix_getxattr call
Pranith Kumar Karampuri
pkarampu at redhat.com
Wed May 17 10:43:49 UTC 2017
yeah +1 from me too.
On Mon, May 15, 2017 at 2:56 PM, Mohit Agrawal <moagrawa at redhat.com> wrote:
> I was just checking of posix_getxattr code to debug of my one problem.I
> have found scope of improvement in
> this function to execute system call in better way.As of now
> function(posix_getxattr) is calling system
> calls (sys_lgetxattr) two times to get the value of xattr or in case of
> list of xattr it calls multiple times
> 1) In first time it get the buffer size required to store the value.
> call "size = sys_lgetxattr (real_path, key, NULL, 0);"
> 2) In second time it calls the sys_lgetxattr with buffer after allocate
> the buffer size
> sys_lgetxattr (real_path, key, value, size);
> In the same way function is calling for listxattr also.I think we can
> optimise it as like below
> declare buffer buf(size can be double to this also)
> 1) Call size = sys_lgetxattr (real_path,key,buf,8192)
> 2) if size == -1 and errono == ERANGE then we need to call systemcalls
> in old way like above otherwise
> we don't need to do anything.
> In the case of failure we need to call systemcall 3 times while buffer
> is more than our declared buffer
> size otherwise in most of the cases we need to call it only once.
> Please share your input on this, appreciate your input.
> Mohit Agrawal
> Gluster-devel mailing list
> Gluster-devel at gluster.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gluster-devel