Re: [PATCH v5 4/5] dm-thin: Add REQ_OP_PROVISION support

From: Mike Snitzer
Date: Mon May 01 2023 - 15:16:46 EST


On Wed, Apr 19 2023 at 8:48P -0400,
Sarthak Kukreti <sarthakkukreti@xxxxxxxxxxxx> wrote:

> dm-thinpool uses the provision request to provision
> blocks for a dm-thin device. dm-thinpool currently does not
> pass through REQ_OP_PROVISION to underlying devices.
>
> For shared blocks, provision requests will break sharing and copy the
> contents of the entire block. Additionally, if 'skip_block_zeroing'
> is not set, dm-thin will opt to zero out the entire range as a part
> of provisioning.
>
> Signed-off-by: Sarthak Kukreti <sarthakkukreti@xxxxxxxxxxxx>
> ---
> drivers/md/dm-thin.c | 73 +++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 68 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index 2b13c949bd72..58d633f5c928 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -1891,7 +1893,8 @@ static void process_shared_bio(struct thin_c *tc, struct bio *bio,
>
> if (bio_data_dir(bio) == WRITE && bio->bi_iter.bi_size) {
> break_sharing(tc, bio, block, &key, lookup_result, data_cell);
> - cell_defer_no_holder(tc, virt_cell);
> + if (bio_op(bio) != REQ_OP_PROVISION)
> + cell_defer_no_holder(tc, virt_cell);

Can you please explain why cell_defer_no_holder() is skipped for REQ_OP_PROVISION here?

Thanks,
Mike