diff options
-rw-r--r-- | fs/bcachefs/buckets.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/reflink.c | 8 |
2 files changed, 12 insertions, 8 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 67b7e79648b1..d83ea0e53df3 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1023,6 +1023,18 @@ int bch2_trigger_extent(struct btree_trans *trans, struct bkey_s_c old, struct bkey_s new, unsigned flags) { + struct bkey_ptrs_c new_ptrs = bch2_bkey_ptrs_c(new.s_c); + struct bkey_ptrs_c old_ptrs = bch2_bkey_ptrs_c(old); + unsigned new_ptrs_bytes = (void *) new_ptrs.end - (void *) new_ptrs.start; + unsigned old_ptrs_bytes = (void *) old_ptrs.end - (void *) old_ptrs.start; + + /* if pointers aren't changing - nothing to do: */ + if (new_ptrs_bytes == old_ptrs_bytes && + !memcmp(new_ptrs.start, + old_ptrs.start, + new_ptrs_bytes)) + return 0; + if (flags & BTREE_TRIGGER_TRANSACTIONAL) { struct bch_fs *c = trans->c; int mod = (int) bch2_bkey_needs_rebalance(c, new.s_c) - diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c index b24b71bc4e60..faa5d3670058 100644 --- a/fs/bcachefs/reflink.c +++ b/fs/bcachefs/reflink.c @@ -301,14 +301,6 @@ int bch2_trans_mark_reflink_v(struct btree_trans *trans, (flags & BTREE_TRIGGER_INSERT)) check_indirect_extent_deleting(new, &flags); - if (old.k->type == KEY_TYPE_reflink_v && - new.k->type == KEY_TYPE_reflink_v && - old.k->u64s == new.k->u64s && - !memcmp(bkey_s_c_to_reflink_v(old).v->start, - bkey_s_to_reflink_v(new).v->start, - bkey_val_bytes(new.k) - 8)) - return 0; - return bch2_trigger_extent(trans, btree_id, level, old, new, flags); } |