]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Don't touch journal_buf->data->seq in journal_res_get
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 23 Jan 2025 18:06:35 +0000 (13:06 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:13 +0000 (21:02 -0400)
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>
fs/bcachefs/journal.h

index 1e5fcfe3624af1cce678bbe788be0629157e4a6f..e514d664b8aee6dc37f03fe3cf6bf52a69db631c 100644 (file)
@@ -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;
 }