summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-01-23 13:06:35 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-14 21:02:13 -0400
commit2e853fdbc74411643b00a14ee75ca234675a9bf2 (patch)
tree31b731b33297325b4fba850d446bda1c810bd3dd
parent199a3578edec89069f1e07cf92135c8fce50e706 (diff)
downloadlinux-2e853fdbc74411643b00a14ee75ca234675a9bf2.tar.gz
linux-2e853fdbc74411643b00a14ee75ca234675a9bf2.zip
bcachefs: Don't touch journal_buf->data->seq in journal_res_get
This is a small optimization, reducing the number of cachelines we touch in the fast path - and it's also necessary for the next patch that increases JOURNAL_BUF_NR. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/journal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h
index 1e5fcfe3624a..e514d664b8ae 100644
--- a/fs/bcachefs/journal.h
+++ b/fs/bcachefs/journal.h
@@ -364,7 +364,10 @@ static inline int journal_res_get_fast(struct journal *j,
res->ref = true;
res->offset = old.cur_entry_offset;
- res->seq = le64_to_cpu(j->buf[old.idx].data->seq);
+ res->seq = journal_cur_seq(j);
+ res->seq -= (res->seq - old.idx) & JOURNAL_BUF_MASK;
+
+ EBUG_ON(res->seq != le64_to_cpu(j->buf[old.idx].data->seq));
return 1;
}