btrfs: raid56: store a physical address in structure sector_ptr
authorQu Wenruo <wqu@suse.com>
Wed, 9 Apr 2025 11:10:40 +0000 (13:10 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:46 +0000 (14:30 +0200)
commitcd678925e9f20e671fdb67a9e1d358ad445a8cc9
tree05887f1f1e1812e33b9a251d36d2c0e20c20db73
parent6f3f722df7254b7e652e042a93f7e2b011223af0
btrfs: raid56: store a physical address in structure sector_ptr

Instead of using a @page + @pg_offset pair inside sector_ptr structure,
use a single physical address instead.

This allows us to grab both the page and offset from a single u64 value.
Although we still need an extra bool value, @has_paddr, to distinguish
if the sector is properly mapped (as the 0 physical address is totally
valid).

This change doesn't change the size of structure sector_ptr, but reduces
the parameters of several functions.

Note: the original idea and patch is from Christoph Hellwig
(https://lore.kernel.org/linux-btrfs/20250409111055.3640328-7-hch@lst.de/)
but the final implementation is different.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[ Use physical addresses instead to handle highmem. ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c