]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: do_trace_key_cache_fill()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 21 Mar 2025 21:03:12 +0000 (17:03 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 2 Apr 2025 14:24:34 +0000 (10:24 -0400)
Reducing stack frame usage; this moves the printbuf out of the main
stack frame.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_key_cache.c

index edce594333756e05b891f2a7ac36095aa14ae595..f4d2e2cc2d5384dcbd8745eb3bffbe1ff6b6aa20 100644 (file)
@@ -287,6 +287,19 @@ err:
        return ret;
 }
 
+static noinline_for_stack void do_trace_key_cache_fill(struct btree_trans *trans,
+                                                      struct btree_path *ck_path,
+                                                      struct bkey_s_c k)
+{
+       struct printbuf buf = PRINTBUF;
+
+       bch2_bpos_to_text(&buf, ck_path->pos);
+       prt_char(&buf, ' ');
+       bch2_bkey_val_to_text(&buf, trans->c, k);
+       trace_key_cache_fill(trans, buf.buf);
+       printbuf_exit(&buf);
+}
+
 static noinline int btree_key_cache_fill(struct btree_trans *trans,
                                         struct btree_path *ck_path,
                                         unsigned flags)
@@ -320,15 +333,8 @@ static noinline int btree_key_cache_fill(struct btree_trans *trans,
        if (ret)
                goto err;
 
-       if (trace_key_cache_fill_enabled()) {
-               struct printbuf buf = PRINTBUF;
-
-               bch2_bpos_to_text(&buf, ck_path->pos);
-               prt_char(&buf, ' ');
-               bch2_bkey_val_to_text(&buf, trans->c, k);
-               trace_key_cache_fill(trans, buf.buf);
-               printbuf_exit(&buf);
-       }
+       if (trace_key_cache_fill_enabled())
+               do_trace_key_cache_fill(trans, ck_path, k);
 out:
        /* We're not likely to need this iterator again: */
        bch2_set_btree_iter_dontneed(&iter);