diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-10-07 15:57:47 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:29 -0400 |
commit | 43de7376f36c236255b7daf88e8286720426568b (patch) | |
tree | 57f39404fc55a0a1e8e609d7e9146816537b5d52 /fs/bcachefs/buckets.h | |
parent | 9ec211b0ff4019407d029c49099f24dfedbc4db1 (diff) |
bcachefs: Fix erasure coding disk space accounting
Disk space accounting for erasure coding + compression was completely
broken - we need to calculate the parity sectors delta the same way we
calculate disk_sectors, by calculating the old and new usage and
subtracting to get the difference.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r-- | fs/bcachefs/buckets.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h index e93cda51d705..5f91a57abc70 100644 --- a/fs/bcachefs/buckets.h +++ b/fs/bcachefs/buckets.h @@ -137,8 +137,8 @@ static inline u8 ptr_stale(struct bch_dev *ca, return gen_after(ptr_bucket_mark(ca, ptr).gen, ptr->gen); } -static inline unsigned __ptr_disk_sectors(struct extent_ptr_decoded p, - unsigned live_size) +static inline s64 __ptr_disk_sectors(struct extent_ptr_decoded p, + unsigned live_size) { return live_size && p.crc.compression_type ? max(1U, DIV_ROUND_UP(live_size * p.crc.compressed_size, @@ -146,7 +146,7 @@ static inline unsigned __ptr_disk_sectors(struct extent_ptr_decoded p, : live_size; } -static inline unsigned ptr_disk_sectors(struct extent_ptr_decoded p) +static inline s64 ptr_disk_sectors(struct extent_ptr_decoded p) { return __ptr_disk_sectors(p, p.crc.live_size); } |