diff options
| author | Qu Wenruo <[email protected]> | 2025-01-29 03:35:26 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2025-03-18 19:35:42 +0000 |
| commit | 6c6201278e65378b53d8b6933a44018653b081e0 (patch) | |
| tree | c7a625b5e7e1ca817cdece6637e2fb95fd14e381 /fs/btrfs/async-thread.c | |
| parent | btrfs: simplify subpage handling of btrfs_clear_buffer_dirty() (diff) | |
| download | kernel-6c6201278e65378b53d8b6933a44018653b081e0.tar.gz kernel-6c6201278e65378b53d8b6933a44018653b081e0.zip | |
btrfs: simplify subpage handling of write_one_eb()
Currently inside write_one_eb() we have two different ways of handling
subpage and regular metadata.
The differences are:
- Extra offset/length calculation when adding the folio range to bio for
subpage cases
- Only decrease wbc->nr_to_write if the whole page is no longer dirty
for subpage cases
- Use subpage helper for subpage cases
Merge the tow ways into a shared one:
- Always calculate the to-be-queued range
So that bio_add_folio() can use the same calculated resulted length
and offset for both cases.
- Use btrfs_meta_folio_clear_dirty() and
btrfs_meta_folio_set_writeback() helpers
This will cover both cases.
- Only decrease wbc->nr_to_write if the folio is no longer dirty
Since we have the folio locked, no one else can modify the folio dirty
flags (set_extent_buffer_dirty() will also lock the folio for subpage
cases).
Thus after our btrfs_meta_folio_clear_dirty() call, if the whole folio
is no longer dirty, we're submitting the last dirty eb of the folio,
and can decrease wbc->nr_to_write properly.
Signed-off-by: Qu Wenruo <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/async-thread.c')
0 files changed, 0 insertions, 0 deletions
