dm writecache: use list_move instead of list_del/list_add in writecache_writeback()
authorBaokun Li <libaokun1@huawei.com>
Wed, 9 Jun 2021 07:04:33 +0000 (15:04 +0800)
committerMike Snitzer <snitzer@redhat.com>
Mon, 14 Jun 2021 15:49:04 +0000 (11:49 -0400)
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-writecache.c

index e18bbfd..56179a2 100644 (file)
@@ -1864,15 +1864,13 @@ restart:
                        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;
@@ -1907,8 +1905,7 @@ restart:
                        //      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;