mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Restore an optimisation to locks.c
@ 2002-08-22 14:12 Matthew Wilcox
  0 siblings, 0 replies; only message in thread
From: Matthew Wilcox @ 2002-08-22 14:12 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel


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

diff -urpNX dontdiff linux-2.5.31/fs/locks.c linux-2.5.31-willy/fs/locks.c
--- linux-2.5.31/fs/locks.c	2002-08-01 14:16:39.000000000 -0700
+++ linux-2.5.31-willy/fs/locks.c	2002-08-21 08:29:29.000000000 -0700
@@ -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;

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-22 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-22 14:12 [PATCH] Restore an optimisation to locks.c Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®