Remove several superfluous sector casts
Subsystems (3)
v3 cover Remove several superfluous sector casts
Hi Jens,
This patch series fixes one bcache bug and removes superfluous casts of sector numbers / offsets. Please consider this patch series for inclusion in the upstream kernel.
Thanks,
Bart.
Changes compared to v2:
- Fixed Kent's email address.
Changes compared to v1:
- Rebased on top of v6.17-rc1.
- Added Acked-by and Reviewed-by tags.
Bart Van Assche (5):
block, bfq: Remove a superfluous cast
block, genhd: Remove disk_stats.sectors casts
bcache, tracing: Do not truncate orig_sector
bcache, tracing: Remove superfluous casts
block, tracing: Remove superfluous casts
block/bfq-iosched.c | 3 +-- block/genhd.c | 12 ++++++------ include/trace/events/bcache.h | 15 +++++++-------- include/trace/events/block.h | 34 +++++++++++++--------------------- 4 files changed, 27 insertions(+), 37 deletions(-)
PATCH v3 1/5 block, bfq: Remove a superfluous cast
sector_t is a synonym for u64 and all architectures define u64 as unsigned long long. Hence, it is not necessary to cast type sector_t to unsigned long long. Remove a superfluous cast to improve compile-time type checking.
--- block/bfq-iosched.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/bfq-iosched.c +1 -2
@@ -760,8 +760,7 @@ bfq_rq_pos_tree_lookup(struct bfq_data *bfqd, struct rb_root *root,if (rb_link) *rb_link = p; -bfq_log (bfqd,"rq_pos_tree_lookup %llu: returning %d" , - (unsigned long long )sector, +bfq_log (bfqd,"rq_pos_tree_lookup %llu: returning %d" , sector, bfqq ? bfqq->pid :0 );return bfqq;
PATCH v3 2/5 block, genhd: Remove disk_stats.sectors casts
In reply to Bart Van AsscheIn include/linux/part_stat.h, disk_stats.sectors is declared as unsigned long[]. Instead of casting disk_stats.sectors to unsigned long long and formatting it with %llu, remove the cast and format these numbers with %lu. No functionality has been changed.
--- block/genhd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
block/genhd.c +6 -6
@@ -1074,19 +1074,19 @@ ssize_t part_stat_show(struct device *dev, }part_stat_read_all (bdev, &stat); return sysfs_emit(buf, - "%8lu %8lu %8llu %8u " - "%8lu %8lu %8llu %8u " + "%8lu %8lu %8lu %8u " + "%8lu %8lu %8lu %8u " "%8u %8u %8u " - "%8lu %8lu %8llu %8u " + "%8lu %8lu %8lu %8u " "%8lu %8u" "\n", stat.ios[STAT_READ], stat.merges[STAT_READ], - (unsigned long long)stat.sectors[STAT_READ], + stat.sectors[STAT_READ], (unsigned int)div_u64(stat.nsecs[STAT_READ], NSEC_PER_MSEC), stat.ios[STAT_WRITE], stat.merges[STAT_WRITE], - (unsigned long long)stat.sectors[STAT_WRITE], + stat.sectors[STAT_WRITE], (unsigned int)div_u64(stat.nsecs[STAT_WRITE], NSEC_PER_MSEC), inflight, jiffies_to_msecs(stat.io_ticks),
@@ -1097,7 +1097,7 @@ ssize_t part_stat_show(struct device *dev, NSEC_PER_MSEC), stat.ios[STAT_DISCARD ], stat.merges[STAT_DISCARD ], - (unsigned long long )stat.sectors[STAT_DISCARD ], + stat.sectors[STAT_DISCARD ], (unsigned int )div_u64 (stat.nsecs[STAT_DISCARD ],NSEC_PER_MSEC ), stat.ios[STAT_FLUSH ], (unsigned int)div_u64(stat.nsecs[STAT_FLUSH], NSEC_PER_MSEC));
PATCH v3 3/5 bcache, tracing: Do not truncate orig_sector
In reply to Bart Van AsscheChange the type of orig_sector from dev_t (unsigned int) into sector_t (u64) to prevent truncation of orig_sector by the tracing code.
--- include/trace/events/bcache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/bcache.h +1 -1
@@ -16,7 +16,7 @@ DECLARE_EVENT_CLASS(bcache_request, __field(unsigned int, orig_major ) __field(unsigned int, orig_minor ) __field(sector_t, sector ) - __field(dev_t, orig_sector ) + __field(sector_t, orig_sector ) __field(unsigned int, nr_sector ) __array(char, rwbs, 6 ) ),
PATCH v3 4/5 bcache, tracing: Remove superfluous casts
In reply to Bart Van Asschesector_t is a synonym for u64 and all architectures define u64 as unsigned long long. Hence, it is not necessary to cast type sector_t to unsigned long long. Remove the superfluous casts to improve compile-time type checking.
--- include/trace/events/bcache.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
include/trace/events/bcache.h +6 -7
@@ -33,9 +33,9 @@ DECLARE_EVENT_CLASS(bcache_request,TP_printk ("%d,%d %s %llu + %u (from %d,%d @ %llu)" ,MAJOR (__entry->dev),MINOR (__entry->dev), - __entry->rwbs, (unsigned long long )__entry->sector, + __entry->rwbs, __entry->sector, __entry->nr_sector, __entry->orig_major, __entry->orig_minor, - (unsigned long long )__entry->orig_sector) + __entry->orig_sector) ); DECLARE_EVENT_CLASS(bkey,
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(bcache_bio,TP_printk ("%d,%d %s %llu + %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, __entry->nr_sector) + __entry->sector, __entry->nr_sector) ); DEFINE_EVENT(bcache_bio, bcache_bypass_sequential,
@@ -144,7 +144,7 @@ TRACE_EVENT(bcache_read,TP_printk ("%d,%d %s %llu + %u hit %u bypass %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), - __entry->rwbs, (unsigned long long )__entry->sector, + __entry->rwbs, __entry->sector, __entry->nr_sector, __entry->cache_hit, __entry->bypass) );
@@ -175,7 +175,7 @@ TRACE_EVENT(bcache_write,TP_printk ("%pU inode %llu %s %llu + %u hit %u bypass %u" , __entry->uuid, __entry->inode, - __entry->rwbs, (unsigned long long )__entry->sector, + __entry->rwbs, __entry->sector, __entry->nr_sector, __entry->writeback, __entry->bypass) );
@@ -243,8 +243,7 @@ TRACE_EVENT(bcache_journal_write,TP_printk ("%d,%d %s %llu + %u keys %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, __entry->nr_sector, - __entry->nr_keys) + __entry->sector, __entry->nr_sector, __entry->nr_keys) );/* Btree */
PATCH v3 5/5 block, tracing: Remove superfluous casts
In reply to Bart Van Asschesector_t is a synonym for u64 and all architectures define u64 as unsigned long long. Hence, it is not necessary to cast type sector_t to unsigned long long. Remove the superfluous casts to improve compile-time type checking.
--- include/trace/events/block.h | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-)
include/trace/events/block.h +13 -21
@@ -41,7 +41,7 @@ DECLARE_EVENT_CLASS(block_buffer,TP_printk ("%d,%d sector=%llu size=%zu" ,MAJOR (__entry->dev),MINOR (__entry->dev), - (unsigned long long )__entry->sector, __entry->size + __entry->sector, __entry->size ) );
@@ -108,7 +108,7 @@ TRACE_EVENT(block_rq_requeue, TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __get_str(cmd), - (unsigned long long)__entry->sector, __entry->nr_sector, + __entry->sector, __entry->nr_sector, __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), IOPRIO_CLASS_STRINGS), IOPRIO_PRIO_HINT(__entry->ioprio),
@@ -145,7 +145,7 @@ DECLARE_EVENT_CLASS(block_rq_completion, TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __get_str(cmd), - (unsigned long long)__entry->sector, __entry->nr_sector, + __entry->sector, __entry->nr_sector, __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), IOPRIO_CLASS_STRINGS), IOPRIO_PRIO_HINT(__entry->ioprio),
@@ -219,7 +219,7 @@ DECLARE_EVENT_CLASS(block_rq, TP_printk("%d,%d %s %u (%s) %llu + %u %s,%u,%u [%s]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __entry->bytes, __get_str(cmd), - (unsigned long long)__entry->sector, __entry->nr_sector, + __entry->sector, __entry->nr_sector, __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), IOPRIO_CLASS_STRINGS), IOPRIO_PRIO_HINT(__entry->ioprio),
@@ -328,8 +328,7 @@ TRACE_EVENT(block_bio_complete,TP_printk ("%d,%d %s %llu + %u [%d]" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - __entry->nr_sector, __entry->error) + __entry->sector, __entry->nr_sector, __entry->error) ); DECLARE_EVENT_CLASS(block_bio,
@@ -356,8 +355,7 @@ DECLARE_EVENT_CLASS(block_bio,TP_printk ("%d,%d %s %llu + %u [%s]" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - __entry->nr_sector, __entry->comm) + __entry->sector, __entry->nr_sector, __entry->comm) );/**
@@ -509,9 +507,7 @@ TRACE_EVENT(block_split,TP_printk ("%d,%d %s %llu / %llu [%s]" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - (unsigned long long )__entry->new_sector, - __entry->comm) + __entry->sector, __entry->new_sector, __entry->comm) );/**
@@ -549,10 +545,9 @@ TRACE_EVENT(block_bio_remap,TP_printk ("%d,%d %s %llu + %u <- (%d,%d) %llu" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - __entry->nr_sector, + __entry->sector, __entry->nr_sector,MAJOR (__entry->old_dev),MINOR (__entry->old_dev), - (unsigned long long )__entry->old_sector) + __entry->old_sector) );/**
@@ -593,10 +588,9 @@ TRACE_EVENT(block_rq_remap,TP_printk ("%d,%d %s %llu + %u <- (%d,%d) %llu %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - __entry->nr_sector, + __entry->sector, __entry->nr_sector,MAJOR (__entry->old_dev),MINOR (__entry->old_dev), - (unsigned long long )__entry->old_sector, __entry->nr_bios) + __entry->old_sector, __entry->nr_bios) );/**
@@ -630,8 +624,7 @@ TRACE_EVENT(blkdev_zone_mgmt,TP_printk ("%d,%d %s %llu + %llu" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->rwbs, - (unsigned long long )__entry->sector, - __entry->nr_sectors) + __entry->sector, __entry->nr_sectors) ); DECLARE_EVENT_CLASS(block_zwplug,
@@ -657,8 +650,7 @@ DECLARE_EVENT_CLASS(block_zwplug,TP_printk ("%d,%d zone %u, BIO %llu + %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), __entry->zno, - (unsigned long long )__entry->sector, - __entry->nr_sectors) + __entry->sector, __entry->nr_sectors) ); DEFINE_EVENT(block_zwplug, disk_zone_wplug_add_bio,
Bart,
Quoted 3 lines
This patch series fixes one bcache bug and removes superfluous casts of sector numbers / offsets. Please consider this patch series for inclusion in the upstream kernel.
Looks OK.
Signature · 1 line
Martin K. Petersen