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: add block trace commands for zone operations

Add block trace commands for zone operations. These commands can only be
handled with version 2 of the blktrace protocol. For version 1, warn if a
command that does not fit into the 16 bits reserved for the command in
this version is passed in.

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

authored by

Johannes Thumshirn and committed by
Jens Axboe
f9ee38bb 4d8bc7bd

+36 -6
+11 -2
include/uapi/linux/blktrace_api.h
··· 26 26 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ 27 27 BLK_TC_FUA = 1 << 15, /* fua requests */ 28 28 29 - BLK_TC_END = 1 << 15, /* we've run out of bits! */ 29 + BLK_TC_END_V1 = 1 << 15, /* we've run out of bits! */ 30 + 31 + BLK_TC_ZONE_APPEND = 1ull << 16, /* zone append */ 32 + BLK_TC_ZONE_RESET = 1ull << 17, /* zone reset */ 33 + BLK_TC_ZONE_RESET_ALL = 1ull << 18, /* zone reset all */ 34 + BLK_TC_ZONE_FINISH = 1ull << 19, /* zone finish */ 35 + BLK_TC_ZONE_OPEN = 1ull << 20, /* zone open */ 36 + BLK_TC_ZONE_CLOSE = 1ull << 21, /* zone close */ 37 + 38 + BLK_TC_END_V2 = 1ull << 21, 30 39 }; 31 40 32 41 #define BLK_TC_SHIFT (16) 33 - #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) 42 + #define BLK_TC_ACT(act) ((u64)(act) << BLK_TC_SHIFT) 34 43 35 44 /* 36 45 * Basic trace actions
+25 -4
kernel/trace/blktrace.c
··· 163 163 bytes, what, error, cgid, cgid_len, 164 164 pdu_data, pdu_len); 165 165 return relay_blktrace_event1(bt, sequence, pid, cpu, sector, bytes, 166 - lower_32_bits(what), error, cgid, cgid_len, 167 - pdu_data, pdu_len); 166 + what, error, cgid, cgid_len, pdu_data, 167 + pdu_len); 168 168 } 169 169 170 170 /* ··· 342 342 case REQ_OP_FLUSH: 343 343 what |= BLK_TC_ACT(BLK_TC_FLUSH); 344 344 break; 345 + case REQ_OP_ZONE_APPEND: 346 + what |= BLK_TC_ACT(BLK_TC_ZONE_APPEND); 347 + break; 348 + case REQ_OP_ZONE_RESET: 349 + what |= BLK_TC_ACT(BLK_TC_ZONE_RESET); 350 + break; 351 + case REQ_OP_ZONE_RESET_ALL: 352 + what |= BLK_TC_ACT(BLK_TC_ZONE_RESET_ALL); 353 + break; 354 + case REQ_OP_ZONE_FINISH: 355 + what |= BLK_TC_ACT(BLK_TC_ZONE_FINISH); 356 + break; 357 + case REQ_OP_ZONE_OPEN: 358 + what |= BLK_TC_ACT(BLK_TC_ZONE_OPEN); 359 + break; 360 + case REQ_OP_ZONE_CLOSE: 361 + what |= BLK_TC_ACT(BLK_TC_ZONE_CLOSE); 362 + break; 345 363 default: 346 364 break; 347 365 } 366 + 367 + if (WARN_ON_ONCE(bt->version == 1 && 368 + (what >> BLK_TC_SHIFT) > BLK_TC_END_V1)) 369 + return; 348 370 349 371 if (cgid) 350 372 what |= __BLK_TA_CGROUP; ··· 408 386 sequence = per_cpu_ptr(bt->sequence, cpu); 409 387 (*sequence)++; 410 388 relay_blktrace_event(bt, *sequence, pid, cpu, sector, bytes, 411 - lower_32_bits(what), error, cgid, cgid_len, 412 - pdu_data, pdu_len); 389 + what, error, cgid, cgid_len, pdu_data, pdu_len); 413 390 local_irq_restore(flags); 414 391 } 415 392