From patchwork Mon Apr 20 23:36:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 6245001 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 69577BF4A6 for ; Mon, 20 Apr 2015 23:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F88B2026D for ; Mon, 20 Apr 2015 23:36:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EDA02026C for ; Mon, 20 Apr 2015 23:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753471AbbDTXgz (ORCPT ); Mon, 20 Apr 2015 19:36:55 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34075 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbbDTXgy (ORCPT ); Mon, 20 Apr 2015 19:36:54 -0400 Received: by pacyx8 with SMTP id yx8so221879808pac.1; Mon, 20 Apr 2015 16:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YYNyCv6IrI/dD3sYjKx4fxsGpMaJ3SRgX/lqgRvdwJU=; b=bGUBDRfFmhodoU9hkLGssoEyz+uC2axBAJTeUOxtkKS9I0/rJkwTM+664LUXkLo2aG UGPlJPOK/M5nx2KX3Xpip5zfzIRxHwPSH4ckRfzMCznaC9AFBWP3o0IUdqA/loe7Sxnt tAlMyuAya1RnuGyERNmIH+38X7qU0+w4xCx/3gcOocqtsAa8N6UXVGiD3usebKGWrgpu GHwUmmdxyTKL0tZE2JgErn2+dImzWJopEUTVMvTw3PpPDo4f/CDZMN5zaPORHTIFdxLq 8bQFXEmF0AJIH/M2zkYu/AoyqVa/FZwp7pKNOtMS/uSwRDCCOHapbbkpU2dqXzPbiig2 f5Iw== X-Received: by 10.66.62.201 with SMTP id a9mr32184286pas.101.1429573014147; Mon, 20 Apr 2015 16:36:54 -0700 (PDT) Received: from localhost.localdomain (KD106168100169.ppp-bb.dion.ne.jp. [106.168.100.169]) by mx.google.com with ESMTPSA id f4sm22995pdc.95.2015.04.20.16.36.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Apr 2015 16:36:53 -0700 (PDT) From: Akinobu Mita To: target-devel@vger.kernel.org Cc: Akinobu Mita , Nicholas Bellinger , Sagi Grimberg , "Martin K. Petersen" , Christoph Hellwig , "James E.J. Bottomley" , linux-scsi@vger.kernel.org Subject: [PATCH 4/4] target/file: enable WRITE SAME when protection info is enabled Date: Tue, 21 Apr 2015 08:36:22 +0900 Message-Id: <1429572982-6809-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429572982-6809-1-git-send-email-akinobu.mita@gmail.com> References: <1429572982-6809-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now we can generate correct PI for WRITE SAME command, so it is unnecessary to disallow WRITE SAME when protection info is enabled. Signed-off-by: Akinobu Mita Cc: Nicholas Bellinger Cc: Sagi Grimberg Cc: "Martin K. Petersen" Cc: Christoph Hellwig Cc: "James E.J. Bottomley" Cc: target-devel@vger.kernel.org Cc: linux-scsi@vger.kernel.org --- drivers/target/target_core_file.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 829817a..200d9ec 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -381,11 +381,6 @@ fd_execute_write_same(struct se_cmd *cmd) target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } - if (cmd->prot_op) { - pr_err("WRITE_SAME: Protection information with FILEIO" - " backends not supported\n"); - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - } if (cmd->t_data_nents > 1 || cmd->t_data_sg[0].length != cmd->se_dev->dev_attrib.block_size) { @@ -401,6 +396,14 @@ fd_execute_write_same(struct se_cmd *cmd) if (!bvec) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + if (cmd->prot_op) { + ret = fd_do_rw(cmd, fd_dev->fd_prot_file, se_dev->prot_length, + cmd->t_prot_sg, cmd->t_prot_nents, + cmd->prot_length, 0); + if (ret < 0) + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + } + for (i = 0; i < nolb; i++) { bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); bvec[i].bv_len = cmd->t_data_sg[0].length;