diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-19 19:01:41 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:19 -0400 |
commit | 7a0e4afb1a1116a3580144c7c902e6024333f20e (patch) | |
tree | 2439ac083d1be5524f053e173d6860689d7691a1 /fs/bcachefs/bkey_sort.c | |
parent | 62d5bd955fd81320d1e03fdebb4342ee14df1d1f (diff) | |
download | linux-stable-7a0e4afb1a1116a3580144c7c902e6024333f20e.tar.gz linux-stable-7a0e4afb1a1116a3580144c7c902e6024333f20e.tar.bz2 linux-stable-7a0e4afb1a1116a3580144c7c902e6024333f20e.zip |
bcachefs: Don't call bch2_bkey_transform() unnecessarily
If the packed format isn't changing, there's no need to call
bch2_bkey_transform().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/bkey_sort.c')
-rw-r--r-- | fs/bcachefs/bkey_sort.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c index da0b7a63b146..b1385a77da11 100644 --- a/fs/bcachefs/bkey_sort.c +++ b/fs/bcachefs/bkey_sort.c @@ -127,6 +127,7 @@ bch2_sort_repack(struct bset *dst, struct btree *src, struct bkey_format *in_f = &src->format; struct bkey_packed *in, *out = vstruct_last(dst); struct btree_nr_keys nr; + bool transform = memcmp(out_f, &src->format, sizeof(*out_f)); memset(&nr, 0, sizeof(nr)); @@ -134,8 +135,10 @@ bch2_sort_repack(struct bset *dst, struct btree *src, if (filter_whiteouts && bkey_deleted(in)) continue; - if (bch2_bkey_transform(out_f, out, bkey_packed(in) - ? in_f : &bch2_bkey_format_current, in)) + if (!transform) + bkey_copy(out, in); + else if (bch2_bkey_transform(out_f, out, bkey_packed(in) + ? in_f : &bch2_bkey_format_current, in)) out->format = KEY_FORMAT_LOCAL_BTREE; else bch2_bkey_unpack(src, (void *) out, in); |