Skip to content

btrfs: two small and safe fixes for large folios

Qu Wenruo linux-btrfs 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 4 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Fix a bug that page_pgoff() usage lacks left page shift

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: fix the ASSERT() inside GET_SUBPAGE_BITMAP()fs/btrfs/subpage.c+1 -11 reply
2/2btrfs: fix the file offset calculation inside btrfs_decompress_buf2page()fs/btrfs/compression.c+17 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchFilipe MananaBoris BurkovSweet Tea Dorminy
SeriesR-b R-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: two small and safe fixes for large folios

[CHANGELOG]
v2:
- Fix a bug that page_pgoff() usage lacks left page shift

Two small and simple fixes.

The first one is that with large folios, we can have order 6 folios which reached our current BITS_PER_LONG limit, triggering a previously impossible ASSERT(), which is based on the fact that our largest page size (64K) can not reach BITS_PER_LONG blocks per page.

An easily fix by extending the ASSERT() condition to cover blocks_per_folio == BITS_PER_LONG cases.

The second one is a little more complex, that with large folios, if we still go through the single page bio vec iteration, we can not call page_offset(), as non-head pages of a large folio do not have their page::index initialized properly.

Fix that by going a helper using page_pgoff() to calculate the file offset, which handles both head and non-head pages of a large folio.

Qu Wenruo (2):
btrfs: fix the ASSERT() inside GET_SUBPAGE_BITMAP()
btrfs: fix the file offset calculation inside
btrfs_decompress_buf2page()

 fs/btrfs/compression.c | 18 +++++++++++++++++-
 fs/btrfs/subpage.c     |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)
Signature · 1 line
2.49.0