summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-10-15 22:23:02 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:44 -0400
commit6ea873d1727af15ae429882737e8848492b63595 (patch)
tree24b64bcee5a0d70e0dfd89eac3b23ed7828bb7e0 /fs/bcachefs
parent97c0e19502549c0501581f9efff45022a10be2aa (diff)
downloadlwn-6ea873d1727af15ae429882737e8848492b63595.tar.gz
lwn-6ea873d1727af15ae429882737e8848492b63595.zip
bcachefs: Fix copygc of compressed data
The check for when we need to get a disk reservation was wrong. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/move.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 9967dd422e4d..8aa13b41d20d 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -296,14 +296,14 @@ int bch2_migrate_write_init(struct bch_fs *c, struct migrate_write *m,
unsigned compressed_sectors = 0;
bkey_for_each_ptr_decode(k.k, ptrs, p, entry)
- if (!p.ptr.cached &&
- crc_is_compressed(p.crc) &&
- bch2_dev_in_target(c, p.ptr.dev, data_opts.target))
+ if (p.ptr.dev == data_opts.rewrite_dev &&
+ !p.ptr.cached &&
+ crc_is_compressed(p.crc))
compressed_sectors += p.crc.compressed_size;
if (compressed_sectors) {
ret = bch2_disk_reservation_add(c, &m->op.res,
- compressed_sectors,
+ k.k->size * m->op.nr_replicas,
BCH_DISK_RESERVATION_NOFAIL);
if (ret)
return ret;