From: Baokun Li <libaokun1@huawei.com>
To: <clm@fb.com>, <josef@toxicpanda.com>, <dsterba@suse.com>,
<anand.jain@oracle.com>, <linux-btrfs@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <weiyongjun1@huawei.com>, <yuehaibing@huawei.com>,
<yangjihong1@huawei.com>, <yukuai3@huawei.com>,
<libaokun1@huawei.com>, "Hulk Robot" <hulkci@huawei.com>
Subject: [PATCH -next v2] btrfs: send: use list_move_tail instead of list_del/list_add_tail in send.c
Date: Fri, 11 Jun 2021 14:51:15 +0800 [thread overview]
Message-ID: <20210611065115.1165906-1-libaokun1@huawei.com> (raw)
Using list_move_tail() instead of list_del() + list_add_tail() in send.c.
And open-code name_cache_used() as there is only one user.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
V1->V2:
open-code name_cache_used()
fs/btrfs/send.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index bd69db72acc5..418ada6139fd 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2077,16 +2077,6 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
return NULL;
}
-/*
- * Removes the entry from the list and adds it back to the end. This marks the
- * entry as recently used so that name_cache_clean_unused does not remove it.
- */
-static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
-{
- list_del(&nce->list);
- list_add_tail(&nce->list, &sctx->name_cache_list);
-}
-
/*
* Remove some entries from the beginning of name_cache_list.
*/
@@ -2147,7 +2137,14 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
kfree(nce);
nce = NULL;
} else {
- name_cache_used(sctx, nce);
+
+ /*
+ * Removes the entry from the list and adds it back to the end.
+ * This marks the entry as recently used so that
+ * name_cache_clean_unused does not remove it.
+ */
+ list_move_tail(&nce->list, &sctx->name_cache_list);
+
*parent_ino = nce->parent_ino;
*parent_gen = nce->parent_gen;
ret = fs_path_add(dest, nce->name, nce->name_len);
--
2.31.1
next reply other threads:[~2021-06-11 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 6:51 Baokun Li [this message]
2021-06-11 12:37 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210611065115.1165906-1-libaokun1@huawei.com \
--to=libaokun1@huawei.com \
--cc=anand.jain@oracle.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=hulkci@huawei.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=weiyongjun1@huawei.com \
--cc=yangjihong1@huawei.com \
--cc=yuehaibing@huawei.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®