From: Alan Huang <mmpgouride@gmail.com>
To: kent.overstreet@linux.dev
Cc: linux-bcachefs@vger.kernel.org, Alan Huang <mmpgouride@gmail.com>
Subject: [PATCH 4/4] bcachefs: Simplify logic
Date: Tue, 15 Apr 2025 13:33:07 +0800 [thread overview]
Message-ID: <20250415053307.81354-5-mmpgouride@gmail.com> (raw)
In-Reply-To: <20250415053307.81354-1-mmpgouride@gmail.com>
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
fs/bcachefs/btree_io.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 14e3329baa43..afcd13092807 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1017,7 +1017,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
bool used_mempool, blacklisted;
bool updated_range = b->key.k.type == KEY_TYPE_btree_ptr_v2 &&
BTREE_PTR_RANGE_UPDATED(&bkey_i_to_btree_ptr_v2(&b->key)->v);
- unsigned u64s;
unsigned ptr_written = btree_ptr_sectors_written(bkey_i_to_s_c(&b->key));
u64 max_journal_seq = 0;
struct printbuf buf = PRINTBUF;
@@ -1224,23 +1223,20 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
sorted = btree_bounce_alloc(c, btree_buf_bytes(b), &used_mempool);
sorted->keys.u64s = 0;
- set_btree_bset(b, b->set, &b->data->keys);
-
b->nr = bch2_key_sort_fix_overlapping(c, &sorted->keys, iter);
memset((uint8_t *)(sorted + 1) + b->nr.live_u64s * sizeof(u64), 0,
btree_buf_bytes(b) -
sizeof(struct btree_node) -
b->nr.live_u64s * sizeof(u64));
- u64s = le16_to_cpu(sorted->keys.u64s);
+ b->data->keys.u64s = sorted->keys.u64s;
*sorted = *b->data;
- sorted->keys.u64s = cpu_to_le16(u64s);
swap(sorted, b->data);
set_btree_bset(b, b->set, &b->data->keys);
b->nsets = 1;
b->data->keys.journal_seq = cpu_to_le64(max_journal_seq);
- BUG_ON(b->nr.live_u64s != u64s);
+ BUG_ON(b->nr.live_u64s != le16_to_cpu(b->data->keys.u64s));
btree_bounce_free(c, btree_buf_bytes(b), used_mempool, sorted);
--
2.48.1
next prev parent reply other threads:[~2025-04-15 5:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 5:33 [PATCH 0/4] bcachefs: Random cleanup Alan Huang
2025-04-15 5:33 ` [PATCH 1/4] bcachefs: Kill bch2_trans_unlock_noassert Alan Huang
2025-04-15 14:34 ` Kent Overstreet
2025-04-15 5:33 ` [PATCH 2/4] bcachefs: mark_btree_node_locked_noreset -> mark_btree_node_locked_reset Alan Huang
2025-04-15 14:34 ` Kent Overstreet
2025-04-15 14:40 ` Alan Huang
2025-04-15 15:10 ` Kent Overstreet
2025-04-15 5:33 ` [PATCH 3/4] bcachefs: Remove spurious +1/-1 operation Alan Huang
2025-04-15 14:35 ` Kent Overstreet
2025-04-15 5:33 ` Alan Huang [this message]
2025-04-15 14:36 ` [PATCH 4/4] bcachefs: Simplify logic Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250415053307.81354-5-mmpgouride@gmail.com \
--to=mmpgouride@gmail.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox