public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: chuck.lever@oracle.com, linux-fsdevel@vger.kernel.org
Cc: trond.myklebust@hammerspace.com, linux-nfs@vger.kernel.org
Subject: [PATCH 3/3] filelock: remove redundant filp arg from vfs_cancel_lock
Date: Mon, 14 Nov 2022 10:02:40 -0500	[thread overview]
Message-ID: <20221114150240.198648-4-jlayton@kernel.org> (raw)
In-Reply-To: <20221114150240.198648-1-jlayton@kernel.org>

struct file_lock already has a fl_file field that must be populated, so
the @filp argument to this function is redundant. Remove it and use
fl_file instead.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/lockd/svclock.c | 4 +---
 fs/locks.c         | 6 +++---
 include/linux/fs.h | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 21ee6b1c4d9e..2bced428b078 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -677,7 +677,6 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
 {
 	struct nlm_block	*block;
 	int status = 0;
-	int mode;
 
 	dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
 				nlmsvc_file_inode(file)->i_sb->s_id,
@@ -695,8 +694,7 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
 	if (block != NULL) {
 		struct file_lock *fl = &block->b_call->a_args.lock.fl;
 
-		mode = lock_to_openmode(fl);
-		vfs_cancel_lock(block->b_file->f_file[mode], fl);
+		vfs_cancel_lock(fl);
 		status = nlmsvc_unlink_block(block);
 		nlmsvc_release_block(block);
 	}
diff --git a/fs/locks.c b/fs/locks.c
index 0bc1808f7d98..64eeb4002bbb 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2657,14 +2657,14 @@ void locks_remove_file(struct file *filp)
 
 /**
  * vfs_cancel_lock - file byte range unblock lock
- * @filp: The file to apply the unblock to
  * @fl: The lock to be unblocked
  *
  * Used by lock managers to cancel blocked requests
  */
-int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
+int vfs_cancel_lock(struct file_lock *fl)
 {
-	WARN_ON_ONCE(filp != fl->fl_file);
+	struct file *filp = fl->fl_file;
+
 	if (filp->f_op->lock)
 		return filp->f_op->lock(filp, F_CANCELLK, fl);
 	return 0;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 507fa1a61bb5..d5da4c448cd8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1169,7 +1169,7 @@ extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *
 extern int locks_delete_block(struct file_lock *);
 extern int vfs_test_lock(struct file_lock *);
 extern int vfs_lock_file(unsigned int, struct file_lock *, struct file_lock *);
-extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
+extern int vfs_cancel_lock(struct file_lock *fl);
 bool vfs_file_has_locks(struct file *file);
 extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
@@ -1280,7 +1280,7 @@ static inline int vfs_lock_file(unsigned int cmd, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
+static inline int vfs_cancel_lock(struct file_lock *fl)
 {
 	return 0;
 }
-- 
2.38.1


  parent reply	other threads:[~2022-11-14 15:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 15:02 [PATCH 0/3] filelock: remove redundant filp arguments from API Jeff Layton
2022-11-14 15:02 ` [PATCH 1/3] filelock: remove redundant filp argument from vfs_lock_file Jeff Layton
2022-11-15  8:59   ` Christoph Hellwig
2022-11-14 15:02 ` [PATCH 2/3] filelock: remove redundant filp argument from vfs_test_lock Jeff Layton
2022-11-15  8:59   ` Christoph Hellwig
2022-11-14 15:02 ` Jeff Layton [this message]
2022-11-15  9:00   ` [PATCH 3/3] filelock: remove redundant filp arg from vfs_cancel_lock Christoph Hellwig
2022-11-14 15:08 ` [PATCH 0/3] filelock: remove redundant filp arguments from API Chuck Lever III
2022-11-14 15:31   ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114150240.198648-4-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox