Skip to contentSkip to conversation

Restore an optimisation to locks.c

PATCH New Matthew Wilcox 1 participant 1 message Aug 22, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Restore an optimisation to locks.c

akpm reports that this optimisation I removed in 2.4.30 actually has a noticeable impact. Please apply:

fs/locks.c +8 -0
diff -urpNX dontdiff linux-2.5.31/fs/locks.c linux-2.5.31-willy/fs/locks.c
@@ -1609,6 +1612,14 @@ void locks_remove_posix(struct file *fil
 {
 	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_flags = FL_POSIX;
 	lock.fl_start = 0;
Signature · 1 line
Revolutions do not require corporate support.