linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Christian Brauner <brauner@kernel.org>,
	Carlos Maiolino <cem@kernel.org>, Qu Wenruo <wqu@suse.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/4] FIXUP: iomap: aligning to larger than fs block size doesn't make sense
Date: Mon, 27 Oct 2025 09:11:43 -0700	[thread overview]
Message-ID: <20251027161143.GT3356773@frogsfrogsfrogs> (raw)
In-Reply-To: <20251023135559.124072-3-hch@lst.de>

On Thu, Oct 23, 2025 at 03:55:43PM +0200, Christoph Hellwig wrote:
> All of the VFS and helpers assume that the file system block size must
> be larger or equal to the device block size.  So doing a max of both
> doesn't really make much sense.  Siplify the code in iomap_dio_bio_iter

                                   Simplify

> to do a simple if/else.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

With that fixed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/iomap/direct-io.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
> index ce9cbd2bace0..8d094d6f5f3e 100644
> --- a/fs/iomap/direct-io.c
> +++ b/fs/iomap/direct-io.c
> @@ -336,17 +336,19 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio)
>  	int nr_pages, ret = 0;
>  	u64 copied = 0;
>  	size_t orig_count;
> -	unsigned int alignment = bdev_logical_block_size(iomap->bdev);
> +	unsigned int alignment;
>  
>  	if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1))
>  		return -EINVAL;
>  
>  	/*
> -	 * Align to the larger one of bdev and fs block size, to meet the
> -	 * alignment requirement of both layers.
> +	 * File systems that write out of place and always allocate new blocks
> +	 * need each bio to be block aligned as that's the unit of allocation.
>  	 */
>  	if (dio->flags & IOMAP_DIO_FSBLOCK_ALIGNED)
> -		alignment = max(alignment, fs_block_size);
> +		alignment = fs_block_size;
> +	else
> +		alignment = bdev_logical_block_size(iomap->bdev);
>  
>  	if (dio->flags & IOMAP_DIO_WRITE) {
>  		bio_opf |= REQ_OP_WRITE;
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2025-10-27 16:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 13:55 alloc misaligned vectors for zoned XFS Christoph Hellwig
2025-10-23 13:55 ` [PATCH 1/4] iomap: add IOMAP_DIO_FSBLOCK_ALIGNED flag Christoph Hellwig
2025-10-27 16:10   ` Darrick J. Wong
2025-10-27 21:41     ` Qu Wenruo
2025-10-27 21:56       ` Darrick J. Wong
2025-10-29  7:44       ` Christoph Hellwig
2025-10-29  8:00         ` Qu Wenruo
2025-10-29  8:15           ` Christoph Hellwig
2025-10-31 12:40             ` Christian Brauner
2025-10-23 13:55 ` [PATCH 2/4] FIXUP: iomap: aligning to larger than fs block size doesn't make sense Christoph Hellwig
2025-10-27 16:11   ` Darrick J. Wong [this message]
2025-10-23 13:55 ` [PATCH 3/4] FIXUP: iomap: also apply IOMAP_DIO_FSBLOCK_ALIGNED to the iomap range Christoph Hellwig
2025-10-27 16:12   ` Darrick J. Wong
2025-10-23 13:55 ` [PATCH 4/4] xfs: support sub-block aligned vectors in always COW mode Christoph Hellwig
2025-10-27 16:15   ` Darrick J. Wong

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=20251027161143.GT3356773@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --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 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).