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

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

 



On 06/13/2019 08:17 AM, Bart Van Assche wrote:
> On 6/13/19 7:16 AM, Chaitanya Kulkarni wrote:
>> +#define REQ_OP_NAME(name) [REQ_OP_##name] = #name
>> +static const char *const op_name[] = {
>> +	REQ_OP_NAME(READ),
>> +	REQ_OP_NAME(WRITE),
>> +	REQ_OP_NAME(FLUSH),
>> +	REQ_OP_NAME(DISCARD),
>> +	REQ_OP_NAME(SECURE_ERASE),
>> +	REQ_OP_NAME(ZONE_RESET),
>> +	REQ_OP_NAME(WRITE_SAME),
>> +	REQ_OP_NAME(WRITE_ZEROES),
>> +	REQ_OP_NAME(SCSI_IN),
>> +	REQ_OP_NAME(SCSI_OUT),
>> +	REQ_OP_NAME(DRV_IN),
>> +	REQ_OP_NAME(DRV_OUT),
>> +};
>> +
>> +static inline const char *op_str(int op)
>> +{
>> +	const char *op_str = "REQ_OP_UNKNOWN";
>> +
>> +	if (op < ARRAY_SIZE(op_name) && op_name[op])
>> +		op_str = op_name[op];
>> +
>> +	return op_str;
>> +}
>
> If this patch gets applied there will be three copies in the upstream
> code that convert a REQ_OP_* constant into a string: one in blk-core.c,
> one in blk-mq-debugfs.c and one in include/trace/events/f2fs.h. Is it
> possible to avoid that duplication and have only one function that does
> the number-to-string conversion?
>
Okay let me work on this refactoring and send out V3.
> 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