Commit 25aef71f authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] reintroduce close() optimisation

This optimisation is really noticeable as it avoids having to take the
BKL on every close().
parent ea3bc13f
...@@ -1609,6 +1609,14 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner) ...@@ -1609,6 +1609,14 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
{ {
struct file_lock lock; struct file_lock lock;
/*
* If there are no locks held on this file, we don't need to call
* posix_lock_file(). Another process could be setting a lock on this
* file at the same time, but we wouldn't remove that lock anyway.
*/
if (!filp->f_dentry->d_inode->i_flock)
return;
lock.fl_type = F_UNLCK; lock.fl_type = F_UNLCK;
lock.fl_flags = FL_POSIX; lock.fl_flags = FL_POSIX;
lock.fl_start = 0; lock.fl_start = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment