mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 18:35:20 +02:00
btrfs: subpage: fix the bitmap dump which can cause bitmap corruption
In commit75258f20fb
("btrfs: subpage: dump extra subpage bitmaps for debug") an internal macro GET_SUBPAGE_BITMAP() is introduced to grab the bitmap of each attribute. But that commit is using bitmap_cut() which will do the left shift of the larger bitmap, causing incorrect values. Thankfully this bitmap_cut() is only called for debug usage, and so far it's not yet causing problem. Fix it to use bitmap_read() to only grab the desired sub-bitmap. Fixes:75258f20fb
("btrfs: subpage: dump extra subpage bitmaps for debug") CC: stable@vger.kernel.org # 6.6+ Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0ae653fbec
commit
77b0b98bb7
|
@ -902,8 +902,14 @@ void btrfs_folio_end_all_writers(const struct btrfs_fs_info *fs_info, struct fol
|
|||
}
|
||||
|
||||
#define GET_SUBPAGE_BITMAP(subpage, subpage_info, name, dst) \
|
||||
bitmap_cut(dst, subpage->bitmaps, 0, \
|
||||
subpage_info->name##_offset, subpage_info->bitmap_nr_bits)
|
||||
{ \
|
||||
const int bitmap_nr_bits = subpage_info->bitmap_nr_bits; \
|
||||
\
|
||||
ASSERT(bitmap_nr_bits < BITS_PER_LONG); \
|
||||
*dst = bitmap_read(subpage->bitmaps, \
|
||||
subpage_info->name##_offset, \
|
||||
bitmap_nr_bits); \
|
||||
}
|
||||
|
||||
void __cold btrfs_subpage_dump_bitmap(const struct btrfs_fs_info *fs_info,
|
||||
struct folio *folio, u64 start, u32 len)
|
||||
|
|
Loading…
Reference in New Issue
Block a user