Re: [PATCH 2/2] block: add more debug data to print_req_err

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/11/19 1:02 PM, Chaitanya Kulkarni wrote:
+static inline const char *req_op_str(struct request *req)
+{
+       char *ret;
+
+       switch (req_op(req)) {
+       case REQ_OP_READ:
+               ret = "read";
+               break;
+       case REQ_OP_WRITE:
+               ret = "write";
+               break;
+       case REQ_OP_FLUSH:
+               ret = "flush";
+               break;
+       case REQ_OP_DISCARD:
+               ret = "discard";
+               break;
+       case REQ_OP_SECURE_ERASE:
+               ret = "secure_erase";
+               break;
+       case REQ_OP_ZONE_RESET:
+               ret = "zone_reset";
+               break;
+       case REQ_OP_WRITE_SAME:
+               ret = "write_same";
+               break;
+       case REQ_OP_WRITE_ZEROES:
+               ret = "write_zeroes";
+               break;
+       case REQ_OP_SCSI_IN:
+               ret = "scsi_in";
+               break;
+       case REQ_OP_SCSI_OUT:
+               ret = "scsi_out";
+               break;
+       case REQ_OP_DRV_IN:
+               ret = "drv_in";
+               break;
+       case REQ_OP_DRV_OUT:
+               ret = "drv_out";
+               break;
+       default:
+               ret = "unknown";
+       }
+
+       return ret;
+}
Please use an array instead of a switch/case statement to do this conversion. See also blk-mq-debugfs.c for examples.

Please also make show_bio_op(op) in include/trace/events/f2fs.h call the above function.

Thanks,

Bart.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux