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

From: Sarthak Kukreti
Date: Sat May 06 2023 - 02:32:47 EST


On Mon, May 1, 2023 at 12:15 PM Mike Snitzer <snitzer@xxxxxxxxxx> wrote:
>
> 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?
>
I recalled seeing a BUG in dm-prison-v1 if I allowed
cell_defer_no_holder() for REQ_OP_PROVISION, but from additional
testing, it looks like it was left behind from a cleanup in v4.
Dropped in v6.

Thanks
Sarthak

> Thanks,
> Mike