Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: cleanup bio_issue

Now that bio->bi_issue is only used by blk-iolatency to get bio issue
time, replace bio_issue with u64 time directly and remove bio_issue to
make code cleaner.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Yu Kuai and committed by
Jens Axboe
1733e888 79b24810

+7 -60
+1 -1
block/bio.c
··· 261 261 bio->bi_private = NULL; 262 262 #ifdef CONFIG_BLK_CGROUP 263 263 bio->bi_blkg = NULL; 264 - bio->bi_issue.value = 0; 264 + bio->issue_time_ns = 0; 265 265 if (bdev) 266 266 bio_associate_blkg(bio); 267 267 #ifdef CONFIG_BLK_CGROUP_IOCOST
+1 -1
block/blk-cgroup.h
··· 372 372 373 373 static inline void blkcg_bio_issue_init(struct bio *bio) 374 374 { 375 - bio_issue_init(&bio->bi_issue, bio_sectors(bio)); 375 + bio->issue_time_ns = blk_time_get_ns(); 376 376 } 377 377 378 378 static inline void blkcg_use_delay(struct blkcg_gq *blkg)
+3 -11
block/blk-iolatency.c
··· 485 485 mod_timer(&blkiolat->timer, jiffies + HZ); 486 486 } 487 487 488 - static void iolatency_record_time(struct iolatency_grp *iolat, 489 - struct bio_issue *issue, u64 now, 490 - bool issue_as_root) 488 + static void iolatency_record_time(struct iolatency_grp *iolat, u64 start, 489 + u64 now, bool issue_as_root) 491 490 { 492 - u64 start = bio_issue_time(issue); 493 491 u64 req_time; 494 - 495 - /* 496 - * Have to do this so we are truncated to the correct time that our 497 - * issue is truncated to. 498 - */ 499 - now = __bio_issue_time(now); 500 492 501 493 if (now <= start) 502 494 return; ··· 617 625 * submitted, so do not account for it. 618 626 */ 619 627 if (iolat->min_lat_nsec && bio->bi_status != BLK_STS_AGAIN) { 620 - iolatency_record_time(iolat, &bio->bi_issue, now, 628 + iolatency_record_time(iolat, bio->issue_time_ns, now, 621 629 issue_as_root); 622 630 window_start = atomic64_read(&iolat->window_start); 623 631 if (now > window_start &&
-42
block/blk.h
··· 681 681 return ns_to_ktime(blk_time_get_ns()); 682 682 } 683 683 684 - /* 685 - * From most significant bit: 686 - * 1 bit: reserved for other usage, see below 687 - * 12 bits: original size of bio 688 - * 51 bits: issue time of bio 689 - */ 690 - #define BIO_ISSUE_RES_BITS 1 691 - #define BIO_ISSUE_SIZE_BITS 12 692 - #define BIO_ISSUE_RES_SHIFT (64 - BIO_ISSUE_RES_BITS) 693 - #define BIO_ISSUE_SIZE_SHIFT (BIO_ISSUE_RES_SHIFT - BIO_ISSUE_SIZE_BITS) 694 - #define BIO_ISSUE_TIME_MASK ((1ULL << BIO_ISSUE_SIZE_SHIFT) - 1) 695 - #define BIO_ISSUE_SIZE_MASK \ 696 - (((1ULL << BIO_ISSUE_SIZE_BITS) - 1) << BIO_ISSUE_SIZE_SHIFT) 697 - #define BIO_ISSUE_RES_MASK (~((1ULL << BIO_ISSUE_RES_SHIFT) - 1)) 698 - 699 - /* Reserved bit for blk-throtl */ 700 - #define BIO_ISSUE_THROTL_SKIP_LATENCY (1ULL << 63) 701 - 702 - static inline u64 __bio_issue_time(u64 time) 703 - { 704 - return time & BIO_ISSUE_TIME_MASK; 705 - } 706 - 707 - static inline u64 bio_issue_time(struct bio_issue *issue) 708 - { 709 - return __bio_issue_time(issue->value); 710 - } 711 - 712 - static inline sector_t bio_issue_size(struct bio_issue *issue) 713 - { 714 - return ((issue->value & BIO_ISSUE_SIZE_MASK) >> BIO_ISSUE_SIZE_SHIFT); 715 - } 716 - 717 - static inline void bio_issue_init(struct bio_issue *issue, 718 - sector_t size) 719 - { 720 - size &= (1ULL << BIO_ISSUE_SIZE_BITS) - 1; 721 - issue->value = ((issue->value & BIO_ISSUE_RES_MASK) | 722 - (blk_time_get_ns() & BIO_ISSUE_TIME_MASK) | 723 - ((u64)size << BIO_ISSUE_SIZE_SHIFT)); 724 - } 725 - 726 684 void bdev_release(struct file *bdev_file); 727 685 int bdev_open(struct block_device *bdev, blk_mode_t mode, void *holder, 728 686 const struct blk_holder_ops *hops, struct file *bdev_file);
+2 -5
include/linux/blk_types.h
··· 198 198 return true; 199 199 } 200 200 201 - struct bio_issue { 202 - u64 value; 203 - }; 204 - 205 201 typedef __u32 __bitwise blk_opf_t; 206 202 207 203 typedef unsigned int blk_qc_t; ··· 238 242 * on release of the bio. 239 243 */ 240 244 struct blkcg_gq *bi_blkg; 241 - struct bio_issue bi_issue; 245 + /* Time that this bio was issued. */ 246 + u64 issue_time_ns; 242 247 #ifdef CONFIG_BLK_CGROUP_IOCOST 243 248 u64 bi_iocost_cost; 244 249 #endif