From patchwork Tue Jun 28 20:02:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B7D7CCA47E for ; Tue, 28 Jun 2022 20:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbiF1UMQ (ORCPT ); Tue, 28 Jun 2022 16:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbiF1ULx (ORCPT ); Tue, 28 Jun 2022 16:11:53 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8EE745537; Tue, 28 Jun 2022 13:02:55 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SJBVqU006351; Tue, 28 Jun 2022 20:02:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=vDqx+3+BhHBkQbg1kh9CEIH62EEnJrJ9BDupq6pbeak=; b=RMGegNfDvo0U9GOJapykfu/axd07lIds6kXZ36Th1igxQqbEpyNPEIjq5MVTuKz927Hx 7q5GHik0wyPv3n2JTXAmaKdjSk0ULvF6DX+9SKjjSc1t0CLuI85B56b/jAF43VCt/mAA ic77Bx/aAEvCP8IcsrH7EN/ulZrzNfyGiBKj6Dv6G2LZvMY5IycXzb/fvgMinRxp1YdH h3x+0KLbsoLa7fYDXgvkBKpZVIQF/wSZ9SAlBMU9YTTUAr/H7NRrtGBcJYiFtFoivk9+ tl+gooM7q+LcZ3ygzaH30OfARjTTYOg4ki69a8V0SStZqX2HeZIRD+VB2xONLf7bmAkc kQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52f6mg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:48 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25SJtS1c033544; Tue, 28 Jun 2022 20:02:47 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gwrt25gqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D4ICu2IbcPh6iZXcIPcToJnWIy2QmQQgx8RwqtF3YYuzzS0pvKsOzCnMYnihC4eaYtlcRbTHSzmKIRA9mD7RWhcyYcKRN+f0iv+24Jp2YUuhJNTt8rRw63+NSSMy6Son3C4WeQJ6iXy9lIH31l6ekkfZrWjBLM+65xr5s9lWlwViKnlqAQ+J2i9eWaEUFQqy3vO3rqf6/y1rFdgiP0KvTTfT0z2pdomKnuuGMZncDTKpM4eJquig91RoAwYL1WhtfKD10m6X1T/sO4j46h99jhZI+j0wxa7rWiAGP+rjhaA00zYd2Dbx/61154/KGC06sDne8uDDvlHNgv01jK5rtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vDqx+3+BhHBkQbg1kh9CEIH62EEnJrJ9BDupq6pbeak=; b=enJ5ffnY/7tYMaLWUTKFoiYcRErOHG5UJHbaa7BXMI2g1XjL0FnckleM17X5w+li/028wYyFbo9hHTXXB7LQolpTiHPlxZP/fhtJInbhHxdchNC80KN6I6z6HWE6aZikS8ZuVLTNxAPUJ132g/wjYO1B9w0cd9gj8lc0kEXSwXi0PavUQ+4yrV/xQS0eXi+aST8Q9aXCzRmOvSnQZl3R4GPFlLfVZFdJmThlUzbUYT+L2fmxJGK/DsBh0RgQZm1mHn58Ghj/1OpdBXsQ2cYVEmkvMmsSHwcK5NhjijXsYWxqzYssPnpFo0JnpZQDD7IOsypoDHlY9/FiGhjATCmGdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vDqx+3+BhHBkQbg1kh9CEIH62EEnJrJ9BDupq6pbeak=; b=Em8CZT9pwGCt4GaleFgnPTbfak6CNd/6O8ZJpj+eQem9blDWwzHsEQjyCu3wsIaNtwmgHrkDKFG+0WksXlEe32he3D9zHndB2vW8QzvwPzdKXyeqruxJHXsoZKLtXow2yrCXtKtaOTWOIZ8BDU6f0S7SSoVGMz3qqgRFH+9fOPY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY4PR1001MB2376.namprd10.prod.outlook.com (2603:10b6:910:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 20:02:43 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 20:02:43 +0000 From: Mike Christie To: hch@infradead.org, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Christoph Hellwig Subject: [PATCH v2 1/5] scsi: target: Remove incorrect zero blocks WRITE_SAME check Date: Tue, 28 Jun 2022 15:02:26 -0500 Message-Id: <20220628200230.15052-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628200230.15052-1-michael.christie@oracle.com> References: <20220628200230.15052-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0019.namprd21.prod.outlook.com (2603:10b6:5:174::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c50a8b37-ba16-45f0-a3f9-08da594126d4 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2376:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m2SC/eZ3iU6ekQu/YbEakiBfQjl5FRT0ZeUAEygC9rVK+djg5K/KFnWnynnQPLKAdu2/nDgU5FpYPyOTPtSYNnoWqlYW1j1HMAcOTYkcJb11U9H3dVFCxONKb8YUzHxOYQC1KeCoEr7446TeqIzDNnvHXw4M5qnAt15W6NT4WkgJfcpG9tPhKVqCyz1tkivfHhF86qED5LRiJ3YQqAGsC2yrSS4hHM8DbOAG+OUXLde7vzECid9CEaEtobazdKzv0FFk7IJoY4hi7NQLHIcWq+mn3R+qcZe7O3noau2l7YGjh6bvaBO5vVlyqW8aBCW7uju6gdYkmIhSx17GeolfsVnjo/VMbdFFM7cdM6MWgTdJCvw0WG+HMMWQKLOK+ft1va441Lq8KnrvMR0NXzy6t3/AlxvEyEQ6NE+uZ2oNl2qONTzUmR7m70NCAum8c3s3UeIvbYe2VWAJPVRYbq7zqwj5hOHrbMUeu8aNkIisfwFN/klvZHjAMtJXn2zNJ1TEhbTeFIymqKqTllnpAi9AmdzEe9Q4KaLbx7tBL73Hwc72Wm7rT+1WV0YaJ30vuxzWVVmW4niCyti9Qd142A8tiWkVs3fssjABaWiPD/szMaxT/dBUsJJjt+4oQpUYmidR3LDR/G3G2kOk8cqAN47yeGOMVLTrBDhUc6X4MHMmau68g+WzgwxCvva4U9RhQG12AGaAhWYXKl8U+9l4m+r2c4Io/CP0CBR5fxHpG31zRbxkV80OfXUKnOcp/DmMsr4D7qByL4wb9bOJSKTT4HMTnCSXBLeAaRbVmhWA3A9EuJE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(136003)(396003)(39860400002)(366004)(376002)(186003)(83380400001)(8676002)(6666004)(6506007)(2616005)(52116002)(1076003)(54906003)(26005)(41300700001)(6512007)(38350700002)(38100700002)(66946007)(36756003)(4744005)(4326008)(2906002)(5660300002)(478600001)(86362001)(6486002)(8936002)(66476007)(66556008)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Dit+AFpaLAXYxN3tAsTdAreuaqChDhfYmRee0yLLwIVqVdDb8YElaqragGR9t3D/h5YJDkyVYURntnYA5jaMqkrThtxlM6IIEFWkMfcbGLzU48ztwEDQyz82X/qc8uEX1Lkuw5k5A2Ojpfb7rFb0ZuwlR2ZqU2SRRfp0rFmLcxUR2PNJ5/cg1WfkO5+x0cMk0jH1ecyuMv5xhQPL9er3f6ec44KCxDr47q1TktOD80sy6CAka4mr7f7TJyk+tkhpwcy/GS7AHEqnSXSAeWaNZHyGUjtcda0roySfVYTeaUN4Y5/6Q7KFCrllVDKA+wMWuLMb7TcvWxaI4zh67iuiY43iD6h0KCyLGShqKxg4d++w8nryrWbdQOuNSjb801H+3h8OnS3jLhQwPZBSguV1Fpn9/oKNC3Hc64ijMeXG3m7ldqa5lO6oVYBt5CI2FxylLyi1NlRPW1LSypL8YFXqFBJ0JIFGRrlL4kz2Gmuv9P5DBlw3wtPRvCRUoR00nmCp3xOqGw7+dY2jjVcD636eiQ2SYA+xchA1x03pLZqX+L0282wYsxzncXkGWA+faMqJKrEqVK/mSDGWpMo1Q8ZWEearlCKkkH/sBW4SigRiVPU1qugMXp7O2RCXDRe2o4dZOgmGjmPwqctPdVkanXbSK9/X+6vp366Kfb+HZFfNazWH0ErYVnQn2kmBoWm30Z+dsANT5bajArZUqfWLnMrsubVriJfMVeT1VOPd7OegiDJXRn8sEPxaRu+W8NTzvjKxm+DLoRHHx5qFr7ayRgsXOD+hbg6F62XmgUT7hlt4kQZc7rKlUyhGgsX1UdHPRfgsTGlrxf2v4xsSuGpdTPn0WJJCn1q9Tz3uVDafm0wNJP+YdqjmGnl4yaM+4f6vlb9kHHM3MAGgkUXaqAA55HsgfY2Qzwy+FsuCt+VbS+AId3Nh03ReKZCTcecrEQkGo07G/An6dPOjKYF0mmq1lzD++r5RjNMeX1lQ7ipnvjWO9Iu2k1vfe0ZnO+ivZTCjmxBFPMOpwWmosNWOvNzeCDKzGj2mMbCkKstuJJK/tFgavZ6Kv1+B+bHE2T6cIN2rK5hrh+x2xnn1BpUPhPz3YjBRsaFUWnnBwGnCTFC9++HodXabbIQEVvrNqRJudsYKcqGWzHklFVTdeYVIYseC3tmHjefNwy02XedR8shtoGMvW/dEya8WtmHGwekiMslzWunoaNgpZYGTF/9BdleoothX2qKLJityvs2KXNA8R8ZeJOpHiS46iOUYu9QSSVH8iWSX/3XgnZ/2pL1Csy+hwDaYI9EV0ldu22NE5ROiMACifcNNz1YM5NvADeM0rkqFx83U6M+7O5aJTnWjpnFNDIdnLCCS/Etb5/AvMllvtUQgaDeeV9ELVX64h1n5XBPjd9ztiEX+6s+y5pVhTyP0Ep0Ei6IkIt3nt3WwI2pTvL8lyebZZkGzBfrWnMxCaS+/VzTN0vZsVf1fAOso3OcRi95t1woX0AkwTU+77mMVmAJ2oRnrVs/PCmci6Wey8KAr0/W6h5gFOJoxaZObnCziOtVfNZ+X8Lu5VoB1ViL2C/FeLctGjKrLP26sosJI66gXPh2hGlGqkJ9BEVmjdLPYllQGYA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c50a8b37-ba16-45f0-a3f9-08da594126d4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 20:02:38.7281 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S2dsOTuRaGX6W4+41eEbgzrQ7S+pDeGqR7hYMiXcKPVti5Od7VSt2tI7YLV4DBa0Y1KF5e6Xt/aZr+cY2AaYZg2x0FU7OAtQvG4aUAwsMM4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2376 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-28_11:2022-06-28, 2022-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280079 X-Proofpoint-ORIG-GUID: xceHaC2WOqstjq7N5nTyB2CCwynct-rU X-Proofpoint-GUID: xceHaC2WOqstjq7N5nTyB2CCwynct-rU Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We use WSNZ=1 so if we get a WRITE_SAME with zero logical blocks we are supposed to fail it. We do this check and failure in target_core_sbc.c before calling into the backend, so we can remove the incorrect check in target_core_file. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/target_core_file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 6c8d8b051bfd..e8440e5dd804 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -438,10 +438,6 @@ fd_execute_write_same(struct se_cmd *cmd) unsigned int len = 0, i; ssize_t ret; - if (!nolb) { - 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"); From patchwork Tue Jun 28 20:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 585780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E441C43334 for ; Tue, 28 Jun 2022 20:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbiF1UMS (ORCPT ); Tue, 28 Jun 2022 16:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiF1ULx (ORCPT ); Tue, 28 Jun 2022 16:11:53 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82FE53B004; Tue, 28 Jun 2022 13:02:56 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SJBcSV006374; Tue, 28 Jun 2022 20:02:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=kFbTvsAWX4HwQghk2vUrSsLuau40KP0ZwpgQ10Xvtuk=; b=qz64AYyige3Lz2n3oFX59vId1XWOmTjSByKzz7/p8OW7oqcPSgffEdpeKnbDbaBAsreK 85FVvPVBGArVM/Zt4AeZijKxZK+5NLHen3V7Ng/dh6lnIMyv2Dx4qZ6+8+HudEzKsmH7 mzgg5KYye3SPlz9dQDTUPV2y4MGqdTGydDROAM1XMJOCI8476M1uJYLWM4pnKwzCPSus b1GXU+4KUlkHbO7ohAGmb8+zFFLnlvPrOR0gX/faibvl2gKRnTnwqMfOBpHge3RHurpi 8juhI5Xob8nVs8Wzcy2udgk2gjga2NqZ/ofI93sWynH1fibbDRlbKHGRDtiBPYjQtDUk Pw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52f6mn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:50 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25SJt6Cb033237; Tue, 28 Jun 2022 20:02:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt88ax2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O9+xMLohGAqCFtCnHSDj4KhSTtUIy/knYzcCLNZkHQVLT0zSziWetkGHGDB229QVo9z/xtJe4iHrdjeVlcSCIuR4sbIZDc00d7LI8IiNI+tkvXrIyxS07uUokqA3WflbpJ+HtC/IgehmaqIDTa5EvY2rx9+EjWZg6GYde+kl4edNTfgEMRxbgiomb/uW08tWFokioKdpVeb8AHr92csUwMvxDsH0EYDqDcPUevo+H0ncM9jQm9iCts/nsZY0WXnszi7Hzn0bn1oR8T+r6eNe4GfQs8B19/IyoJAKgCeDTsL3AcUHRdHzAn/kFYTSe0VImXGLR7qObn3bdkKkLs/00A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kFbTvsAWX4HwQghk2vUrSsLuau40KP0ZwpgQ10Xvtuk=; b=Huh6RFj9wZJFN9MoapcIMtVNxuw/7Zj63kHR1IefsfGG+MhdcKWEAuuzDl8hQSb2bfX5oXr0QOL7PYbF6j9iUgjd/tUwPAzJSYLyva2GezgTgdR6S/Cuhn3y59UGviUBNuObSj+pkJMK4SFlzKz5i4HxcRzwqna/wE99rpwYBus9FfbFdMClSJfu2WzjxOntjQ0w+4Hbg3TD2A00PKqonECia16bHGHhnjihNSdN4oi15tGocW7soIemPyYMmkJTBHPWAlvrRjSF+y1mTFrVCJrhRK5piC9WEIBbugxcH+iZLm4qm/BzAH8/AOXvoaScVGTVV00QqPWLr8jG07U3Nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kFbTvsAWX4HwQghk2vUrSsLuau40KP0ZwpgQ10Xvtuk=; b=ds3nJbQO0NpoDcbV0rSE7F7dqO0kQbpDQVWYjsgnfFen/0+WLchNmmo34JA8b5f9Mfr5jOTtbBZFh1EB34FfkTGF3E8yYe/nlPLS7RmxcJ9Xol0xObK+qgxaei2F9Svmvpzy2wcMOZXMdeIW4V17DeFxoGW60BEJUEjtBsQMYAI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY4PR1001MB2376.namprd10.prod.outlook.com (2603:10b6:910:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 20:02:46 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 20:02:46 +0000 From: Mike Christie To: hch@infradead.org, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Christoph Hellwig Subject: [PATCH v2 2/5] scsi: target: Add callout to configure unmap settings Date: Tue, 28 Jun 2022 15:02:27 -0500 Message-Id: <20220628200230.15052-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628200230.15052-1-michael.christie@oracle.com> References: <20220628200230.15052-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0019.namprd21.prod.outlook.com (2603:10b6:5:174::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7bd3255-1e5e-45ba-b02a-08da59412744 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2376:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j57NoiBvK23vjJ0gEoDwIEFpoVpjNnwbpDW67ObdkmXo2SVLy093e8/BSI1QLjwL+RzCWVZHKtXa1dIDLknfmOs6P0dZgqxhiX7hVYxkjmayV0xAQbjH1w+sLdLvi3oSGvxWZ5hnbhh6LIMHElhEiDAcwDz979pkfR2eAnfiBOHpB1E9afrmFyfKdsu9pinqw+71xUuAXJM6lL9SOE3B+enjJAmyuNxmbI/8AiB14VjvqCF1oWC25kwC+0OTrBqN716PSK4Obr9FxOK7OlRu8KMefsIcvEHn71YXwNoHKo1SLCFoBEiWkV2vYaCPgycK2kCSu68Pwk/VXxvSHvC8KXii92X+IbHtCfMNOFz9oLHGniU0nMWTmGj7xDnH4UwCL1HAk/K+uHKonGESisx4bQHaxuJjpz6ArQIrI6nkhdmZAafQZB/nYlDPEYxAGYtdtvtLEILg+mQDAN4WaY69eEDs7YkPzzPCYyuGFdQoR1jntEekojN1AZCh3JMEND5IHvpRJyR0xZLa05PILa9gte7rC1wqjmmSI1UiwsvukJ95gg3d3ZiPlZpb0X3dVH4av1lLRBUEUX6jFkQuSQGr4TYd58klylFQeNlla5zLk8Ksr1noaUN+XKFiGdQtzSn7+NdIKKrruA4UBLGD4sKnDDY8Vcc/LI2zb0kEK6pbAL90eBcPGreb9lRsvPViqBGsFP1SZfb4CsJqoBE/f2Z1GEe8/cz9OmaSUT7iMC3yqfPft+zt3A/orN0GTdmfAk1tqAoDICG+Gri0Au9OyOJg5Ms3qWMdOQVlkuYafYw5BJX27IvVOruOTb33NAvTKti7 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(136003)(396003)(39860400002)(366004)(376002)(186003)(83380400001)(8676002)(6666004)(6506007)(2616005)(52116002)(1076003)(54906003)(26005)(41300700001)(6512007)(38350700002)(38100700002)(66946007)(36756003)(4326008)(2906002)(5660300002)(478600001)(86362001)(6486002)(8936002)(66476007)(66556008)(316002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zbEzBwYZVAHndiREfdRSyB9de/fnKnS/3VDg2vCj1D+Vhq9G3A74xUqWooDPSSTe/Kd/IZGMhHzPyC+j60FHGna3CeyC67tQxG6u5vcCpTw7tzmiKqDurYsculkYlxUt32q+X5z6jiaesMMZzlsnKyJcIsgi4ljEgwlqO0ouTTzoWMNHHPDEmLQE42vRXBvW4p2A41H/Ncct0S/67Ddlb9k/ewgYEqkJ/i1JJ5cVwk5sZaBBRe4jD61Vmi1yqYQ2LwYLugCnHZrUoKULUQM0FS+8v2Fxaqwzu5GpZbx0mZYBRJy9XDqA8iqnMZ639XwDljKyZEDt2++ZLq3YAWbWBFzdLOGRypuYAZysb0KKiBA7i4mXsFpxlL1Rip7XTKEQU1+l0SSDNR+c3U2RF693XpBq3bVY7HqwSfO5oyGgCoEgeUxxLj59vVNOgjEd2qi5wA8FX7viJwe9Q4d+VfpxUd+ajx7yMDSua9Y2JMnQPvaiYyosDoyhO4wQkMyKdOiuK0znz9B36whpJaDzoXWIqEkBsbJOgiyzN95EWfflfCTEGdtj01C5qcpCmfOuol1pz6AkcDh+h2diMqMQN7M4ka5OUAer5YwW/X5Vot8kPkU2+S7N6uu8Z+m0gPwupv91q7OipJ9Cqr5JgIm/8pfMFm+W+oWpJIVkKzCw5dQ1hsNrYRZnFYy9B7aeHsh69Dlyz8ohmjIRZYpATjZjuArBQDsVlDpMRaXPTiobA09eNEMZHAXEGgs7c8lErBUgVuIP6H7fa4v5ZDdGgCd4KsNcf7N2UEQ2Voa2f+WWjKMDTqODVnTRPeygkjRF/HUaCEo5TmHOocPYbKXGQ7GCtEtMSDqSy96Rh5tWOoLDUqVYsL9DEo/quTTX9t/rDiFGg1ieckMlcsJ6xUsT6YCGPSD54QRNGQdh8wMPZXLOH+SqfcwL9pWQQQHPQIncjoa5jrrTwfR2M483MO4UxyaPhFI4eGCGPZ/U5kN0/YkMjytT9/uK3v0bJndanh+F8Y6nBsOzvYCkDPjsfarrsWqP0u3t7FscDtsmSxFGRTJ0XL1hWmUjcyuLDaZRGI7R/3GUs4asbxz3VXn8e5pci/cx331x+9VymGsHr7hmMp0fbDFm0ccKlr5e/d0OuOj5TX18t70nAnVeU+zn/DIDRZ9GzPwZCAbKYisXF9ceyO1YhW/XfB9dB2VR6+Rd0Eucu5oOpGg0lYC4JLGrHACH0fCw8bBLnjL7Yg9wvL7gaX1Ga+QlYUvFgauwek5BQhUTPNi2Q9enIq5JQztUvzxrDZpSp4/sEf91wnt9NNGMLDlHg7vrlriCSA0t/oKE1hFkjL/9wKqXcnreMY5EIXXOPKaljTdG0EiivpYV7ESiJg4FPRu9MCQgsatWfUdDlfoXflyOuTZDUy6DGcpdcQQAA/P4vNmdQ7QOJt/J+KHzy/ZV7/WrJ/1Bgp3H1M01icDrShR0YdfPNDnkw/G+a9lpMbzJmnl2Y4tOiVjDnhLmxrdTo7Rx/NpumKjOmo4wVNv7TbfBRhQekfM63PZYZ9sVyscXFZEo0SvjeTUYtWkY0RptySfDA2kKkQoyznhaXR4bwMbQh+cOJ98FLwXoEhXAh/FSaPTCew== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7bd3255-1e5e-45ba-b02a-08da59412744 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 20:02:39.4624 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XSraHa39ZgEi8unAaHnCjxJGeHlSjr1jx42YMjEihcSkUzQalWGLcK8JpRXIXV41QsvchU/tFIWWculbZZorYqfKrMpiKtb6VQzZeJ5kimQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2376 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-28_11:2022-06-28, 2022-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280079 X-Proofpoint-ORIG-GUID: UaAt6L29US6lomP3OkN0erGjLdHM7mCT X-Proofpoint-GUID: UaAt6L29US6lomP3OkN0erGjLdHM7mCT Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds a callout to configure a backend's unmap settings. This will be used in this patchset to allow userspace to setup unmap after the initial device setup similar to how we can setup the other attrs post device configuration. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/target_core_device.c | 6 ++++++ include/target/target_core_backend.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 25f33eb25337..086ac9c9343c 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -960,6 +960,12 @@ int target_configure_device(struct se_device *dev) ret = dev->transport->configure_device(dev); if (ret) goto out_free_index; + + if (dev->transport->configure_unmap && + dev->transport->configure_unmap(dev)) { + pr_debug("Discard support available, but disabled by default.\n"); + } + /* * XXX: there is not much point to have two different values here.. */ diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 773963a1e0b5..a3c193df25b3 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -37,6 +37,7 @@ struct target_backend_ops { struct se_dev_plug *(*plug_device)(struct se_device *se_dev); void (*unplug_device)(struct se_dev_plug *se_plug); + bool (*configure_unmap)(struct se_device *se_dev); ssize_t (*set_configfs_dev_params)(struct se_device *, const char *, ssize_t); ssize_t (*show_configfs_dev_params)(struct se_device *, char *); From patchwork Tue Jun 28 20:02:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 585779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA407CCA479 for ; Tue, 28 Jun 2022 20:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbiF1UNF (ORCPT ); Tue, 28 Jun 2022 16:13:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbiF1ULz (ORCPT ); Tue, 28 Jun 2022 16:11:55 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F3E2D56; Tue, 28 Jun 2022 13:03:04 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SJBcSa006374; Tue, 28 Jun 2022 20:02:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=6782uCgRws/oZZR0w+xgF2N9igQAqYZ3Y9IlxYvShjw=; b=CLYhCDoFeUkuYOWwM9itUHVuudaaJ+LjlI7WOAqlgyrQxGbRUiM6ChDFmhSZW0LiKod3 PAyRmJIF3vjcXiLZdbAySthIRp2jPwfIO0okey6gYkDxqmplOY5CnyaNdXrj1r+G+VpX BQWSKoXX0LhToZINa9bIJ17Sp1sGeSDo5rEz+UDRL0j1bP87xNSWBxeLhMPOEN2+aJRL kbsM2xiLgJuBzSxdjKycXChbfohexysCAUqFG87cCjnD50SNGH/vZO6mHpjhT2KcAoJn X60e/fMOtDjsYnZ7sos18aROFdCMUY9Jd49ZWkUdjJt4641vRo6Cp1E8Jjfzdgjx8Wit CA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52f6n6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25SJt5vJ033186; Tue, 28 Jun 2022 20:02:58 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt88b0m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:02:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GhXE14oih5J143lVUgtDUm0gSSfZitB3vSz14ZdC9mmlbyhNnLgvLXtfjdga58wAqW0pnz+LKFKVbMRzwBui6uVH8E0lIrXkt9yLhhsQzBMrD/G1z+YlMHOE0M1I7uRjF8v4M1uWqQPWlnQ4raxlWRVBxZ1MWKpPAeRQtleXWCc8N0oLkDuTDwigfPb0Lda/V7Y5dbymfzKaICeyzxvffJ13cDORoKo9krkIuQZM3WvhBVz0mZRhTEwsKTNoZpDuEVbpynGvw58GkeSohteApX+qzuGsUbkt+wvJOJwWoDIRa4hfCbTrsW1V20ae9RjJBegh76SREWMUCCYiNhtDCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6782uCgRws/oZZR0w+xgF2N9igQAqYZ3Y9IlxYvShjw=; b=IS+9zO7caQLFABCjHJwwmCrw9ZaedU/kBUh8pHjg08cATYV/X0rT6xYf6k6f83ZfSRKvAn7AHVNUPVUp9PG9E6ThyKj/EvaGgngDTBdUt2ifbNIk5MPjVf1Y5NmKNNGI6Qr1bQxqvB8H4kv36IBdx/LSkeRcAyoWawRLFIp7WEvCeWBIaOkQMCXzu0g+buitlFWe9ACvtY3SyXS3B71Q+dnG60wJOeCxSdgeIv7816gbQ+BUOV1aoJ9jH04FQNsSV8uPbYasEGaqRDmPT+IW0YMzZrMPtUeQhWyhuu8i/agJ7ryxAz7FuQ8sfRTb5pR/eAzfEJdeqzuKm0VYft8WKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6782uCgRws/oZZR0w+xgF2N9igQAqYZ3Y9IlxYvShjw=; b=X77lmIaZ8ADgc4VYOf/5RBsg02ORjYYKRIo9eMMP77+9Fcu5TuYpxs6ypynHpYD1YBNPNSjEOF+MV1WV3d6A8wvumVO5wwCVJguW3uu1QNXq7Z6A5I0xMhQJQ5+OEkjvhDmrcsrDeXSDfobW17Ge3pTlrlMohUwz/u0Bi14Baw4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY4PR1001MB2376.namprd10.prod.outlook.com (2603:10b6:910:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 20:02:49 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 20:02:49 +0000 From: Mike Christie To: hch@infradead.org, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Christoph Hellwig Subject: [PATCH v2 3/5] scsi: target: Add iblock configure_unmap callout Date: Tue, 28 Jun 2022 15:02:28 -0500 Message-Id: <20220628200230.15052-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628200230.15052-1-michael.christie@oracle.com> References: <20220628200230.15052-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0019.namprd21.prod.outlook.com (2603:10b6:5:174::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80f35a96-7b64-466e-9580-08da594127ad X-MS-TrafficTypeDiagnostic: CY4PR1001MB2376:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lHUw34vpyTkzkTkm/D17aowCuLBysNyFBHhwXYgxR92nuXP2U13bSdQc8W/ILK20ZCjvW2Nyq0yBLHlm8nhDyLgupSIY/+W+UYBox9O9GGMpsxAEYISo6H6JHMvg0xBovMP9XaiTQhqDoKrpx/8L092SHOCfLNzYT726L4TaJgt4PUKp0KEuFGp0O9Z7cnAMPr0XwN30Xq/CBTFzPxtwjyrDJMLI30BlTloPhfmUrC/Xo0ASiLYiRq8lSamP/Xt1k9WUSSgiYrc35/FqnszUsJVVFYGDtwvi+v+IzBvry6SmmaZZ/AKYLQfhJ19FuIAYMpnOedJAz9Gro7qt9kMbfDR4h727PHjVX6KSezEDNT4976oLBxv/UPBKTsDUoF9zQRaFe+czRwuncfxK48ZAVHhTIMNMiLYud9Uu2b4oS4cVD8eq/0PdkhMvmDCLIoU9Ba03EpmPKgln5Q2ENLKtlVXjTqBrKUg6jaup4WU3WCWQvV8I+xOkpjXtn3GF0JK9qZ3AmIvTtX262bT8Zgc7xA3GroNzdJjDPuYp80WisWrmP7zIgDfF/fWErhmObTnRYUnXa4pyp7rx22XG286+MMFwGR3TnELDvBhdQXh/bI+9SPyxTRJyi63MA4meqnsCHBKqPm8GSaoCN/2TpvtwdKIaLpPxnA9J/LJUzGO8qFNOyE/7kREPSwOlPP518smKYKcFs+1fJiUSx6ptN9CZnalfhgUE4fmihSQ3dxOA9R62iVw/c1x04PUzyaRtHa5suBuKfYmDVEAF1CmT6TGEXwPy1Y/Hy/7ecvNq7mvUpF8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(136003)(396003)(39860400002)(366004)(376002)(186003)(83380400001)(8676002)(6666004)(6506007)(2616005)(52116002)(1076003)(54906003)(26005)(41300700001)(6512007)(38350700002)(38100700002)(66946007)(36756003)(4326008)(2906002)(5660300002)(478600001)(86362001)(6486002)(8936002)(66476007)(66556008)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0vfNBmFMkk1fKWJh/UZM4om0KH8EO5T77EXgtBpn65EYHW7CmSsElXMq8pb9+/bAqjK615xbYy5X9AKgpPHFzaJw6bkHljXSjMbV2ps8NnDXe13udV+jQMzKZoJq4a3iKCYB4wCDLkMMCRv9sHKj6RbYULIAyX4fJ4V77WBTiwAPPwxNJwodmyfOms3PWSDKmNODxVtqoW+n1jDzVk++IT9qccEIotgDCGbQOgaHJZcNe/rdu1DUq+6zYnD6+JjccrsDO7zwWn+XJ/jOyZSZMX0lv5F3DzUM/iJaFDaiZfdDvBDOoR1mOD36U9u26rtAzDSDvUDbwmYH7Na1EjlYtdCdxQt4UtOE7W61q1f84dAH+xGq2N+iKHftNr0VPBzYCjTuqtOepBHZ/uvBU0c/cXPrXlO1nZR+b8jo1mmv1IzNhxSQDdx9QCpMXSOiYtSmHQasUzY5eIBGeCDdlM2IksiStAj+/vx2d8uga4/8H7mKe6isJ+5FygkIBMuz4MxaxJnW7ofg7HLpVf34Tjuh9oDYGbcZyJSmk3KnHIdSzGGwct63xTcTl51ZBWlgwBGgOTkXyDoTqvTHnzwU3HLEVEG3J2Z7OGci6kRlSPi9aYjPXd015OCAVfqFLtbP/r3s+Fkos9js6+KVe3pB77KxoOzz7rMx429mDH6xo3ayUVzumVNM5N+19/xbv4cVDm1hfn3dPxHIJJ/BbEHVKL8LR/6CUQoM9vLceITfD5T09uu08d13KHhsrzGJebARmoOarImX2s/LEw+kB9sK9qKfpiqi+zRXCniWOxuw2mfMotuqKnsyRV6xM+v+CdqeY7f6LFvicpoKFdu9UB00rYF0HhDHQDE5npg9678lezDdfkv0NBp2VV9sIbWRtQwva+9XfXUCNZK+/G9wdxDwcSYZxrPRcyKJzI/znpJJ4mnkRi7DFGJ0gx8wCtYNJP09WjKCM3OqQLLJb1LxWZipvETVdgKEkDRHAiy5gNLRib/FUtLVrHi/wV+zBsmTWb543fDejlGV3SLx0Esn+4rq/3us1ZtZoSSjRDErOq6bC2JvYRmQWKTx5WcvGiAr9IKjGGKMOsN1zj6MsMbX9r4tT5Wkvl0CywuIQl7g1bU5Rd/9dqSCTtdQeVCogG9Yicm4ZGOaobceve+5R/m4mHOOfu239+Txi6ghWrxs41fra6WbhuemRupb5LiusiyP/rSIGWGHB0fXq68gDao0RPhQK943McHKzPUs0EdOoMzzmMq6+BcX4H8A+84BwX95RvuUpoPWLj5wQdHHJ/BTbwlz17vpwilpaZznhAzyNQHttC7wkqXvbwCsNB8qQeUF/wytLwKVT7Bv2BB7Uqj1d2/fc9rJtKe5T5UKvQdxoRA4fkV5tg9B3ukChFZEWxf/EFgsMFF+h6b600M082mi2tcfkOoAlNaWMTcmXbJzMPSqGbhRyl2HdMM5oJEbWLzo4623n2lrbYh0HsnApVT9d2Z0ekndNCkdtEozWIBrG3ou70XLV8njq2rXhyW5nr9g9rZKwwdI+qaK0nTBFi6S5egDA3dQvUGg6lV5KpgTjJQGtSH9vzSw3PwSSGTvsrUAsq7Y+PaaMMVV1GbFY+IbCgyOUG4VSQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80f35a96-7b64-466e-9580-08da594127ad X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 20:02:40.1655 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: inDQtlQvycPEZVBmOE3G8RYGDBaxI10zzuvnZEdVQ7qzxPGH1aHt7w8hxHrkEUVz6/80HXN1Paojmqbu3pC6qeoNNtzxOEdpXS0KSmo6sUM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2376 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-28_11:2022-06-28, 2022-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280079 X-Proofpoint-ORIG-GUID: tGuPOTzciTMJ57bw2oowM-HMgDvQEJ-D X-Proofpoint-GUID: tGuPOTzciTMJ57bw2oowM-HMgDvQEJ-D Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move iblock's unmap setup code to a configure_unmap callout. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/target_core_iblock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 1ed9381751e6..7bef97097b78 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -76,6 +76,14 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam return NULL; } +static bool iblock_configure_unmap(struct se_device *dev) +{ + struct iblock_dev *ib_dev = IBLOCK_DEV(dev); + + return target_configure_unmap_from_queue(&dev->dev_attrib, + ib_dev->ibd_bd); +} + static int iblock_configure_device(struct se_device *dev) { struct iblock_dev *ib_dev = IBLOCK_DEV(dev); @@ -119,10 +127,6 @@ static int iblock_configure_device(struct se_device *dev) dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); dev->dev_attrib.hw_queue_depth = q->nr_requests; - if (target_configure_unmap_from_queue(&dev->dev_attrib, bd)) - pr_debug("IBLOCK: BLOCK Discard support available," - " disabled by default\n"); - /* * Enable write same emulation for IBLOCK and use 0xFFFF as * the smaller WRITE_SAME(10) only has a two-byte block count. @@ -903,6 +907,7 @@ static const struct target_backend_ops iblock_ops = { .configure_device = iblock_configure_device, .destroy_device = iblock_destroy_device, .free_device = iblock_free_device, + .configure_unmap = iblock_configure_unmap, .plug_device = iblock_plug_device, .unplug_device = iblock_unplug_device, .parse_cdb = iblock_parse_cdb, From patchwork Tue Jun 28 20:02:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE76CCA479 for ; Tue, 28 Jun 2022 20:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229599AbiF1UNE (ORCPT ); Tue, 28 Jun 2022 16:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230450AbiF1ULz (ORCPT ); Tue, 28 Jun 2022 16:11:55 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 719912C66A; Tue, 28 Jun 2022 13:03:12 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SJBWTK012398; Tue, 28 Jun 2022 20:03:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=TFmH33paTvH6YlZKdpHFk+ritk6F7f2maGo7L3AI/7Y=; b=IPc0JTo1vVo8ItA3+pfaXHNHD4eTL21QBCUfKaKCdOVdjWQ+1TYbqlhmBwlaV0vnAvnQ lr6fPBlPHl9l81zQvx6Cqx7wxIV9+Yln4cdsU1yZ0Bf47/mNOpbMdGPlmc2qPSuweOVA GveQROVszpDfPQ2bKlg9+Q+XAzNsinde3iiaGsSXUBkUY7PqswkixHu7CKZq6HpAYugD wETEWE3VgqwLEcOBQbvgLlLguRXy186u6gupVNSYJ84+jZTSEl0BjwyIBlCqhaBUt74y dDRgA7xO1jkakcBWDPrsNjosB/Rj0Vz783jGPQn+I1xerxl89dFkRvlw1SBJYXZrF7Dd Rg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gwtwu76ns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:03:04 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25SJswrC004573; Tue, 28 Jun 2022 20:03:04 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gwrt2v4yk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:03:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fC2rmiyG3gHJDkacN/PFsJyTKZUbted2sy0QHv876nq9uG9PIaAbN14l5c3L9brAOlhtaSJczJRDF1lD+z7tGVjAQRPEQWKQ25FDYikAaLY62FBb7XuTGU1LxQjI/7hQhIq+5Rp8O7FX6sTN5paoZEkmLh9VMzzk6gy6ozvXH0I3lyowv0TIAbMo3k/dv/EgZvu6Soc+vg6yLmIf27yeBsaIElqJevYxmg9QB0XlYUJbjqqodmFzsbE07F0eScUlYpsD3wqKjZ/qPFZDqKsAqYBqrdWyZG+DlLnejGDOyntqpFuLvybrclfavbkFyYmbRw++xULtP51F34FqPWZwyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TFmH33paTvH6YlZKdpHFk+ritk6F7f2maGo7L3AI/7Y=; b=cQneqqr+A80iNrEXFl5eP927rjJXRc52SrJfUIF3WnYXJVt6J+T2esIR02I+5onRChWCt3IHm3rAs2h7baV67VAH1c5PHsculI0jTNW99bCTiXadicDnEkp9Yz39Drhn8JuRC4Pla5s2k6HwBxxcWoolIvUaVgD6irSN+aZfj+uZRWphMWl+z1wcAtEbRiDLKQRFL6PE8MMTZmHzQONoIp6ya2daKofyolLVoePg69+cHO2VVhf6C2tfJE9YdTKYChjNDJwmTM3Zrm46Y8FIsj2CWfop8BcmZjBuL0UhW87uTIauoYJP6SWLbvzC4devMoFzr/EEeF/kE7LU26DCLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TFmH33paTvH6YlZKdpHFk+ritk6F7f2maGo7L3AI/7Y=; b=U+7/Exr8UzI6tEK59dmSdSORnokHItObTkA6QgNTslW4dC9v7lX4Tv5x2R46q3sU0GiFb4SKJlmsfwhZtzXSWSTKP4YCjewSoQ6ExJub50kP/KRi5s4YkuZ6STKqgTXEphX1EfaS72pe8Goxt6T9o1yL9HltwgDVLzLqrB2i7k0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY4PR1001MB2376.namprd10.prod.outlook.com (2603:10b6:910:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 20:02:57 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 20:02:57 +0000 From: Mike Christie To: hch@infradead.org, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Christoph Hellwig Subject: [PATCH v2 4/5] scsi: target: Add file configure_unmap callout Date: Tue, 28 Jun 2022 15:02:29 -0500 Message-Id: <20220628200230.15052-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628200230.15052-1-michael.christie@oracle.com> References: <20220628200230.15052-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0019.namprd21.prod.outlook.com (2603:10b6:5:174::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71594733-7ae8-4c3e-dd1a-08da59412818 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2376:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qCNwSFBtL4sYap9+kH/CoUF/eA7gUNljSoLyOckpdWWtPShG6hhxS06CxJtaPi6ORtsft3HPn7Azy68iYdFbCulRCcrAdaanrMegeVhn6u6HAQXhiteXjVXFgiVVhVaUZ7gOdRekSseHAJIzUnxnRhsrUWT83br042WbqQI+8o2pHza8BN+2uvaVo0AEmg1xd2XRg5AdzD1/OVzyn5fph9ArTLr4oNe+M97gQEBhnKHXoN26zktoUwYXp3NJcwGG2kR3/AV3VO6v/6tteRWQNt0eszsFbmXr6vvFezkZoCcSSHNaEF9VAFmZ6ACUmHLQbGtQpiJZcLHI8AfXBbzJGvu1CuQlnOruu0it5dlvDgs4aCQOMZhjmgG8VYGoZgkHiN4w2BckKV6z5e7mOjuNzgEKq5ZB1AR20rYk+yGPfgJobMCx/RrtWvlF7igBljV+A0LBG1oOxMvaHxYeD8ykcU2V1fYD6TJ7cLgt94p8NR0GE+0rgE5gb1qyXRFm0/v6Cua6O5UGgJphHdUfYRyJX5T1W0sx/sj0UQ7PdQxJ4liO61k9+hu7EwKudigADi87KGduA5o/br7eWMeJ+UyKmn1ZOMw5whhUqhOqxS5DTtHjis6Klq27omb3DAa37rOXdgXK3ZkCCIKjf3ZWzFk+ucGPDF0ChCIXUwhrmrcjhx3+ESAmaLLV8rPRTmz+7oouT5nZXxnwW9YAG3yzR0v7R8G0rR+oznJ3quTJ8TQuwGjmZodgxpJu+gKVxKwu2iGGDp1O3VAJ1FjXkSHw2MYG4xQoU7ewUba9FXla1DEFJLY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(136003)(396003)(39860400002)(366004)(376002)(186003)(83380400001)(8676002)(6666004)(6506007)(2616005)(52116002)(1076003)(54906003)(26005)(41300700001)(6512007)(38350700002)(38100700002)(66946007)(36756003)(4326008)(2906002)(5660300002)(478600001)(86362001)(6486002)(8936002)(66476007)(66556008)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rxAKMVUJcbZ5kdZaotK71OikRRFurjAKu+loJuCfxj10soszVO4Kbfwh1140EqXWv72FUipNka60kfuJ4Alp3SVb9ulRVV++HEQpb1KQax80WKigOo/ldlaWihBh1VYmu4QHMbYUj2dOYViaXs80FLUOcpG5///YnX9wZw62vHtjLz2tji8k/fbBDdeeOQ1WXYFJTXcxJtt5w9RpYOQku3B13b0MbHKgxQkctv2EMyTrYc+R/5N+9hdvlZ1npP6mgtzEHQ0V/GNgVL+nmcopYL7IV8EMAfwHDihEpk/1OF8oba84x0FOhduyHRqqU7sZWYGsByG0l8X5RRge/tC56WGGbRtlNnuo4I6GfJA5RVzVGEAp/VxKcxkwkNUv1zCp/C7zMBBDOAJqqQZoCNsqUR86wXI2kiDtyVhG+Ltux330hXrIqm6g5NwOApsoTT+CFavo56DYiBDMrNQv0ofTnJQ6IcZCKlRpeA+oEoCB0kcYBkqTcwJAKxZE5Np83JWPadXiu1ub36JEoBB6/myuHxKbVCCA4NshzSmzy/x0bKR6I8AJPx0ygFLW7BqH4u49gym3Y6KlLrBGH8rWeKncJJNp6d3tbxXIlhAz4kkJstJ/DEc+W20GJIVkRpdpoG0QL/Oy8j0hZOekWKrW7wMqf/X8oiBjBsZgkkh4WGVpwT9dDpon1i1Q4XqOeS1KMggm0r9pgJWtBNKq0pBvXS1ep0Qcu1Fvv4hnLXswZajdu23vXPHLD3Zc7kYGqxqHQYo4E65JCgXlZ74qJ8UxbpBBoAW8tb0n3Fv8o9JkKBVtlgOuyCwN8fphkeAjHa/yJkv0ONTy+sTy90y8y8dQe+p+jhL8ASYsHzxAXDSrKV5GW8Xd+ZZ+FtQIbdlAIQz9+yEPCSTDhbEAQhe7ZEC3nB6468aFeP0mqL4EII6rbxSKNdrIDdoWizXJJ9mAryXhf4S9bwAf32hhfxOcnhzKV5kxzDFRR3I8i377ObeUu3Uh+liPCtyJb6ZZ/lsZOwYjSoN6B8CbTrToQk5kn5Ml5PmzcveqNdgZxvQqqIpuCWt8301QSSTFucKmeToO2RyMN4aqgyLcZj3Z5B0J7SBpnKc4CUVgEfSsNHkdW11zn29LI7cr+Azt26NJCQF7LOZxuiHbeFDJW6Hq5LtxwWDbypx4OxMb43L8542u+5i35aLEIeYAnC4UTK9QL+tQuPDOeKLmDi/Uj+1/kl3BN4I471vQAYjZtOKWti0DWgGwf0/L8lKNe7FD0zHfgrp20eN3ishe1LuDODmd1FBQcbBN087zfhS1hIUyByfGCeINEtof64YoHrO/27GZ4Hn8U5iD05KkE2z+FhXjYNC+wI+/Qm8w5rXdVZdYkZlVS/5SAVWlWtdu+qjHgFxBu6uZNH0u453k7cU0QYMMrxWpA3pGvQ2RJMajwyqftfxQI83PaxN2x9wXDIBU19YNAe/2lOZao5J7TH80pR56dCKk4itGFBVlD0ZDYsWTwDJH3NHrFk46XGb6G/SRrtVw2BEFr2uPuJK1WPUs/FewWdCW0Kd6v+5/z1HfD+XCd7vWsQHWYjDwr4ZbEJEv6Q0xoETURj9w+MAPXK5S8glXjT4eqIyT3EUCXQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71594733-7ae8-4c3e-dd1a-08da59412818 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 20:02:40.8373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xE2/+bKPSNKHLcQo/uMZhoVxjx96eIciXTz1Tw/KGW6nxieeCkQ7eSv6EE2gfrVaXHgY4Tdee1+OWAnGxtk01QrM/q39J2H2HPWTV/en0R0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2376 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-28_11:2022-06-28, 2022-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280079 X-Proofpoint-ORIG-GUID: hGGk0TnLxrkTDgC3ODwQpu9m5JElxwpX X-Proofpoint-GUID: hGGk0TnLxrkTDgC3ODwQpu9m5JElxwpX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move file's unmap setup code to a configure_unmap callout. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/target_core_file.c | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index e8440e5dd804..28aa643be5d5 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -86,6 +86,24 @@ static struct se_device *fd_alloc_device(struct se_hba *hba, const char *name) return &fd_dev->dev; } +static bool fd_configure_unmap(struct se_device *dev) +{ + struct file *file = FD_DEV(dev)->fd_file; + struct inode *inode = file->f_mapping->host; + + if (S_ISBLK(inode->i_mode)) + return target_configure_unmap_from_queue(&dev->dev_attrib, + I_BDEV(inode)); + + /* Limit UNMAP emulation to 8k Number of LBAs (NoLB) */ + dev->dev_attrib.max_unmap_lba_count = 0x2000; + /* Currently hardcoded to 1 in Linux/SCSI code. */ + dev->dev_attrib.max_unmap_block_desc_count = 1; + dev->dev_attrib.unmap_granularity = 1; + dev->dev_attrib.unmap_granularity_alignment = 0; + return true; +} + static int fd_configure_device(struct se_device *dev) { struct fd_dev *fd_dev = FD_DEV(dev); @@ -149,10 +167,6 @@ static int fd_configure_device(struct se_device *dev) " block_device blocks: %llu logical_block_size: %d\n", dev_size, div_u64(dev_size, fd_dev->fd_block_size), fd_dev->fd_block_size); - - if (target_configure_unmap_from_queue(&dev->dev_attrib, bdev)) - pr_debug("IFILE: BLOCK Discard support available," - " disabled by default\n"); /* * Enable write same emulation for IBLOCK and use 0xFFFF as * the smaller WRITE_SAME(10) only has a two-byte block count. @@ -170,16 +184,6 @@ static int fd_configure_device(struct se_device *dev) } fd_dev->fd_block_size = FD_BLOCKSIZE; - /* - * Limit UNMAP emulation to 8k Number of LBAs (NoLB) - */ - dev->dev_attrib.max_unmap_lba_count = 0x2000; - /* - * Currently hardcoded to 1 in Linux/SCSI code.. - */ - dev->dev_attrib.max_unmap_block_desc_count = 1; - dev->dev_attrib.unmap_granularity = 1; - dev->dev_attrib.unmap_granularity_alignment = 0; /* * Limit WRITE_SAME w/ UNMAP=0 emulation to 8k Number of LBAs (NoLB) @@ -923,6 +927,7 @@ static const struct target_backend_ops fileio_ops = { .configure_device = fd_configure_device, .destroy_device = fd_destroy_device, .free_device = fd_free_device, + .configure_unmap = fd_configure_unmap, .parse_cdb = fd_parse_cdb, .set_configfs_dev_params = fd_set_configfs_dev_params, .show_configfs_dev_params = fd_show_configfs_dev_params, From patchwork Tue Jun 28 20:02:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E2FFCCA481 for ; Tue, 28 Jun 2022 20:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiF1UNH (ORCPT ); Tue, 28 Jun 2022 16:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiF1UMD (ORCPT ); Tue, 28 Jun 2022 16:12:03 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC8F37AA6; Tue, 28 Jun 2022 13:05:12 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SJBcSb006374; Tue, 28 Jun 2022 20:03:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=/pNmDdT8p9MIDe2fOUZ0ESfMW/fxBIj0JHC1MvAQM/U=; b=rNpnLeij3XCAbp+pDO8ThSCp+Kz0NhkPaDNvImzqZqtR5Ftsi2DBl29vpTncvE+CQU/h 99/lm1PtA4TUmfTE5dNwgwsuJPA1Pho30gB2U1oJr/ki4Za4lQT5vjnzhz2kwQCmo+FK tGmnOFIvN122/rQRe9WWagP8mZ31Z+AOzapHOp9PSzSsGn/0Ak+fhlRwd8hhD4k5ahrO 7PVevW1oZoLp1iR6yyCcl4IpOF3h28LGg3t1WT6Hq2yJWR7wRI6aP0yIi5Ea2acAZJAB HB6rVtRYlI55RXIGb7fRjUrBIIbmKyzB+LXck9EdKh9Q6BizecjC+VZoNIVP004q+y/J bg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52f6nf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:03:07 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25SJsvOH004522; Tue, 28 Jun 2022 20:03:06 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gwrt2v50m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 20:03:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnM9FwEOIL1CI4z/f9UrYav3SpI1baNgE69AdMxSh/FsMiXIooiO0kdtbgUpcIRFo5lAlkQifaaMsQ/bT3uUwzZkL2p9ETZ3ESYMzeb2M8hHoKVZEkvZQsruj8dMtrvDnZXC6aYH1mZcAD7AgqV2F6N2jKieUv1YQpSZfUZFi5VbQr3TXkFBiA5ZJVpb1tJKvesMVypaENL5U4cHi9U8ibPNRUOgSzWEU0czEEmZJvYjSHrcKpbahbMkNGG7WG7xLYFz5N1gaDMNbOT+5SyLlwX1o4rP91qp5tNaiKUM8j4C5cuLSAypS+vjx6An83kGnC1TV6jB3aLX2OMDn09QLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/pNmDdT8p9MIDe2fOUZ0ESfMW/fxBIj0JHC1MvAQM/U=; b=mlBwTnkoE3fz6aoRC5jrn+cXCuO0YOW7oyk7Pgx+b8jfilVQu53wNgk53y7uuliGMYBw/+W+UuMSN4jlNmvcahKJ04NsyWLf5Xi87bxY+MweUI6hmZgcQ5ACgTAMX4vUSzuNfZHYtza0OvmWIZ9vlGqzEsTZrxRb7vQSb/7R3tTI76gXv5I/bEygK+Ro4IRX32RaJP9Pqul8EgPUlyrhnaKdwU9YRFxkRpVtBBGVUuKkoLZdxIta1NskSlCN4K2NuaujgngHwMplKUSwrmokaWq1zvlLxNT0Ed4MDd5ujs+hJ/AQPzS+cTr7DcNDNBplZsReWqQZ5nLFsOEee4bThg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/pNmDdT8p9MIDe2fOUZ0ESfMW/fxBIj0JHC1MvAQM/U=; b=VY30j+l/U1ARO1vbjntqcfU1Z3UCQMuxZfWF+NsW4BlzcQ8GxuKubqRM56U+AF0AQDjp+16TQxrpyCxshymQs5C+p3hH6evNXfSQ0qZ29TrVwUcgXIXHLmzj0EAcxLzgD6nScs1luDEJWuq5hPS+SJPijPVhBuRLJ2R84uQHYXw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY4PR1001MB2376.namprd10.prod.outlook.com (2603:10b6:910:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 20:02:58 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 20:02:58 +0000 From: Mike Christie To: hch@infradead.org, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Christoph Hellwig Subject: [PATCH v2 5/5] scsi: target: Detect unmap support post configuration Date: Tue, 28 Jun 2022 15:02:30 -0500 Message-Id: <20220628200230.15052-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628200230.15052-1-michael.christie@oracle.com> References: <20220628200230.15052-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0019.namprd21.prod.outlook.com (2603:10b6:5:174::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31c2a702-98d5-42b3-24ba-08da59412884 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2376:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zyJjEWDrMjj60UKtzsGr1fOwzjTLIVIfVacYmD/llePRP5cVqjKjtsDZARA7bj+pmtfPlnfPNTrbkHbebDeSrVzjk4Wo8/6nXeRFYoZT7GJkoakTnGZXJNIbnZltfh1h0DvtHR4diKbIbAR07tjUDaCSqvYS0vvi3Ry+ZTvWVEU8NHf+FDvXYzqW52IqTJgW4w1xb1nNKwc3zPt/PCJpWWeKFekFaPwd9w1mLi7SvE5rk311u1YiKCnVJxermcU9ZMTVHtQG8mpOJwRYGSKI8FgSpswbwsn+fTI9tS3o/XqWkXYPTUQ75EaAi3+x8Ql0tfKtu2NLmd5hppb0Tz6FBGI6Dvk9i8NRPQRnAaqIBFoCtKKAXjZEIOtjKp5oTrlIkp74jkbvee9s5ZFZpHtaHpK37/GH3yGLMzk4grm4mS7oV+xHi0hKYb2Vt+GeKjRFOwBpw2F8CimSgOiNqZOS0WQCG4JM6V/cajh43aPdCG5eYeqvTFvbelSgYAvWT+Lp8GGKE8oPe+ci4xwSt0nCC2CMI1EXmr8D0P8QY4/+OxmBO6yEHYfKPvEZlgFAVTaNBIv3tl2xOUxrItG7ItcuF8K24ugRWj4uUp6Y5fs6+iDBji+079l5ZBSP0766nyFF+IbSROGpWZAJU+R7k2/DWys8TChZo3FlJmOmcvSxDYItRfQnIVVpZJ9OnIMF88Iz3P2qVjWCfLSIpKuFMkBcliRiyqiBFr6p0G7wYv4LLEMrjH+d06W9Of79TdrJLR86iO48D3v+8R70Wu7xk3hjucgdf4Q3cQwmCTUAblxXKGI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(136003)(396003)(39860400002)(366004)(376002)(186003)(83380400001)(8676002)(6666004)(6506007)(2616005)(52116002)(1076003)(54906003)(26005)(41300700001)(6512007)(38350700002)(38100700002)(66946007)(36756003)(4326008)(2906002)(5660300002)(478600001)(86362001)(6486002)(8936002)(66476007)(66556008)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MVASGn2l++GcUU5LtURzJL0FkEbVcRoo5Idc6KD0iOE403VCprYYQ0juriBnZXe4rOY4XnEjpWl4fzKWAKnMy2IYCuDSeBw/UjUGjYjltOg7olVI3Yi4gXpQnp9l8OgxpsuQ629rMRXMSB1Ub4ZkJ56WQrGfY7H3Mcm3GNLDvz+J6hyevCuGmTbmj5TtMirfuA4QpqxRZ/n3g9sUw3EGznSPLzZOMbKrIP1H1YntTC3X7DzvH37DL+/E3ii8dOrnw9NPair3jO3ph/IBA7CrmYldbjbnz5uyXShbWnrFoIW0thssvj+rCixGEIXC9ighiNiTPFbRG1wTJzeH/EuSOHKmmyGyhWJ4hN25PiJw0wvtx2NobJdqnAyAf2yQHWLjaxMecpRPNUGpWx5ZjACeMSP/uFT71lTEH5TkjIWQvtPQ2BaZt8yPX1lQ2kO55MQLdMOsZ/3sByJE1mrpgPrDq4KKE2jU2NSRUMEPi9vBR7OLxjzBRrrYfK2Mev22iJwo2p370jh9lfuEaUtnayNRU1d5uB0+JLkW92WLYMCFv+Q1Xm2H7GvPraSlDfLft4WfdnoKYD8xHNf/bMRX2av+tfkAImiph1imWGtbz69DqD1ggUUH74BoQd3eSJ0PRQ0moJ6KtrTxGf49qzAZz/Sjggm2HzkmNkwFfPZz3c2AOQWKxPs6GtpkJp+xdmnJyVjorMnzvRjTB4F63GiHYHucAozBwESoi8ePo3FFo8DcWPy5OrPHhR9a913ifrZbOU3skMdbqhjzOJkN4QQeMObnXbx534dHN8k5VrQotBM4IAVqx76CpkM9YyMuN+e2wNNLp3M7b3T7bSE+N887qaOLn/bDMlEF2KNVi2EQEyuEzOQVlUhlyLVk1CUTsEfKL+4DxvjRhHxQI0gT/EtzFcEf8MVICndh3YaAp2U5frGwwz90JUg/WSy/Lu7enZkQixKqE/jLbtdgTR8Ogi7YqYLyXhA+sods3WKU58dLBQhXbGEgSkRdy8ZJTotludp8VUztXQyRK+L6VJOE4CW0Zf2Ux4nbbk2nPuthgLqMgFIr5nQFwqEAV4s7pCl7yHV9iFjvYhmzDlIYzHIiXXsQVqxJ4R/0wnbtCNUxEI2KpknOaVYTadvGFLVixjpU6Sunrs1+jmvWy0zNXd+1iH4XATFGukCiCg8P4+MQZ/7+KJkJxAfAqD7cQcg9qkGxvCefVD25rX+Z2N+de4KMLFXF8ya1N3zYBuUwPSEoFTURExIor1ZMC58LvW2swnIltJEGlJ3iRXxDzQojvKnb93J+ogeaPPaJtMzcQoRcndjGyylD70NtTD7kdgux5lzyMFnzLz+s8wgUl2hv2R+5xRwSWNzlOWBAtWM2jtOssae+IbIZSUrwwRDLJ2+Z8AYufE8bSQb89Ysigjrq5gzzUgV0sd+bIDs3vlUSQsJEDsnd2P7rDb5nsaHsjMCuxIZoXGLGvPWs9poVV70CPa2WVRWxicQSJz32xB3zjS9pqW4lhY6Ryh1kR3QDgGkzowa3v9oG2Fr7WLKZ6zlhuxZ7d4DVZDsGeOcHGt3IznP1Tq2vszkA/LyuRaP1PV0JSBvoh6/JpvXU2kb/JcbAG+efMTmaIOf6rQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31c2a702-98d5-42b3-24ba-08da59412884 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 20:02:41.5403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VwYIZ7ZYb0petBmLPqQeOWAI1KcaUl+rZfB77334Woz/j8kjcbWd+6qajXAGjNi6A6xU6q4NpAzhmuqbgt2eN8ndnF5Jn91O08v0akWaZlg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2376 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-28_11:2022-06-28, 2022-06-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280079 X-Proofpoint-ORIG-GUID: KHjtdYsBd2EtqCuNHdSEQXsiesvQo1A4 X-Proofpoint-GUID: KHjtdYsBd2EtqCuNHdSEQXsiesvQo1A4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On our backend we can do something similar to LIO where we can enable and disable unmap support on the fly. In the scsi/block layer we can detect this by just doing a rescan. However, LIO cannot detect this change because we only check during the initial configuration. This patch allows unmap detection to also happen when the user tries to turn it on. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/target_core_configfs.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index bbcbbfa72b07..f28d3c6dab98 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -732,6 +732,7 @@ static ssize_t emulate_tpu_store(struct config_item *item, const char *page, size_t count) { struct se_dev_attrib *da = to_attrib(item); + struct se_device *dev = da->da_dev; bool flag; int ret; @@ -744,8 +745,11 @@ static ssize_t emulate_tpu_store(struct config_item *item, * Discard supported is detected iblock_create_virtdevice(). */ if (flag && !da->max_unmap_block_desc_count) { - pr_err("Generic Block Discard not supported\n"); - return -ENOSYS; + if (!dev->transport->configure_unmap || + !dev->transport->configure_unmap(dev)) { + pr_err("Generic Block Discard not supported\n"); + return -ENOSYS; + } } da->emulate_tpu = flag; @@ -758,6 +762,7 @@ static ssize_t emulate_tpws_store(struct config_item *item, const char *page, size_t count) { struct se_dev_attrib *da = to_attrib(item); + struct se_device *dev = da->da_dev; bool flag; int ret; @@ -770,8 +775,11 @@ static ssize_t emulate_tpws_store(struct config_item *item, * Discard supported is detected iblock_create_virtdevice(). */ if (flag && !da->max_unmap_block_desc_count) { - pr_err("Generic Block Discard not supported\n"); - return -ENOSYS; + if (!dev->transport->configure_unmap || + !dev->transport->configure_unmap(dev)) { + pr_err("Generic Block Discard not supported\n"); + return -ENOSYS; + } } da->emulate_tpws = flag; @@ -964,6 +972,7 @@ static ssize_t unmap_zeroes_data_store(struct config_item *item, const char *page, size_t count) { struct se_dev_attrib *da = to_attrib(item); + struct se_device *dev = da->da_dev; bool flag; int ret; @@ -982,10 +991,12 @@ static ssize_t unmap_zeroes_data_store(struct config_item *item, * Discard supported is detected iblock_configure_device(). */ if (flag && !da->max_unmap_block_desc_count) { - pr_err("dev[%p]: Thin Provisioning LBPRZ will not be set" - " because max_unmap_block_desc_count is zero\n", - da->da_dev); - return -ENOSYS; + if (!dev->transport->configure_unmap || + !dev->transport->configure_unmap(dev)) { + pr_err("dev[%p]: Thin Provisioning LBPRZ will not be set because max_unmap_block_desc_count is zero\n", + da->da_dev); + return -ENOSYS; + } } da->unmap_zeroes_data = flag; pr_debug("dev[%p]: SE Device Thin Provisioning LBPRZ bit: %d\n",