[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617-allenfalls-brummen-3ce2da5794f8@brauner>
Date: Tue, 17 Jun 2025 13:54:21 +0200
From: Christian Brauner <brauner@...nel.org>
To: Jan Kara <jack@...e.cz>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
Jens Axboe <axboe@...nel.dk>, Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Eric Van Hensbergen <ericvh@...nel.org>,
Latchesar Ionkov <lucho@...kov.net>, Dominique Martinet <asmadeus@...ewreck.org>,
Christian Schoenebeck <linux_oss@...debyte.com>, David Sterba <dsterba@...e.com>,
David Howells <dhowells@...hat.com>, Marc Dionne <marc.dionne@...istor.com>,
Alexander Viro <viro@...iv.linux.org.uk>, Benjamin LaHaise <bcrl@...ck.org>,
Miklos Szeredi <miklos@...redi.hu>, Amir Goldstein <amir73il@...il.com>,
Kent Overstreet <kent.overstreet@...ux.dev>, "Tigran A . Aivazian" <aivazian.tigran@...il.com>,
Kees Cook <kees@...nel.org>, Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
Xiubo Li <xiubli@...hat.com>, Ilya Dryomov <idryomov@...il.com>,
Jan Harkes <jaharkes@...cmu.edu>, coda@...cmu.edu, Tyler Hicks <code@...icks.com>,
Gao Xiang <xiang@...nel.org>, Chao Yu <chao@...nel.org>, Yue Hu <zbestahu@...il.com>,
Jeffle Xu <jefflexu@...ux.alibaba.com>, Sandeep Dhavale <dhavale@...gle.com>,
Hongbo Li <lihongbo22@...wei.com>, Namjae Jeon <linkinjeon@...nel.org>,
Sungjong Seo <sj1557.seo@...sung.com>, Yuezhang Mo <yuezhang.mo@...y.com>,
Theodore Ts'o <tytso@....edu>, Andreas Dilger <adilger.kernel@...ger.ca>,
Jaegeuk Kim <jaegeuk@...nel.org>, OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
Viacheslav Dubeyko <slava@...eyko.com>, John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Yangtao Li <frank.li@...o.com>, Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>, Johannes Berg <johannes@...solutions.net>,
Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>, David Woodhouse <dwmw2@...radead.org>,
Dave Kleikamp <shaggy@...nel.org>, Trond Myklebust <trondmy@...nel.org>,
Anna Schumaker <anna@...nel.org>, Ryusuke Konishi <konishi.ryusuke@...il.com>,
Konstantin Komarov <almaz.alexandrovich@...agon-software.com>, Mark Fasheh <mark@...heh.com>, Joel Becker <jlbec@...lplan.org>,
Joseph Qi <joseph.qi@...ux.alibaba.com>, Bob Copeland <me@...copeland.com>,
Mike Marshall <hubcap@...ibond.com>, Martin Brandenburg <martin@...ibond.com>,
Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.org>,
Ronnie Sahlberg <ronniesahlberg@...il.com>, Shyam Prasad N <sprasad@...rosoft.com>,
Tom Talpey <tom@...pey.com>, Bharath SM <bharathsm@...rosoft.com>,
Zhihao Cheng <chengzhihao1@...wei.com>, Hans de Goede <hdegoede@...hat.com>,
Carlos Maiolino <cem@...nel.org>, Damien Le Moal <dlemoal@...nel.org>,
Naohiro Aota <naohiro.aota@....com>, Johannes Thumshirn <jth@...nel.org>,
Dan Williams <dan.j.williams@...el.com>, Matthew Wilcox <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>, Pedro Falcato <pfalcato@...e.de>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, v9fs@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-afs@...ts.infradead.org, linux-aio@...ck.org, linux-unionfs@...r.kernel.org,
linux-bcachefs@...r.kernel.org, linux-mm@...ck.org, linux-btrfs@...r.kernel.org,
ceph-devel@...r.kernel.org, codalist@...a.cs.cmu.edu, ecryptfs@...r.kernel.org,
linux-erofs@...ts.ozlabs.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, linux-um@...ts.infradead.org, linux-mtd@...ts.infradead.org,
jfs-discussion@...ts.sourceforge.net, linux-nfs@...r.kernel.org, linux-nilfs@...r.kernel.org,
ntfs3@...ts.linux.dev, ocfs2-devel@...ts.linux.dev,
linux-karma-devel@...ts.sourceforge.net, devel@...ts.orangefs.org, linux-cifs@...r.kernel.org,
samba-technical@...ts.samba.org, linux-xfs@...r.kernel.org, nvdimm@...ts.linux.dev
Subject: Re: [PATCH 09/10] fs: convert most other generic_file_*mmap() users
to .mmap_prepare()
On Tue, Jun 17, 2025 at 12:23:41PM +0200, Jan Kara wrote:
> On Mon 16-06-25 20:33:28, Lorenzo Stoakes wrote:
> > Update nearly all generic_file_mmap() and generic_file_readonly_mmap()
> > callers to use generic_file_mmap_prepare() and
> > generic_file_readonly_mmap_prepare() respectively.
> >
> > We update blkdev, 9p, afs, erofs, ext2, nfs, ntfs3, smb, ubifs and vboxsf
> > file systems this way.
> >
> > Remaining users we cannot yet update are ecryptfs, fuse and cramfs. The
> > former two are nested file systems that must support any underlying file
> > ssytem, and cramfs inserts a mixed mapping which currently requires a VMA.
> >
> > Once all file systems have been converted to mmap_prepare(), we can then
> > update nested file systems.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
>
> Overall the patch looks good. Just a couple of notes regarding pointless
> local variable being created...
>
> > ---
> > block/fops.c | 9 +++++----
> > fs/9p/vfs_file.c | 11 ++++++-----
> > fs/afs/file.c | 11 ++++++-----
> > fs/erofs/data.c | 16 +++++++++-------
> > fs/ext2/file.c | 12 +++++++-----
> > fs/nfs/file.c | 13 +++++++------
> > fs/nfs/internal.h | 2 +-
> > fs/nfs/nfs4file.c | 2 +-
> > fs/ntfs3/file.c | 15 ++++++++-------
> > fs/smb/client/cifsfs.c | 12 ++++++------
> > fs/smb/client/cifsfs.h | 4 ++--
> > fs/smb/client/file.c | 14 ++++++++------
> > fs/ubifs/file.c | 8 ++++----
> > fs/vboxsf/file.c | 8 ++++----
> > 14 files changed, 74 insertions(+), 63 deletions(-)
> >
> > diff --git a/block/fops.c b/block/fops.c
> > index 1309861d4c2c..5a0ebc81e489 100644
> > --- a/block/fops.c
> > +++ b/block/fops.c
> > @@ -911,14 +911,15 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start,
> > return error;
> > }
> >
> > -static int blkdev_mmap(struct file *file, struct vm_area_struct *vma)
> > +static int blkdev_mmap_prepare(struct vm_area_desc *desc)
> > {
> > + struct file *file = desc->file;
> > struct inode *bd_inode = bdev_file_inode(file);
>
> I guess no need to create 'file' variable here since it has only one use in
> the line above...
Agreed, fixed in-tree.
> > -static int afs_file_mmap(struct file *file, struct vm_area_struct *vma)
> > +static int afs_file_mmap_prepare(struct vm_area_desc *desc)
> > {
> > + struct file *file = desc->file;
> > struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
>
> Same comment about pointless local variable here as well.
Same.
> > -static int erofs_file_mmap(struct file *file, struct vm_area_struct *vma)
> > +static int erofs_file_mmap_prepare(struct vm_area_desc *desc)
> > {
> > + struct file *file = desc->file;
> > +
> > if (!IS_DAX(file_inode(file)))
>
> And here...
Same.
> > -int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
> > +int cifs_file_strict_mmap_prepare(struct vm_area_desc *desc)
> > {
> > + struct file *file = desc->file;
> > int xid, rc = 0;
> > struct inode *inode = file_inode(file);
>
> Again pointless local variable 'file' here.
Same.
> > -int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
> > +int cifs_file_mmap_prepare(struct vm_area_desc *desc)
> > {
> > + struct file *file = desc->file;
> > int rc, xid;
>
> And here (the only use is in cifs_revalidate_file(file)).
Same.
Powered by blists - more mailing lists