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.