linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: John Garry <john.g.garry@oracle.com>
Cc: brauner@kernel.org, djwong@kernel.org, cem@kernel.org,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, martin.petersen@oracle.com
Subject: Re: [PATCH RFC v5 10/10] iomap: Rename ATOMIC flags again
Date: Wed, 12 Mar 2025 00:13:42 -0700	[thread overview]
Message-ID: <Z9E0JqQfdL4nPBH-@infradead.org> (raw)
In-Reply-To: <20250310183946.932054-11-john.g.garry@oracle.com>

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.


  reply	other threads:[~2025-03-12  7:13 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 18:39 [PATCH v5 00/10] large atomic writes for xfs with CoW John Garry
2025-03-10 18:39 ` [PATCH v5 01/10] xfs: Pass flags to xfs_reflink_allocate_cow() John Garry
2025-03-12  7:15   ` Christoph Hellwig
2025-03-12  8:19     ` John Garry
2025-03-10 18:39 ` [PATCH v5 02/10] xfs: Switch atomic write size check in xfs_file_write_iter() John Garry
2025-03-12  7:17   ` Christoph Hellwig
2025-03-12  8:21     ` John Garry
2025-03-10 18:39 ` [PATCH v5 03/10] xfs: Refactor xfs_reflink_end_cow_extent() John Garry
2025-03-12  7:24   ` Christoph Hellwig
2025-03-12  8:27     ` John Garry
2025-03-12  8:35       ` Christoph Hellwig
2025-03-12 15:46         ` Darrick J. Wong
2025-03-12 22:06           ` John Garry
2025-03-12 23:22             ` Darrick J. Wong
2025-03-13  1:25           ` Dave Chinner
2025-03-13  4:51             ` Darrick J. Wong
2025-03-13  6:11               ` John Garry
2025-03-18  0:43                 ` Dave Chinner
2025-03-13  7:21               ` Dave Chinner
2025-03-22  5:19                 ` Darrick J. Wong
2025-03-10 18:39 ` [PATCH v5 04/10] xfs: Reflink CoW-based atomic write support John Garry
2025-03-12  7:27   ` Christoph Hellwig
2025-03-12  9:13     ` John Garry
2025-03-12 13:45       ` Christoph Hellwig
2025-03-12 14:48         ` John Garry
2025-03-10 18:39 ` [PATCH v5 05/10] xfs: Iomap SW-based " John Garry
2025-03-12  7:37   ` Christoph Hellwig
2025-03-12  9:00     ` John Garry
2025-03-12 13:52       ` Christoph Hellwig
2025-03-12 14:57         ` John Garry
2025-03-12 15:55           ` Christoph Hellwig
2025-03-12 16:11             ` John Garry
2025-03-10 18:39 ` [PATCH v5 06/10] xfs: Add xfs_file_dio_write_atomic() John Garry
2025-03-10 18:39 ` [PATCH v5 07/10] xfs: Commit CoW-based atomic writes atomically John Garry
2025-03-12  7:39   ` Christoph Hellwig
2025-03-12  9:04     ` John Garry
2025-03-12 13:54       ` Christoph Hellwig
2025-03-12 15:01         ` John Garry
2025-03-10 18:39 ` [PATCH v5 08/10] xfs: Update atomic write max size John Garry
2025-03-11 14:40   ` Carlos Maiolino
2025-03-12  7:41   ` Christoph Hellwig
2025-03-12  8:09     ` John Garry
2025-03-12  8:13       ` Christoph Hellwig
2025-03-12  8:14         ` John Garry
2025-03-10 18:39 ` [PATCH v5 09/10] xfs: Allow block allocator to take an alignment hint John Garry
2025-03-12  7:42   ` Christoph Hellwig
2025-03-12  8:05     ` John Garry
2025-03-12 13:45       ` Christoph Hellwig
2025-03-12 14:47         ` John Garry
2025-03-12 16:00         ` Darrick J. Wong
2025-03-12 16:28           ` John Garry
2025-03-10 18:39 ` [PATCH RFC v5 10/10] iomap: Rename ATOMIC flags again John Garry
2025-03-12  7:13   ` Christoph Hellwig [this message]
2025-03-12 23:59     ` Dave Chinner
2025-03-13  6:28       ` John Garry
2025-03-13  7:02         ` Christoph Hellwig
2025-03-13  7:41           ` John Garry
2025-03-13  7:49             ` Christoph Hellwig
2025-03-13  7:53               ` John Garry
2025-03-13  8:09                 ` Christoph Hellwig
2025-03-13  8:18                   ` Christoph Hellwig
2025-03-13  8:24                     ` John Garry
2025-03-13  8:28                     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9E0JqQfdL4nPBH-@infradead.org \
    --to=hch@infradead.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=john.g.garry@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).