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/blk-throttle: Remove throtl_slice from struct throtl_data

throtl_slice is now a constant. Remove the variable and use the constant
directly where needed.

Cc: Yu Kuai <yukuai@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Guenter Roeck and committed by
Jens Axboe
6483faa3 20d0b359

+13 -19
+13 -19
block/blk-throttle.c
··· 38 38 /* Total Number of queued bios on READ and WRITE lists */ 39 39 unsigned int nr_queued[2]; 40 40 41 - unsigned int throtl_slice; 42 - 43 41 /* Work for dispatching throttled bios */ 44 42 struct work_struct dispatch_work; 45 43 }; ··· 444 446 static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, 445 447 unsigned long expires) 446 448 { 447 - unsigned long max_expire = jiffies + 8 * sq_to_td(sq)->throtl_slice; 449 + unsigned long max_expire = jiffies + 8 * DFL_THROTL_SLICE; 448 450 449 451 /* 450 452 * Since we are adjusting the throttle limit dynamically, the sleep ··· 512 514 if (time_after(start, tg->slice_start[rw])) 513 515 tg->slice_start[rw] = start; 514 516 515 - tg->slice_end[rw] = jiffies + tg->td->throtl_slice; 517 + tg->slice_end[rw] = jiffies + DFL_THROTL_SLICE; 516 518 throtl_log(&tg->service_queue, 517 519 "[%c] new slice with credit start=%lu end=%lu jiffies=%lu", 518 520 rw == READ ? 'R' : 'W', tg->slice_start[rw], ··· 527 529 tg->io_disp[rw] = 0; 528 530 } 529 531 tg->slice_start[rw] = jiffies; 530 - tg->slice_end[rw] = jiffies + tg->td->throtl_slice; 532 + tg->slice_end[rw] = jiffies + DFL_THROTL_SLICE; 531 533 532 534 throtl_log(&tg->service_queue, 533 535 "[%c] new slice start=%lu end=%lu jiffies=%lu", ··· 538 540 static inline void throtl_set_slice_end(struct throtl_grp *tg, bool rw, 539 541 unsigned long jiffy_end) 540 542 { 541 - tg->slice_end[rw] = roundup(jiffy_end, tg->td->throtl_slice); 543 + tg->slice_end[rw] = roundup(jiffy_end, DFL_THROTL_SLICE); 542 544 } 543 545 544 546 static inline void throtl_extend_slice(struct throtl_grp *tg, bool rw, ··· 669 671 * sooner, then we need to reduce slice_end. A high bogus slice_end 670 672 * is bad because it does not allow new slice to start. 671 673 */ 672 - throtl_set_slice_end(tg, rw, jiffies + tg->td->throtl_slice); 674 + throtl_set_slice_end(tg, rw, jiffies + DFL_THROTL_SLICE); 673 675 674 676 time_elapsed = rounddown(jiffies - tg->slice_start[rw], 675 - tg->td->throtl_slice); 677 + DFL_THROTL_SLICE); 676 678 /* Don't trim slice until at least 2 slices are used */ 677 - if (time_elapsed < tg->td->throtl_slice * 2) 679 + if (time_elapsed < DFL_THROTL_SLICE * 2) 678 680 return; 679 681 680 682 /* ··· 685 687 * lower rate than expected. Therefore, other than the above rounddown, 686 688 * one extra slice is preserved for deviation. 687 689 */ 688 - time_elapsed -= tg->td->throtl_slice; 690 + time_elapsed -= DFL_THROTL_SLICE; 689 691 bytes_trim = throtl_trim_bps(tg, rw, time_elapsed); 690 692 io_trim = throtl_trim_iops(tg, rw, time_elapsed); 691 693 if (!bytes_trim && !io_trim) ··· 695 697 696 698 throtl_log(&tg->service_queue, 697 699 "[%c] trim slice nr=%lu bytes=%lld io=%d start=%lu end=%lu jiffies=%lu", 698 - rw == READ ? 'R' : 'W', time_elapsed / tg->td->throtl_slice, 700 + rw == READ ? 'R' : 'W', time_elapsed / DFL_THROTL_SLICE, 699 701 bytes_trim, io_trim, tg->slice_start[rw], tg->slice_end[rw], 700 702 jiffies); 701 703 } ··· 766 768 jiffy_elapsed = jiffies - tg->slice_start[rw]; 767 769 768 770 /* Round up to the next throttle slice, wait time must be nonzero */ 769 - jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, tg->td->throtl_slice); 771 + jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, DFL_THROTL_SLICE); 770 772 io_allowed = calculate_io_allowed(iops_limit, jiffy_elapsed_rnd); 771 773 if (io_allowed > 0 && tg->io_disp[rw] + 1 <= io_allowed) 772 774 return 0; ··· 792 794 793 795 /* Slice has just started. Consider one slice interval */ 794 796 if (!jiffy_elapsed) 795 - jiffy_elapsed_rnd = tg->td->throtl_slice; 797 + jiffy_elapsed_rnd = DFL_THROTL_SLICE; 796 798 797 - jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); 799 + jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, DFL_THROTL_SLICE); 798 800 bytes_allowed = calculate_bytes_allowed(bps_limit, jiffy_elapsed_rnd); 799 801 /* Need to consider the case of bytes_allowed overflow. */ 800 802 if ((bytes_allowed > 0 && tg->bytes_disp[rw] + bio_size <= bytes_allowed) ··· 846 848 sq_queued(&tg->service_queue, rw) == 0) 847 849 throtl_start_new_slice(tg, rw, true); 848 850 else 849 - throtl_extend_slice(tg, rw, jiffies + tg->td->throtl_slice); 851 + throtl_extend_slice(tg, rw, jiffies + DFL_THROTL_SLICE); 850 852 } 851 853 852 854 static unsigned long tg_dispatch_bps_time(struct throtl_grp *tg, struct bio *bio) ··· 1331 1333 if (ret) { 1332 1334 q->td = NULL; 1333 1335 kfree(td); 1334 - goto out; 1335 1336 } 1336 1337 1337 - td->throtl_slice = DFL_THROTL_SLICE; 1338 - 1339 - out: 1340 1338 blk_mq_unquiesce_queue(disk->queue); 1341 1339 blk_mq_unfreeze_queue(disk->queue, memflags); 1342 1340