diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-09 20:19:18 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:18 +0200 |
commit | bf0fdb4d89bf16bbcd3a0a340a10ffde25b13d57 (patch) | |
tree | 8e09338c386e3813bbb726f0cf296e7ac0110d40 /fs/bcachefs/move.c | |
parent | bcachefs: Split out struct gc_stripe from struct stripe (diff) | |
download | linux-bf0fdb4d89bf16bbcd3a0a340a10ffde25b13d57.tar.xz linux-bf0fdb4d89bf16bbcd3a0a340a10ffde25b13d57.zip |
bcachefs: Don't erasure code cached ptrs
It doesn't make much sense to be erasure coding cached pointers, we
should be erasure coding one of the dirty pointers in an extent. This
patch makes sure we're passing BCH_WRITE_CACHED when we expect the new
pointer to be a cached pointer, and tweaks the write path to not
allocate from a stripe when BCH_WRITE_CACHED is set - and fixes an
assertion we were hitting in the ec path where when adding the stripe to
an extent and deleting the other pointers the pointer to the stripe
didn't exist (because dropping all dirty pointers from an extent turns
it into a KEY_TYPE_error key).
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | fs/bcachefs/move.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 482dfc29385e..8756df0414a8 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -394,10 +394,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.dev == data_opts.rewrite_dev && - !p.ptr.cached && - crc_is_compressed(p.crc)) - compressed_sectors += p.crc.compressed_size; + if (p.ptr.dev == data_opts.rewrite_dev) { + if (p.ptr.cached) + m->op.flags |= BCH_WRITE_CACHED; + + if (!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, |