yeah +1 from me too. On Mon, May 15, 2017 at 2:56 PM, Mohit Agrawal <moagr...@redhat.com> wrote:
> 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 > > _______________________________________________ > Gluster-devel mailing list > Gluster-devel@gluster.org > http://lists.gluster.org/mailman/listinfo/gluster-devel > -- Pranith
_______________________________________________ Gluster-devel mailing list Gluster-devel@gluster.org http://lists.gluster.org/mailman/listinfo/gluster-devel