diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-06-01 14:47:40 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-06-11 22:06:52 -0400 |
commit | 12420ac341533f3715b3deb788637568f22b78ff (patch) | |
tree | 8462f0cf5276a97dd419c88760d08f5a17e5888a /fs/cifs | |
parent | ed0e3ace576d297a5c7015401db1060bbf677b94 (diff) |
cifs: implement drop_inode superblock op
The standard behavior for drop_inode is to delete the inode when the
last reference to it is put and the nlink count goes to 0. This helps
keep inodes that are still considered "not deleted" in cache as long as
possible even when there aren't dentries attached to them.
When server inode numbers are disabled, it's not possible for cifs_iget
to ever match an existing inode (since inode numbers are generated via
iunique). In this situation, cifs can keep a lot of inodes in cache that
will never be used again.
Implement a drop_inode routine that deletes the inode if server inode
numbers are disabled on the mount. This helps keep the cifs inode
caches down to a more manageable size when server inode numbers are
disabled.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsfs.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 78c02eb4cb1f..484e52bb40bb 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -473,14 +473,24 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data) | |||
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | void cifs_drop_inode(struct inode *inode) | ||
477 | { | ||
478 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | ||
479 | |||
480 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | ||
481 | return generic_drop_inode(inode); | ||
482 | |||
483 | return generic_delete_inode(inode); | ||
484 | } | ||
485 | |||
476 | static const struct super_operations cifs_super_ops = { | 486 | static const struct super_operations cifs_super_ops = { |
477 | .put_super = cifs_put_super, | 487 | .put_super = cifs_put_super, |
478 | .statfs = cifs_statfs, | 488 | .statfs = cifs_statfs, |
479 | .alloc_inode = cifs_alloc_inode, | 489 | .alloc_inode = cifs_alloc_inode, |
480 | .destroy_inode = cifs_destroy_inode, | 490 | .destroy_inode = cifs_destroy_inode, |
481 | /* .drop_inode = generic_delete_inode, | 491 | .drop_inode = cifs_drop_inode, |
482 | .delete_inode = cifs_delete_inode, */ /* Do not need above two | 492 | /* .delete_inode = cifs_delete_inode, */ /* Do not need above |
483 | functions unless later we add lazy close of inodes or unless the | 493 | function unless later we add lazy close of inodes or unless the |
484 | kernel forgets to call us with the same number of releases (closes) | 494 | kernel forgets to call us with the same number of releases (closes) |
485 | as opens */ | 495 | as opens */ |
486 | .show_options = cifs_show_options, | 496 | .show_options = cifs_show_options, |