From patchwork Tue Jun 26 00:10:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10487605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46F9C604D3 for ; Tue, 26 Jun 2018 00:10:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3955028707 for ; Tue, 26 Jun 2018 00:10:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C96B2870C; Tue, 26 Jun 2018 00:10:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32C9128707 for ; Tue, 26 Jun 2018 00:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934572AbeFZAKO (ORCPT ); Mon, 25 Jun 2018 20:10:14 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:55853 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934280AbeFZAKL (ORCPT ); Mon, 25 Jun 2018 20:10:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1529971813; x=1561507813; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Uih0HXZoFWhtKgvp79mEUVS9LkbrdPSzBy8tuJc9QAo=; b=eEs2giwokQ1VmFd7Wj9Z5Y9AqXGbeyumlSYrvXgGwfFzyaco0bYLzUn/ K4nhmbQSsPpH2bafB8Z+h027fDXYIT+MXJFD/CvKy/kweLtj3xmmYQhvp 5RJteSQGXTLqJcQ4ivBNowN07FScLx69MntwSf6WHtXFQJfJaOSke0TbV 5OFI1+bA4B8gLzzlZzuPTakR5ix1I91+iE9VdLmwghSsO45JeOX0Nx+tw qrO4fKdkmwgSsZDOVwECR0QJwp/tU7fjhhAYrKNgKEdtx/IoZdJeQQoLh lR/VdSJzChiR5lJaaoopio5Z4axiecDcYOagv1bmkBTsQ4hBB/uAGLNWT Q==; X-IronPort-AV: E=Sophos;i="5.51,272,1526313600"; d="scan'208";a="81809624" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2018 08:10:11 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 25 Jun 2018 16:59:30 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jun 2018 17:10:10 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , Ming Lei Subject: [PATCH 2/3] sd: Remove the __data_len hack for WRITE SAME again Date: Mon, 25 Jun 2018 17:10:08 -0700 Message-Id: <20180626001009.16557-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626001009.16557-1-bart.vanassche@wdc.com> References: <20180626001009.16557-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that blk_rq_payload_bytes() has been fixed, remove the __data_len hack again from sd_setup_write_same_cmnd(), the function that handles REQ_OP_WRITE_SAME. See also commit 08965c2eba13 ("Revert "sd: remove __data_len hack for WRITE SAME""). See also commit f80de881d8df ("sd: remove __data_len hack for WRITE SAME"). Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: Christoph Hellwig Cc: Ming Lei --- drivers/scsi/sd.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9421d9877730..89da86308aaf 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -947,8 +947,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) struct bio *bio = rq->bio; sector_t sector = blk_rq_pos(rq); unsigned int nr_sectors = blk_rq_sectors(rq); - unsigned int nr_bytes = blk_rq_bytes(rq); - int ret; if (sdkp->device->no_write_same) return BLKPREP_INVALID; @@ -975,21 +973,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) cmd->transfersize = sdp->sector_size; cmd->allowed = SD_MAX_RETRIES; - /* - * For WRITE SAME the data transferred via the DATA OUT buffer is - * different from the amount of data actually written to the target. - * - * We set up __data_len to the amount of data transferred via the - * DATA OUT buffer so that blk_rq_map_sg sets up the proper S/G list - * to transfer a single sector of data first, but then reset it to - * the amount of data to be written right after so that the I/O path - * knows how much to actually write. - */ - rq->__data_len = sdp->sector_size; - ret = scsi_init_io(cmd); - rq->__data_len = nr_bytes; - - return ret; + return scsi_init_io(cmd); } static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)