Re: [PATCH RFC 1/8] block: Introduce provisioning primitives
From: Mike Snitzer
Date: Fri Sep 23 2022 - 11:16:09 EST
On Thu, Sep 15 2022 at 12:48P -0400,
Sarthak Kukreti <sarthakkukreti@xxxxxxxxxxxx> wrote:
> From: Sarthak Kukreti <sarthakkukreti@xxxxxxxxxxxx>
>
> Introduce block request REQ_OP_PROVISION. The intent of this request
> is to request underlying storage to preallocate disk space for the given
> block range. Block device that support this capability will export
> a provision limit within their request queues.
>
> Signed-off-by: Sarthak Kukreti <sarthakkukreti@xxxxxxxxxxxx>
> ---
> block/blk-core.c | 5 ++++
> block/blk-lib.c | 55 +++++++++++++++++++++++++++++++++++++++
> block/blk-merge.c | 17 ++++++++++++
> block/blk-settings.c | 19 ++++++++++++++
> block/blk-sysfs.c | 8 ++++++
> block/bounce.c | 1 +
> include/linux/bio.h | 6 +++--
> include/linux/blk_types.h | 5 +++-
> include/linux/blkdev.h | 16 ++++++++++++
> 9 files changed, 129 insertions(+), 3 deletions(-)
>
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8bb9eef5310e..be79ad68b330 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -57,6 +57,7 @@ void blk_set_default_limits(struct queue_limits *lim)
> lim->misaligned = 0;
> lim->zoned = BLK_ZONED_NONE;
> lim->zone_write_granularity = 0;
> + lim->max_provision_sectors = 0;
> }
> EXPORT_SYMBOL(blk_set_default_limits);
>
> @@ -81,6 +82,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
> lim->max_dev_sectors = UINT_MAX;
> lim->max_write_zeroes_sectors = UINT_MAX;
> lim->max_zone_append_sectors = UINT_MAX;
> + lim->max_provision_sectors = UINT_MAX;
> }
> EXPORT_SYMBOL(blk_set_stacking_limits);
>
Please work through the blk_stack_limits() implementation too (simple
min_not_zero?).