From mboxrd@z Thu Jan 1 00:00:00 1970 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 695842264B2; Mon, 16 Jun 2025 22:54:10 +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=1750114450; cv=none; b=uShQ17Lm273lxbpC5DNmWcsi3TI599mE7bvNqCiT0kWngLYGD1EyAc/1jfmd5J2DlxrfxWNldF3wEEznsFj17UTziR2mCgGsv55djTUkcQ79oDc4rbWqQ3bKYX5uvB4OhgIf0gwOVQdC3PUNSeDG1MyTZQLHlTASQuLBRsX3ksI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750114450; c=relaxed/simple; bh=2rQ4MWMNuiiZXr3ruKby+3pF9PtUetUIutSjWGs52xQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BEFL7P7/Pt3Bw7drXhTdN861rZn1o4JPEunz+07SMZNkdqN+F8Lig/lYbfOrHWPAW7dso9Bhi1ha53GxcYvHZYSVzGdRnWky5/FhhejL2pQQF8z3VhNd2tU2Z5z/AuRVVjdCoOQP45fiPZ+1SZ4TtfDgH8cBanmOyey3FC6pQms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p9LuBOmF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p9LuBOmF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F658C4CEEA; Mon, 16 Jun 2025 22:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750114450; bh=2rQ4MWMNuiiZXr3ruKby+3pF9PtUetUIutSjWGs52xQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=p9LuBOmFGkwzRdPq0c3k3DFo+Gg7PbA5ztEVsDN9YZvn/BtbR0RubCEEUAupc/0QN UyKsXWg+3Xgr8jYaXCDMYIX9AMo3NmXmNJWlhYEhfQb2Sm0ZC+2euqRHnrYZxtOuoI /XOGCT4NNqf3QLkRtC5atg5JemfK28tCQYDxQ+vvt7VJIHaxKtebm4/Pva1Y9ypu3C 0i5AHJz8+318CUMsMSF8zAEbryPRnLo/KnKQMO3Ip+RltAyo1TepCJSxqJg7VUGaup 0RxiaVHPlYYqHNPaSdRNrmN5q1z0dDh0yP0RcMExF7vaS/owYzg4U/4qGi5HRJ5JK3 4Jr+e8uabprHQ== Message-ID: <60615f31-7a58-4336-adaa-129408c90000@kernel.org> Date: Tue, 17 Jun 2025 07:51:56 +0900 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 10/10] fs: replace mmap hook with .mmap_prepare for simple mappings To: Lorenzo Stoakes , Andrew Morton Cc: "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 , Christian Brauner , Jan Kara , 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 , 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 References: From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/17/25 4:33 AM, 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 For zonefs, Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research