diff mbox series

[1/9] block: export __bio_iov_append_get_pages()

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

Commit Message

Chaitanya Kulkarni Nov. 26, 2020, 2:40 a.m. UTC
In this prep patch we exoprt the __bio_iov_append_get_pages() so that
NVMeOF target can use the core logic of building Zone Append bios for
REQ_OP_ZONE_APPEND without repeating the code.

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

Comments

Damien Le Moal Nov. 26, 2020, 8:09 a.m. UTC | #1
On 2020/11/26 11:42, Chaitanya Kulkarni wrote:
> In this prep patch we exoprt the __bio_iov_append_get_pages() so that
> NVMeOF target can use the core logic of building Zone Append bios for
> REQ_OP_ZONE_APPEND without repeating the code.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  block/bio.c         | 3 ++-
>  include/linux/bio.h | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index fa01bef35bb1..de356fa28315 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1033,7 +1033,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>  	return 0;
>  }
>  
> -static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
> +int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
>  {
>  	unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
>  	unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
> @@ -1079,6 +1079,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
>  	iov_iter_advance(iter, size - left);
>  	return ret;
>  }
> +EXPORT_SYMBOL_GPL(__bio_iov_append_get_pages);

Why not use bio_iov_iter_get_pages() which is already exported ? As long as the
bio op is set to REQ_OP_ZONE_APPEND when bio_iov_iter_get_pages() is called,
__bio_iov_append_get_pages() will be used in that function.

>  
>  /**
>   * bio_iov_iter_get_pages - add user or kernel pages to a bio
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index c6d765382926..47247c1b0b85 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -446,6 +446,7 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
>  		unsigned int len, unsigned int off, bool *same_page);
>  void __bio_add_page(struct bio *bio, struct page *page,
>  		unsigned int len, unsigned int off);
> +int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter);
>  int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
>  void bio_release_pages(struct bio *bio, bool mark_dirty);
>  extern void bio_set_pages_dirty(struct bio *bio);
>
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index fa01bef35bb1..de356fa28315 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1033,7 +1033,7 @@  static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
 	return 0;
 }
 
-static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
+int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
 {
 	unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
 	unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
@@ -1079,6 +1079,7 @@  static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
 	iov_iter_advance(iter, size - left);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(__bio_iov_append_get_pages);
 
 /**
  * bio_iov_iter_get_pages - add user or kernel pages to a bio
diff --git a/include/linux/bio.h b/include/linux/bio.h
index c6d765382926..47247c1b0b85 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -446,6 +446,7 @@  bool __bio_try_merge_page(struct bio *bio, struct page *page,
 		unsigned int len, unsigned int off, bool *same_page);
 void __bio_add_page(struct bio *bio, struct page *page,
 		unsigned int len, unsigned int off);
+int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter);
 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
 void bio_release_pages(struct bio *bio, bool mark_dirty);
 extern void bio_set_pages_dirty(struct bio *bio);