* Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] [not found] ` <149132131706.18980.7074156386090748482.stgit@warthog.procyon.org.uk> @ 2017-04-05 10:53 ` David Howells 2017-04-05 12:30 ` David Sterba 0 siblings, 1 reply; 5+ messages in thread From: David Howells @ 2017-04-05 10:53 UTC (permalink / raw) To: linux-btrfs Cc: dhowells, linux-xfs, hch, amir73il, david, fstests, linux-fsdevel, Eryu Guan I've added a test to xfstests that exercises the new statx syscall. However, it fails on btrfs: Test statx on a directory +[!] stx_nlink differs, 1 != 2 +Failed +stat_test failed because a new directory it creates has an nlink of 1, not 2. Is this a case of my making an incorrect assumption or is it an fs bug? David ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] 2017-04-05 10:53 ` Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] David Howells @ 2017-04-05 12:30 ` David Sterba 2017-04-05 12:32 ` Amir Goldstein 0 siblings, 1 reply; 5+ messages in thread From: David Sterba @ 2017-04-05 12:30 UTC (permalink / raw) To: David Howells Cc: linux-btrfs, linux-xfs, hch, amir73il, david, fstests, linux-fsdevel, Eryu Guan On Wed, Apr 05, 2017 at 11:53:41AM +0100, David Howells wrote: > I've added a test to xfstests that exercises the new statx syscall. However, > it fails on btrfs: > > Test statx on a directory > +[!] stx_nlink differs, 1 != 2 > +Failed > +stat_test failed > > because a new directory it creates has an nlink of 1, not 2. Is this a case > of my making an incorrect assumption or is it an fs bug? Afaik nlink == 1 means that there's no accounting of subdirectories, and it's a valid value. The 'find' utility can use nlink to optimize directory traversal but otherwise I'm not aware of other usage. All directories in btrfs have nlink == 1. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] 2017-04-05 12:30 ` David Sterba @ 2017-04-05 12:32 ` Amir Goldstein 2017-04-08 15:43 ` Eryu Guan 2017-04-08 21:02 ` David Howells 0 siblings, 2 replies; 5+ messages in thread From: Amir Goldstein @ 2017-04-05 12:32 UTC (permalink / raw) To: dsterba, David Howells, Linux Btrfs, linux-xfs, Christoph Hellwig, Amir Goldstein, Dave Chinner, fstests, linux-fsdevel, Eryu Guan On Wed, Apr 5, 2017 at 3:30 PM, David Sterba <dsterba@suse.cz> wrote: > On Wed, Apr 05, 2017 at 11:53:41AM +0100, David Howells wrote: >> I've added a test to xfstests that exercises the new statx syscall. However, >> it fails on btrfs: >> >> Test statx on a directory >> +[!] stx_nlink differs, 1 != 2 >> +Failed >> +stat_test failed >> >> because a new directory it creates has an nlink of 1, not 2. Is this a case >> of my making an incorrect assumption or is it an fs bug? > > Afaik nlink == 1 means that there's no accounting of subdirectories, and > it's a valid value. The 'find' utility can use nlink to optimize > directory traversal but otherwise I'm not aware of other usage. > > All directories in btrfs have nlink == 1. FYI, Overlayfs uses nlink = 1 for merge dirs to silence 'find' et al. Ext4 uses nlink = 1 for directories with more than 32K subdirs (EXT4_FEATURE_RO_COMPAT_DIR_NLINK). But in both those fs newly created directories will have nlink = 2. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] 2017-04-05 12:32 ` Amir Goldstein @ 2017-04-08 15:43 ` Eryu Guan 2017-04-08 21:02 ` David Howells 1 sibling, 0 replies; 5+ messages in thread From: Eryu Guan @ 2017-04-08 15:43 UTC (permalink / raw) To: David Howells, dsterba Cc: dsterba, Linux Btrfs, linux-xfs, Christoph Hellwig, Dave Chinner, fstests, linux-fsdevel, Amir Goldstein On Wed, Apr 05, 2017 at 03:32:30PM +0300, Amir Goldstein wrote: > On Wed, Apr 5, 2017 at 3:30 PM, David Sterba <dsterba@suse.cz> wrote: > > On Wed, Apr 05, 2017 at 11:53:41AM +0100, David Howells wrote: > >> I've added a test to xfstests that exercises the new statx syscall. However, > >> it fails on btrfs: > >> > >> Test statx on a directory > >> +[!] stx_nlink differs, 1 != 2 > >> +Failed > >> +stat_test failed > >> > >> because a new directory it creates has an nlink of 1, not 2. Is this a case > >> of my making an incorrect assumption or is it an fs bug? > > > > Afaik nlink == 1 means that there's no accounting of subdirectories, and > > it's a valid value. The 'find' utility can use nlink to optimize > > directory traversal but otherwise I'm not aware of other usage. > > > > All directories in btrfs have nlink == 1. > > FYI, > > Overlayfs uses nlink = 1 for merge dirs to silence 'find' et al. > Ext4 uses nlink = 1 for directories with more than 32K subdirs > (EXT4_FEATURE_RO_COMPAT_DIR_NLINK). > > But in both those fs newly created directories will have nlink = 2. Is there a conclusion on this? Seems the test should be updated accordingly? Thanks, Eryu ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] 2017-04-05 12:32 ` Amir Goldstein 2017-04-08 15:43 ` Eryu Guan @ 2017-04-08 21:02 ` David Howells 1 sibling, 0 replies; 5+ messages in thread From: David Howells @ 2017-04-08 21:02 UTC (permalink / raw) To: Eryu Guan Cc: dhowells, dsterba, Linux Btrfs, linux-xfs, Christoph Hellwig, Dave Chinner, fstests, linux-fsdevel, Amir Goldstein Eryu Guan <eguan@redhat.com> wrote: > > Overlayfs uses nlink = 1 for merge dirs to silence 'find' et al. > > Ext4 uses nlink = 1 for directories with more than 32K subdirs > > (EXT4_FEATURE_RO_COMPAT_DIR_NLINK). > > > > But in both those fs newly created directories will have nlink = 2. > > Is there a conclusion on this? Seems the test should be updated > accordingly? I've dropped the nlink check on directories. David ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-04-08 21:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170405103809.GY22845@eguan.usersys.redhat.com>
[not found] ` <149132130900.18980.537296385250153410.stgit@warthog.procyon.org.uk>
[not found] ` <149132131706.18980.7074156386090748482.stgit@warthog.procyon.org.uk>
2017-04-05 10:53 ` Does btrfs get nlink on directories wrong? -- was Re: [PATCH 2/4] xfstests: Add first statx test [ver #5] David Howells
2017-04-05 12:30 ` David Sterba
2017-04-05 12:32 ` Amir Goldstein
2017-04-08 15:43 ` Eryu Guan
2017-04-08 21:02 ` David Howells
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).