Re: [PATCH 3/5] block: allow block_dump to print all REQ_OP_XXX

Minwoo Im
2019-07-03T00:50:27Z

> diff --git a/block/blk-core.c b/block/blk-core.c
> index 5143a8e19b63..9855c5d5027d 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1127,17 +1127,15 @@ EXPORT_SYMBOL_GPL(direct_make_request);
> */
> blk_qc_t submit_bio(struct bio *bio)
> {
> + unsigned int count = bio_sectors(bio);

Chaitanya,

Could it have a single empty line right after this just like you have
for the if-statement below for the block_dump. It's just a nitpick.

> /*
> * If it's a regular read/write or a barrier with data attached,
> * go through the normal accounting stuff before submission.
> */
> if (bio_has_data(bio)) {
> - unsigned int count;
>
> if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
> count = queue_logical_block_size(bio->bi_disk->queue) >> 9;
> - else
> - count = bio_sectors(bio);
>
> if (op_is_write(bio_op(bio))) {
> count_vm_events(PGPGOUT, count);
> @@ -1145,15 +1143,16 @@ blk_qc_t submit_bio(struct bio *bio)
> task_io_account_read(bio->bi_iter.bi_size);
> count_vm_events(PGPGIN, count);
> }
> + }
>
> - if (unlikely(block_dump)) {
> - char b[BDEVNAME_SIZE];
> - printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
> - current->comm, task_pid_nr(current),
> - blk_op_str(bio_op(bio)),
> - (unsigned long long)bio->bi_iter.bi_sector,
> - bio_devname(bio, b), count);
> - }
> + if (unlikely(block_dump)) {
> + char b[BDEVNAME_SIZE];
> +
> + printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
> + current->comm, task_pid_nr(current),
> + blk_op_str(bio_op(bio)),
> + (unsigned long long)bio->bi_iter.bi_sector,
> + bio_devname(bio, b), count);

It would be great if non-data command is traced, I think.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>