From: Christoph Hellwig <hch@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH] iomap: follow the alignment requirement for iomap_dio_hole_iter()
Date: Thu, 30 Jul 2026 00:45:21 -0700 [thread overview]
Message-ID: <amsBEVNnsYJjKGpK@infradead.org> (raw)
In-Reply-To: <e69cc8a4a9c3f641b97872b50f04c397880077cd.1785374485.git.wqu@suse.com>
On Thu, Jul 30, 2026 at 10:52:10AM +0930, Qu Wenruo wrote:
> [BUG]
> On the latest development branch, btrfs with 8K block size on 4K page
> sized systems will fail the following fsstress workload:
>
> # $fsstress -n 4 -d $mnt -s 1785675805 -v
Please add this to xfstests.
> +/*
> + * 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.
> + */
> +static unsigned int iomap_dio_alignment(const struct iomap_iter *iter,
> + const struct iomap_dio *dio)
> +{
> + if (dio->flags & IOMAP_DIO_FSBLOCK_ALIGNED)
> + return i_blocksize(iter->inode);
> + return bdev_logical_block_size(iter->iomap.bdev);
> +}
This already exists in the VFS iomap tree (with a slightly different
prototype).
> static int iomap_dio_hole_iter(struct iomap_iter *iter, struct iomap_dio *dio)
> {
> - loff_t length = iov_iter_zero(iomap_length(iter), dio->submit.iter);
> + loff_t copied = iov_iter_zero(iomap_length(iter), dio->submit.iter);
> + const unsigned int alignment = iomap_dio_alignment(iter, dio);
> + const loff_t aligned_copied = round_down(copied, alignment);
>
> - dio->size += length;
> - if (!length)
> + iov_iter_revert(dio->submit.iter, copied - aligned_copied);
> + dio->size += aligned_copied;
> + if (!aligned_copied)
> return -EFAULT;
> - return iomap_iter_advance(iter, length);
> + return iomap_iter_advance(iter, aligned_copied);
> }
iomap generall expects extents to be block aligned, how do you end up
with non-aligned reporting here?
next prev parent reply other threads:[~2026-07-30 7:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 1:22 [PATCH] iomap: follow the alignment requirement for iomap_dio_hole_iter() Qu Wenruo
2026-07-30 7:45 ` Christoph Hellwig [this message]
2026-07-30 8:36 ` Qu Wenruo
2026-07-30 12:01 ` 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=amsBEVNnsYJjKGpK@infradead.org \
--to=hch@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox