Use dm_bufio_forget_buffers instead of block-by-block loop and 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@xxxxxxxxxx> --- drivers/md/dm-ebs-target.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/md/dm-ebs-target.c =================================================================== --- linux-2.6.orig/drivers/md/dm-ebs-target.c 2020-06-02 13:27:14.000000000 +0200 +++ linux-2.6/drivers/md/dm-ebs-target.c 2020-06-02 15:11:18.000000000 +0200 @@ -167,8 +167,8 @@ static void __ebs_forget_bio(struct ebs_ 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. */ -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel