On Mon, May 15, 2017 at 2:56 PM, Mohit Agrawal <moagrawa@xxxxxxxxxx> wrote:
Hi,I was just checking of posix_getxattr code to debug of my one problem.I have found scope of improvement inthis function to execute system call in better way.As of now function(posix_getxattr) is calling systemcalls (sys_lgetxattr) two times to get the value of xattr or in case of list of xattr it calls multiple times1) 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 sizesys_lgetxattr (real_path, key, value, size);In the same way function is calling for listxattr also.I think we can optimise it as like belowdeclare 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 otherwisewe 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 buffersize otherwise in most of the cases we need to call it only once.
+1.
Please add a counter for the number of times the failure happens with ERANGE, and see if we can log offender keys. Helps to adjust the size later.
Please add a counter for the number of times the failure happens with ERANGE, and see if we can log offender keys. Helps to adjust the size later.
-Amar
Please share your input on this, appreciate your input.RegardsMohit Agrawal
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://lists.gluster.org/mailman/listinfo/gluster-devel
--
Amar Tumballi (amarts)
_______________________________________________ Gluster-devel mailing list Gluster-devel@xxxxxxxxxxx http://lists.gluster.org/mailman/listinfo/gluster-devel