Skip to contentSkip to conversation

dm writecache: use list_move instead of list_del/list_add in dm-writecache.c

PATCH Superseded Baokun Li 1 participant 1 message Jun 9, 2021 1 message not in the archive Device mapper

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Baokun Li

author
#1 lore raw

PATCH 1/1 dm writecache: use list_move instead of list_del/list_add in dm-writecache.c

Using list_move() instead of list_del() + list_add() in dm-writecache.c.

---
 drivers/md/dm-writecache.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/md/dm-writecache.c +3 -6
index ea9f0d8fff1d..a809a616d691 100644
@@ -1868,15 +1868,13 @@ static void writecache_writeback(struct work_struct *work)
 			if (unlikely(read_original_sector(wc, f) ==
 				     read_original_sector(wc, e))) {
 				BUG_ON(!f->write_in_progress);
-				list_del(&e->lru);
-				list_add(&e->lru, &skipped);
+				list_move(&e->lru, &skipped);
 				cond_resched();
 				continue;
 			}
 		}
 		wc->writeback_size++;
-		list_del(&e->lru);
-		list_add(&e->lru, &wbl.list);
+		list_move(&e->lru, &wbl.list);
 		wbl.size++;
 		e->write_in_progress = true;
 		e->wc_list_contiguous = 1;
@@ -1911,8 +1909,7 @@ static void writecache_writeback(struct work_struct *work)
 			//	break;
 
 			wc->writeback_size++;
-			list_del(&g->lru);
-			list_add(&g->lru, &wbl.list);
+			list_move(&g->lru, &wbl.list);
 			wbl.size++;
 			g->write_in_progress = true;
 			g->wc_list_contiguous = BIO_MAX_VECS;

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel