[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240612221529.GM2764752@frogsfrogsfrogs>
Date: Wed, 12 Jun 2024 15:15:29 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: Ritesh Harjani <ritesh.list@...il.com>
Cc: linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Dave Chinner <david@...morbit.com>,
Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Christian Brauner <brauner@...nel.org>,
Ojaswin Mujoo <ojaswin@...ux.ibm.com>, Jan Kara <jack@...e.cz>,
Luis Chamberlain <mcgrof@...nel.org>
Subject: Re: [PATCH] Documentation: document the design of iomap and how to
port
On Wed, Jun 12, 2024 at 12:07:40PM +0530, Ritesh Harjani wrote:
>
> "Darrick J. Wong" <djwong@...nel.org> writes:
>
> > On Tue, Jun 11, 2024 at 04:15:02PM +0530, Ritesh Harjani wrote:
> >>
> >> Hi Darrick,
> >>
> >> Resuming my review from where I left off yesterday.
> >
>
> <snip>
> >> > +Writes
> >> > +~~~~~~
> >> > +
> >> > +The ``iomap_file_buffered_write`` function writes an ``iocb`` to the
> >> > +pagecache.
> >> > +``IOMAP_WRITE`` or ``IOMAP_WRITE`` | ``IOMAP_NOWAIT`` will be passed as
> >> > +the ``flags`` argument to ``->iomap_begin``.
> >> > +Callers commonly take ``i_rwsem`` in either shared or exclusive mode.
> >>
> >> shared(e.g. aligned overwrites)
> >
>
> Ok, I see we were in buffered I/O section (Sorry, I misunderstood
> thinking this was for direct-io)
Aha. I'll change these headings to "Buffered Readahead and Reads" and
"Buffered Writes".
> > That's a matter of debate -- xfs locks out concurrent reads by taking
> > i_rwsem in exclusive mode, whereas (I think?) ext4 and most other
> > filesystems take it in shared mode and synchronizes readers and writers
> > with folio locks.
>
> Ext4 too takes inode lock in exclusive mode in case of
> buffered-write. It's the DIO writes/overwrites in ext4 which has special
> casing for shared/exclusive mode locking.
>
> But ext4 buffered-read does not take any inode lock (it uses
> generic_file_read_iter()). So the synchronization must happen via folio
> lock w.r.t buffered-writes.
>
> However, I am not sure if we have any filesystem taking VFS inode lock in
> shared more for buffered-writes.
In theory you could if no other metadata needed updating, such as a dumb
filesystem with fixed size files where timestamps don't matter.
> BTW -
> I really like all of the other updates that you made w.r.t the review
> comments. All of those looks more clear to me. (so not commenting on them
> individually).
>
> Thanks!
No, thank /you/ and everyone else for reading all the way through it.
I'll finish cleaning things up and put out a v2.
--D
> -ritesh
>
Powered by blists - more mailing lists