Re: [PATCH v2 4/4] btrfs: zoned: don't clobber the extent buffer when zeroing it out

Johannes Thumshirn <[email protected]> Thu, 23 Jul 2026 20:33:14 +0200
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On 7/23/26 8:18 PM, Boris Burkov wrote:
>> @@ -2334,8 +2338,21 @@ static noinline_for_stack void write_one_eb(struct extent_buffer *eb,
>>   		btrfs_meta_folio_set_writeback(folio, eb);
>>   		if (!folio_test_dirty(folio))
>>   			wbc->nr_to_write -= folio_nr_pages(folio);
>> -		bio_add_folio_nofail(&bbio->bio, folio, range_len,
>> -				     offset_in_folio(folio, range_start));
>> +		if (test_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags)) {
>> +			u32 off = 0;
>> +
>> +			while (off < range_len) {
>> +				u32 add = min_t(u32, PAGE_SIZE, range_len - off);
>> +
>> +				bio_add_folio_nofail(&bbio->bio,
>> +						     page_folio(ZERO_PAGE(0)),
>> +						     add, 0);
> In your opinion would it be better to hang the zero_page off eb->folios[]?
>
> Gets rid of this special case but might do something surprising /
> unexpected (or just be a dumb idea and not work at all, lol)

Interesting question, I haven't thought about it. I'll try to think 
about that when trying the active bg first write.