Commit 6ea873d1 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix copygc of compressed data

The check for when we need to get a disk reservation was wrong.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 97c0e195
...@@ -296,14 +296,14 @@ int bch2_migrate_write_init(struct bch_fs *c, struct migrate_write *m, ...@@ -296,14 +296,14 @@ int bch2_migrate_write_init(struct bch_fs *c, struct migrate_write *m,
unsigned compressed_sectors = 0; unsigned compressed_sectors = 0;
bkey_for_each_ptr_decode(k.k, ptrs, p, entry) bkey_for_each_ptr_decode(k.k, ptrs, p, entry)
if (!p.ptr.cached && if (p.ptr.dev == data_opts.rewrite_dev &&
crc_is_compressed(p.crc) && !p.ptr.cached &&
bch2_dev_in_target(c, p.ptr.dev, data_opts.target)) crc_is_compressed(p.crc))
compressed_sectors += p.crc.compressed_size; compressed_sectors += p.crc.compressed_size;
if (compressed_sectors) { if (compressed_sectors) {
ret = bch2_disk_reservation_add(c, &m->op.res, ret = bch2_disk_reservation_add(c, &m->op.res,
compressed_sectors, k.k->size * m->op.nr_replicas,
BCH_DISK_RESERVATION_NOFAIL); BCH_DISK_RESERVATION_NOFAIL);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment