linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: <sfrench@samba.org>
Cc: <linux-cifs@vger.kernel.org>, <samba-technical@lists.samba.org>,
	<kernel-janitors@vger.kernel.org>, <lsahlber@redhat.com>,
	<sunke32@huawei.com>
Subject: [PATCH] cifs: use list_move instead of list_del + list_add
Date: Sat, 24 Sep 2022 12:32:59 +0800	[thread overview]
Message-ID: <20220924043259.819006-1-sunke32@huawei.com> (raw)

Using list_move() instead of list_del() + list_add().

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 fs/cifs/cached_dir.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cached_dir.c b/fs/cifs/cached_dir.c
index b58bed63db1e..68f86f052dba 100644
--- a/fs/cifs/cached_dir.c
+++ b/fs/cifs/cached_dir.c
@@ -389,8 +389,7 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon)
 	INIT_LIST_HEAD(&entry);
 	spin_lock(&cfids->cfid_list_lock);
 	list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
-		list_del(&cfid->entry);
-		list_add(&cfid->entry, &entry);
+		list_move(&cfid->entry, &entry);
 		cfids->num_entries--;
 		cfid->is_open = false;
 		/* To prevent race with smb2_cached_lease_break() */
@@ -531,8 +530,7 @@ void free_cached_dirs(struct cached_fids *cfids)
 	list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
 		cfid->on_list = false;
 		cfid->is_open = false;
-		list_del(&cfid->entry);
-		list_add(&cfid->entry, &entry);
+		list_move(&cfid->entry, &entry);
 	}
 	spin_unlock(&cfids->cfid_list_lock);
 
-- 
2.31.1


                 reply	other threads:[~2022-09-24  4:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220924043259.819006-1-sunke32@huawei.com \
    --to=sunke32@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    /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;
as well as URLs for NNTP newsgroup(s).