public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	WenRuo Qu <wqu@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 4/5] btrfs: prepare extent_io.c for future larger folio support
Date: Sat, 22 Feb 2025 15:32:32 +1030	[thread overview]
Message-ID: <ca38a144-41c1-45ea-9769-4e0b22625810@gmx.com> (raw)
In-Reply-To: <c68a0824-493c-4049-9050-6e270793c44f@wdc.com>



在 2025/2/21 22:42, Johannes Thumshirn 写道:
> On 20.02.25 10:24, Qu Wenruo wrote:
>> @@ -2468,8 +2468,8 @@ void extent_write_locked_range(struct inode *inode, const struct folio *locked_f
>>    	ASSERT(IS_ALIGNED(start, sectorsize) && IS_ALIGNED(end + 1, sectorsize));
>>
>>    	while (cur <= end) {
>> -		u64 cur_end = min(round_down(cur, PAGE_SIZE) + PAGE_SIZE - 1, end);
>> -		u32 cur_len = cur_end + 1 - cur;
>> +		u64 cur_end;
>> +		u32 cur_len;
>>    		struct folio *folio;
>>
>>    		folio = filemap_get_folio(mapping, cur >> PAGE_SHIFT);
>> @@ -2479,13 +2479,18 @@ void extent_write_locked_range(struct inode *inode, const struct folio *locked_f
>>    		 * code is just in case, but shouldn't actually be run.
>>    		 */
>>    		if (IS_ERR(folio)) {
>> +			cur_end = min(round_down(cur, PAGE_SIZE) + PAGE_SIZE - 1, end);
>> +			cur_len = cur_end + 1 - cur;
>
> Why is it still using PAGE_SIZE here?

This is because we are at a failure path where there is no folio.

But we still want to skip to the next slot (may or may not exist
though), so we have to increase the bytenr by the minimal unit of
filemap, which is still a page.

Thanks,
Qu

>
>>    			btrfs_mark_ordered_io_finished(BTRFS_I(inode), NULL,
>>    						       cur, cur_len, false);
>>    			mapping_set_error(mapping, PTR_ERR(folio));
>> -			cur = cur_end + 1;
>> +			cur = cur_end;
>>    			continue;
>>    		}
>>
>> +		cur_end = min(folio_pos(folio) + folio_size(folio) - 1, end);
>> +		cur_len = cur_end + 1 - cur;
>> +
>>    		ASSERT(folio_test_locked(folio));
>>    		if (pages_dirty && folio != locked_folio)
>>    			ASSERT(folio_test_dirty(folio));


  reply	other threads:[~2025-02-22  5:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20  9:22 [PATCH 0/5] btrfs: prepare for larger folios support Qu Wenruo
2025-02-20  9:22 ` [PATCH 1/5] btrfs: prepare subpage.c " Qu Wenruo
2025-02-21 12:06   ` Johannes Thumshirn
2025-02-22  5:03     ` Qu Wenruo
2025-02-20  9:22 ` [PATCH 2/5] btrfs: remove the PAGE_SIZE usage inside inline extent reads Qu Wenruo
2025-02-21 11:37   ` Johannes Thumshirn
2025-02-20  9:22 ` [PATCH 3/5] btrfs: prepare btrfs_launcher_folio() for larger folios support Qu Wenruo
2025-02-21 12:08   ` Johannes Thumshirn
2025-02-20  9:22 ` [PATCH 4/5] btrfs: prepare extent_io.c for future larger folio support Qu Wenruo
2025-02-21 12:12   ` Johannes Thumshirn
2025-02-22  5:02     ` Qu Wenruo [this message]
2025-02-25 18:41   ` Nathan Chancellor
2025-02-20  9:22 ` [PATCH 5/5] btrfs: prepare btrfs_page_mkwrite() for larger folios Qu Wenruo
2025-02-21 12:22   ` Johannes Thumshirn
2025-02-21 11:23 ` [PATCH 0/5] btrfs: prepare for larger folios support Johannes Thumshirn
2025-02-21 12:34   ` Filipe Manana
2025-02-21 22:33   ` Qu Wenruo

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=ca38a144-41c1-45ea-9769-4e0b22625810@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=linux-btrfs@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