[Gluster-devel] [Gluster-users] Why nodeid==1 need to be checked and dealt with specially in "fuse-bridge.c"?

Amar Tumballi atumball at redhat.com
Sun Mar 19 14:02:17 UTC 2017


On Sun, Mar 19, 2017 at 2:28 AM, Zhitao Li <zhitaoli1201 at outlook.com> wrote:

> Hello, Amar,
>
> Thanks for your kind help.
>
> Could you tell me why a lookup instead of a stat should be applied if
> nodeid==1 in fuse_getattr?
>
>
> Looks like that part of the code is introduced in very first commit (git
show d5910898) and is not revisited in a long time.
If there are no crashes you see by removing it, i recommend you submit a
patch, it should be taken in. Because I see that inode resolution should
get the proper inode for (nodeid == 1) case aslo.

There was a bug in fuse where for root inode there used to be no 'lookup'
coming. It was assumed to be present during the mount. We did fix it by
calling the fuse_root_lookup() during init (from the notify()) itself. So,
this part of the code can be taken out.

Regards,
Amar

Best regards,
> Zhitao Li
>
> Sent from Outlook <http://aka.ms/weboutlook>
> ------------------------------
> *From:* Amar Tumballi <atumball at redhat.com>
> *Sent:* Saturday, March 18, 2017 11:23:17 PM
> *To:* Zhitao Li
> *Cc:* gluster-users at gluster.org; Zhitao Li; 1318078301 at qq.com
> *Subject:* Re: [Gluster-users] Why nodeid==1 need to be checked and dealt
> with specially in "fuse-bridge.c"?
>
>
>
> On Wed, Mar 15, 2017 at 9:17 PM, Zhitao Li <zhitaoli1201 at outlook.com>
> wrote:
>
>> Hello, everyone,
>>
>>
>> I have been trying to optimize *"ls" performance* for Glusterfs
>> recently. My volume is disperse(48 bricks  with redundancy 16), and I
>> mount it with fuse. I create 10000 little files in mount point. Then I
>> execute "ls" command. In my cluster, it takes about 3 seconds.
>>
>> I have a question about *fuse_getattr *function in "fuse-bridge.c" .*
>> Why need we check whether nodeid is equal to 1?* , which means it is the
>> mount point.  It is hard for me to get its meaning.
>>
>> (In my case, I find the operation of fuse_getattr takes neer half time
>> for "ls", that is why I want to know what the check means. )
>>
>>
>>
>>
>>
>>
>> I try to disable the special check, and then test "ls". It works normally
>> and have a speedup 2x(about 1.3s without check). The reason is that in my
>> case, "lookup" cost is much higher than "stat". Without the special check,
>> getattr goes into "stat" instead of "lookup".
>>
>>
>> Could you tell me the meaning of the special check for "nodeid == 1"?
>>
> glusterfs passes 'nodeid' as pointer of inode_t for an entry in all the
> cases. But in case of root (which is inode number 1, and nodeid 1), we
> can't pass inode pointer value, but needs to override that part of the code
> to send 1 instead of pointer. Hence a separate fuse_root_lookup_cbk()
> function.
>
> Regards,
> Amar
>
>
>
>> I would appreciate it if anyone could give some tips . Thank you!
>>
>> Best regards,
>> Zhitao Li
>>
>> Sent from Outlook <http://aka.ms/weboutlook>
>>
>> _______________________________________________
>> Gluster-users mailing list
>> Gluster-users at gluster.org
>> http://lists.gluster.org/mailman/listinfo/gluster-users
>>
>
>
>
> --
> Amar Tumballi (amarts)
>



-- 
Amar Tumballi (amarts)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20170319/c22219ae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 71684 bytes
Desc: not available
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20170319/c22219ae/attachment-0001.png>


More information about the Gluster-devel mailing list