diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-05-21 16:01:00 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-11 21:36:09 -0400 |
commit | 9fd5746fd3d7838bf6ff991d50f1257057d1156f (patch) | |
tree | e0afe14ea9415b0e54c40703bb44acfec100a4b3 /fs/char_dev.c | |
parent | ebc1ac164560a241d9bf1b7519062910c3f90a01 (diff) |
fs: Remove i_cindex from struct inode
The only user of the i_cindex element in the inode structure is used
is by the firewire drivers. As part of an attempt to slim down the
inode structure to save memory --- since a typical Linux system will
have hundreds of thousands if not millions of inodes cached, a
reduction in the size inode has high leverage.
The firewire driver does not need i_cindex in any fast path, so it's
simple enough to calculate when it is needed, instead of wasting space
in the inode structure.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: krh@redhat.com
Cc: stefanr@s5r6.in-berlin.de
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 38f71222a552..b7c9d5187a75 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -375,7 +375,6 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
375 | p = inode->i_cdev; | 375 | p = inode->i_cdev; |
376 | if (!p) { | 376 | if (!p) { |
377 | inode->i_cdev = p = new; | 377 | inode->i_cdev = p = new; |
378 | inode->i_cindex = idx; | ||
379 | list_add(&inode->i_devices, &p->list); | 378 | list_add(&inode->i_devices, &p->list); |
380 | new = NULL; | 379 | new = NULL; |
381 | } else if (!cdev_get(p)) | 380 | } else if (!cdev_get(p)) |
@@ -405,6 +404,18 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
405 | return ret; | 404 | return ret; |
406 | } | 405 | } |
407 | 406 | ||
407 | int cdev_index(struct inode *inode) | ||
408 | { | ||
409 | int idx; | ||
410 | struct kobject *kobj; | ||
411 | |||
412 | kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx); | ||
413 | if (!kobj) | ||
414 | return -1; | ||
415 | kobject_put(kobj); | ||
416 | return idx; | ||
417 | } | ||
418 | |||
408 | void cd_forget(struct inode *inode) | 419 | void cd_forget(struct inode *inode) |
409 | { | 420 | { |
410 | spin_lock(&cdev_lock); | 421 | spin_lock(&cdev_lock); |
@@ -557,6 +568,7 @@ EXPORT_SYMBOL(cdev_init); | |||
557 | EXPORT_SYMBOL(cdev_alloc); | 568 | EXPORT_SYMBOL(cdev_alloc); |
558 | EXPORT_SYMBOL(cdev_del); | 569 | EXPORT_SYMBOL(cdev_del); |
559 | EXPORT_SYMBOL(cdev_add); | 570 | EXPORT_SYMBOL(cdev_add); |
571 | EXPORT_SYMBOL(cdev_index); | ||
560 | EXPORT_SYMBOL(register_chrdev); | 572 | EXPORT_SYMBOL(register_chrdev); |
561 | EXPORT_SYMBOL(unregister_chrdev); | 573 | EXPORT_SYMBOL(unregister_chrdev); |
562 | EXPORT_SYMBOL(directly_mappable_cdev_bdi); | 574 | EXPORT_SYMBOL(directly_mappable_cdev_bdi); |