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.

blktrace: untangle if/else sequence in __blk_add_trace

Untangle the if/else sequence setting the trace action in
__blk_add_trace() and turn it into a switch statement for better
extensibility.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Johannes Thumshirn and committed by
Jens Axboe
70e3c62b 04678e72

+11 -2
+11 -2
kernel/trace/blktrace.c
··· 278 278 what |= MASK_TC_BIT(opf, META); 279 279 what |= MASK_TC_BIT(opf, PREFLUSH); 280 280 what |= MASK_TC_BIT(opf, FUA); 281 - if (op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE) 281 + 282 + switch (op) { 283 + case REQ_OP_DISCARD: 284 + case REQ_OP_SECURE_ERASE: 282 285 what |= BLK_TC_ACT(BLK_TC_DISCARD); 283 - if (op == REQ_OP_FLUSH) 286 + break; 287 + case REQ_OP_FLUSH: 284 288 what |= BLK_TC_ACT(BLK_TC_FLUSH); 289 + break; 290 + default: 291 + break; 292 + } 293 + 285 294 if (cgid) 286 295 what |= __BLK_TA_CGROUP; 287 296