From: Douglas Gilbert <dgilbert@interlog.com>
To: Randall Huang <ihhuang@abmail.org>,
Christoph Hellwig <hch@infradead.org>
Cc: huangrandall@google.com, jejb@linux.vnet.ibm.com,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: associate bio write hint with WRITE CDB
Date: Thu, 3 Jan 2019 16:00:13 -0500 [thread overview]
Message-ID: <e5bc96cd-1b48-3b7e-706f-4cbbd1a040a4@interlog.com> (raw)
In-Reply-To: <20190103094755.GA96532@google.com>
On 2019-01-03 4:47 a.m., Randall Huang wrote:
> On Wed, Jan 02, 2019 at 11:51:33PM -0800, Christoph Hellwig wrote:
>> On Wed, Dec 26, 2018 at 12:15:04PM +0800, Randall Huang wrote:
>>> In SPC-3, WRITE(10)/(16) support grouping function.
>>> Let's associate bio write hint with group number for
>>> enabling StreamID or Turbo Write feature.
>>>
>>> Signed-off-by: Randall Huang <huangrandall@google.com>
>>> ---
>>> drivers/scsi/sd.c | 14 ++++++++++++--
>>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>>> index 4b49cb67617e..28bfa9ed2b54 100644
>>> --- a/drivers/scsi/sd.c
>>> +++ b/drivers/scsi/sd.c
>>> @@ -1201,7 +1201,12 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
>>> SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff;
>>> SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff;
>>> SCpnt->cmnd[13] = (unsigned char) this_count & 0xff;
>>> - SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0;
>>> + if (rq_data_dir(rq) == WRITE) {
>>> + SCpnt->cmnd[14] = rq->bio->bi_write_hint & 0x3f;
>>> + } else {
>>> + SCpnt->cmnd[14] = 0;
>>> + }
>>
>> No need for braces here.
> Already send a new version
>>
>> But what I'm more worried about is devices not recognizing the feature
>> throwing up on the field. Can you check what SBC version first
>> references these or come up with some other decently smart conditional?
> My reference is SCSI Block Commands – 3 (SBC-3) Revision 25.
> Section 5.32 WRITE (10) and 5.34 WRITE (16)
>
>> Maybe Martin has a good idea, too.
>
That is the GROUP NUMBER field. Also found in READ(16) at the same
location within its cdb. The proposed code deserves at least an
explanatory comment.
Since it is relatively recent, perhaps the above should only be done iff:
- the REPORT SUPPORTED OPERATION CODES (RSOC) command is supported, and
- in the RSOC entry for WRITE(16), the CDB USAGE DATA field (a bit mask)
indicates the GROUP NUMBER field is supported
That check can be done once, at disk attachment time where there is already
code to fetch RSOC.
Is there a bi_read_hint ? If not then the bi_write_hint should also be applied
to READ(16). Makes that variable naming look pretty silly though.
Doug Gilbert
next prev parent reply other threads:[~2019-01-03 21:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181226041504.66283-1-huangrandall@google.com>
[not found] ` <20190103075133.GA5141@infradead.org>
2019-01-03 9:47 ` [PATCH] scsi: associate bio write hint with WRITE CDB Randall Huang
2019-01-03 21:00 ` Douglas Gilbert [this message]
2019-01-03 21:40 ` Ewan D. Milne
2019-01-04 4:57 ` Martin K. Petersen
2019-01-04 5:22 ` Randall Huang
2019-01-04 6:11 ` Martin K. Petersen
2019-01-10 17:33 ` Alex Lemberg
2019-01-03 9:55 Randall Huang
-- strict thread matches above, loose matches on Subject: below --
2019-01-03 9:19 Randall Huang
2018-12-26 5:51 Randall Huang
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=e5bc96cd-1b48-3b7e-706f-4cbbd1a040a4@interlog.com \
--to=dgilbert@interlog.com \
--cc=hch@infradead.org \
--cc=huangrandall@google.com \
--cc=ihhuang@abmail.org \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).