[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aGIxiOeJ_-lmRmiT@infradead.org>
Date: Sun, 29 Jun 2025 23:41:12 -0700
From: "hch@...radead.org" <hch@...radead.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: 陈涛涛 Taotao Chen <chentaotao@...iglobal.com>,
"tytso@....edu" <tytso@....edu>,
"hch@...radead.org" <hch@...radead.org>,
"adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>,
"brauner@...nel.org" <brauner@...nel.org>,
"jani.nikula@...ux.intel.com" <jani.nikula@...ux.intel.com>,
"rodrigo.vivi@...el.com" <rodrigo.vivi@...el.com>,
"tursulin@...ulin.net" <tursulin@...ulin.net>,
"airlied@...il.com" <airlied@...il.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"intel-gfx@...ts.freedesktop.org" <intel-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"chentao325@...com" <chentao325@...com>,
"frank.li@...o.com" <frank.li@...o.com>
Subject: Re: [PATCH v3 4/4] ext4: support uncached buffered I/O
On Fri, Jun 27, 2025 at 06:03:09PM +0100, Matthew Wilcox wrote:
> On Fri, Jun 27, 2025 at 11:03:13AM +0000, 陈涛涛 Taotao Chen wrote:
> > +++ b/fs/ext4/inode.c
> > @@ -1270,6 +1270,9 @@ static int ext4_write_begin(const struct kiocb *iocb,
> > if (unlikely(ret))
> > return ret;
> >
> > + if (iocb->ki_flags & IOCB_DONTCACHE)
> > + fgp |= FGP_DONTCACHE;
>
> I think this needs to be:
>
> if (iocb && iocb->ki_flags & IOCB_DONTCACHE)
>
> because it's legit to call write_begin with a NULL argument. The
> 'file' was always an optional argument, and we should preserve that
> optionality with this transformation.
write_begin and write_end are only callbacks through helpers called
by the file system. So if the file system never passes a NULL
file/kiocb it doesn't need to check for it.
> I wonder if it's worth abstracting some of this boilerplate. Something
> like:
>
> struct folio *write_begin_get_folio(iocb, mapping, index, len)
> {
> fgf_t fgflags = FGP_WRITEBEGIN;
>
> if (iocb && iocb->ki_flags & IOCB_DONTCACHE)
> fgflags |= FGP_DONTCACHE;
> fgflags |= fgf_set_order(len);
>
> return __filemap_get_folio(mapping, index, fgflags,
> mapping_gfp_mask(mapping));
> }
But this helper still seems useful.
Powered by blists - more mailing lists