[Gluster-devel] Suggestion to optimize posix_getxattr call
Mohit Agrawal
moagrawa at redhat.com
Mon May 15 09:26:34 UTC 2017
Hi,
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[8192](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.
Regards
Mohit Agrawal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20170515/fec1a98c/attachment.html>
More information about the Gluster-devel
mailing list