diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2011-07-21 19:59:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 20:43:30 -0400 |
commit | 7f9838fd01833ffb30177d964983076924344c9e (patch) | |
tree | 95487aa8962c0baaed05375f739a4a16a566a388 /fs/sysfs/sysfs.h | |
parent | 86028619b9f653a30f5aa0d331fdedd899a1eea5 (diff) |
sysfs: count subdirectories
sysfs: count subdirectories
This patch introduces a subdirectory counter for each sysfs directory.
Without the patch, sysfs_refresh_inode would walk all entries of the directory
to calculate the number of subdirectories.
This patch improves time of "ls -la /sys/block" when there are 10000 block
devices from 9 seconds to 0.19 seconds.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/sysfs.h')
-rw-r--r-- | fs/sysfs/sysfs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 845ab3ad229d..6348e2c753f6 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -19,6 +19,8 @@ struct sysfs_elem_dir { | |||
19 | struct kobject *kobj; | 19 | struct kobject *kobj; |
20 | /* children list starts here and goes through sd->s_sibling */ | 20 | /* children list starts here and goes through sd->s_sibling */ |
21 | struct sysfs_dirent *children; | 21 | struct sysfs_dirent *children; |
22 | |||
23 | unsigned long subdirs; | ||
22 | }; | 24 | }; |
23 | 25 | ||
24 | struct sysfs_elem_symlink { | 26 | struct sysfs_elem_symlink { |