All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Bart Van Assche <bart.vanassche@wdc.com>,
	Omar Sandoval <osandov@fb.com>, Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 1/2] blk-mq-debugfs: support rq_qos
Date: Fri, 14 Dec 2018 11:11:47 -0800	[thread overview]
Message-ID: <1544814707.185366.425.camel@acm.org> (raw)
In-Reply-To: <20181214113926.7451-2-ming.lei@redhat.com>

On Fri, 2018-12-14 at 19:39 +0800, Ming Lei wrote:
>  static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
>  {
> @@ -856,6 +857,15 @@ int blk_mq_debugfs_register(struct request_queue *q)
>  			goto err;
>  	}
>  
> +	if (q->rq_qos) {
> +		struct rq_qos *rqos = q->rq_qos;
> +
> +		while (rqos) {
> +			blk_mq_debugfs_register_rqos(rqos);
> +			rqos = rqos->next;
> +		}
> +	}

Have you considered to use a for-loop instead of a while loop? That would
allow to remove the if-statement and hence would make the code more compact.

> +int blk_mq_debugfs_register_rqos(struct rq_qos *rqos)
> +{
> +	struct request_queue *q = rqos->q;
> +	char *dir_name = rq_qos_id_to_name(rqos->id);

Please change "char *" into "const char *".

>  enum rq_qos_id {
>  	RQ_QOS_WBT,
>  	RQ_QOS_CGROUP,
> @@ -22,6 +26,9 @@ struct rq_qos {
>  	struct request_queue *q;
>  	enum rq_qos_id id;
>  	struct rq_qos *next;
> +#ifdef CONFIG_BLK_DEBUG_FS
> +	struct dentry		*debugfs_dir;
> +#endif
>  };

The indentation of "debugfs_dir" looks odd to me.

> +static inline char *rq_qos_id_to_name(enum rq_qos_id id)
> +{
> +	switch (id) {
> +	case RQ_QOS_WBT:
> +		return "wbt";
> +	case RQ_QOS_CGROUP:
> +		return "cgroup";
> +	}
> +	return "unknown";
> +}

Same comment here as earlier: please use "const char *" instead of "char *"
for constant strings. Otherwise this patch looks fine to me.

Thanks,

Bart.


  reply	other threads:[~2018-12-14 19:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 11:39 [PATCH 0/2] block: support debugfs on rq_qos & wbt Ming Lei
2018-12-14 11:39 ` [PATCH 1/2] blk-mq-debugfs: support rq_qos Ming Lei
2018-12-14 19:11   ` Bart Van Assche [this message]
2018-12-16 16:04     ` Jens Axboe
2018-12-16 16:09       ` Christoph Hellwig
2018-12-16 16:13         ` Jens Axboe
2018-12-14 11:39 ` [PATCH 2/2] blk-wbt: export internal state via debugfs Ming Lei
2018-12-14 19:15   ` Bart Van Assche
2018-12-16 16:07     ` Jens Axboe
2018-12-17  1:10       ` Ming Lei
2018-12-14 12:56 ` [PATCH 0/2] block: support debugfs on rq_qos & wbt Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1544814707.185366.425.camel@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@wdc.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=osandov@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.