- optimise file_kill() to not take the global lock if the file is not on a list. - Use optimised file_kill() in a few places rather than open-coding the list removal. fs/file_table.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff -puN fs/file_table.c~file-list-less-locking fs/file_table.c --- 25/fs/file_table.c~file-list-less-locking 2003-03-11 22:23:23.000000000 -0800 +++ 25-akpm/fs/file_table.c 2003-03-11 22:24:29.000000000 -0800 @@ -150,11 +150,9 @@ void __fput(struct file *file) fops_put(file->f_op); if (file->f_mode & FMODE_WRITE) put_write_access(inode); - file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; - list_del(&file->f_list); - file_list_unlock(); + file_kill(file); file_free(file); dput(dentry); mntput(mnt); @@ -177,9 +175,7 @@ void put_filp(struct file *file) { if (atomic_dec_and_test(&file->f_count)) { security_file_free(file); - file_list_lock(); - list_del(&file->f_list); - file_list_unlock(); + file_kill(file); file_free(file); } } @@ -195,9 +191,11 @@ void file_move(struct file *file, struct void file_kill(struct file *file) { - file_list_lock(); - list_del_init(&file->f_list); - file_list_unlock(); + if (!list_empty(&file->f_list)) { + file_list_lock(); + list_del_init(&file->f_list); + file_list_unlock(); + } } int fs_may_remount_ro(struct super_block *sb) _