• E
    sysfs: Add s_hash to sysfs_dirent and order directory entries by hash · 4e4d6d86
    Eric W. Biederman 提交于
    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: NEric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
    4e4d6d86
dir.c 24.3 KB