diff mbox series

[4/5] block: move bio_allowed_max_sectors to blk-merge.c

Message ID 20220720142456.1414262-5-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/5] block: move ->bio_split to the gendisk | expand

Commit Message

Christoph Hellwig July 20, 2022, 2:24 p.m. UTC
Move this helper into the only file where it is used.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-merge.c | 10 ++++++++++
 block/blk.h       | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Johannes Thumshirn July 21, 2022, 6:31 a.m. UTC | #1
On 20.07.22 16:25, Christoph Hellwig wrote:
> +/*
> + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
> + * is defined as 'unsigned int', meantime it has to aligned to with logical
> + * block size which is the minimum accepted unit by hardware.
> + */

Not your call, as your only moving the comment but 'to be aligned to'
Christoph Hellwig July 21, 2022, 6:42 a.m. UTC | #2
On Thu, Jul 21, 2022 at 06:31:24AM +0000, Johannes Thumshirn wrote:
> On 20.07.22 16:25, Christoph Hellwig wrote:
> > +/*
> > + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
> > + * is defined as 'unsigned int', meantime it has to aligned to with logical
> > + * block size which is the minimum accepted unit by hardware.
> > + */
> 
> Not your call, as your only moving the comment but 'to be aligned to'

I'm perfectly fine with fixing it, but a little to lazy to resend just
for that :)
Johannes Thumshirn July 21, 2022, 6:42 a.m. UTC | #3
On 21.07.22 08:42, Christoph Hellwig wrote:
> On Thu, Jul 21, 2022 at 06:31:24AM +0000, Johannes Thumshirn wrote:
>> On 20.07.22 16:25, Christoph Hellwig wrote:
>>> +/*
>>> + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
>>> + * is defined as 'unsigned int', meantime it has to aligned to with logical
>>> + * block size which is the minimum accepted unit by hardware.
>>> + */
>>
>> Not your call, as your only moving the comment but 'to be aligned to'
> 
> I'm perfectly fine with fixing it, but a little to lazy to resend just
> for that :)
> 

Sure. I think Jens can fix it up when applying.
Damien Le Moal July 22, 2022, 6:02 a.m. UTC | #4
On 7/20/22 23:24, Christoph Hellwig wrote:
> Move this helper into the only file where it is used.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  block/blk-merge.c | 10 ++++++++++
>  block/blk.h       | 10 ----------
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 1676a835b16e7..9593a8a617292 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -95,6 +95,16 @@ static inline bool req_gap_front_merge(struct request *req, struct bio *bio)
>  	return bio_will_gap(req->q, NULL, bio, req->bio);
>  }
>  
> +/*
> + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
> + * is defined as 'unsigned int', meantime it has to aligned to with logical
> + * block size which is the minimum accepted unit by hardware.
> + */
> +static unsigned int bio_allowed_max_sectors(struct request_queue *q)
> +{
> +	return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9;
> +}
> +
>  static struct bio *blk_bio_discard_split(struct request_queue *q,
>  					 struct bio *bio,
>  					 struct bio_set *bs,
> diff --git a/block/blk.h b/block/blk.h
> index c4b084bfe87c9..3026ba81c85f0 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -349,16 +349,6 @@ static inline void req_set_nomerge(struct request_queue *q, struct request *req)
>  		q->last_merge = NULL;
>  }
>  
> -/*
> - * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
> - * is defined as 'unsigned int', meantime it has to aligned to with logical
> - * block size which is the minimum accepted unit by hardware.
> - */
> -static inline unsigned int bio_allowed_max_sectors(struct request_queue *q)
> -{
> -	return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9;
> -}
> -
>  /*
>   * Internal io_context interface
>   */
diff mbox series

Patch

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 1676a835b16e7..9593a8a617292 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -95,6 +95,16 @@  static inline bool req_gap_front_merge(struct request *req, struct bio *bio)
 	return bio_will_gap(req->q, NULL, bio, req->bio);
 }
 
+/*
+ * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
+ * is defined as 'unsigned int', meantime it has to aligned to with logical
+ * block size which is the minimum accepted unit by hardware.
+ */
+static unsigned int bio_allowed_max_sectors(struct request_queue *q)
+{
+	return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9;
+}
+
 static struct bio *blk_bio_discard_split(struct request_queue *q,
 					 struct bio *bio,
 					 struct bio_set *bs,
diff --git a/block/blk.h b/block/blk.h
index c4b084bfe87c9..3026ba81c85f0 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -349,16 +349,6 @@  static inline void req_set_nomerge(struct request_queue *q, struct request *req)
 		q->last_merge = NULL;
 }
 
-/*
- * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size
- * is defined as 'unsigned int', meantime it has to aligned to with logical
- * block size which is the minimum accepted unit by hardware.
- */
-static inline unsigned int bio_allowed_max_sectors(struct request_queue *q)
-{
-	return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9;
-}
-
 /*
  * Internal io_context interface
  */