From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C702C71136 for ; Tue, 17 Jun 2025 12:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4rgg22onqygB/eQruMH9ITAOw7qiEyHEdTO9GKk2+Yk=; b=jzTcgi4rhsT/Dl sV/VayMRqVlZyGM+yWAe9V7HtSBs7syViLj0AynV8AzWtA7PE8ay3KN5LGgsztXsOpOyBoAWLckYE UKeNeQsgjU5xCA315S8PzTlhZFultDWMGuxOxvzr99wBUYi8oeic8i4X8RNn/4VS4PgcoPA1/QD7y ZEJUvEbLe9WnVT89exfmUrsKQY2bXqFUxXvjiXDqXlTYNorCLpAStqZYJwLPFMzw4vW/6jkkjoIdj E6KOXsSX+tpOegAWuyiYMyp8ihREP4dkcvo2juqqLUkAyvvA4TsIkdSDxE/EzQn+UV8DAwH97VqEg H17S4oSeTH/ukkVHi2Jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uRUz7-000000076nE-2KR7; Tue, 17 Jun 2025 12:00:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uRUwh-000000076I1-3H9Q; Tue, 17 Jun 2025 11:57:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 81BE95C3AD7; Tue, 17 Jun 2025 11:55:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EC2DC4CEE3; Tue, 17 Jun 2025 11:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750161462; bh=T+hj+yayJhfzqGA9kWHW1UQw8dsCOqK3Vx6p1g+lWhs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ANNRMLSMbFJxF0/0JcpxGnRgNC2cM3iQk05j0kIN5dUOf6a+6FhzXEhCV9tljSO6h v2e3uV6HAxpTWa31kRKsnVAXQkLyFD1xYm1QZjMvIFL3ouF6AXeudY39YUcGZrolsh RyM2TZ/EQMyqQ6Y6s4GUWKP0gK9gINzD7L4jwsfBCJ1suak/ya3jB5me4TnYO/YFrF BrbHmvsabgMYM9Mbit9yWCy+NDOo9GjZfXkkWr9NdZCIoi7MIoTDvDFU7neHyJvL+Q sCBOLJVwQyL5L44PlP9UgERzG7VA2X0BjHsxmPcW0plFtm6qxZnaOBFYXof6KFwTQp Bv2/tmMRJtG5w== Date: Tue, 17 Jun 2025 13:57:17 +0200 From: Christian Brauner To: Jan Kara Cc: Lorenzo Stoakes , Andrew Morton , "Liam R . Howlett" , Jens Axboe , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Sterba , David Howells , Marc Dionne , Alexander Viro , Benjamin LaHaise , Miklos Szeredi , Amir Goldstein , Kent Overstreet , "Tigran A . Aivazian" , Kees Cook , Chris Mason , Josef Bacik , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Namjae Jeon , Sungjong Seo , Yuezhang Mo , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Viacheslav Dubeyko , John Paul Adrian Glaubitz , Yangtao Li , Richard Weinberger , Anton Ivanov , Johannes Berg , Mikulas Patocka , David Woodhouse , Dave Kleikamp , Trond Myklebust , Anna Schumaker , Ryusuke Konishi , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Bob Copeland , Mike Marshall , Martin Brandenburg , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Zhihao Cheng , Hans de Goede , Carlos Maiolino , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Dan Williams , Matthew Wilcox , Vlastimil Babka , Jann Horn , Pedro Falcato , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-aio@kvack.org, linux-unionfs@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-um@lists.infradead.org, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, linux-karma-devel@lists.sourceforge.net, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev Subject: Re: [PATCH 10/10] fs: replace mmap hook with .mmap_prepare for simple mappings Message-ID: <20250617-karibus-abgrenzen-e534b9acd4c7@brauner> References: <6nktgdc7ygt6hncfnl33d2jlwvlydspiiklwf6oxiqxxcjhzs2@j6f36ktyv774> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6nktgdc7ygt6hncfnl33d2jlwvlydspiiklwf6oxiqxxcjhzs2@j6f36ktyv774> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250617_045743_902911_ED6F7960 X-CRM114-Status: GOOD ( 22.85 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Tue, Jun 17, 2025 at 12:28:17PM +0200, Jan Kara wrote: > On Mon 16-06-25 20:33:29, Lorenzo Stoakes wrote: > > Since commit c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file > > callback"), the f_op->mmap() hook has been deprecated in favour of > > f_op->mmap_prepare(). > > > > This callback is invoked in the mmap() logic far earlier, so error handling > > can be performed more safely without complicated and bug-prone state > > unwinding required should an error arise. > > > > This hook also avoids passing a pointer to a not-yet-correctly-established > > VMA avoiding any issues with referencing this data structure. > > > > It rather provides a pointer to the new struct vm_area_desc descriptor type > > which contains all required state and allows easy setting of required > > parameters without any consideration needing to be paid to locking or > > reference counts. > > > > Note that nested filesystems like overlayfs are compatible with an > > .mmap_prepare() callback since commit bb666b7c2707 ("mm: add mmap_prepare() > > compatibility layer for nested file systems"). > > > > In this patch we apply this change to file systems with relatively simple > > mmap() hook logic - exfat, ceph, f2fs, bcachefs, zonefs, btrfs, ocfs2, > > orangefs, nilfs2, romfs, ramfs and aio. > > > > Signed-off-by: Lorenzo Stoakes > > Two small nits below. Otherwise feel free to add: > > Reviewed-by: Jan Kara > > > diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c > > index 60a621b00c65..37522137c380 100644 > > --- a/fs/ceph/addr.c > > +++ b/fs/ceph/addr.c > > @@ -2330,13 +2330,14 @@ static const struct vm_operations_struct ceph_vmops = { > > .page_mkwrite = ceph_page_mkwrite, > > }; > > > > -int ceph_mmap(struct file *file, struct vm_area_struct *vma) > > +int ceph_mmap_prepare(struct vm_area_desc *desc) > > { > > + struct file *file = desc->file; > > struct address_space *mapping = file->f_mapping; > > Pointless local variable here... Agreed, fixed in-tree. > > -static int exfat_file_mmap(struct file *file, struct vm_area_struct *vma) > > +static int exfat_file_mmap_prepare(struct vm_area_desc *desc) > > { > > + struct file *file = desc->file; > > Missing empty line here. Fixed in-tree. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/