Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp265973imu; Thu, 3 Jan 2019 19:19:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Npk7pJlntnOsQGkTaBCivBxOd8aal7a6Mzyp496KWcsM2XMkek+DSGVz8A1UQ/ogX1DSj X-Received: by 2002:a63:ae01:: with SMTP id q1mr233550pgf.402.1546571979825; Thu, 03 Jan 2019 19:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546571979; cv=none; d=google.com; s=arc-20160816; b=Dqa+yvIXhPoBRv3e2rhpSxlO1SVgNX2dZFS67NwbqcUHzRPRihjmei8BTGnQo/+vxN CuJ0GTne+4jS7QSFF3OerZR9Kmbu7NsKFG3L5BC/pQf5dnJE9WJYEgCKV11+tdx8JOW4 EAic4NT8H0JiWQTBngCbukIDQX1kWNX6TRlSq1uh9GaAHjKriDV6pJh18wYmmLPWtckD g+x+QmlS3Od3sub8o2ssj1ARKqUH1IcWdwq9kLuO7O7Fpk7vXBCcdhWMikPIUR1OThP5 e6PQN4iTODR0Zfe/4wtxxk6z2/hzZ7T6O8qSs9tzM04VT5/c9WSHCefUbu/sVWRgF5zt B4xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to; bh=MHjQLsB0Eq2e/1bfjHqjRZ80SsnrgHNek4EToUq3IfQ=; b=QZuYQqej3wAepzexp6az3lkh7iSX145qA0nWhq9pZHu1fdr+N+LpLFu5NJ/I//8NeG zBc23wAIdM3pO0/iIHfawcTF2XTC/UmmP55e8Mh8zZr5HWWvFYaodRQsAMX9FXVvxl6b 9prkLWenDTLy2n8I7CCMQaZBN3o3/ZFr/Gi9ULj9akmK2qlCiBDK/hJmMYkjpfbCOSdX DVFzrwGhKzyj/vdBWTPUyZgDjku06DcqXwxt+rZfby7dWUcVX3s5H9MEKv/I1QR8zb2t 1hJHEBhbOJBq/KvgX12ZE7E/1AxsD/YpgPeZWCaSaqRad43/l4aQGpk5aEtHzH1iakJ+ AuIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si54563722pgg.339.2019.01.03.19.19.24; Thu, 03 Jan 2019 19:19:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726729AbfACVAY (ORCPT + 99 others); Thu, 3 Jan 2019 16:00:24 -0500 Received: from smtp.infotech.no ([82.134.31.41]:50880 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbfACVAY (ORCPT ); Thu, 3 Jan 2019 16:00:24 -0500 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id 2133420423B; Thu, 3 Jan 2019 22:00:22 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MKwROC4O7+Tz; Thu, 3 Jan 2019 22:00:15 +0100 (CET) Received: from [192.168.48.23] (host-184-164-16-103.dyn.295.ca [184.164.16.103]) by smtp.infotech.no (Postfix) with ESMTPA id 37558204191; Thu, 3 Jan 2019 22:00:13 +0100 (CET) Reply-To: dgilbert@interlog.com Subject: Re: [PATCH] scsi: associate bio write hint with WRITE CDB To: Randall Huang , Christoph Hellwig Cc: huangrandall@google.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181226041504.66283-1-huangrandall@google.com> <20190103075133.GA5141@infradead.org> <20190103094755.GA96532@google.com> From: Douglas Gilbert Message-ID: Date: Thu, 3 Jan 2019 16:00:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190103094755.GA96532@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> --- >>> 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