diff mbox series

[V9,1/9] block: export bio_add_hw_pages()

Message ID 20210112042623.6316-2-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series nvmet: add ZBD backend support | expand

Commit Message

Chaitanya Kulkarni Jan. 12, 2021, 4:26 a.m. UTC
To implement the NVMe Zone Append command on the NVMeOF target side for
generic Zoned Block Devices with NVMe Zoned Namespaces interface, we
need to build the bios with hardware limitations, i.e. we use
bio_add_hw_page() with queue_max_zone_append_sectors() instead of
bio_add_page().

Without this API being exported NVMeOF target will require to use
bio_add_hw_page() caller bio_iov_iter_get_pages(). That results in
extra work which is inefficient.

Export the API so that NVMeOF ZBD over ZNS backend can use it to build
Zone Append bios.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/bio.c            | 1 +
 block/blk.h            | 4 ----
 include/linux/blkdev.h | 4 ++++
 3 files changed, 5 insertions(+), 4 deletions(-)

Comments

Damien Le Moal Jan. 12, 2021, 5:40 a.m. UTC | #1
On 2021/01/12 13:26, Chaitanya Kulkarni wrote:
> To implement the NVMe Zone Append command on the NVMeOF target side for
> generic Zoned Block Devices with NVMe Zoned Namespaces interface, we
> need to build the bios with hardware limitations, i.e. we use
> bio_add_hw_page() with queue_max_zone_append_sectors() instead of
> bio_add_page().
> 
> Without this API being exported NVMeOF target will require to use
> bio_add_hw_page() caller bio_iov_iter_get_pages(). That results in
> extra work which is inefficient.
> 
> Export the API so that NVMeOF ZBD over ZNS backend can use it to build
> Zone Append bios.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  block/bio.c            | 1 +
>  block/blk.h            | 4 ----
>  include/linux/blkdev.h | 4 ++++
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index 1f2cc1fbe283..5cbd56b54f98 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -826,6 +826,7 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio,
>  	bio->bi_iter.bi_size += len;
>  	return len;
>  }
> +EXPORT_SYMBOL(bio_add_hw_page);
>  
>  /**
>   * bio_add_pc_page	- attempt to add page to passthrough bio
> diff --git a/block/blk.h b/block/blk.h
> index 7550364c326c..200030b2d74f 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -351,8 +351,4 @@ int bdev_resize_partition(struct block_device *bdev, int partno,
>  		sector_t start, sector_t length);
>  int disk_expand_part_tbl(struct gendisk *disk, int target);
>  
> -int bio_add_hw_page(struct request_queue *q, struct bio *bio,
> -		struct page *page, unsigned int len, unsigned int offset,
> -		unsigned int max_sectors, bool *same_page);
> -
>  #endif /* BLK_INTERNAL_H */
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 070de09425ad..028ccc9bdf8d 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -2005,6 +2005,10 @@ struct block_device *I_BDEV(struct inode *inode);
>  struct block_device *bdgrab(struct block_device *bdev);
>  void bdput(struct block_device *);
>  
> +int bio_add_hw_page(struct request_queue *q, struct bio *bio,
> +		struct page *page, unsigned int len, unsigned int offset,
> +		unsigned int max_sectors, bool *same_page);
> +
>  #ifdef CONFIG_BLOCK
>  void invalidate_bdev(struct block_device *bdev);
>  int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Christoph Hellwig Jan. 12, 2021, 7:24 a.m. UTC | #2
EXPORT_SYMBOL_GPL, please.
Chaitanya Kulkarni Jan. 13, 2021, 1:20 a.m. UTC | #3
On 1/11/21 23:24, Christoph Hellwig wrote:
> EXPORT_SYMBOL_GPL, please.
>
Okay.
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 1f2cc1fbe283..5cbd56b54f98 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -826,6 +826,7 @@  int bio_add_hw_page(struct request_queue *q, struct bio *bio,
 	bio->bi_iter.bi_size += len;
 	return len;
 }
+EXPORT_SYMBOL(bio_add_hw_page);
 
 /**
  * bio_add_pc_page	- attempt to add page to passthrough bio
diff --git a/block/blk.h b/block/blk.h
index 7550364c326c..200030b2d74f 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -351,8 +351,4 @@  int bdev_resize_partition(struct block_device *bdev, int partno,
 		sector_t start, sector_t length);
 int disk_expand_part_tbl(struct gendisk *disk, int target);
 
-int bio_add_hw_page(struct request_queue *q, struct bio *bio,
-		struct page *page, unsigned int len, unsigned int offset,
-		unsigned int max_sectors, bool *same_page);
-
 #endif /* BLK_INTERNAL_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 070de09425ad..028ccc9bdf8d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -2005,6 +2005,10 @@  struct block_device *I_BDEV(struct inode *inode);
 struct block_device *bdgrab(struct block_device *bdev);
 void bdput(struct block_device *);
 
+int bio_add_hw_page(struct request_queue *q, struct bio *bio,
+		struct page *page, unsigned int len, unsigned int offset,
+		unsigned int max_sectors, bool *same_page);
+
 #ifdef CONFIG_BLOCK
 void invalidate_bdev(struct block_device *bdev);
 int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,