Message ID | 20241212212941.1268662-4-bvanassche@acm.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Three small block layer patches | expand |
On Thu, Dec 12, 2024 at 01:29:41PM -0800, Bart Van Assche wrote: > Make queue_iostats_passthrough_show() report 0/1 in sysfs instead of 0/4. > > This patch fixes the following sparse warning: > block/blk-sysfs.c:266:31: warning: incorrect type in argument 1 (different base types) > block/blk-sysfs.c:266:31: expected unsigned long var > block/blk-sysfs.c:266:31: got restricted blk_flags_t Maybe turn blk_queue_passthrough_stat into a an inline wrapper so that it automatically does the bool propagation and callers don't have to bother?
On 12/12/24 8:46 PM, Christoph Hellwig wrote: > On Thu, Dec 12, 2024 at 01:29:41PM -0800, Bart Van Assche wrote: >> Make queue_iostats_passthrough_show() report 0/1 in sysfs instead of 0/4. >> >> This patch fixes the following sparse warning: >> block/blk-sysfs.c:266:31: warning: incorrect type in argument 1 (different base types) >> block/blk-sysfs.c:266:31: expected unsigned long var >> block/blk-sysfs.c:266:31: got restricted blk_flags_t > > Maybe turn blk_queue_passthrough_stat into a an inline wrapper so > that it automatically does the bool propagation and callers don't > have to bother? Hi Christoph, There are about 16 functions in include/linux/blkdev.h that test a single bit in q->queue_flags or q->limits.features. Do you really want me to convert all these macros into inline functions? Thanks, Bart.
On Fri, Dec 13, 2024 at 08:26:44AM -0800, Bart Van Assche wrote: > There are about 16 functions in include/linux/blkdev.h that test a single > bit in q->queue_flags or q->limits.features. Do you really want > me to convert all these macros into inline functions? Given that all of them could leak the __bitwise type that could be worthwhile. Alternatively we could also take a hard look at these helpers and check if they are even worth having and otherwise just open code the check for the bits.
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 4241aea84161..767598e719ab 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -263,7 +263,7 @@ static ssize_t queue_nr_zones_show(struct gendisk *disk, char *page) static ssize_t queue_iostats_passthrough_show(struct gendisk *disk, char *page) { - return queue_var_show(blk_queue_passthrough_stat(disk->queue), page); + return queue_var_show(!!blk_queue_passthrough_stat(disk->queue), page); } static ssize_t queue_iostats_passthrough_store(struct gendisk *disk,
Make queue_iostats_passthrough_show() report 0/1 in sysfs instead of 0/4. This patch fixes the following sparse warning: block/blk-sysfs.c:266:31: warning: incorrect type in argument 1 (different base types) block/blk-sysfs.c:266:31: expected unsigned long var block/blk-sysfs.c:266:31: got restricted blk_flags_t Cc: Keith Busch <kbusch@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Fixes: 110234da18ab ("block: enable passthrough command statistics") Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)