linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>,
	 Al Viro <viro@zeniv.linux.org.uk>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 kernel test robot <lkp@intel.com>,
	Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] filelock: add stubs for new functions when CONFIG_FILE_LOCKING=n
Date: Sun, 04 Feb 2024 07:32:55 -0500	[thread overview]
Message-ID: <20240204-flsplit3-v1-1-9820c7d9ce16@kernel.org> (raw)

We recently added several functions to the file locking API. Add stubs
for those functions for when CONFIG_FILE_LOCKING is set to n.

Fixes: 403594111407 ("filelock: add some new helper functions")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402041412.6YvtlflL-lkp@intel.com/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Just a small follow-on fix for CONFIG_FILE_LOCKING=n builds for the
file_lease split. Christian, it might be best to squash this into
the patch it Fixes.

That said, I'm starting to wonder if we ought to just hardcode
CONFIG_FILE_LOCKING to y. Does anyone ship kernels with it disabled? I
guess maybe people with stripped-down embedded builds might?

Another thought too: "locks_" as a prefix is awfully generic. Might it be
better to rename these new functions with a "filelock_" prefix instead?
That would better distinguish to the casual reader that this is dealing
with a file_lock object. I'm happy to respin the set if that's the
consensus.
---
 include/linux/filelock.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index 4a5ad26962c1..553d65a88048 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -263,6 +263,27 @@ static inline int fcntl_getlease(struct file *filp)
 	return F_UNLCK;
 }
 
+static inline bool lock_is_unlock(struct file_lock *fl)
+{
+	return false;
+}
+
+static inline bool lock_is_read(struct file_lock *fl)
+{
+	return false;
+}
+
+static inline bool lock_is_write(struct file_lock *fl)
+{
+	return false;
+}
+
+static inline void locks_wake_up(struct file_lock *fl)
+{
+}
+
+#define for_each_file_lock(_fl, _head)	while(false)
+
 static inline void
 locks_free_lock_context(struct inode *inode)
 {

---
base-commit: 1499e59af376949b062cdc039257f811f6c1697f
change-id: 20240204-flsplit3-da666d82b7b4

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


             reply	other threads:[~2024-02-04 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 12:32 Jeff Layton [this message]
2024-02-04 23:43 ` [PATCH] filelock: add stubs for new functions when CONFIG_FILE_LOCKING=n Chuck Lever
2024-02-05 12:10 ` Christian Brauner
2024-02-05 12:20   ` 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=20240204-flsplit3-v1-1-9820c7d9ce16@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).