]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bcache: Add bch_keylist_init_single()
authorKent Overstreet <kmo@daterainc.com>
Thu, 9 Jan 2014 05:22:02 +0000 (21:22 -0800)
committerKent Overstreet <kmo@daterainc.com>
Tue, 18 Mar 2014 19:22:36 +0000 (12:22 -0700)
This will potentially save us an allocation when we've got inode/dirent bkeys
that don't fit in the keylist's inline keys.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
drivers/md/bcache/bset.h
drivers/md/bcache/journal.c

index 003260f4ddf6e725417956531e64c9cb33022ae4..5f6728d5d4ddb0f406b0b7296025f412f193793b 100644 (file)
@@ -478,6 +478,12 @@ static inline void bch_keylist_init(struct keylist *l)
        l->top_p = l->keys_p = l->inline_keys;
 }
 
+static inline void bch_keylist_init_single(struct keylist *l, struct bkey *k)
+{
+       l->keys = k;
+       l->top = bkey_next(k);
+}
+
 static inline void bch_keylist_push(struct keylist *l)
 {
        l->top = bkey_next(l->top);
index cf8e0932aad2e6029970f0cc3f98ef8e5dad0fb3..c8bfc28cd2bdbd4e7e7d01cb09f01fb56604fe54 100644 (file)
@@ -313,8 +313,6 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)
        uint64_t start = i->j.last_seq, end = i->j.seq, n = start;
        struct keylist keylist;
 
-       bch_keylist_init(&keylist);
-
        list_for_each_entry(i, list, list) {
                BUG_ON(i->pin && atomic_read(i->pin) != 1);
 
@@ -327,8 +325,7 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)
                     k = bkey_next(k)) {
                        trace_bcache_journal_replay_key(k);
 
-                       bkey_copy(keylist.top, k);
-                       bch_keylist_push(&keylist);
+                       bch_keylist_init_single(&keylist, k);
 
                        ret = bch_btree_insert(s, &keylist, i->pin, NULL);
                        if (ret)