Re: [dm-devel] [PATCH v4 02/11] block: introduce bio zone helpers

2021-05-26 Thread Himanshu Madhani




On 5/24/21 9:25 PM, Damien Le Moal wrote:

Introduce the helper functions bio_zone_no() and bio_zone_is_seq().
Both are the BIO counterparts of the request helpers blk_rq_zone_no()
and blk_rq_zone_is_seq(), respectively returning the number of the
target zone of a bio and true if the BIO target zone is sequential.

Signed-off-by: Damien Le Moal 
Reviewed-by: Hannes Reinecke 
Reviewed-by: Chaitanya Kulkarni 
---
  include/linux/blkdev.h | 12 
  1 file changed, 12 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f69c75bd6d27..2db0f376f5d9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1008,6 +1008,18 @@ static inline unsigned int blk_rq_stats_sectors(const 
struct request *rq)
  /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
  const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
  
+static inline unsigned int bio_zone_no(struct bio *bio)

+{
+   return blk_queue_zone_no(bdev_get_queue(bio->bi_bdev),
+bio->bi_iter.bi_sector);
+}
+
+static inline unsigned int bio_zone_is_seq(struct bio *bio)
+{
+   return blk_queue_zone_is_seq(bdev_get_queue(bio->bi_bdev),
+bio->bi_iter.bi_sector);
+}
+
  static inline unsigned int blk_rq_zone_no(struct request *rq)
  {
return blk_queue_zone_no(rq->q, blk_rq_pos(rq));



Reviewed-by: Himanshu Madhani 

--
Himanshu MadhaniOracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel



Re: [dm-devel] [PATCH v4 02/11] block: introduce bio zone helpers

2021-05-25 Thread Christoph Hellwig
On Tue, May 25, 2021 at 11:25:30AM +0900, Damien Le Moal wrote:
> Introduce the helper functions bio_zone_no() and bio_zone_is_seq().
> Both are the BIO counterparts of the request helpers blk_rq_zone_no()
> and blk_rq_zone_is_seq(), respectively returning the number of the
> target zone of a bio and true if the BIO target zone is sequential.

Looks good,

Reviewed-by: Christoph Hellwig 

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel



[dm-devel] [PATCH v4 02/11] block: introduce bio zone helpers

2021-05-24 Thread Damien Le Moal
Introduce the helper functions bio_zone_no() and bio_zone_is_seq().
Both are the BIO counterparts of the request helpers blk_rq_zone_no()
and blk_rq_zone_is_seq(), respectively returning the number of the
target zone of a bio and true if the BIO target zone is sequential.

Signed-off-by: Damien Le Moal 
Reviewed-by: Hannes Reinecke 
Reviewed-by: Chaitanya Kulkarni 
---
 include/linux/blkdev.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f69c75bd6d27..2db0f376f5d9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1008,6 +1008,18 @@ static inline unsigned int blk_rq_stats_sectors(const 
struct request *rq)
 /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
 const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
 
+static inline unsigned int bio_zone_no(struct bio *bio)
+{
+   return blk_queue_zone_no(bdev_get_queue(bio->bi_bdev),
+bio->bi_iter.bi_sector);
+}
+
+static inline unsigned int bio_zone_is_seq(struct bio *bio)
+{
+   return blk_queue_zone_is_seq(bdev_get_queue(bio->bi_bdev),
+bio->bi_iter.bi_sector);
+}
+
 static inline unsigned int blk_rq_zone_no(struct request *rq)
 {
return blk_queue_zone_no(rq->q, blk_rq_pos(rq));
-- 
2.31.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel