Re: [PATCH v2 1/2] block: add blk_alloc_disk and blk_cleanup_disk APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 31, 2022 at 12:00:08PM +0200, Valentin Kleibel wrote:
> Add two new APIs to allocate and free a gendisk including the
> request_queue for use with BIO based drivers.  This is to avoid
> boilerplate code in drivers.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
> Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/20210521055116.1053587-6-hch@xxxxxx
> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
> (cherry picked from commit f525464a8000f092c20b00eead3eaa9d849c599e)
> Fixes: 3582dd291788 (aoe: convert aoeblk to blk-mq)
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215647
> Signed-off-by: Valentin Kleibel <valentin@xxxxxxxx>
> ---
>  block/genhd.c         | 15 +++++++++++++++
>  include/linux/genhd.h |  1 +
>  2 files changed, 16 insertions(+)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 796baf761202..421cad085502 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1836,6 +1836,21 @@ void put_disk_and_module(struct gendisk *disk)
>         }
>  }
>  EXPORT_SYMBOL(put_disk_and_module);
> +/**
> + * blk_cleanup_disk - shutdown a gendisk allocated by blk_alloc_disk
> + * @disk: gendisk to shutdown
> + *
> + * Mark the queue hanging off @disk DYING, drain all pending requests, then
> mark
> + * the queue DEAD, destroy and put it and the gendisk structure.
> + *
> + * Context: can sleep
> + */
> +void blk_cleanup_disk(struct gendisk *disk)
> +{
> +       blk_cleanup_queue(disk->queue);
> +       put_disk(disk);
> +}
> +EXPORT_SYMBOL(blk_cleanup_disk);
> 
>  static void set_disk_ro_uevent(struct gendisk *gd, int ro)
>  {
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 03da3f603d30..b7b180d3734a 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -369,6 +369,7 @@ extern void blk_unregister_region(dev_t devt, unsigned
> long range);
>  #define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
> 
>  int register_blkdev(unsigned int major, const char *name);
> +void blk_cleanup_disk(struct gendisk *disk);
>  void unregister_blkdev(unsigned int major, const char *name);
> 
>  void revalidate_disk_size(struct gendisk *disk, bool verbose);

This backport looks to be incomplete, and is also totally whitespace
damaged and can not be applied at all :(

Please fix both up and resend.

thanks,

greg k-h



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux