Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2337882rdb; Mon, 5 Feb 2024 03:36:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaAjpFSlZ0Cf72c/zd6DCBpJaetOnk7z13LdVSSrG5UT4pBCiRsJAImoAvHlRuOouZjiWF X-Received: by 2002:a05:6214:2622:b0:68c:5c39:5f15 with SMTP id gv2-20020a056214262200b0068c5c395f15mr9835225qvb.34.1707132994980; Mon, 05 Feb 2024 03:36:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707132994; cv=pass; d=google.com; s=arc-20160816; b=ACF8L6l1hDoWtcaddc2Y+Uw579fLBc72nqZmlcUog85qqUhpSWF2WTGwy2CL6BDjlx xNxKHP0Bhpv1yerliWrJDzwjel+XcbBk2p+EN+k4fSKx9rqyN6IRyxMk/ZOhnpg7WnxW WmKP8bgTroueeAOjsaOF1MIUqHezs4jLyxM1vHzKL2yWzOC8fr4RkRJBrVBUajD6TKSH +8D7FWntXLFLUPoogm4xvwwgMlZ7z6h5vtsY9L+d7qxrhzRNTM0FTOGUs9zeUSH8REyj UxEjzURls99VPi/u1qNEvi2163UXZAWCYax0xSlc0oJmVaVvQwXGX4v+PDUEH7tNx5n6 h9qA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4mjHW8qZrUNSR13LtClruy8PbV08GAUa+q0RfSEDPjQ=; fh=aSUzTIHDAsJgGnvAXrVbdC9m32dmAp754LH1Pq35Ikc=; b=n/88OFL5UnJrJa+Wi9GwqMghh5U9Lftnc45or+6HiarDUv5FF/ZIKz7rIeoc8Oh2T/ cZnRfHwSmkYRoSuDWH5Fw1W9uV2UfDB5vdiiKq4TI8BCjpd7bqdqRwlMziElADEUIUvv DtevlSQVWV4JAwqbbDmGL+mhUci8+AY2VX23Q9560E1fdrr8PY4TiW0bYaxN/kv5usza 7ZbG9u7ueig4jqmQYr67lkkxq8jQ40rtkwVwU5s3Sdw58Yx4O/JAiRwwt+ld/olPkgEo mpEP90P2/gcO6ByaARVzIrSX3bJhvwMMQFL6dOMXRtOayJdIg0jUqCOCf2lq13IGmgv+ X5cQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ea5No9/B"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-52494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWJc2arUlyB+hoTudIuXjfLEeP06HAf7GD1MwSmLj3+F/9qz3lyr5SXx5vthfJf7DJA1WsYo8lpovSrW89PJeq5N3iM3ZpKQP4st16L8g== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gu8-20020a056214260800b0068c7906efdasi1516417qvb.189.2024.02.05.03.36.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 03:36:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ea5No9/B"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-52494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52494-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B7C8F1C20A46 for ; Mon, 5 Feb 2024 11:36:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2D5B199B8; Mon, 5 Feb 2024 11:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ea5No9/B" 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 D10DE18E00; Mon, 5 Feb 2024 11:36: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=1707132980; cv=none; b=cMOup714zGX1IJaloq3IfS/vL3L6351XKFKbbtz9J9QfqGjbzQq0fukJEvS5E8s4+sdhUs2Gq8xj9/CHerdVe28QM408QvWpaaAi7ojaxbOzW1Z2bbZ4Yb9Jn8xXqRoPYBtuoK8pKeXy3eGE/Nd3ZGrcXofgNI3MeHAxI1y9nHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707132980; c=relaxed/simple; bh=XXMTy7omW95QL4wYydLM30UA75bH/787fQ5A85xLdT4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OhrKDpFUkiXYAYVsE4XM5HIxXDxBNFSu1EaOjLZVcdNnpVvDGSuW3956uJkyLndAW91OEzRG3QpLElJVd1tqglrJ8pn2nhPG9BlnE9PMC7dTN/zTAM5CBLcbssyTBIRRgzZS1elTUVKsSaggeYA0IN2k+FVNMKBPyp540haKkBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ea5No9/B; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF8BEC433C7; Mon, 5 Feb 2024 11:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707132979; bh=XXMTy7omW95QL4wYydLM30UA75bH/787fQ5A85xLdT4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ea5No9/B9/3ZwCOcBfLkGLDE/MvFK7jfTUn58PgVM0YUBlaEetZHBUxE4H4EzZn42 VWdhM23gfRNhm+XkbKtNEj3C0OmneHbqvfBlFcfZLvnjj3kZ4di005cvbN+JyjMJdQ BruEA7v+rRVY+KS6rCy/IwVi0gCGBix8KOWYvJHTF29ICn+h5BgF4YiPjGhV27Ivp0 jO6Cl/P5PsiUPrSoyHjFnTn7f3CBaebYqvaP/rB+cBxBXBaKeixBPxLeuM1DmUhs89 fZgMOGkmBEvIyeouCRrK7VIoPHz5+OYJ84CAAZZqjo1XPLWVZIGfTK1XnMbrLvuspx LDK7mVCz6FqrA== Date: Mon, 5 Feb 2024 12:36:07 +0100 From: Christian Brauner To: Jeff Layton Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , Alexander Viro , Jan Kara , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Andreas Gruenbacher , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Miklos Szeredi , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org Subject: Re: [PATCH v3 04/47] filelock: add some new helper functions Message-ID: <20240205-wegschauen-unappetitlich-2b0926023605@brauner> References: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> <20240131-flsplit-v3-4-c6129007ee8d@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240131-flsplit-v3-4-c6129007ee8d@kernel.org> > diff --git a/include/linux/filelock.h b/include/linux/filelock.h > index 085ff6ba0653..a814664b1053 100644 > --- a/include/linux/filelock.h > +++ b/include/linux/filelock.h > @@ -147,6 +147,29 @@ int fcntl_setlk64(unsigned int, struct file *, unsigned int, > int fcntl_setlease(unsigned int fd, struct file *filp, int arg); > int fcntl_getlease(struct file *filp); > > +static inline bool lock_is_unlock(struct file_lock *fl) > +{ > + return fl->fl_type == F_UNLCK; > +} > + > +static inline bool lock_is_read(struct file_lock *fl) > +{ > + return fl->fl_type == F_RDLCK; > +} > + > +static inline bool lock_is_write(struct file_lock *fl) > +{ > + return fl->fl_type == F_WRLCK; > +} > + > +static inline void locks_wake_up(struct file_lock *fl) > +{ > + wake_up(&fl->fl_wait); > +} > + > +/* for walking lists of file_locks linked by fl_list */ > +#define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, fl_list) > + This causes a build warning for fs/ceph/ and fs/afs when !CONFIG_FILE_LOCKING. I'm about to fold the following diff into this patch. The diff looks a bit wonky but essentially I've moved lock_is_unlock(), lock_is_{read,write}(), locks_wake_up() and for_each_file_lock() out of the ifdef CONFIG_FILE_LOCKING: diff --git a/include/linux/filelock.h b/include/linux/filelock.h index a814664b1053..62be9c6b1e59 100644 --- a/include/linux/filelock.h +++ b/include/linux/filelock.h @@ -133,20 +133,6 @@ struct file_lock_context { struct list_head flc_lease; }; -#ifdef CONFIG_FILE_LOCKING -int fcntl_getlk(struct file *, unsigned int, struct flock *); -int fcntl_setlk(unsigned int, struct file *, unsigned int, - struct flock *); - -#if BITS_PER_LONG == 32 -int fcntl_getlk64(struct file *, unsigned int, struct flock64 *); -int fcntl_setlk64(unsigned int, struct file *, unsigned int, - struct flock64 *); -#endif - -int fcntl_setlease(unsigned int fd, struct file *filp, int arg); -int fcntl_getlease(struct file *filp); - static inline bool lock_is_unlock(struct file_lock *fl) { return fl->fl_type == F_UNLCK; @@ -170,6 +156,20 @@ static inline void locks_wake_up(struct file_lock *fl) /* for walking lists of file_locks linked by fl_list */ #define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, fl_list) +#ifdef CONFIG_FILE_LOCKING +int fcntl_getlk(struct file *, unsigned int, struct flock *); +int fcntl_setlk(unsigned int, struct file *, unsigned int, + struct flock *); + +#if BITS_PER_LONG == 32 +int fcntl_getlk64(struct file *, unsigned int, struct flock64 *); +int fcntl_setlk64(unsigned int, struct file *, unsigned int, + struct flock64 *); +#endif + +int fcntl_setlease(unsigned int fd, struct file *filp, int arg); +int fcntl_getlease(struct file *filp); + /* fs/locks.c */ void locks_free_lock_context(struct inode *inode); void locks_free_lock(struct file_lock *fl);