[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGeUYESOQsZkOQ1Q@redhat.com>
Date: Fri, 19 May 2023 11:23:12 -0400
From: Mike Snitzer <snitzer@...nel.org>
To: Sarthak Kukreti <sarthakkukreti@...omium.org>,
Joe Thornber <ejt@...hat.com>
Cc: dm-devel@...hat.com, linux-block@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Theodore Ts'o <tytso@....edu>,
"Michael S. Tsirkin" <mst@...hat.com>,
"Darrick J. Wong" <djwong@...nel.org>,
Jason Wang <jasowang@...hat.com>,
Bart Van Assche <bvanassche@...gle.com>,
Christoph Hellwig <hch@...radead.org>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Stefan Hajnoczi <stefanha@...hat.com>,
Brian Foster <bfoster@...hat.com>,
Alasdair Kergon <agk@...hat.com>
Subject: Re: [PATCH v7 4/5] dm-thin: Add REQ_OP_PROVISION support
On Thu, May 18 2023 at 6:33P -0400,
Sarthak Kukreti <sarthakkukreti@...omium.org> 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@...omium.org>
> ---
> drivers/md/dm-thin.c | 74 +++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 70 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index 2b13c949bd72..f1b68b558cf0 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -1245,8 +1247,8 @@ static int io_overlaps_block(struct pool *pool, struct bio *bio)
>
> static int io_overwrites_block(struct pool *pool, struct bio *bio)
> {
> - return (bio_data_dir(bio) == WRITE) &&
> - io_overlaps_block(pool, bio);
> + return (bio_data_dir(bio) == WRITE) && io_overlaps_block(pool, bio) &&
> + bio_op(bio) != REQ_OP_PROVISION;
> }
>
> static void save_and_set_endio(struct bio *bio, bio_end_io_t **save,
> @@ -1394,6 +1396,9 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block,
> m->data_block = data_block;
> m->cell = cell;
>
> + if (bio && bio_op(bio) == REQ_OP_PROVISION)
> + m->bio = bio;
> +
> /*
> * If the whole block of data is being overwritten or we are not
> * zeroing pre-existing data, we can issue the bio immediately.
This doesn't seem like the best way to address avoiding passdown of
provision bios (relying on process_prepared_mapping's implementation
that happens to do the right thing if m->bio set). Doing so cascades
into relying on complete_overwrite_bio() happening to _not_ actually
being specific to "overwrite" bios.
I don't have a better suggestion yet but will look closer. Just think
this needs to be formalized a bit more rather than it happening to
"just work".
Cc'ing Joe to see what he thinks too. This is something we can clean
up with a follow-on patch though, so not a show-stopper for this
series.
Mike
Powered by blists - more mailing lists