All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Sarthak Kukreti <sarthakkukreti@chromium.org>,
	Joe Thornber <thornber@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	sarthakkukreti@google.com, "Darrick J. Wong" <djwong@kernel.org>,
	Jason Wang <jasowang@redhat.com>,
	Bart Van Assche <bvanassche@google.com>,
	linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	dm-devel@redhat.com, Andreas Dilger <adilger.kernel@dilger.ca>,
	Daniil Lunev <dlunev@google.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Brian Foster <bfoster@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: Re: [dm-devel] [PATCH v3 2/3] dm: Add support for block provisioning
Date: Fri, 14 Apr 2023 14:14:48 -0400	[thread overview]
Message-ID: <ZDmYGO7zPqu5y0HW@redhat.com> (raw)
In-Reply-To: <CAJ0trDbyqoKEDN4kzcdn+vWhx+hk6pTM4ndf-E02f3uT9YZ3Uw@mail.gmail.com>

On Fri, Apr 14 2023 at  9:32P -0400,
Joe Thornber <thornber@redhat.com> wrote:

> On Fri, Apr 14, 2023 at 7:52 AM Sarthak Kukreti <sarthakkukreti@chromium.org>
> wrote:
> 
> > Add support to dm devices for REQ_OP_PROVISION. The default mode
> > is to passthrough the request to the underlying device, if it
> > supports it. 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.
> >
> 
> I see two issue with this patch:
> 
> i) You use get_bio_block_range() to see which blocks the provision bio
> covers.  But this function only returns
> complete blocks that are covered (it was designed for discard).  Unlike
> discard, provision is not a hint so those
> partial blocks will need to be provisioned too.
> 
> ii) You are setting off multiple dm_thin_new_mapping operations in flight
> at once.  Each of these receives
> the same virt_cell and frees it  when it completes.  So I think we have
> multiple frees occuring?  In addition you also
> release the cell yourself in process_provision_cell().  Fixing this is not
> trivial, you'll need to reference count the cells,
> and aggregate the mapping operation results.
> 
> I think it would be far easier to restrict the size of the provision bio to
> be no bigger than one thinp block (as we do for normal io).  This way dm
> core can split the bios, chain the child bios rather than having to
> reference count mapping ops, and aggregate the results.

I happened to be looking at implementing WRITE_ZEROES support for DM
thinp yesterday and reached the same conclussion relative to it (both
of Joe's points above, for me "ii)" was: the dm-bio-prison-v1 range
locking we do for discards needs work for other types of IO).

We can work to make REQ_OP_PROVISION spanning multiple thinp blocks
possible as follow-on optimization; but in the near-term DM thinp
needs REQ_OP_PROVISION to be split on a thinp block boundary.

This splitting can be assisted by block core in terms of a new
'provision_granularity' (which for thinp, it'd be set to the thinp
blocksize).  But I don't know that we need to go that far (I'm
thinking its fine to have DM do the splitting it needs and only
elevate related code to block core if/when needed in the future).

DM core can take on conditionally imposing its max_io_len() to handle
splitting REQ_OP_PROVISION as needed on a per-target basis. This DM
core commit I've staged for 6.4 makes this quite a simple change:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-6.4&id=13f6facf3faeed34ca381aef4c9b153c7aed3972

So please rebase on linux-dm.git's dm-6.4 branch, and for
REQ_OP_PROVISION dm.c:__process_abnormal_io() you'd add this:

	case REQ_OP_PROVISION:
                num_bios = ti->num_provision_bios;
                if (ti->max_provision_granularity)
                        max_granularity = limits->max_provision_sectors;
                break;

I'll reply again later today (to patch 2's actual code changes),
because I caught at least one other thing worth mentioning.

Thanks,
Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@kernel.org>
To: Sarthak Kukreti <sarthakkukreti@chromium.org>,
	Joe Thornber <thornber@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@infradead.org>,
	Theodore Ts'o <tytso@mit.edu>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	sarthakkukreti@google.com, "Darrick J. Wong" <djwong@kernel.org>,
	Jason Wang <jasowang@redhat.com>,
	Bart Van Assche <bvanassche@google.com>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	dm-devel@redhat.com, Andreas Dilger <adilger.kernel@dilger.ca>,
	Daniil Lunev <dlunev@google.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Brian Foster <bfoster@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: Re: [PATCH v3 2/3] dm: Add support for block provisioning
Date: Fri, 14 Apr 2023 14:14:48 -0400	[thread overview]
Message-ID: <ZDmYGO7zPqu5y0HW@redhat.com> (raw)
In-Reply-To: <CAJ0trDbyqoKEDN4kzcdn+vWhx+hk6pTM4ndf-E02f3uT9YZ3Uw@mail.gmail.com>

On Fri, Apr 14 2023 at  9:32P -0400,
Joe Thornber <thornber@redhat.com> wrote:

> On Fri, Apr 14, 2023 at 7:52 AM Sarthak Kukreti <sarthakkukreti@chromium.org>
> wrote:
> 
> > Add support to dm devices for REQ_OP_PROVISION. The default mode
> > is to passthrough the request to the underlying device, if it
> > supports it. 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.
> >
> 
> I see two issue with this patch:
> 
> i) You use get_bio_block_range() to see which blocks the provision bio
> covers.  But this function only returns
> complete blocks that are covered (it was designed for discard).  Unlike
> discard, provision is not a hint so those
> partial blocks will need to be provisioned too.
> 
> ii) You are setting off multiple dm_thin_new_mapping operations in flight
> at once.  Each of these receives
> the same virt_cell and frees it  when it completes.  So I think we have
> multiple frees occuring?  In addition you also
> release the cell yourself in process_provision_cell().  Fixing this is not
> trivial, you'll need to reference count the cells,
> and aggregate the mapping operation results.
> 
> I think it would be far easier to restrict the size of the provision bio to
> be no bigger than one thinp block (as we do for normal io).  This way dm
> core can split the bios, chain the child bios rather than having to
> reference count mapping ops, and aggregate the results.

I happened to be looking at implementing WRITE_ZEROES support for DM
thinp yesterday and reached the same conclussion relative to it (both
of Joe's points above, for me "ii)" was: the dm-bio-prison-v1 range
locking we do for discards needs work for other types of IO).

We can work to make REQ_OP_PROVISION spanning multiple thinp blocks
possible as follow-on optimization; but in the near-term DM thinp
needs REQ_OP_PROVISION to be split on a thinp block boundary.

This splitting can be assisted by block core in terms of a new
'provision_granularity' (which for thinp, it'd be set to the thinp
blocksize).  But I don't know that we need to go that far (I'm
thinking its fine to have DM do the splitting it needs and only
elevate related code to block core if/when needed in the future).

DM core can take on conditionally imposing its max_io_len() to handle
splitting REQ_OP_PROVISION as needed on a per-target basis. This DM
core commit I've staged for 6.4 makes this quite a simple change:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-6.4&id=13f6facf3faeed34ca381aef4c9b153c7aed3972

So please rebase on linux-dm.git's dm-6.4 branch, and for
REQ_OP_PROVISION dm.c:__process_abnormal_io() you'd add this:

	case REQ_OP_PROVISION:
                num_bios = ti->num_provision_bios;
                if (ti->max_provision_granularity)
                        max_granularity = limits->max_provision_sectors;
                break;

I'll reply again later today (to patch 2's actual code changes),
because I caught at least one other thing worth mentioning.

Thanks,
Mike

  reply	other threads:[~2023-04-14 18:15 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221229071647.437095-1-sarthakkukreti@chromium.org>
2023-04-14  0:02 ` [dm-devel] [PATCH v3 0/3] Introduce provisioning primitives for thinly provisioned storage Sarthak Kukreti
2023-04-14  0:02   ` Sarthak Kukreti
2023-04-14  0:02   ` [dm-devel] [PATCH v3 1/3] block: Introduce provisioning primitives Sarthak Kukreti
2023-04-14  0:02     ` Sarthak Kukreti
2023-04-17 17:35     ` [dm-devel] " Brian Foster
2023-04-17 17:35       ` Brian Foster
2023-04-18 22:13       ` [dm-devel] " Sarthak Kukreti
2023-04-18 22:13         ` Sarthak Kukreti
2023-04-14  0:02   ` [dm-devel] [PATCH v3 2/3] dm: Add support for block provisioning Sarthak Kukreti
2023-04-14  0:02     ` Sarthak Kukreti
2023-04-14 13:32     ` [dm-devel] " Joe Thornber
2023-04-14 18:14       ` Mike Snitzer [this message]
2023-04-14 18:14         ` Mike Snitzer
2023-04-14 21:58     ` [dm-devel] " Mike Snitzer
2023-04-14 21:58       ` Mike Snitzer
2023-04-18 22:13       ` [dm-devel] " Sarthak Kukreti
2023-04-18 22:13         ` Sarthak Kukreti
2023-04-14  0:02   ` [dm-devel] [PATCH v3 3/3] loop: Add support for provision requests Sarthak Kukreti
2023-04-14  0:02     ` Sarthak Kukreti
2023-04-18 22:12   ` [dm-devel] [PATCH v4 0/4] Introduce provisioning primitives for thinly provisioned storage Sarthak Kukreti
2023-04-18 22:12     ` Sarthak Kukreti
2023-04-18 22:12     ` [dm-devel] [PATCH v4 1/4] block: Introduce provisioning primitives Sarthak Kukreti
2023-04-18 22:12       ` Sarthak Kukreti
2023-04-18 22:43       ` [dm-devel] " Bart Van Assche
2023-04-18 22:43         ` Bart Van Assche
2023-04-20 17:41         ` [dm-devel] " Sarthak Kukreti
2023-04-20 17:41           ` Sarthak Kukreti
2023-04-19 15:36       ` [dm-devel] " Darrick J. Wong
2023-04-19 15:36         ` Darrick J. Wong
2023-04-19 16:17         ` Mike Snitzer
2023-04-19 16:17           ` Mike Snitzer
2023-04-19 17:26           ` [dm-devel] " Darrick J. Wong
2023-04-19 17:26             ` Darrick J. Wong
2023-04-19 23:21             ` [dm-devel] " Dave Chinner
2023-04-19 23:21               ` Dave Chinner
2023-04-20  0:53               ` [dm-devel] " Sarthak Kukreti
2023-04-20  0:53                 ` Sarthak Kukreti
2023-04-18 22:12     ` [dm-devel] [PATCH v4 2/4] dm: Add block provisioning support Sarthak Kukreti
2023-04-18 22:12       ` Sarthak Kukreti
2023-04-18 22:12     ` [dm-devel] [PATCH v4 3/4] dm-thin: Add REQ_OP_PROVISION support Sarthak Kukreti
2023-04-18 22:12       ` Sarthak Kukreti
2023-04-18 22:12     ` [dm-devel] [PATCH v4 4/4] loop: Add support for provision requests Sarthak Kukreti
2023-04-18 22:12       ` Sarthak Kukreti
2023-04-20  0:48   ` [dm-devel] [PATCH v5 0/5] Introduce block provisioning primitives Sarthak Kukreti
2023-04-20  0:48     ` Sarthak Kukreti
2023-04-20  0:48     ` [dm-devel] [PATCH v5 1/5] block: Don't invalidate pagecache for invalid falloc modes Sarthak Kukreti
2023-04-20  0:48       ` Sarthak Kukreti
2023-04-20  1:22       ` [dm-devel] " Darrick J. Wong
2023-04-20  1:22         ` Darrick J. Wong
2023-04-20  1:48         ` [dm-devel] " Sarthak Kukreti
2023-04-20  1:48           ` Sarthak Kukreti
2023-04-20  1:47       ` [dm-devel] [PATCH v5-fix " Sarthak Kukreti
2023-04-20  1:47         ` Sarthak Kukreti
2023-04-20 16:20         ` [dm-devel] " Mike Snitzer
2023-04-20 16:20           ` Mike Snitzer
2023-04-20 17:28           ` [dm-devel] " Sarthak Kukreti
2023-04-20 17:28             ` Sarthak Kukreti
2023-04-20 18:17             ` [dm-devel] " Sarthak Kukreti
2023-04-20 18:17               ` Sarthak Kukreti
2023-04-20 18:15           ` [dm-devel] " Sarthak Kukreti
2023-04-20 18:15             ` Sarthak Kukreti
2023-04-24 15:54       ` [dm-devel] [PATCH v5 " kernel test robot
2023-04-24 15:54         ` kernel test robot
2023-05-04  8:50       ` [dm-devel] " kernel test robot
2023-05-04  8:50         ` kernel test robot
2023-04-20  0:48     ` [dm-devel] [PATCH v5 2/5] block: Introduce provisioning primitives Sarthak Kukreti
2023-04-20  0:48       ` Sarthak Kukreti
2023-04-20  0:48     ` [dm-devel] [PATCH v5 3/5] dm: Add block provisioning support Sarthak Kukreti
2023-04-20  0:48       ` Sarthak Kukreti
2023-04-20  0:48     ` [dm-devel] [PATCH v5 4/5] dm-thin: Add REQ_OP_PROVISION support Sarthak Kukreti
2023-04-20  0:48       ` Sarthak Kukreti
2023-05-01 19:15       ` [dm-devel] " Mike Snitzer
2023-05-01 19:15         ` Mike Snitzer
2023-05-06  6:32         ` [dm-devel] " Sarthak Kukreti
2023-05-06  6:32           ` Sarthak Kukreti
2023-04-20  0:48     ` [dm-devel] [PATCH v5 5/5] loop: Add support for provision requests Sarthak Kukreti
2023-04-20  0:48       ` Sarthak Kukreti
2023-05-06  6:29     ` [dm-devel] [PATCH v6 0/5] Introduce block provisioning primitives Sarthak Kukreti
2023-05-06  6:29       ` Sarthak Kukreti
2023-05-06  6:29       ` [dm-devel] [PATCH v6 1/5] block: Don't invalidate pagecache for invalid falloc modes Sarthak Kukreti
2023-05-06  6:29         ` Sarthak Kukreti
2023-05-09 16:51         ` [dm-devel] " Mike Snitzer
2023-05-09 16:51           ` Mike Snitzer
2023-05-12 18:31         ` [dm-devel] " Darrick J. Wong
2023-05-12 18:31           ` Darrick J. Wong
2023-05-06  6:29       ` [dm-devel] [PATCH v6 2/5] block: Introduce provisioning primitives Sarthak Kukreti
2023-05-06  6:29         ` Sarthak Kukreti
2023-05-09 16:52         ` [dm-devel] " Mike Snitzer
2023-05-09 16:52           ` Mike Snitzer
2023-05-12 18:37         ` [dm-devel] " Darrick J. Wong
2023-05-12 18:37           ` Darrick J. Wong
2023-05-15 21:55           ` [dm-devel] " Sarthak Kukreti
2023-05-15 21:55             ` Sarthak Kukreti
2023-05-06  6:29       ` [dm-devel] [PATCH v6 3/5] dm: Add block provisioning support Sarthak Kukreti
2023-05-06  6:29         ` Sarthak Kukreti
2023-05-09 16:52         ` [dm-devel] " Mike Snitzer
2023-05-09 16:52           ` Mike Snitzer
2023-05-06  6:29       ` [dm-devel] [PATCH v6 4/5] dm-thin: Add REQ_OP_PROVISION support Sarthak Kukreti
2023-05-06  6:29         ` Sarthak Kukreti
2023-05-09 16:58         ` [dm-devel] " Mike Snitzer
2023-05-09 16:58           ` Mike Snitzer
2023-05-11 20:03           ` [dm-devel] " Sarthak Kukreti
2023-05-11 20:03             ` Sarthak Kukreti
2023-05-12 14:34             ` [dm-devel] " Mike Snitzer
2023-05-12 14:34               ` Mike Snitzer
2023-05-12 17:32         ` [dm-devel] " Mike Snitzer
2023-05-12 17:32           ` Mike Snitzer
2023-05-15 21:19           ` [dm-devel] " Sarthak Kukreti
2023-05-15 21:19             ` Sarthak Kukreti
2023-05-06  6:29       ` [dm-devel] [PATCH v6 5/5] loop: Add support for provision requests Sarthak Kukreti
2023-05-06  6:29         ` Sarthak Kukreti
2023-05-15 12:40         ` [dm-devel] " Brian Foster
2023-05-15 12:40           ` Brian Foster
2023-05-15 21:31           ` [dm-devel] " Sarthak Kukreti
2023-05-15 21:31             ` Sarthak Kukreti
2023-05-12 18:28       ` [dm-devel] [PATCH v6 0/5] Introduce block provisioning primitives Darrick J. Wong
2023-05-12 18:28         ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZDmYGO7zPqu5y0HW@redhat.com \
    --to=snitzer@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bfoster@redhat.com \
    --cc=bvanassche@google.com \
    --cc=djwong@kernel.org \
    --cc=dlunev@google.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=sarthakkukreti@chromium.org \
    --cc=sarthakkukreti@google.com \
    --cc=stefanha@redhat.com \
    --cc=thornber@redhat.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.