]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm ebs: use dm_bufio_forget_buffers
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 2 Jun 2020 13:34:41 +0000 (15:34 +0200)
committerMike Snitzer <snitzer@redhat.com>
Fri, 5 Jun 2020 18:59:42 +0000 (14:59 -0400)
Use dm_bufio_forget_buffers instead of a block-by-block loop that
calls dm_bufio_forget. dm_bufio_forget_buffers is faster than the loop
because it searches for used buffers using rb-tree.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ebs-target.c

index ae3f5fad3b39bfa618f15bdfe3c281dea5579f04..44451276f1281b791186fae9d5b83a8e7a46ea77 100644 (file)
@@ -167,8 +167,8 @@ static void __ebs_forget_bio(struct ebs_c *ec, struct bio *bio)
        sector_t blocks, sector = bio->bi_iter.bi_sector;
 
        blocks = __nr_blocks(ec, bio);
-       for (; blocks--; sector += ec->u_bs)
-               dm_bufio_forget(ec->bufio, __sector_to_block(ec, sector));
+
+       dm_bufio_forget_buffers(ec->bufio, __sector_to_block(ec, sector), blocks);
 }
 
 /* Worker funtion to process incoming bios. */