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. 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. > */ > 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 > > - if (atomic_hw && length != iter->len) > + if (bio_atomic && length != iter->len) > return -EINVAL; This could really use a comment explaining what the check is for. > - if (WARN_ON_ONCE(atomic_hw && n != length)) { > + if (WARN_ON_ONCE(bio_atomic && n != length)) { Same. > -#define IOMAP_ATOMIC_HW (1 << 9) /* HW-based torn-write protection */ > -#define IOMAP_DONTCACHE (1 << 10) > -#define IOMAP_ATOMIC_SW (1 << 11)/* SW-based torn-write protection */ > +#define IOMAP_DONTCACHE (1 << 9) > +#define IOMAP_BIO_ATOMIC (1 << 10) /* Use REQ_ATOMIC on single bio */ > +#define IOMAP_FS_ATOMIC (1 << 11) /* FS-based torn-write protection */ Please also fix the overly long lines here by moving the comments above the definitions. That should also give you enough space to expand the comment into a full sentence describing the flag fully.