Re: [PATCH 3/7] sysfs: Keep an nlink count on sysfs directories.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cornelia Huck <cornelia.huck@xxxxxxxxxx> writes:

> On Mon, 11 Jan 2010 12:21:51 -0800,
> "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> wrote:
>
>> From: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>
>> 
>> On large directories sysfs_count_nlinks can be a significant
>> bottleneck, so keep a count in sysfs_dirent.  If we exceed
>> the maximum number of directory entries we can store return
>> nlink of 1.  An nlink of 1 matches what reiserfs does in
>> this case, and it let's find and similar utlities know that
>> we have a the directory nlink can not be used for optimization
>> purposes.
>> 
>> Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>
>> ---
>>  fs/sysfs/dir.c   |   20 ++++++++++++++++++++
>>  fs/sysfs/inode.c |   15 +--------------
>>  fs/sysfs/mount.c |    1 +
>>  fs/sysfs/sysfs.h |    1 +
>>  4 files changed, 23 insertions(+), 14 deletions(-)
>> 
>
>> @@ -420,6 +438,7 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
>>  		return -EEXIST;
>> 
>>  	sd->s_parent = sysfs_get(acxt->parent_sd);
>> +	sysfs_dir_inc_nlink(sd->s_parent);
>> 
>>  	sysfs_link_sibling(sd);
>> 
>> @@ -512,6 +531,7 @@ void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
>> 
>>  	BUG_ON(sd->s_flags & SYSFS_FLAG_REMOVED);
>> 
>> +	sysfs_dir_dec_nlink(sd->s_parent);
>>  	sysfs_unlink_sibling(sd);
>> 
>>  	/* Update timestamps on the parent */
>
> Shouldn't s_nlink be adjusted in sysfs_rename for the move case as well?

Yes.  I hereby nominate this as my most buggy patch ever.
Ugh.

I thought I actually cared about nlinks when I bothered to keep a
nlink count, but I am starting to think I really don't.

Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux