]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Kill journal_res_state.unwritten_idx
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 23 Jan 2025 18:43:15 +0000 (13:43 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:12 +0000 (21:02 -0400)
Dead code

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c
fs/bcachefs/journal_io.c
fs/bcachefs/journal_types.h

index 05b1250619eccd847f2b52b9fc82713e9638b249..65d8cc5ff7d306a07f028bf198b0920e8a7d87ca 100644 (file)
@@ -1389,8 +1389,7 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
        set_bit(JOURNAL_running, &j->flags);
        j->last_flush_write = jiffies;
 
-       j->reservations.idx = j->reservations.unwritten_idx = journal_cur_seq(j);
-       j->reservations.unwritten_idx++;
+       j->reservations.idx = journal_cur_seq(j);
 
        c->last_bucket_seq_cleanup = journal_cur_seq(j);
 
index 11c39e0c34f4cb393b0dca68a65e864c7515f313..f2ff28e6697c0b4652087be48f40b52b080cb250 100644 (file)
@@ -1611,7 +1611,6 @@ static CLOSURE_CALLBACK(journal_write_done)
        struct journal *j = container_of(w, struct journal, buf[w->idx]);
        struct bch_fs *c = container_of(j, struct bch_fs, journal);
        struct bch_replicas_padded replicas;
-       union journal_res_state old, new;
        u64 seq = le64_to_cpu(w->data->seq);
        int err = 0;
 
@@ -1671,16 +1670,6 @@ static CLOSURE_CALLBACK(journal_write_done)
                if (j->watermark != BCH_WATERMARK_stripe)
                        journal_reclaim_kick(&c->journal);
 
-               old.v = atomic64_read(&j->reservations.counter);
-               do {
-                       new.v = old.v;
-                       BUG_ON(journal_state_count(new, new.unwritten_idx));
-                       BUG_ON(new.unwritten_idx != (seq & JOURNAL_BUF_MASK));
-
-                       new.unwritten_idx++;
-               } while (!atomic64_try_cmpxchg(&j->reservations.counter,
-                                              &old.v, new.v));
-
                closure_wake_up(&w->wait);
                completed = true;
        }
@@ -1695,7 +1684,7 @@ static CLOSURE_CALLBACK(journal_write_done)
        }
 
        if (journal_last_unwritten_seq(j) == journal_cur_seq(j) &&
-                  new.cur_entry_offset < JOURNAL_ENTRY_CLOSED_VAL) {
+           j->reservations.cur_entry_offset < JOURNAL_ENTRY_CLOSED_VAL) {
                struct journal_buf *buf = journal_cur_buf(j);
                long delta = buf->expires - jiffies;
 
index 1ef3a28ed6ab388130af75d4fb825ceeee5e6233..c407f9ce4d2464306b8d5eb029b4fbce732c6c59 100644 (file)
@@ -98,9 +98,8 @@ union journal_res_state {
        };
 
        struct {
-               u64             cur_entry_offset:20,
+               u64             cur_entry_offset:22,
                                idx:2,
-                               unwritten_idx:2,
                                buf0_count:10,
                                buf1_count:10,
                                buf2_count:10,
@@ -110,13 +109,13 @@ union journal_res_state {
 
 /* bytes: */
 #define JOURNAL_ENTRY_SIZE_MIN         (64U << 10) /* 64k */
-#define JOURNAL_ENTRY_SIZE_MAX         (4U  << 20) /* 4M */
+#define JOURNAL_ENTRY_SIZE_MAX         (4U  << 22) /* 16M */
 
 /*
  * We stash some journal state as sentinal values in cur_entry_offset:
  * note - cur_entry_offset is in units of u64s
  */
-#define JOURNAL_ENTRY_OFFSET_MAX       ((1U << 20) - 1)
+#define JOURNAL_ENTRY_OFFSET_MAX       ((1U << 22) - 1)
 
 #define JOURNAL_ENTRY_BLOCKED_VAL      (JOURNAL_ENTRY_OFFSET_MAX - 2)
 #define JOURNAL_ENTRY_CLOSED_VAL       (JOURNAL_ENTRY_OFFSET_MAX - 1)