Skip to contentSkip to conversation

cifs: use list_move instead of list_del + list_add

PATCH New Sun Ke 1 participant 1 message Sep 24, 2022

Subsystems (3)
lore
Share & tools
lore

Sun Ke

author
#0 lore raw

PATCH 1/1 cifs: use list_move instead of list_del + list_add

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

---
 fs/cifs/cached_dir.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/cifs/cached_dir.c +2 -4
index b58bed63db1e..68f86f052dba 100644
@@ -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);
 
Signature · 1 line
2.31.1