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

block: replace REQ_THROTTLED with a bio flag

It's the last bio-only REQ_* flag, and we have space for it in the bio
bi_flags field.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shaun Tancheff <shaun.tancheff@seagate.com>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by

Christoph Hellwig and committed by
Jens Axboe
8d2bbd4c 188bd2b1

+7 -11
+5 -5
block/blk-throttle.c
··· 818 818 tg->io_disp[rw]++; 819 819 820 820 /* 821 - * REQ_THROTTLED is used to prevent the same bio to be throttled 821 + * BIO_THROTTLED is used to prevent the same bio to be throttled 822 822 * more than once as a throttled bio will go through blk-throtl the 823 823 * second time when it eventually gets issued. Set it when a bio 824 824 * is being charged to a tg. 825 825 */ 826 - if (!(bio->bi_opf & REQ_THROTTLED)) 827 - bio->bi_opf |= REQ_THROTTLED; 826 + if (!bio_flagged(bio, BIO_THROTTLED)) 827 + bio_set_flag(bio, BIO_THROTTLED); 828 828 } 829 829 830 830 /** ··· 1401 1401 WARN_ON_ONCE(!rcu_read_lock_held()); 1402 1402 1403 1403 /* see throtl_charge_bio() */ 1404 - if ((bio->bi_opf & REQ_THROTTLED) || !tg->has_rules[rw]) 1404 + if (bio_flagged(bio, BIO_THROTTLED) || !tg->has_rules[rw]) 1405 1405 goto out; 1406 1406 1407 1407 spin_lock_irq(q->queue_lock); ··· 1480 1480 * being issued. 1481 1481 */ 1482 1482 if (!throttled) 1483 - bio->bi_opf &= ~REQ_THROTTLED; 1483 + bio_clear_flag(bio, BIO_THROTTLED); 1484 1484 return throttled; 1485 1485 } 1486 1486
+2 -6
include/linux/blk_types.h
··· 119 119 #define BIO_QUIET 6 /* Make BIO Quiet */ 120 120 #define BIO_CHAIN 7 /* chained bio, ->bi_remaining in effect */ 121 121 #define BIO_REFFED 8 /* bio has elevated ->bi_cnt */ 122 + #define BIO_THROTTLED 9 /* This bio has already been subjected to 123 + * throttling rules. Don't do it again. */ 122 124 123 125 /* 124 126 * Flags starting here get preserved by bio_reset() - this includes ··· 167 165 __REQ_PREFLUSH, /* request for cache flush */ 168 166 __REQ_RAHEAD, /* read ahead, can fail anytime */ 169 167 170 - /* bio only flags */ 171 - __REQ_THROTTLED, /* This bio has already been subjected to 172 - * throttling rules. Don't do it again. */ 173 - 174 168 /* request only flags */ 175 169 __REQ_SORTED, /* elevator knows about this request */ 176 170 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ ··· 211 213 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_PREFLUSH | REQ_FUA | REQ_FLUSH_SEQ) 212 214 213 215 #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) 214 - #define REQ_THROTTLED (1ULL << __REQ_THROTTLED) 215 - 216 216 #define REQ_SORTED (1ULL << __REQ_SORTED) 217 217 #define REQ_SOFTBARRIER (1ULL << __REQ_SOFTBARRIER) 218 218 #define REQ_FUA (1ULL << __REQ_FUA)