sysfs: Add s_hash to sysfs_dirent and order directory entries by hash
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 19 Dec 2011 04:05:43 +0000 (20:05 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Jan 2012 20:36:17 +0000 (12:36 -0800)
commit4e4d6d860b9393c5395ba5920edb5b4c5d43a3a3
tree245addd82a018bd6a9483b01decfada9a13ffc3e
parentdcd6c92267155e70a94b3927bce681ce74b80d1f
sysfs: Add s_hash to sysfs_dirent and order directory entries by hash

Compute a 31 bit hash of directory entries (that can fit in a signed
32bit off_t) and index the sysfs directory entries by that hash,
replacing the per directory indexes by name and by inode.  Because we
now only use a single rbtree this reduces the size of sysfs_dirent by 2
pointers.  Because we have fewer cases to deal with the code is now
simpler.

For now I use the simple hash that the dcache uses as that is easy to
use and seems simple enough.

In addition to makeing the code simpler using a hash for the file
position in readdir brings sysfs in line with other filesystems that
have non-trivial directory structures.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/dir.c
fs/sysfs/sysfs.h
This page took 0.024797 seconds and 5 git commands to generate.