Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@infradead.org>, Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3] iomap: follow the alignment requirement for iomap_dio_hole_iter()
Date: Wed, 5 Aug 2026 07:01:20 +0930	[thread overview]
Message-ID: <d3e39d91-e7cc-4f8c-b7dd-22896fffe639@gmx.com> (raw)
In-Reply-To: <anHirnemstkJksXp@infradead.org>



在 2026/8/4 22:31, Christoph Hellwig 写道:
> On Sat, Aug 01, 2026 at 07:17:26AM +0930, Qu Wenruo wrote:
>> +++ b/fs/iomap/direct-io.c
>> @@ -409,7 +409,10 @@ static inline unsigned int iomap_dio_alignment(struct inode *inode,
>>   {
>>   	if (dio_flags & IOMAP_DIO_FSBLOCK_ALIGNED)
>>   		return i_blocksize(inode);
>> -	return bdev_logical_block_size(bdev);
>> +	/* @bdev can be NULL for hole cases. */
>> +	if (bdev)
>> +		return bdev_logical_block_size(bdev);
>> +	return SECTOR_SIZE;
> 
> No.  As said for previous versions you should not use
> iomap_dio_alignment.  There is no such things as sub-fsblock alignment
> for holes.  All mappings need to be aligned on fs blocks, you can do
> sub-mapping granularity I/O in it, but not align on it.  So don't
> call iomap_dio_alignment, but instead align down the shortened range
> from the fault to a fs block boundary.

OK, got it now.

> 
> And really sort out the btrfs locking that we can't get rid of this
> premature faulting as it keeps messing up core code way too much.

That will be a long term work, meanwhile I'm only fixing a short-term 
bug, already affecting existing bs > ps support.

I hate the btrfs internal locking mechanism just as you, but it won't be 
an easy thing to do in the short term.

Thanks,
Qu

      reply	other threads:[~2026-08-04 21:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 21:47 [PATCH v3] iomap: follow the alignment requirement for iomap_dio_hole_iter() Qu Wenruo
2026-08-04 13:01 ` Christoph Hellwig
2026-08-04 21:31   ` Qu Wenruo [this message]

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=d3e39d91-e7cc-4f8c-b7dd-22896fffe639@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=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