Re: [PATCH RFC v5 10/10] iomap: Rename ATOMIC flags again

From: Dave Chinner
Date: Wed Mar 12 2025 - 20:00:07 EST


On Wed, Mar 12, 2025 at 12:13:42AM -0700, Christoph Hellwig wrote:
> On Mon, Mar 10, 2025 at 06:39:46PM +0000, John Garry wrote:
> > Dave Chinner thought that names IOMAP_ATOMIC_HW and IOMAP_ATOMIC_SW were
> > not appropopiate. Specifically because IOMAP_ATOMIC_HW could actually be
> > realised with a SW-based method in the block or md/dm layers.
> >
> > So rename to IOMAP_ATOMIC_BIO and IOMAP_ATOMIC_FS.
>
> Looking over the entire series and the already merged iomap code:
> there should be no reason at all for having IOMAP_ATOMIC_FS.
> The only thing it does is to branch out to
> xfs_atomic_write_sw_iomap_begin from xfs_atomic_write_iomap_begin.
>
> You can do that in a much simpler and nicer way by just having
> different iomap_ops for the bio based vs file system based atomics.

Agreed - I was going to suggest that, but got distracted by
something else and then forgot about it when I got back to writing
the email...

> I agree with dave that bio is a better term for the bio based
> atomic, but please use the IOMAP_ATOMIC_BIO name above instead
> of the IOMAP_BIO_ATOMIC actually used in the code if you change
> it.

Works for me.

> > */
> > static inline blk_opf_t iomap_dio_bio_opflags(struct iomap_dio *dio,
> > - const struct iomap *iomap, bool use_fua, bool atomic_hw)
> > + const struct iomap *iomap, bool use_fua, bool bio_atomic)
>
> Not new here, but these two bools are pretty ugly.
>
> I'd rather have a
>
> blk_opf_t extra_flags;
>
> in the caller that gets REQ_FUA and REQ_ATOMIC assigned as needed,
> and then just clear

Yep, that is cleaner..

-Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx