sysfs: count subdirectories
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 21 Jul 2011 23:59:22 +0000 (19:59 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 00:43:30 +0000 (17:43 -0700)
commit7f9838fd01833ffb30177d964983076924344c9e
tree95487aa8962c0baaed05375f739a4a16a566a388
parent86028619b9f653a30f5aa0d331fdedd899a1eea5
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>
fs/sysfs/dir.c
fs/sysfs/inode.c
fs/sysfs/sysfs.h