Skip to content

Commit

Permalink
dm writecache: use list_move instead of list_del/list_add in writecac…
Browse files Browse the repository at this point in the history
…he_writeback()

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Baokun Li authored and Mike Snitzer committed Jun 14, 2021
1 parent 991bd8d commit 8c77f1c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/md/dm-writecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,15 +1864,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;
Expand Down Expand Up @@ -1907,8 +1905,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;
Expand Down

0 comments on commit 8c77f1c

Please sign in to comment.