diff mbox series

cifs: use list_move instead of list_del + list_add

Message ID 20220924043259.819006-1-sunke32@huawei.com (mailing list archive)
State New, archived
Headers show
Series cifs: use list_move instead of list_del + list_add | expand

Commit Message

Sun Ke Sept. 24, 2022, 4:32 a.m. UTC
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 mbox series

Patch

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);