All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Jens Axboe <axboe@kernel.dk>
Cc: "hch@infradead.org" <hch@infradead.org>,
	linux-block <linux-block@vger.kernel.org>,
	Keith Busch <kbusch@kernel.org>,
	"linux-scsi @ vger . kernel . org" <linux-scsi@vger.kernel.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"linux-fsdevel @ vger . kernel . org"
	<linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v5 04/10] block: Modify revalidate zones
Date: Fri, 10 Apr 2020 00:27:57 +0000	[thread overview]
Message-ID: <BY5PR04MB690032EB738B8C7DB3D95D40E7DE0@BY5PR04MB6900.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200409165352.2126-5-johannes.thumshirn@wdc.com

On 2020/04/10 1:54, Johannes Thumshirn wrote:
> From: Damien Le Moal <damien.lemoal@wdc.com>
> 
> Modify the interface of blk_revalidate_disk_zones() to add an optional
> revalidation callback function that a driver can use to extend checks and
> processing done during zone revalidation. The callback, if defined, is
> executed time after all zones are inspected and with the queue frozen.
> blk_revalidate_disk_zones() is renamed as __blk_revalidate_disk_zones()
> and blk_revalidate_disk_zones() implemented as an inline function calling
> __blk_revalidate_disk_zones() without no revalidation callback specified,
> resulting in an unchanged behavior for all callers of
> blk_revalidate_disk_zones().
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  block/blk-zoned.c      | 19 ++++++++++++++-----
>  include/linux/blkdev.h | 10 +++++++++-
>  2 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 00b025b8b7c0..6c37fec6859b 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -437,20 +437,27 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
>  }
>  
>  /**
> - * blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps
> - * @disk:	Target disk
> + * __blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps
> + * @disk:		Target disk
> + * @revalidate_cb:	LLD callback
> + * @revalidate_data:	LLD callback argument
>   *
>   * Helper function for low-level device drivers to (re) allocate and initialize
>   * a disk request queue zone bitmaps. This functions should normally be called
>   * within the disk ->revalidate method for blk-mq based drivers.  For BIO based
>   * drivers only q->nr_zones needs to be updated so that the sysfs exposed value
>   * is correct.
> + * If the @revalidate_cb callback function is not NULL, the callback will be
> + * executed with the device request queue frozen after all zones have been
> + * checked.
>   */
> -int blk_revalidate_disk_zones(struct gendisk *disk)
> +int __blk_revalidate_disk_zones(struct gendisk *disk,
> +				revalidate_zones_cb revalidate_cb,
> +				void *revalidate_data)
>  {
>  	struct request_queue *q = disk->queue;
>  	struct blk_revalidate_zone_args args = {
> -		.disk		= disk,
> +		.disk			= disk,

Ooops... whitespace change here.


>  	};
>  	unsigned int noio_flag;
>  	int ret;
> @@ -480,6 +487,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
>  		q->nr_zones = args.nr_zones;
>  		swap(q->seq_zones_wlock, args.seq_zones_wlock);
>  		swap(q->conv_zones_bitmap, args.conv_zones_bitmap);
> +		if (revalidate_cb)
> +			revalidate_cb(disk, revalidate_data);
>  		ret = 0;
>  	} else {
>  		pr_warn("%s: failed to revalidate zones\n", disk->disk_name);
> @@ -491,4 +500,4 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
>  	kfree(args.conv_zones_bitmap);
>  	return ret;
>  }
> -EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
> +EXPORT_SYMBOL_GPL(__blk_revalidate_disk_zones);
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index e591b22ace03..a730cacda0f7 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -353,6 +353,8 @@ struct queue_limits {
>  typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
>  			       void *data);
>  
> +typedef void (*revalidate_zones_cb)(struct gendisk *disk, void *data);
> +
>  #ifdef CONFIG_BLK_DEV_ZONED
>  
>  #define BLK_ALL_ZONES  ((unsigned int)-1)
> @@ -362,7 +364,13 @@ unsigned int blkdev_nr_zones(struct gendisk *disk);
>  extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
>  			    sector_t sectors, sector_t nr_sectors,
>  			    gfp_t gfp_mask);
> -extern int blk_revalidate_disk_zones(struct gendisk *disk);
> +int __blk_revalidate_disk_zones(struct gendisk *disk,
> +				revalidate_zones_cb revalidate_cb,
> +				void *revalidate_data);
> +static inline int blk_revalidate_disk_zones(struct gendisk *disk)
> +{
> +	return __blk_revalidate_disk_zones(disk, NULL, NULL);
> +}
>  
>  extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
>  				     unsigned int cmd, unsigned long arg);
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2020-04-10  0:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 16:53 [PATCH v5 00/10] Introduce Zone Append for writing to zoned block devices Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 01/10] block: provide fallbacks for blk_queue_zone_is_seq and blk_queue_zone_no Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 02/10] block: Introduce REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-04-10  7:10   ` Christoph Hellwig
2020-04-14  9:43     ` Johannes Thumshirn
2020-04-14 11:28       ` hch
2020-04-09 16:53 ` [PATCH v5 03/10] block: introduce blk_req_zone_write_trylock Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 04/10] block: Modify revalidate zones Johannes Thumshirn
2020-04-10  0:27   ` Damien Le Moal [this message]
2020-04-10  6:40   ` Christoph Hellwig
2020-04-10  6:55     ` Damien Le Moal
2020-04-09 16:53 ` [PATCH v5 05/10] scsi: sd_zbc: factor out sanity checks for zoned commands Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 06/10] scsi: export scsi_mq_free_sgtables Johannes Thumshirn
2020-04-10  5:58   ` Christoph Hellwig
2020-04-10  7:46     ` Johannes Thumshirn
2020-04-10 14:22   ` Bart Van Assche
2020-04-09 16:53 ` [PATCH v5 07/10] scsi: sd_zbc: emulate ZONE_APPEND commands Johannes Thumshirn
2020-04-10  0:30   ` Damien Le Moal
2020-04-10  6:18   ` Christoph Hellwig
2020-04-10  6:38     ` Christoph Hellwig
2020-04-10  8:01       ` Johannes Thumshirn
2020-04-14 11:09       ` Johannes Thumshirn
2020-04-14 11:30         ` hch
2020-04-10  7:54     ` Johannes Thumshirn
2020-04-10  7:23   ` Christoph Hellwig
2020-04-14 10:18     ` Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 08/10] null_blk: Support REQ_OP_ZONE_APPEND Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 09/10] block: export bio_release_pages and bio_iov_iter_get_pages Johannes Thumshirn
2020-04-09 16:53 ` [PATCH v5 10/10] zonefs: use REQ_OP_ZONE_APPEND for sync DIO Johannes Thumshirn

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=BY5PR04MB690032EB738B8C7DB3D95D40E7DE0@BY5PR04MB6900.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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.