From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: "axboe@fb.com" <axboe@fb.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"snitzer@redhat.com" <snitzer@redhat.com>,
"hch@lst.de" <hch@lst.de>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"hare@suse.de" <hare@suse.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"don.brace@microsemi.com" <don.brace@microsemi.com>,
"james.bottomley@hansenpartnership.com"
<james.bottomley@hansenpartnership.com>,
"osandov@fb.com" <osandov@fb.com>,
"loberman@redhat.com" <loberman@redhat.com>,
"kashyap.desai@broadcom.com" <kashyap.desai@broadcom.com>
Subject: Re: [PATCH 2/3] scsi: read host_busy via scsi_host_busy()
Date: Sat, 28 Apr 2018 16:17:27 +0800 [thread overview]
Message-ID: <20180428081726.GA7325@ming.t460p> (raw)
In-Reply-To: <6112db0045837d0583d4b30aa4a1fd2bc4bdc239.camel@wdc.com>
On Fri, Apr 27, 2018 at 03:51:46PM +0000, Bart Van Assche wrote:
> On Fri, 2018-04-20 at 14:57 +0800, Ming Lei wrote:
> > show_host_busy(struct device *dev, struct device_attribute *attr, char *buf)
> > {
> > struct Scsi_Host *shost = class_to_shost(dev);
> > - return snprintf(buf, 20, "%d\n", atomic_read(&shost->host_busy));
> > + return snprintf(buf, 20, "%d\n", scsi_host_busy(shost));
> > }
> > static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL);
>
> The ", 20" part is cargo-cult programming. Since you have to touch this code,
> please either use "sprintf(buf, ...)" or use "scnprintf(buf, PAGE_SIZE, ...)".
This patch is only to replace atomic_read(&shost->host_busy) with
scsi_host_busy(shost) which returns 'int' too, so nothing related
with snprintf(buf, 20,..).
No mention the string with 20 length is enough to hold integer, so it
isn't needed too.
So I don't see any reason to do that in this patch.
Thanks,
Ming
next prev parent reply other threads:[~2018-04-28 8:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 6:57 [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Ming Lei
2018-04-20 6:57 ` [PATCH 1/3] scsi: introduce scsi_host_busy() Ming Lei
2018-04-27 15:47 ` Bart Van Assche
2018-04-20 6:57 ` [PATCH 2/3] scsi: read host_busy via scsi_host_busy() Ming Lei
2018-04-27 15:51 ` Bart Van Assche
2018-04-28 8:17 ` Ming Lei [this message]
2018-04-20 6:57 ` [PATCH 3/3] scsi: avoid to hold host-wide counter of host_busy for scsi_mq Ming Lei
2018-04-27 16:16 ` Bart Van Assche
2018-04-28 8:26 ` Ming Lei
2018-04-27 15:31 ` [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Bart Van Assche
2018-04-27 15:39 ` Jens Axboe
2018-04-27 15:48 ` Bart Van Assche
2018-04-27 15:55 ` Laurence Oberman
2018-04-27 16:19 ` Jens Axboe
2018-04-28 8:47 ` Ming Lei
2018-06-22 15:29 ` Bart Van Assche
2018-06-22 21:43 ` Ming Lei
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=20180428081726.GA7325@ming.t460p \
--to=ming.lei@redhat.com \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@fb.com \
--cc=don.brace@microsemi.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=osandov@fb.com \
--cc=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox