summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-02-09 01:21:03 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-04-02 22:23:33 -0800
commitf938dfed551ab3849d4f0334b456d3564ed4b97c (patch)
treeef05dc828494f9862b226e1444948cab18e84c40
parentafb0d04b086672dbb4a73b633b71713e3efc31e4 (diff)
bcache compression debug
-rw-r--r--fs/bcachefs/buckets.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 184a29f93e41..7cfe4325bbbb 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -395,17 +395,21 @@ void bch2_mark_metadata_bucket(struct bch_dev *ca, struct bucket *g,
#if 0
/* Reverting this until the copygc + compression issue is fixed: */
-static unsigned __disk_sectors(const union bch_extent_crc *crc, unsigned sectors)
+static unsigned __disk_sectors(const struct bkey *k,
+ const union bch_extent_crc *crc,
+ unsigned sectors)
{
return crc_compression_type(crc)
- ? sectors * crc_compressed_size(crc) / crc_uncompressed_size(crc)
+ ? sectors * crc_compressed_size(k, crc) / crc_uncompressed_size(k, crc)
: sectors;
}
-static unsigned __compressed_sectors(const union bch_extent_crc *crc, unsigned sectors)
+static unsigned __compressed_sectors(const struct bkey *k,
+ const union bch_extent_crc *crc,
+ unsigned sectors)
{
return crc_compression_type(crc)
- ? min_t(unsigned, crc_compressed_size(crc), sectors)
+ ? min_t(unsigned, crc_compressed_size(k, crc), sectors)
: sectors;
}
#else
@@ -451,10 +455,10 @@ static void bch2_mark_pointer(struct bch_fs *c,
new_sectors = e.k->size + sectors;
}
- disk_sectors = -__disk_sectors(crc, old_sectors)
- + __disk_sectors(crc, new_sectors);
- compressed_sectors = -__compressed_sectors(crc, old_sectors)
- + __compressed_sectors(crc, new_sectors);
+ disk_sectors = -__disk_sectors(e.k, crc, old_sectors)
+ + __disk_sectors(e.k, crc, new_sectors);
+ compressed_sectors = -__compressed_sectors(e.k, crc, old_sectors)
+ + __compressed_sectors(e.k, crc, new_sectors);
if (gc_will_visit) {
if (journal_seq)