From patchwork Mon Apr 10 16:08:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9673157 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 B61206020C for ; Mon, 10 Apr 2017 16:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F5C926AE3 for ; Mon, 10 Apr 2017 16:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 945F7283E1; Mon, 10 Apr 2017 16:09:10 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 2C6D526AE3 for ; Mon, 10 Apr 2017 16:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752372AbdDJQI2 (ORCPT ); Mon, 10 Apr 2017 12:08:28 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:44623 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751812AbdDJQIZ (ORCPT ); Mon, 10 Apr 2017 12:08:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GeJa7X8K1hvoZGX3VYVZEWSHWYIh2bTMXX8LSW/WQJ8=; b=cQM/1iZWHJiETE46VBy642b77 DAgxaIzuF1koJWHHjCavZz57oWW/QTJQj2zeNY96x1j1pCOhd0UU5sUG9fLQEbQis6ZW8/qZfOEFW 6M1c95Huoy2d9N+VnwgzB22q7dMOA8PsX+hGHcSfEozMprLhTLsbMYRWVCHejLDV/L3/wAI1rGSGt cR4HT/C+OEab7epnZH5zOJzi2FyQXdj98ovELy5xP6TtFnQ4D3uDNAW/7WLAvOTWWdHR5oAshy+0W 463xHkMs06wNzPwX4II07P6HV41l9sMr5sbLGGLaPfNY4uXx2pG9H/0vJD5eOH3Nehwxc+cAu+SvO GPdxA1XnA==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cxbrW-0008N2-Nn; Mon, 10 Apr 2017 16:08:19 +0000 From: Christoph Hellwig To: axboe@kernel.dk, martin.petersen@oracle.com, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, target-devel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, drbd-dev@lists.linbit.com, dm-devel@redhat.com Subject: [PATCH 3/8] sd: remove write same support Date: Mon, 10 Apr 2017 18:08:02 +0200 Message-Id: <20170410160807.23674-4-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170410160807.23674-1-hch@lst.de> References: <20170410160807.23674-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are no more end-users of REQ_OP_WRITE_SAME left, so we can start deleting it. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 70 --------------------------------------------------- drivers/scsi/sd_zbc.c | 1 - 2 files changed, 71 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8cf34a8e3eea..a905802e927e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -878,77 +878,10 @@ static void sd_config_write_same(struct scsi_disk *sdkp) sdkp->zeroing_mode = SD_ZERO_WRITE; out: - blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks * - (logical_block_size >> 9)); blk_queue_max_write_zeroes_sectors(q, sdkp->max_ws_blocks * (logical_block_size >> 9)); } -/** - * sd_setup_write_same_cmnd - write the same data to multiple blocks - * @cmd: command to prepare - * - * Will issue either WRITE SAME(10) or WRITE SAME(16) depending on - * preference indicated by target device. - **/ -static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) -{ - struct request *rq = cmd->request; - struct scsi_device *sdp = cmd->device; - struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); - 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; - - BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size); - - if (sd_is_zoned(sdkp)) { - ret = sd_zbc_setup_write_cmnd(cmd); - if (ret != BLKPREP_OK) - return ret; - } - - sector >>= ilog2(sdp->sector_size) - 9; - nr_sectors >>= ilog2(sdp->sector_size) - 9; - - rq->timeout = SD_WRITE_SAME_TIMEOUT; - - if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff) { - cmd->cmd_len = 16; - cmd->cmnd[0] = WRITE_SAME_16; - put_unaligned_be64(sector, &cmd->cmnd[2]); - put_unaligned_be32(nr_sectors, &cmd->cmnd[10]); - } else { - cmd->cmd_len = 10; - cmd->cmnd[0] = WRITE_SAME; - put_unaligned_be32(sector, &cmd->cmnd[2]); - put_unaligned_be16(nr_sectors, &cmd->cmnd[7]); - } - - 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; -} - static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd) { struct request *rq = cmd->request; @@ -1232,8 +1165,6 @@ static int sd_init_command(struct scsi_cmnd *cmd) } case REQ_OP_WRITE_ZEROES: return sd_setup_write_zeroes_cmnd(cmd); - case REQ_OP_WRITE_SAME: - return sd_setup_write_same_cmnd(cmd); case REQ_OP_FLUSH: return sd_setup_flush_cmnd(cmd); case REQ_OP_READ: @@ -1872,7 +1803,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) switch (req_op(req)) { case REQ_OP_DISCARD: case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE_SAME: case REQ_OP_ZONE_RESET: if (!result) { good_bytes = blk_rq_bytes(req); diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 1994f7799fce..8af6c9cd30ca 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -330,7 +330,6 @@ void sd_zbc_complete(struct scsi_cmnd *cmd, switch (req_op(rq)) { case REQ_OP_WRITE: case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE_SAME: case REQ_OP_ZONE_RESET: /* Unlock the zone */