public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] st_nlink after rmdir() and rename()
Date: Fri, 04 Mar 2011 06:37:15 +0900	[thread overview]
Message-ID: <87lj0v9984.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <AANLkTinJPQtcBQsBd+OmioywcxSgzWXFgqMBSrfx8e6D@mail.gmail.com> (Linus Torvalds's message of "Thu, 3 Mar 2011 13:02:50 -0800")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Thu, Mar 3, 2011 at 12:46 PM, OGAWA Hirofumi
> <hirofumi@mail.parknet.co.jp> wrote:
>>
>> But, some commands see i_nlink (IIRC, it's checking i_nlink == 2, to
>> know empty dir or not).
>
> Actually, that would be a serious bug in the application.
>
> The traditional rule of thumb is that a directory with i_nlink==1 has
> a "I'm not counting at all".
>
> For example, I think that's the rule that 'find' uses to decide if a
> directory can have subdirectories (and when it could try to stop
> scanning early): i_nlink == 1 means that yes, it _can_ have
> subdirectories, we just don't know how many.

Yes. I think it is.

> So checking i_nlink==2 is actually a user-level bug.

We can call it's the user-level bug, but like you know, we will receive
many complain if old behavior was broken. If you are saying i_nlink == 2
is meaning the undefine, it sounds strange. (I was thinking it's why
isofs is using i_nlink == 1 always. I.e. i_nlink >= 2 is defined
behavior. Actually the reason would be "find" was checking i_nlink == 2
though)

>> So we have to simulate some levels. I guess you
>> are not saying we don't need to care it at all though.
>
> I'm saying that it should just work to set i_nlink=1 and not do
> anything at all. Ever. It's a valid model for directory counts.
>
> Seriously - that's what isofs does, for example. It does mean that
> 'find' for certain cases gets bit more expensive, but on the other
> hand, other operations are a lot _less_ expensive.
>
> We might well try that as a FAT mount option, to let people decide
> whether they really do want the "scan directories all the time" or
> only the "let 'find' scan directories when it needs to" behavior.

Yes. i_nlink == 1 is ok, IIRC (I checked last time at least. And I used
i_nlink == 1 for exFAT).  And I agree with you almost all, but isofs is
read-only, the read-only is why I was not really sure.

And I can't only see is why you refuse to make consistent behavior (if
you are saying it). It's why I said if it's _really easy_.

Thanks
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  parent reply	other threads:[~2011-03-03 21:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  3:24 [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03  4:42 ` Al Viro
2011-03-03  5:17 ` Linus Torvalds
2011-03-03  6:03   ` Al Viro
2011-03-03 20:05     ` Linus Torvalds
2011-03-03 20:46       ` OGAWA Hirofumi
2011-03-03 20:50         ` OGAWA Hirofumi
2011-03-03 21:02         ` Linus Torvalds
2011-03-03 21:30           ` Al Viro
2011-03-03 21:37           ` OGAWA Hirofumi [this message]
2011-03-03 21:52             ` Linus Torvalds
2011-03-03 22:26               ` OGAWA Hirofumi
2011-03-03 22:37                 ` Linus Torvalds
2011-03-03 23:14                   ` OGAWA Hirofumi
2011-03-03 23:12                 ` Al Viro
2011-03-03 22:57               ` Al Viro
2011-03-03 23:07                 ` Al Viro
2011-03-04  6:55                 ` omfs fixes Al Viro
2011-03-04 15:24                   ` Bob Copeland
2011-03-03 21:23       ` [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03 14:34 ` Theodore Tso
2011-03-03 16:17   ` Andreas Schwab
2011-03-03 19:16   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lj0v9984.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox