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: introduce blk_queue_rot()

To check if a request queue is for a rotational device, a double
negation is needed with the pattern "!blk_queue_nonrot(q)". Simplify
this with the introduction of the helper blk_queue_rot() which tests
if a requests queue limit has the BLK_FEAT_ROTATIONAL feature set.
All call sites of blk_queue_nonrot() are modified to use blk_queue_rot()
and blk_queue_nonrot() definition removed.

No functional changes.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
2719bd1e 068f5b5e

+16 -20
+10 -10
block/bfq-iosched.c
··· 231 231 #define BFQ_RQ_SEEKY(bfqd, last_pos, rq) \ 232 232 (get_sdist(last_pos, rq) > \ 233 233 BFQQ_SEEK_THR && \ 234 - (!blk_queue_nonrot(bfqd->queue) || \ 234 + (blk_queue_rot(bfqd->queue) || \ 235 235 blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT)) 236 236 #define BFQQ_CLOSE_THR (sector_t)(8 * 1024) 237 237 #define BFQQ_SEEKY(bfqq) (hweight32(bfqq->seek_history) > 19) ··· 4165 4165 4166 4166 /* don't use too short time intervals */ 4167 4167 if (delta_usecs < 1000) { 4168 - if (blk_queue_nonrot(bfqd->queue)) 4168 + if (!blk_queue_rot(bfqd->queue)) 4169 4169 /* 4170 4170 * give same worst-case guarantees as idling 4171 4171 * for seeky ··· 4487 4487 struct bfq_queue *bfqq) 4488 4488 { 4489 4489 bool rot_without_queueing = 4490 - !blk_queue_nonrot(bfqd->queue) && !bfqd->hw_tag, 4490 + blk_queue_rot(bfqd->queue) && !bfqd->hw_tag, 4491 4491 bfqq_sequential_and_IO_bound, 4492 4492 idling_boosts_thr; 4493 4493 ··· 4521 4521 * flash-based device. 4522 4522 */ 4523 4523 idling_boosts_thr = rot_without_queueing || 4524 - ((!blk_queue_nonrot(bfqd->queue) || !bfqd->hw_tag) && 4524 + ((blk_queue_rot(bfqd->queue) || !bfqd->hw_tag) && 4525 4525 bfqq_sequential_and_IO_bound); 4526 4526 4527 4527 /* ··· 4722 4722 * there is only one in-flight large request 4723 4723 * at a time. 4724 4724 */ 4725 - if (blk_queue_nonrot(bfqd->queue) && 4725 + if (!blk_queue_rot(bfqd->queue) && 4726 4726 blk_rq_sectors(bfqq->next_rq) >= 4727 4727 BFQQ_SECT_THR_NONROT && 4728 4728 bfqd->tot_rq_in_driver >= 1) ··· 6340 6340 bfqd->hw_tag_samples = 0; 6341 6341 6342 6342 bfqd->nonrot_with_queueing = 6343 - blk_queue_nonrot(bfqd->queue) && bfqd->hw_tag; 6343 + !blk_queue_rot(bfqd->queue) && bfqd->hw_tag; 6344 6344 } 6345 6345 6346 6346 static void bfq_completed_request(struct bfq_queue *bfqq, struct bfq_data *bfqd) ··· 7293 7293 INIT_HLIST_HEAD(&bfqd->burst_list); 7294 7294 7295 7295 bfqd->hw_tag = -1; 7296 - bfqd->nonrot_with_queueing = blk_queue_nonrot(bfqd->queue); 7296 + bfqd->nonrot_with_queueing = !blk_queue_rot(bfqd->queue); 7297 7297 7298 7298 bfqd->bfq_max_budget = bfq_default_max_budget; 7299 7299 ··· 7328 7328 * Begin by assuming, optimistically, that the device peak 7329 7329 * rate is equal to 2/3 of the highest reference rate. 7330 7330 */ 7331 - bfqd->rate_dur_prod = ref_rate[blk_queue_nonrot(bfqd->queue)] * 7332 - ref_wr_duration[blk_queue_nonrot(bfqd->queue)]; 7333 - bfqd->peak_rate = ref_rate[blk_queue_nonrot(bfqd->queue)] * 2 / 3; 7331 + bfqd->rate_dur_prod = ref_rate[!blk_queue_rot(bfqd->queue)] * 7332 + ref_wr_duration[!blk_queue_rot(bfqd->queue)]; 7333 + bfqd->peak_rate = ref_rate[!blk_queue_rot(bfqd->queue)] * 2 / 3; 7334 7334 7335 7335 /* see comments on the definition of next field inside bfq_data */ 7336 7336 bfqd->actuator_load_threshold = 4;
+1 -1
block/blk-iocost.c
··· 812 812 u64 now_ns; 813 813 814 814 /* rotational? */ 815 - if (!blk_queue_nonrot(disk->queue)) 815 + if (blk_queue_rot(disk->queue)) 816 816 return AUTOP_HDD; 817 817 818 818 /* handle SATA SSDs w/ broken NCQ */
+1 -4
block/blk-iolatency.c
··· 988 988 u64 now = blk_time_get_ns(); 989 989 int cpu; 990 990 991 - if (blk_queue_nonrot(blkg->q)) 992 - iolat->ssd = true; 993 - else 994 - iolat->ssd = false; 991 + iolat->ssd = !blk_queue_rot(blkg->q); 995 992 996 993 for_each_possible_cpu(cpu) { 997 994 struct latency_stat *stat;
+2 -3
block/blk-wbt.c
··· 747 747 * We default to 2msec for non-rotational storage, and 75msec 748 748 * for rotational storage. 749 749 */ 750 - if (blk_queue_nonrot(q)) 751 - return 2000000ULL; 752 - else 750 + if (blk_queue_rot(q)) 753 751 return 75000000ULL; 752 + return 2000000ULL; 754 753 } 755 754 756 755 static int wbt_data_dir(const struct request *rq)
+2 -2
include/linux/blkdev.h
··· 680 680 #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 681 681 #define blk_queue_noxmerges(q) \ 682 682 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 683 - #define blk_queue_nonrot(q) (!((q)->limits.features & BLK_FEAT_ROTATIONAL)) 683 + #define blk_queue_rot(q) ((q)->limits.features & BLK_FEAT_ROTATIONAL) 684 684 #define blk_queue_io_stat(q) ((q)->limits.features & BLK_FEAT_IO_STAT) 685 685 #define blk_queue_passthrough_stat(q) \ 686 686 ((q)->limits.flags & BLK_FLAG_IOSTATS_PASSTHROUGH) ··· 1463 1463 1464 1464 static inline bool bdev_nonrot(struct block_device *bdev) 1465 1465 { 1466 - return blk_queue_nonrot(bdev_get_queue(bdev)); 1466 + return !blk_queue_rot(bdev_get_queue(bdev)); 1467 1467 } 1468 1468 1469 1469 static inline bool bdev_synchronous(struct block_device *bdev)