* [PATCH 1/6] block: return unsigned int from bdev_io_opt
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:27 ` John Garry
2024-11-19 16:09 ` [PATCH 2/6] block: return unsigned int from queue_dma_alignment Christoph Hellwig
` (7 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
The underlying limit is defined as an unsigned int, so return that from
bdev_io_opt as well.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 195db38fda16..37439acfa34e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1271,7 +1271,7 @@ static inline unsigned int queue_io_opt(const struct request_queue *q)
return q->limits.io_opt;
}
-static inline int bdev_io_opt(struct block_device *bdev)
+static inline unsigned int bdev_io_opt(struct block_device *bdev)
{
return queue_io_opt(bdev_get_queue(bdev));
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 2/6] block: return unsigned int from queue_dma_alignment
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
2024-11-19 16:09 ` [PATCH 1/6] block: return unsigned int from bdev_io_opt Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:28 ` John Garry
2024-11-19 16:09 ` [PATCH 3/6] block: return unsigned int from blk_lim_dma_alignment_and_pad Christoph Hellwig
` (6 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
The underlying limit is defined as an unsigned int, so return that from
queue_dma_alignment as well.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 37439acfa34e..d1a6f4bc4a1c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1417,7 +1417,7 @@ static inline bool bdev_zone_is_seq(struct block_device *bdev, sector_t sector)
return is_seq;
}
-static inline int queue_dma_alignment(const struct request_queue *q)
+static inline unsigned int queue_dma_alignment(const struct request_queue *q)
{
return q->limits.dma_alignment;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 3/6] block: return unsigned int from blk_lim_dma_alignment_and_pad
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
2024-11-19 16:09 ` [PATCH 1/6] block: return unsigned int from bdev_io_opt Christoph Hellwig
2024-11-19 16:09 ` [PATCH 2/6] block: return unsigned int from queue_dma_alignment Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:29 ` John Garry
2024-11-19 16:09 ` [PATCH 4/6] block: return bool from blk_rq_aligned Christoph Hellwig
` (5 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
The underlying limits are defined as unsigned int, so return that from
blk_lim_dma_alignment_and_pad as well.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d1a6f4bc4a1c..74e3c611a4f7 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1458,7 +1458,8 @@ static inline bool bdev_iter_is_aligned(struct block_device *bdev,
bdev_logical_block_size(bdev) - 1);
}
-static inline int blk_lim_dma_alignment_and_pad(struct queue_limits *lim)
+static inline unsigned int
+blk_lim_dma_alignment_and_pad(struct queue_limits *lim)
{
return lim->dma_alignment | lim->dma_pad_mask;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 4/6] block: return bool from blk_rq_aligned
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (2 preceding siblings ...)
2024-11-19 16:09 ` [PATCH 3/6] block: return unsigned int from blk_lim_dma_alignment_and_pad Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:34 ` John Garry
2024-11-19 16:09 ` [PATCH 5/6] block: remove a duplicate definition for bdev_read_only Christoph Hellwig
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
blk_rq_aligned returns a boolean condition, don't mascquerade it as int.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 74e3c611a4f7..e4fc967e8cb9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1464,7 +1464,7 @@ blk_lim_dma_alignment_and_pad(struct queue_limits *lim)
return lim->dma_alignment | lim->dma_pad_mask;
}
-static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr,
+static inline bool blk_rq_aligned(struct request_queue *q, unsigned long addr,
unsigned int len)
{
unsigned int alignment = blk_lim_dma_alignment_and_pad(&q->limits);
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] block: return bool from blk_rq_aligned
2024-11-19 16:09 ` [PATCH 4/6] block: return bool from blk_rq_aligned Christoph Hellwig
@ 2024-11-19 16:34 ` John Garry
2024-11-19 16:37 ` Christoph Hellwig
0 siblings, 1 reply; 17+ messages in thread
From: John Garry @ 2024-11-19 16:34 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe; +Cc: linux-block
On 19/11/2024 16:09, Christoph Hellwig wrote:
> blk_rq_aligned returns a boolean condition, don't mascquerade it as int.
I think that the spelling is masquerade. Well according to spellcheck...
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
> ---
> include/linux/blkdev.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 74e3c611a4f7..e4fc967e8cb9 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1464,7 +1464,7 @@ blk_lim_dma_alignment_and_pad(struct queue_limits *lim)
> return lim->dma_alignment | lim->dma_pad_mask;
> }
>
> -static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr,
> +static inline bool blk_rq_aligned(struct request_queue *q, unsigned long addr,
> unsigned int len)
> {
> unsigned int alignment = blk_lim_dma_alignment_and_pad(&q->limits);
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] block: return bool from blk_rq_aligned
2024-11-19 16:34 ` John Garry
@ 2024-11-19 16:37 ` Christoph Hellwig
0 siblings, 0 replies; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:37 UTC (permalink / raw)
To: John Garry; +Cc: Christoph Hellwig, Jens Axboe, linux-block
On Tue, Nov 19, 2024 at 04:34:34PM +0000, John Garry wrote:
> On 19/11/2024 16:09, Christoph Hellwig wrote:
>> blk_rq_aligned returns a boolean condition, don't mascquerade it as int.
>
> I think that the spelling is masquerade. Well according to spellcheck...
Hmm, I thought I had fixed that up because the spellchecker noticed it,
but I guess I fumbled that up.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/6] block: remove a duplicate definition for bdev_read_only
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (3 preceding siblings ...)
2024-11-19 16:09 ` [PATCH 4/6] block: return bool from blk_rq_aligned Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:32 ` John Garry
2024-11-19 16:09 ` [PATCH 6/6] block: return bool from get_disk_ro and bdev_read_only Christoph Hellwig
` (3 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
bdev_read_only is already defined as an inline function in blkdev.h.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e4fc967e8cb9..957767c0cafd 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1582,7 +1582,6 @@ static inline void bio_end_io_acct(struct bio *bio, unsigned long start_time)
return bio_end_io_acct_remapped(bio, start_time, bio->bi_bdev);
}
-int bdev_read_only(struct block_device *bdev);
int set_blocksize(struct file *file, int size);
int lookup_bdev(const char *pathname, dev_t *dev);
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 6/6] block: return bool from get_disk_ro and bdev_read_only
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (4 preceding siblings ...)
2024-11-19 16:09 ` [PATCH 5/6] block: remove a duplicate definition for bdev_read_only Christoph Hellwig
@ 2024-11-19 16:09 ` Christoph Hellwig
2024-11-19 16:37 ` John Garry
2024-11-19 16:38 ` more int return value cleanup for blkdev.h helpers Martin K. Petersen
` (2 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2024-11-19 16:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
get_disk_ro and bdev_read_only return boolean conditions,
don't masquerade them as int.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/blkdev.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 957767c0cafd..f2c0868544a3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -775,13 +775,13 @@ static inline void bdev_clear_flag(struct block_device *bdev, unsigned flag)
atomic_andnot(flag, &bdev->__bd_flags);
}
-static inline int get_disk_ro(struct gendisk *disk)
+static inline bool get_disk_ro(struct gendisk *disk)
{
return bdev_test_flag(disk->part0, BD_READ_ONLY) ||
test_bit(GD_READ_ONLY, &disk->state);
}
-static inline int bdev_read_only(struct block_device *bdev)
+static inline bool bdev_read_only(struct block_device *bdev)
{
return bdev_test_flag(bdev, BD_READ_ONLY) || get_disk_ro(bdev->bd_disk);
}
--
2.45.2
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: more int return value cleanup for blkdev.h helpers
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (5 preceding siblings ...)
2024-11-19 16:09 ` [PATCH 6/6] block: return bool from get_disk_ro and bdev_read_only Christoph Hellwig
@ 2024-11-19 16:38 ` Martin K. Petersen
2024-11-19 16:58 ` Johannes Thumshirn
2024-11-20 2:07 ` Jens Axboe
8 siblings, 0 replies; 17+ messages in thread
From: Martin K. Petersen @ 2024-11-19 16:38 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, linux-block
Christoph,
> as John pointed out there are a bunch more helpers in blkdev.h that
> return int when the underlying value should be unsigned int. Thid
> series fixes those, and also switches those that return boolean values
> to bool and drop a duplicate prototype.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: more int return value cleanup for blkdev.h helpers
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (6 preceding siblings ...)
2024-11-19 16:38 ` more int return value cleanup for blkdev.h helpers Martin K. Petersen
@ 2024-11-19 16:58 ` Johannes Thumshirn
2024-11-20 2:07 ` Jens Axboe
8 siblings, 0 replies; 17+ messages in thread
From: Johannes Thumshirn @ 2024-11-19 16:58 UTC (permalink / raw)
To: hch, Jens Axboe; +Cc: linux-block@vger.kernel.org
Minus the spelling error John pointed out,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: more int return value cleanup for blkdev.h helpers
2024-11-19 16:09 more int return value cleanup for blkdev.h helpers Christoph Hellwig
` (7 preceding siblings ...)
2024-11-19 16:58 ` Johannes Thumshirn
@ 2024-11-20 2:07 ` Jens Axboe
8 siblings, 0 replies; 17+ messages in thread
From: Jens Axboe @ 2024-11-20 2:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On Tue, 19 Nov 2024 17:09:17 +0100, Christoph Hellwig wrote:
> as John pointed out there are a bunch more helpers in blkdev.h
> that return int when the underlying value should be unsigned int.
> Thid series fixes those, and also switches those that return boolean
> values to bool and drop a duplicate prototype.
>
> Diffstat:
> blkdev.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> [...]
Applied, thanks!
[1/6] block: return unsigned int from bdev_io_opt
commit: 5a9d1b83e5334915c651604648c20a9fc64d47a3
[2/6] block: return unsigned int from queue_dma_alignment
commit: ed5db174cf39374215934f21b04639a7a1513023
[3/6] block: return unsigned int from blk_lim_dma_alignment_and_pad
commit: e769489a54401d0c89555f7ad8672038b5c2b767
[4/6] block: return bool from blk_rq_aligned
commit: da77d9b23700708d0d22a4407d32a8755a3596e8
[5/6] block: remove a duplicate definition for bdev_read_only
commit: e888810bc4f471f85989a0991aff28d2ac9f783b
[6/6] block: return bool from get_disk_ro and bdev_read_only
commit: 766a71ef65bb217ed8bf1c068ac14c7d3c15d487
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 17+ messages in thread