Message ID | 20240204-flsplit3-v1-1-9820c7d9ce16@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp327024dyb; Sun, 4 Feb 2024 04:33:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVaidBEwFPf6jAegJn/x7O+7VIy7BcaB49bO/+grlSNIO0z1DRCUGigyisox/sRULhTDhA X-Received: by 2002:a17:906:b7d5:b0:a37:7fb9:ea27 with SMTP id fy21-20020a170906b7d500b00a377fb9ea27mr1270580ejb.48.1707050018814; Sun, 04 Feb 2024 04:33:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707050018; cv=pass; d=google.com; s=arc-20160816; b=Q8+8PcAvk4ZLTXvjgjmIPaOTm8JB5WUFupJkATutfzcKPek5t7h6ykWxA4aIzBp9KM 4fMYQ24ue57k0yB2zh4I3yz9zTEo6qyu3KyJpr9Rv1r/2ZmgNHth4bSPwWuvCRUk9P8e NVrrzvCAMty8LMcU8oIL4M36k+2lyK9pkBtzkQiMJp3Wc/f7x+rRjdGPxNdNnDoXhO7g MyPr5cIsmJ91HNMtZzdN5SXR+R4qUcvHjsTiIeBLmG8Mz0AwUA1b1mO1LIqiEf2O4xwN 9jtxiaB66s0Jlo9bJRzgtqZm0n6Ya6PRaFhX1eCIGufgrgAe6Wec3usIGcwsgswMRV9k O5VA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=chNB993vzxmWRbzhyAD/YyYfCNh0waJ6BNXgIOj77SE=; fh=n+Su+1sTi+/Mc3jUGmVKAKZlzxABUP6tzNqdDnKglnA=; b=MLBbC5fWxGwNUmp8IM8KI4/4obaOxLqzgCOgGw1+PM9QRH0L6MQtzHYPXS9AOG4B+e p5EZjHPvr3ajx8YeNr79w3IwxufoLhjenuqlwFAObNYZxkgOP6NHXs/9uHDXjsvGeW/Y iBtZAglm8mN6sO2sZllbaMYz4q2dbinXrldZySuVqzgR55TMUHYYg4dAPzMO7cra/w85 pN/Mfe1QU2rTvALJSXCbVEjFG9sYTr9Cof4jBC6iHs8akvtKe4XcWUiCTGdObM2F6Jrz Jghw4mBmCyhu1CVxX37aq2Ep0fVBFuZrihTNjEo5gGYpje5tbroVyjqjctoIynmcF9Hh R5Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BI9dNCw6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWuppzmHjm+ObqTdkPWsNour3HTtxMWyFNVEDL/qMrPZu1D0VBz/urERa9gCVj7I0CwF1GYCzD52sRNeNVlN7gGqrqgWw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y5-20020a170906558500b00a32e34b96d1si2892106ejp.669.2024.02.04.04.33.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 04:33:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BI9dNCw6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51638-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6FB811F220BC for <ouuuleilei@gmail.com>; Sun, 4 Feb 2024 12:33:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40785225AD; Sun, 4 Feb 2024 12:33:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BI9dNCw6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B7B224CB; Sun, 4 Feb 2024 12:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707049999; cv=none; b=qXmOXN5DcuXbmPYDK7GAE6ydfXHEBAXctQmu1EXF+YzBq3OXZzXulBtNFp2tdRqWjZ2WLjtSwtT2kmTYTVzkxn1AiRqHZpQ89ZALTDRgOAmhlZE83Yuc0NOZx9Hxtnpyaf07HRd4N+RNB8NhbHvTuOIWiEjvt6glxjsZvhs0b5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707049999; c=relaxed/simple; bh=tUb84TlzXHt1IU/2JXj468FUS1oRysS/ztfYJPoYHp4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=fDyj0RSFSg48SCOM0cHIFEud+y+mLdHgyx+DQ3CLijHCJHFEYZW/IJKYKB2g/yU9FUau8CtC9AKhLZwsQMhF7A3v8GFoh2H0eav2GabEeRJf902SieukWC5L54kBM9xZKkMgu69Lyi4CgbyzSaUoHXsE7dPGHFQsQ9cQDhUF2ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BI9dNCw6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A13CC433F1; Sun, 4 Feb 2024 12:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707049999; bh=tUb84TlzXHt1IU/2JXj468FUS1oRysS/ztfYJPoYHp4=; h=From:Date:Subject:To:Cc:From; b=BI9dNCw6srBdVv2d6s4fdVRyF6Q5nj8TgLOoHUgs6OiICA9dexhGykAxw5imT3QLU clUOjqspg17cwmhJuGP/8b3FNtkEfEuEM4bK7qM7pV76bSeQMvnO6jnpip3fq7MHvf BAR7VgFZ/RyYx5TELqFfR0wRPa2ST3/Pcc/AA0VP6m9zw+9DvuKVvQRpqYnrUrSjvI r1o8lTUe9/zE2oBqNYyIuvBHKTXr2yJMpadoM34IuWlGJf4Ud925WQ9qnT47BZs3cH D3rkZhda+B9QDT0RaJBz8bpmlWdcgByOhttIv18/ObDpTiB0kQdJ2HEZcwTksjVKFN u7Lkx1NrIVS5w== From: Jeff Layton <jlayton@kernel.org> Date: Sun, 04 Feb 2024 07:32:55 -0500 Subject: [PATCH] filelock: add stubs for new functions when CONFIG_FILE_LOCKING=n Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240204-flsplit3-v1-1-9820c7d9ce16@kernel.org> X-B4-Tracking: v=1; b=H4sIAPaDv2UC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDIwMT3bSc4oKczBJj3ZREMzOzFAujJPMkEyWg8oKi1LTMCrBR0bG1tQA 3JXiZWgAAAA== 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> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2028; i=jlayton@kernel.org; h=from:subject:message-id; bh=tUb84TlzXHt1IU/2JXj468FUS1oRysS/ztfYJPoYHp4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlv4QHX6KksZ4zQY7QHs4PamLpO9ItNSIcm/Xlu JYUjeZHVIGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZb+EBwAKCRAADmhBGVaC FQ8FD/4mvgATOGCSC4QBT43oj6d4HGsFeiX7kppaIBfKAaXZS6BAxwH0/glK7jGhFLuKwnI0vHi 2TZoCdGeaLY5KUjhMTUzpg8zrzYRTFZBQvBbFRFvarLTEdXkqjrMFuSdw8KIqONnWIm2xkIOlgO 8Usr7m+Sozb211U7aASJpnsD0Elu2IQvlNf4O8NsaemBPtzAf0YtqFKNcXa4F/ZhFNIc3ETKl7J 9Jr5sFgwifCdCbpUF6rECc//W4bpPd3EJBSiI/+25mtR7bYWo2l9pKAnacftcxpydTFl6ligUDv U7LfXnYX5anjso0vor6moqyxJ8oVQxQIaLmV/2RQovX5ZThw7PwkI5TP2ncpkS8ixb5ZsD+Kh6C UJPjh/HqWhmMI608RFSPelhFBZrdSZbRLu2xL89xWRuZU9BxR0hNtjuapTmOP6IIngTl1mnaWtO Ws+gAlYzd/DDXsbXisl5PjbUIYymzvVMiyysULzkD35mMu3v4mMPNfpRl527l/uswPWcqzGr1gx sEfFKOp46g/b6Q808YIhr/5YFPe4wmjjjqIZ4clujx2yck8tb/SkwCbRkaz7rBczWEQgkr+n9eE q7ApE3Q1LP8NloMM9rZ9sz3+aOtU6Epb8bnOgJT9Fsjz1wymtXlRUtm+QjsrqDzii20Jrit2t8r k8eR1ThyZrTdowg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789971680075621162 X-GMAIL-MSGID: 1789971680075621162 |
Series |
filelock: add stubs for new functions when CONFIG_FILE_LOCKING=n
|
|
Commit Message
Jeff Layton
Feb. 4, 2024, 12:32 p.m. UTC
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(+)
---
base-commit: 1499e59af376949b062cdc039257f811f6c1697f
change-id: 20240204-flsplit3-da666d82b7b4
Best regards,
Comments
On Sun, Feb 04, 2024 at 07:32:55AM -0500, Jeff Layton wrote: > 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? One thing you might try is building a kernel with both settings and compare the resulting object sizes. CONFIG_FILE_LOCKING was added during the git era, actually, so we have some reasonable archaeology available: commit bfcd17a6c5529bc37234cfa720a047cf9397bcfc Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> AuthorDate: Wed Aug 6 15:12:22 2008 +0200 Commit: J. Bruce Fields <bfields@fieldses.org> CommitDate: Mon Sep 29 17:56:57 2008 -0400 Configure out file locking features This patch adds the CONFIG_FILE_LOCKING option which allows to remove support for advisory locks. With this patch enabled, the flock() system call, the F_GETLK, F_SETLK and F_SETLKW operations of fcntl() and NFS support are disabled. These features are not necessarly needed on embedded systems. It allows to save ~11 Kb of kernel code and data: text data bss dec hex filename 1125436 118764 212992 1457192 163c28 vmlinux.old 1114299 118564 212992 1445855 160fdf vmlinux -11137 -200 0 -11337 -2C49 +/- This patch has originally been written by Matt Mackall <mpm@selenic.com>, and is part of the Linux Tiny project. Embedded folks might want to keep CONFIG_FILE_LOCKING. > 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. "posix_lock" might be even better, but no-one likes to make function names longer. > --- > 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> > >
> 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. If it's just a rename then just point me to a branch I can pull. I don't think it's worth resending just because you effectively did some variant of s/lock_*/filelock_*/g In any case, folded this one.
On Mon, 2024-02-05 at 13:10 +0100, Christian Brauner wrote: > > 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. > > If it's just a rename then just point me to a branch I can pull. I don't > think it's worth resending just because you effectively did some variant > of s/lock_*/filelock_*/g > > In any case, folded this one. Thanks! I haven't done a rename (yet). I was just trying to feel out whether it was worthwhile. At this point, I'm thinking I'll just leave them as-is., but let me know if anyone has opinions to the contrary.
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) {