From: Christoph Hellwig <hch@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, brauner@kernel.org,
djwong@kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] iomap: add IOMAP_DIO_ALIGNED flag for btrfs
Date: Sun, 12 Oct 2025 23:33:27 -0700 [thread overview]
Message-ID: <aOydN1rIsWiNo4m6@infradead.org> (raw)
In-Reply-To: <5dbcc1d717c1f8a6ed85da4768306efb0073ff78.1760335677.git.wqu@suse.com>
On Mon, Oct 13, 2025 at 04:38:40PM +1030, Qu Wenruo wrote:
> For now only btrfs will utilize this flag, as btrfs needs to calculate
> checksum for direct read.
Maybe reword this as:
The initial user of this flag is btrfs, whichs needs to calculate
the checksum for direct read and thus requires the biovec to be
file system block size aligned?
> index 802d4dbe5b38..15aff186642d 100644
> --- a/fs/btrfs/direct-io.c
> +++ b/fs/btrfs/direct-io.c
Please split the patch to use the flag in btrfs from the one adding
the the flag to iomap.
> + const unsigned int alignment = (dio->flags & IOMAP_DIO_ALIGNED) ?
> + max(fs_block_size, bdev_logical_block_size(iomap->bdev)) :
> + bdev_logical_block_size(iomap->bdev);
Please unwind this into an if/else to be easily readable. Also a
comment on why you still need the max when the flag is set would be
useful.
> + ret = bio_iov_iter_get_pages(bio, dio->submit.iter, alignment - 1);
Please avoid overly long lines in the iomap code.
> +/*
> + * Ensure each bio is aligned to fs block size.
> + *
> + * For filesystems which need to calculate/verify data checksum for each data bio.
Another overly long line here.
> + */
> +#define IOMAP_DIO_ALIGNED (1 << 3)
Maybe call the flag IOMAP_DIO_FSBLOCK_ALIGNED to make it clear
what alignment is implied by the flag.
next prev parent reply other threads:[~2025-10-13 6:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 6:08 [PATCH] iomap: add IOMAP_DIO_ALIGNED flag for btrfs Qu Wenruo
2025-10-13 6:33 ` Christoph Hellwig [this message]
2025-10-13 7:06 ` Qu Wenruo
2025-10-13 7:11 ` 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=aOydN1rIsWiNo4m6@infradead.org \
--to=hch@infradead.org \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wqu@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.