Signed-off-by: Kent Overstreet <[email protected]>
---
 fs/bcachefs/btree_update.c | 15 ++++++++-------
 fs/bcachefs/btree_update.h | 26 ++++++++++++++++++++------
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/fs/bcachefs/btree_update.c b/fs/bcachefs/btree_update.c
index e97e78c10f49..f7949dbe8f70 100644
--- a/fs/bcachefs/btree_update.c
+++ b/fs/bcachefs/btree_update.c
@@ -546,7 +546,7 @@ int bch2_btree_insert_clone_trans(struct btree_trans *trans,
 
 void *__bch2_trans_subbuf_alloc(struct btree_trans *trans,
                                struct btree_trans_subbuf *buf,
-                               unsigned u64s)
+                               unsigned u64s, ulong ip)
 {
        unsigned new_top = buf->u64s + u64s;
        unsigned old_size = buf->size;
@@ -554,7 +554,7 @@ void *__bch2_trans_subbuf_alloc(struct btree_trans *trans,
        if (new_top > buf->size)
                buf->size = roundup_pow_of_two(new_top);
 
-       void *n = bch2_trans_kmalloc_nomemzero(trans, buf->size * sizeof(u64));
+       void *n = bch2_trans_kmalloc_nomemzero_ip(trans, buf->size * 
sizeof(u64), ip);
        if (IS_ERR(n))
                return n;
 
@@ -807,11 +807,11 @@ int bch2_btree_bit_mod_buffered(struct btree_trans 
*trans, enum btree_id btree,
        return bch2_trans_update_buffered(trans, btree, &k);
 }
 
-static int __bch2_trans_log_str(struct btree_trans *trans, const char *str, 
unsigned len)
+static int __bch2_trans_log_str(struct btree_trans *trans, const char *str, 
unsigned len, ulong ip)
 {
        unsigned u64s = DIV_ROUND_UP(len, sizeof(u64));
 
-       struct jset_entry *e = bch2_trans_jset_entry_alloc(trans, 
jset_u64s(u64s));
+       struct jset_entry *e = bch2_trans_jset_entry_alloc_ip(trans, 
jset_u64s(u64s), ip);
        int ret = PTR_ERR_OR_ZERO(e);
        if (ret)
                return ret;
@@ -824,7 +824,7 @@ static int __bch2_trans_log_str(struct btree_trans *trans, 
const char *str, unsi
 
 int bch2_trans_log_str(struct btree_trans *trans, const char *str)
 {
-       return __bch2_trans_log_str(trans, str, strlen(str));
+       return __bch2_trans_log_str(trans, str, strlen(str), _RET_IP_);
 }
 
 int bch2_trans_log_msg(struct btree_trans *trans, struct printbuf *buf)
@@ -833,13 +833,14 @@ int bch2_trans_log_msg(struct btree_trans *trans, struct 
printbuf *buf)
        if (ret)
                return ret;
 
-       return __bch2_trans_log_str(trans, buf->buf, buf->pos);
+       return __bch2_trans_log_str(trans, buf->buf, buf->pos, _RET_IP_);
 }
 
 int bch2_trans_log_bkey(struct btree_trans *trans, enum btree_id btree,
                        unsigned level, struct bkey_i *k)
 {
-       struct jset_entry *e = bch2_trans_jset_entry_alloc(trans, 
jset_u64s(k->k.u64s));
+       struct jset_entry *e = bch2_trans_jset_entry_alloc_ip(trans,
+                                               jset_u64s(k->k.u64s), _RET_IP_);
        int ret = PTR_ERR_OR_ZERO(e);
        if (ret)
                return ret;
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index 9feef1dc4de5..e4b6e7d51a2e 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -137,21 +137,29 @@ static inline void *btree_trans_subbuf_top(struct 
btree_trans *trans,
 
 void *__bch2_trans_subbuf_alloc(struct btree_trans *,
                                struct btree_trans_subbuf *,
-                               unsigned);
+                               unsigned, ulong);
 
 static inline void *
-bch2_trans_subbuf_alloc(struct btree_trans *trans,
-                       struct btree_trans_subbuf *buf,
-                       unsigned u64s)
+bch2_trans_subbuf_alloc_ip(struct btree_trans *trans,
+                          struct btree_trans_subbuf *buf,
+                          unsigned u64s, ulong ip)
 {
        if (buf->u64s + u64s > buf->size)
-               return __bch2_trans_subbuf_alloc(trans, buf, u64s);
+               return __bch2_trans_subbuf_alloc(trans, buf, u64s, ip);
 
        void *p = btree_trans_subbuf_top(trans, buf);
        buf->u64s += u64s;
        return p;
 }
 
+static inline void *
+bch2_trans_subbuf_alloc(struct btree_trans *trans,
+                       struct btree_trans_subbuf *buf,
+                       unsigned u64s)
+{
+       return bch2_trans_subbuf_alloc_ip(trans, buf, u64s, _THIS_IP_);
+}
+
 static inline struct jset_entry *btree_trans_journal_entries_start(struct 
btree_trans *trans)
 {
        return btree_trans_subbuf_base(trans, &trans->journal_entries);
@@ -162,10 +170,16 @@ static inline struct jset_entry 
*btree_trans_journal_entries_top(struct btree_tr
        return btree_trans_subbuf_top(trans, &trans->journal_entries);
 }
 
+static inline struct jset_entry *
+bch2_trans_jset_entry_alloc_ip(struct btree_trans *trans, unsigned u64s, ulong 
ip)
+{
+       return bch2_trans_subbuf_alloc_ip(trans, &trans->journal_entries, u64s, 
ip);
+}
+
 static inline struct jset_entry *
 bch2_trans_jset_entry_alloc(struct btree_trans *trans, unsigned u64s)
 {
-       return bch2_trans_subbuf_alloc(trans, &trans->journal_entries, u64s);
+       return bch2_trans_jset_entry_alloc_ip(trans, u64s, _THIS_IP_);
 }
 
 int bch2_btree_insert_clone_trans(struct btree_trans *, enum btree_id, struct 
bkey_i *);
-- 
2.50.0


Reply via email to