more int return value cleanup for blkdev.h helpers
Hi Jens,
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(-)
PATCH 1/6 block: return unsigned int from bdev_io_opt
The underlying limit is defined as an unsigned int, so return that from bdev_io_opt as well.
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -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)); }
Signature · 1 line
2.45.2
Re: [PATCH 1/6] block: return unsigned int from bdev_io_opt
Quoted 4 lines · Christoph Hellwig
The underlying limit is defined as an unsigned int, so return that from
bdev_io_optas well.Signed-off-by Christoph Hellwig<[email protected]>
PATCH 2/6 block: return unsigned int from queue_dma_alignment
In reply to Christoph HellwigThe underlying limit is defined as an unsigned int, so return that from queue_dma_alignment as well.
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -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; }
Signature · 1 line
2.45.2
Re: [PATCH 2/6] block: return unsigned int from queue_dma_alignment
Quoted 4 lines · Christoph Hellwig
The underlying limit is defined as an unsigned int, so return that from
queue_dma_alignmentas well.Signed-off-by Christoph Hellwig<[email protected]>
PATCH 3/6 block: return unsigned int from blk_lim_dma_alignment_and_pad
In reply to Christoph HellwigThe underlying limits are defined as unsigned int, so return that from blk_lim_dma_alignment_and_pad as well.
--- include/linux/blkdev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/blkdev.h +2 -1
@@ -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; }
Signature · 1 line
2.45.2
Re: [PATCH 3/6] block: return unsigned int from blk_lim_dma_alignment_and_pad
Quoted 4 lines · Christoph Hellwig
The underlying limits are defined as unsigned int, so return that from
blk_lim_dma_alignment_and_padas well.Signed-off-by Christoph Hellwig<[email protected]>
PATCH 4/6 block: return bool from blk_rq_aligned
In reply to Christoph Hellwigblk_rq_aligned returns a boolean condition, don't mascquerade it as int.
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -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);
Signature · 1 line
2.45.2
Re: [PATCH 4/6] block: return bool from blk_rq_aligned
Quoted 1 line · Christoph Hellwig
blk_rq_alignedreturns a boolean condition, don't mascquerade it as int.
I think that the spelling is masquerade. Well according to spellcheck...
Quoted 2 lines
Signed-off-by Christoph Hellwig <[email protected]>
Quoted 17 lines
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/blkdev.h +1
-1@@ -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);
Re: [PATCH 4/6] block: return bool from blk_rq_aligned
Quoted 4 lines · John Garry
Quoted 1 line · Christoph Hellwig
blk_rq_alignedreturns 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.
PATCH 5/6 block: remove a duplicate definition for bdev_read_only
In reply to Christoph Hellwigbdev_read_only is already defined as an inline function in blkdev.h.
--- include/linux/blkdev.h | 1 - 1 file changed, 1 deletion(-)
include/linux/blkdev.h +0 -1
@@ -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);
Signature · 1 line
2.45.2
Re: [PATCH 5/6] block: remove a duplicate definition for bdev_read_only
Quoted 3 lines · Christoph Hellwig
bdev_read_onlyis already defined as an inline function inblkdev.h.Signed-off-by Christoph Hellwig<[email protected]>
PATCH 6/6 block: return bool from get_disk_ro and bdev_read_only
In reply to Christoph Hellwigget_disk_ro and bdev_read_only return boolean conditions, don't masquerade them as int.
--- include/linux/blkdev.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/blkdev.h +2 -2
@@ -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); }
Signature · 1 line
2.45.2
Re: [PATCH 6/6] block: return bool from get_disk_ro and bdev_read_only
Quoted 4 lines · Christoph Hellwig
get_disk_roandbdev_read_onlyreturn boolean conditions, don't masquerade them as int.Signed-off-by Christoph Hellwig<[email protected]>
Martin K. Petersen
Reviewed-byChristoph,
Quoted 4 lines
as John pointed out there are a bunch more helpers in
blkdev.hthat 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.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Johannes Thumshirn
Reviewed-byMinus the spelling error John pointed out,
Quoted 10 lines · Christoph Hellwig
as John pointed out there are a bunch more helpers in
blkdev.hthat 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: 766a71ef65bb217ed8bf1c068ac14c7d3c15d487Best regards,
Signature · 1 line
Jens Axboe