[PATCH 1/5] block: export blk_next_bio()

Damien Le Moal Damien.LeMoal at wdc.com
Wed Jun 9 02:32:11 PDT 2021


On 2021/06/08 14:46, Chaitanya Kulkarni wrote:
> The block layer provides emulation of zone management operations
> targeting all zones of a zoned block device only for the zone reset
> operation (REQ_OP_ZONE_RESET). In order to correctly implement
> exporting of zoned block devices with NVMeOF, emulating zone management
> operations targeting all zones of a device is also necessary for the
> open, close and finish zone operations (REQ_OP_ZONE_OPEN,
> REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH).
> 
> Instead of duplicating the code, export the existing helper from block
> layer so we can use a bio chaining pattern that is present in the block
> layer for REQ_OP_ZONE RESET all emulation in the NVMeOF zoned block
> device backend.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> ---
>  block/blk-lib.c     | 1 +
>  include/linux/bio.h | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 7b256131b20b..9f09beadcbe3 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -21,6 +21,7 @@ struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp)
>  
>  	return new;
>  }
> +EXPORT_SYMBOL_GPL(blk_next_bio);
>  
>  int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
>  		sector_t nr_sects, gfp_t gfp_mask, int flags,
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index a0b4cfdf62a4..b2491ead22a0 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -822,4 +822,6 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb)
>  		bio->bi_opf |= REQ_NOWAIT;
>  }
>  
> +struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp);
> +
>  #endif /* __LINUX_BIO_H */
> 

Note: this should be sent to Jens and linux-block too. This needs Jens Ack.

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal at wdc.com>

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list