From patchwork Tue Jun 28 02:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586050 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 B9EFFCCA493 for ; Tue, 28 Jun 2022 02:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343748AbiF1Cdt (ORCPT ); Mon, 27 Jun 2022 22:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245048AbiF1CbO (ORCPT ); Mon, 27 Jun 2022 22:31:14 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95E462529C; Mon, 27 Jun 2022 19:30:11 -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 25S19MfG002132; Tue, 28 Jun 2022 02:30:03 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=whTYCkuc2PN1YhPwWr3BqNljE1zisoZXDAexTpoI9Pc=; b=GtnXa4KDm/aR0Koyi+cAjlmhumCzx+k8xr1Qa9zCSY/7LsnLhbNJDgjeHHTtXfTK/dQc bq8qDfoERNP4WzoDER4/yjjOVa9GrcoDHpfjbQP5fog0xzmOjqjA8IPlG1F7MwM1Hb6n 3n9756lbgbEHqcilybAuxbXAXkAjvGiI9RmqfGpXvfHUXTUMWF7AYiAN0qi+pYinP2L5 3fOvYFioWj+yVYr1sqB7188dRlze2xrsBITaZQtH3Zn84dB6hFXy8rvW4AxK9jMiDAO0 tSFdvdHSu7KITPIFroOF8GbUu+cWn+ijywWHx+AYfmrdXvsapMLL4KSeFHIqQVpKMLj7 0Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52csph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:03 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25S2KJsA018705; Tue, 28 Jun 2022 02:30:02 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt1t5vh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JxzS7gMko/egp9xDh2RFpH2YgllgkEx058gbnLc4NPNta8kyPphDR3f4fqm/pkDAHf6DdmCKwVaWjmaCWa3tErV3t754/nQjMTmKBiL4wde+Xn96WeYGTK4DmYjy6Jq+V9St+0ZAiQcXH/dmR4NL6wqBCP5biVQNV1P2FtTn3qXKNNjNhIWTWrR2+tzUD2d6d/OVRUYdkGEajoVnqWMUauuwV/qSt+JgaC9U4gSmTzWu9FZ8HRxbKQ6Rw/eYxwta5WriiXrK+v0mLtplu5CmolLTXNMsSEPSpehN8Nh5TBcIWYRC272aXkoBc06tIv5J3lHMuhy2YyP/4gIp7nzjGA== 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=whTYCkuc2PN1YhPwWr3BqNljE1zisoZXDAexTpoI9Pc=; b=ar5w/gm71GqAX6+XUAMwXoFdjm5PctGcSS8+FVIpntMfU95/De/ekTTZnFWATLKNnL0FQGlMN7DNfSXneVYCdP61k5wy+tK2zlDBZtRuIuqeI53ID1i6tf6g9Rb6gUUry4wKIk3ZtLIuFokbGNr2yv1svPfwP1IVy5K3BAHydffm/5y4Eu0KoGYvtSkCVFcKy9HdFvJo9u68IXVV/16vI/5aZel8FbqzenQl/f0J30ij0Wcr5S4pmIStO72WcPS3Wx8V0Gs3lUQtb00imjkeRTYSFoxcoOC9JoWqF82Y9oldLg9k2Ri3tAogIELJZFCobcJ+UccHfC39t7QVX/wT8Q== 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=whTYCkuc2PN1YhPwWr3BqNljE1zisoZXDAexTpoI9Pc=; b=NmCYK79RgDqM0l4ktryGDxNx3RRl2qlqRRGU6B0ZhGq8H5YN/mj6IKVnSNgbiF1Rzx4hv0FjUFZq7tDKvpW6Khm7ZRfhuvKuaKOyqQBdf9Q/zAVop+Z3y23IfO8MrfcpvIqVTi/ctUIgauZzsq2n8g8mSzi78TD4rRAOwCcD5LE= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BLAPR10MB5140.namprd10.prod.outlook.com (2603:10b6:208:320::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 28 Jun 2022 02:30:01 +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 02:30:01 +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 Subject: [PATCH 1/5] scsi: target: Remove incorrect zero blocks WRITE_SAME check Date: Mon, 27 Jun 2022 21:29:49 -0500 Message-Id: <20220628022953.20948-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628022953.20948-1-michael.christie@oracle.com> References: <20220628022953.20948-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::25) 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: fd5f4021-b5a3-451e-82ec-08da58ae19d3 X-MS-TrafficTypeDiagnostic: BLAPR10MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7dtaYiIsVFvSvfC19/9kFs1e1n5FAA57HtM52l2fVMRP0sK/v9WC7X5lA06X5Eo4+OLc9nGeeJ+zqpkTlc81twK9zmnk9QYWWfKPf/ZUZaGEB4GAuG5qNo6Ue9DwHhHhTAbItVRhyOnngu9heGrdcW3KbL+Eb/3RbtiTOPezsU7lpZfjbo47l86h/wYpcjylFF6ZlulSkqBlt72zzDPo2NUg7K+SYBLHj+/sjf6AaM+2aLewgs5m5wkezrrjgcKLFV9MRDD5ia6XL0GTJqEdqUEwkd1+huZb329QyeG9Sdf6BoRGyR/Fcs1D5t0LL0/w64xCJ23978fS8i+yRx0mbRRxeuTjY34kJvOmiQKnfSA1V/zmBwAhu/cdlUrCxO6UnjoArf/75Fw1iGVaZTHVkSW5N3dI5IFPxGlnoSEmGuxhmFYhwoCAOilYVlnu5zgmXJGhz85kRUBJJk+9Wesbu4kq45X2a1R7jHcaOj1V+C/bLcoRPFd0paAR7cQVRYfFVBvyLFuombsvG9DhPjrEjL7HnqoSFgsuOg7euS2CdmcqSnOjwtYE5T/yLvQenWxHrbKmzLeDFgqzwd+LRKjgFOYBBbDdDFfxjLrJX8gxgvVkj1dhKFfdyJTHHV5XFDCrK1tCQ9vh6IvPPI3BPNXZaLlmwZf5gaHyHlZdM6x2uRYuj0gpfuct6Rg8IZC2ewcu26L25GFT3EYQlHW0SslYsDNXatrA+Aes6pRlPW/9kTq1knTIX9+f8VeicbtGDTigjepmyQNA2RyB8l/9WvAb9DXcpLKKf+aYXBIVF5g+0Qc= 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)(136003)(366004)(39860400002)(396003)(376002)(346002)(478600001)(26005)(83380400001)(2906002)(52116002)(107886003)(6512007)(6486002)(4744005)(2616005)(4326008)(8676002)(5660300002)(186003)(66946007)(6666004)(66556008)(8936002)(1076003)(38100700002)(36756003)(41300700001)(6506007)(38350700002)(86362001)(66476007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l2yk9qK1mjtTynl1bFqnOCtAgpEmPZktbdvGR+S+t8KIyBagq8R7wGFIjCnjNwGRxWxxLEAgNUlZsJhYokyFAfYuCe8RMgcSLi7oMHM5tmFzBYka7fZYDB0LA3PSgaEm3IBMUQD0365V+YRpbH+f/nSRetgj31KSPDuDt98/E5VuBHGo3nA1y9s+PznrHAo+bC/2HJyZu72MduYfnXeLHr5dhvYAYpbhyk0cFr2+/3AbKyHYlhRsZRa+Cw8WTiwB+2nx3C5QnsHfvrF6EmHQRGGPNb4D6Y2biHa73naeKKXMCCaFXzCFW0F/MZ+E7vjH4raOSE31Raj/AY5RAkUWrG2AcPRm5anmELDSNFPv+c0SWgVZUdDa3Hzn79bMPn09VBPE0E3Y3AhJJeEeVBO5tZnJIb3YhI0BwMFghGYiUZlH1DVL0JK4mmCsdASNmWYoAIq2ZKQzZKKvoV6ITu0NEncymnW/wH1ATcZA/O/jdO3Q7/iPpWr/9jsqAzzY7WN7b408ZLGZte3d0R9klX0WOWalvQT+kosUT49I67CGj9ba3lSlD3NqX+Kk93+ERGk/3tsJAOHSZwGVZKwtjSeoru2wp8QJxkx10c6CqS1dV95shHqnvAG8V24tm6GmXS+ykK46/pKRAR0BkcI7byAQYcky9TEzeJhQdzMs8RK5R7A6d4W7gB+sE027K11hMG2gNalRclpsbeG5ibG8A2CUOp5XUWJDVXsE8/pJ80e21unPm8qJzNMne3NcNhF+VI55nyAc/hQSvXsunC26x9Fwut3uxuBFaktXv2EpkiRKcRX1tNiPYFcouh30vdKskOta9lVZtX1sVU4xHALyNAuRYQqLv2eOlssMJlV3+Ml01zS72Jqaj87jZJr5sZLE8PUJZIb0qTn2nPnchfD4bWW8NWqCkL1KSnWR/wPWn2cnV25b5FvUDnJwmHUGppkQ6a2wkpsRF90yd3yoFZMBS3TckuQTCe/NuHX04qzOMkpfZSKcZjq04vJjNnZtINFtbTcKzx+VVQ9JEkdDGPXdDn+f5DnSixvAU7TQ53TIwZ3S1A2DD6i0nuqbljF+LiwIwzzMI5zEJWTP9qxp2sN8VNyCkzndv4d2jdPdcx6tKTF3K1OU/5yxEChjr4WIBrYxhhKvhLMKz39tPFSl9EBEyggJxqm5qfeYQXq5DkCVTpPnAY7Y1soUOA0I+4/q2s5+IBsXfN9kSj88PpN4KDLA7+AWJ7JVwYwJOCSiZDdmtet61bdaKmCO4c9j0c4gDh33Xwx98nobDibC1cJfp1oYRD1I3AoDX7oaZPPnoB75fAdE1pl8VvzZxbpCL+jfV9wM4tnRGia6q+Shu3bL+xJ4jOn6zAxRBczRBjgTMcc7b4fz9X+Z5ZWw7BusZtwuYjiGzcIJ/hJOuJzjx45AB5Pu6PutsknNN6ce8MN8KKgHS3VDVNIaMhxuIBkM34dSRrlx3hUOtdo3ChXwOerOUaQCr8wmc4qLurQBeTy26FbX/tpHsev9vYKVGJKPLul5AG47XPr0j/ZELrccyTJWkAWQ6ytvjpx9vVgI0/eQ3AHDKfYReq7xBdWPUKPHpSr9rS0FEBJE+yvS5CkGSZDlsXIUY4vOSQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd5f4021-b5a3-451e-82ec-08da58ae19d3 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:30:00.9379 (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: 0nzkcPW5k7Z8UIdpDz2iyTm+lYkA3MTIzku7uUhV4cdYw89F9zTxQuEgXbfUqgNvNeNRVkHEUgUAxmPl+N+41uBqHvygL0jDU5EInwFPIXM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5140 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-27_06:2022-06-24, 2022-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280009 X-Proofpoint-ORIG-GUID: lAhliTK-cZjfwqgoFJZYGv9E46kRD4FM X-Proofpoint-GUID: lAhliTK-cZjfwqgoFJZYGv9E46kRD4FM 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 --- 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 02:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586049 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 EB9C1CCA481 for ; Tue, 28 Jun 2022 02:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244773AbiF1Cd4 (ORCPT ); Mon, 27 Jun 2022 22:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244858AbiF1CbO (ORCPT ); Mon, 27 Jun 2022 22:31:14 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73B12529E; Mon, 27 Jun 2022 19:30:11 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25S2HwMf031758; Tue, 28 Jun 2022 02:30:03 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=f2OuKbh1EcWytAx9zQDoghqJiI19M+su0WhERB2G5ME=; b=iliWrw7wRno3ZQd1f16fIFDIqY+dJyvRBp7M78aDLH9pR77+JzoRC6R9xcy6RpELMfjq JHsV/4exd0jPMGOBzS4wtm1oDq2743LHSFVGGnnyDMrkpEgywru/8TG7Ui3Ow7nCx6Pt afvjsKwYymHMzhFOXMsmXon4ylmQShz0ewO31Qs8o5g6bIuDCR9O3rJD50TcHHYKDzIO zFDpgfzfAzFBS+Y+lFLzf3Noyqg13za30DggUM+lOtSpqnuhoZgVDhI2+QAzwHNLKWD+ YiwwsbvbWURsXit8HWEz6BE8I20N68QopPdI8azmHdkLGIyA1XHMeK6vl1/l+nEDlo7l yw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gwrsccrkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:03 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25S2KJsB018705; Tue, 28 Jun 2022 02:30:03 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt1t5vh-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kIz8Bx+SIDO6tvvpcCzk2ug4tRF85kKf8uapbREkbH2yCDNPExdpqjb5mMw9Owfxd7sMPXqQHCBGeKeEC3YQkZv1jFsbl8fPxm1WJvry2Eh/yv5X6bFUmTxa9r8XbOimorpEu4S1lJIb3MEwvFANzZiVjuPSskm3Xhaqro9f+3np9fm/qwspRhkidttZ8EJiFDN76AWLiPkPdcwqZOGh51dfgWnidTtNidz4EIla67USup4h622+x7pfcoMa0KhAWZzgAmFCPzNqngXgVOHPWwuWP7KFoZEmTHnEE4G0UAzy/4lcpM0kk+/uxNjQNXfu8t6GDVRAQ9aGHiQxS0pFjA== 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=f2OuKbh1EcWytAx9zQDoghqJiI19M+su0WhERB2G5ME=; b=kFo8hnKDOA3BcimWnC4bi7bZMCD2OigYyLY9uNQ4ODHGJGSAFmjUMFuooTePlGdpa6CYKPVME5QbJKyMneKDVU/fWRfvh3KQHyQ1Uq0PgFw7/hrwQJBdYgZjlb4F4PAsLnmXlv2K9bHT7li1S6LgO+vDVsjUh5BI6PmsBVSBMpposO9+TY1fUPJVcrXdwAMdhuN5C1J5fk4SphAGSlYQrYRmLY8d/C6X5yO5miLvEqC15GCTirYFUTXh0EglBGaF5WeGnV6UnJvznlIMPVwtBgqpvAI1+yGv7h5m8aIY9BPCqegrnCicSVkQ4B6O0AvAFaGni13fQvCju+z5lUVPKQ== 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=f2OuKbh1EcWytAx9zQDoghqJiI19M+su0WhERB2G5ME=; b=r/R2+pK+r1ET5zySZqwbNyT1exU/i4Fo3wj1ed4QOKR6lasOirybQ2UI+g+z4r+th85kLq7OzBmtGfa9r5rxjlkrQTWYdo3ZnttMo978m8XSALjHQYQFzQiYUVu8UtNUazePj4gPrnckSEkpCSC2VngLfRFhNN1XOq0PD2Byt4c= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BLAPR10MB5140.namprd10.prod.outlook.com (2603:10b6:208:320::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 28 Jun 2022 02:30:01 +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 02:30:01 +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 Subject: [PATCH 2/5] scsi: target: Add callout to configure unmap settings Date: Mon, 27 Jun 2022 21:29:50 -0500 Message-Id: <20220628022953.20948-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628022953.20948-1-michael.christie@oracle.com> References: <20220628022953.20948-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::25) 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: dbd55ea5-e939-48a5-df0a-08da58ae1a32 X-MS-TrafficTypeDiagnostic: BLAPR10MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E1mmdJg76kE7OAniOFN9F8kLNB1C/kzO8ImaPykwWgV9d9iY9OKnHC5fyjX56dPuqo7KuwnMN1ROoAyTTqLFMdVhZJ04WGV93UEPqhVJzqJkdX45SlVaAt6hfTAVQTGkxQR+LTSE6jivfZigYpcWIPyGK+UY14cGDodvFTuw8qpIdsZZZ+Ylj4Uo1oUFnM0FusS3zI3+Ou7V1KJitSeLl2JxAZ3poCnPYwkwkVMdtMtTpJQbiWS6cXpW13x60M8iUH5dIX5bwSKenwBjvmJ1njJ4no8Zl0SyulX8/HDSvuXj8t0Hu/daI9YeK0zrjLRI4TcijRGAmGTnwgfVFEcVkQl5lxJrTIOVNVVPdX0D0MnsQuvtwSsc+FpqysO0hnowP1tFlxP8dod4bpfxUuecGqiAsV7P+lqgkgfZs0Ks0Toc79Jp/ICcYWqVlwz21I237tV04MAigXTyGCRS7HePgYujyv0qAsZMKD0VvZMMP5jLsCD66JG05K3Ynvstut0Kd+jlughiVyE1pddSnDZotAB2iK8m7bYiZqnUmez/w73ysVqRhYeSUkjAgrIRc/bYXJugGyC6q1H5egnwlssg3AII8ZGIn+t9L0Um5zoFR4mVI2Q+xFfJx7M9i3IJmZLddqripG3BpAumZnPAjNX2KW6MFkGeDFXuLb25jcresOP+m0x8XSACenCnV80wpQE6PggWECxL0O1YCP+9jXXXRnTeM145O8twSGAQCOzqAbIaI0DtkqbXL2j16bom4Spp8yKHAjTKUyH5Vsc4o/TaPNQnOVjVbMaQzjG2qKQh/rZOHup7uH+TWJN7CTE9Mw4j 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)(136003)(366004)(39860400002)(396003)(376002)(346002)(478600001)(26005)(83380400001)(2906002)(52116002)(107886003)(6512007)(6486002)(2616005)(4326008)(8676002)(5660300002)(186003)(66946007)(6666004)(66556008)(8936002)(1076003)(38100700002)(36756003)(41300700001)(6506007)(38350700002)(86362001)(66476007)(316002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TsM/Dxli2qHxrHw4zEQkJS3ANDh8U6UHgb93zApsbMHIxNo8X2uEBdXsgwFGowQ6Il3VYWcSQrQqlmfsooMaQe86iV59f7kk9XGWqjr3v1MvOvrmSkU5IXRgoxaCfFx7GgljoM1VK1isJNgNzlBSDY+p3KyqpB5ute8ZkrEheA666hovwdyIlOKNNh9vao8Mz+fuThokujIUbrZzJkg8gOX/EwnnQwk2Bo00dfzMPEQ2Q5sXzdjh5g2YBptmBIB5WMfrJ6+kZbea6cqFeaDKtTJdFVrXKHHVDcP0YVCLwi+by/djqEGVquJcC+tVTa1szu6fgzS6vnmoW2pbV+lkRRQH0qDyQY+/E1EurbnQHPVQq+Ij+9M1Vl1nEPTcJKvX3BuVv+cJHLxgC98qJ8m8iSeK1hZ9L9QhAiNw3z3A6Fdtupu73eLIuDdGWGS5w/jDVUAvbLf3nuo1aCZ3JLam4uQfehgq4+sJEgWxsbuUjtcJ8CRURYfM6mLuc5BG5NrS085RdasmOspra7B5asJFyKFNv7di0xHE313vin/vjHL3enQmSw0q1nelTQUCwxxk4ORk5PDi/dPM0c7CjCGL91FKRdrYZEUTPyc+jUK+N2S6+OweBJfUNL+bS+cvgBGI1EGodHaMvPgTQGjngPrvNBsi1Eu9CRXByDa5YvR+Gwz96y++6Qml3PjzZkrKs9NJbWBRekoOQO7nxV0ysAMyF9VlMaj1nqWRHhqrsqONgI7FFuPqvOQVeJNW+YXFOejG30OLRR84H6Y+7E0HdLY2k2PEdLuhbZ6aM/3GHm34uVwr6UOSUHhxUnpdzR+ZGJHqaXAHV9GvdfvsdJQ3ZqvEvMvBpDsan8bVnSaDUyB92H16h3gRk5fA1TFo4Tpyyn0VHq0QvZeSYD55B23uco3qpuGVLsgAqS2W6U/Jgquh8sax7kGjVfn12rEHLgo7q4pOW2XZsY0Fi7hk+DIu79qn7lq2UVg60xuuBFa/5S+wlIu38Fm5a41TAQ5DMYFy6dlWtade8rEZDovRWe6IG/BX2kv8GPHrTN9pFgY91shcE35DuSOjWa6qNdSKLf5kwcFzozwM71TGAJR3VZupY4bsTO2SZm2ptB92VgPIbDXum6GwDnOgy7x3amK3feQc4D2BWmGSCE3ERsX7DSer7UEXwL7Ocsr+H2q63Z9Bph+n402if+X7Qj7V7a5jpiEwcExIbzGpju/rGhLJN2R4oLk5QQcBpX37RJip9SP7ABcMBX80IqEetyjqjiIPZgU/7aj3xyP0IA9qB1O/JeIwZEb2GbSK2xCbtstdMaR+MBxzsSaFc40rjwxgH9oAxtIEkvUhoCvvkaW+SNffZVh/oQMgUPwDH9DwQFsLMW9Pu6sr7/KgLsDOcWGWRp098m0yQL6EMM0AwgbV5SUo3Qm4kIR1RB0d+BEnf8vESw+MaKGlhUlaKIHVhHa5IoGYep85fZEXYqgTnkoB/Wp3nO97zAS78IXklS5V9Axy0c5T+pLdXFKclPOgeyvAi7v1Wi2Mh7m+AXvXqQG5DaB5cPkNOO5106FruUKIWcGSaDe0ElziHBcZzzCzTMO6SvwH3GhgRn3wU/801Xv7mpl50xONRyKumw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbd55ea5-e939-48a5-df0a-08da58ae1a32 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:30:01.5004 (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: TrGbfIHHFcTLgTYQu24DzE4qnhgjtpy4fF2ftRjpMNFLHx/5gazpU5XKJ4GWpHkQYdB5AABJOv8fRWpf2AjQU+51Iqw996Wu660I40CEXrU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5140 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-27_06:2022-06-24, 2022-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280009 X-Proofpoint-ORIG-GUID: gdJnnZAkyFQdQN21oWQJUrbi9iQGDpAg X-Proofpoint-GUID: gdJnnZAkyFQdQN21oWQJUrbi9iQGDpAg 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 --- 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 02:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 585785 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 24887CCA497 for ; Tue, 28 Jun 2022 02:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244739AbiF1Cdx (ORCPT ); Mon, 27 Jun 2022 22:33:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244980AbiF1CbO (ORCPT ); Mon, 27 Jun 2022 22:31:14 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D852529A; Mon, 27 Jun 2022 19:30:11 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25RK02WF031609; Tue, 28 Jun 2022 02:30:04 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=GfQovHwOwOOb/ZjRzBJKGHQud/6QBqk3DPTjWhSwUIE=; b=uj4iFPXGKxEEYTf2KpO1cO4cFautdF9oKK2rrfT/KmJg9V09tNMBzE407YUCrWAksCqS h5aWk/B84YAIjKJZfhaXWOxhEeOwDPFUpFnJh2eMXJBssh9+s6AkqPUW42UTOc8g57TJ WmE+uyNk0mKVBrrd0e7F7YX63SZGTAvUVZnK6WajIL6J0BGJeg5MyifTcm1/nn3JBCvo AR96nOVTT95le3G22RjQka/AYdL+Ccv3Muwx5mVtPl+L918pArYQcFW3FARUkXH+QYC0 HDrVuQyv/mdbTb+sN8cM6htw43mzbA0Ob9F35KECZlHfgx1TTvUD97qo9LwFG+CyahkH Kg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gwrsccrkn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:04 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25S2KJsC018705; Tue, 28 Jun 2022 02:30:03 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt1t5vh-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mVvYHIgPPV9+OKNhvrXR8/KIFHO+o70RHgzYO8mHaBVGTdXFHMZt5A31rMFbUF/Mmvq3kVkClTiBkO4bGxCKmASKSih6G8Gi8xFFXJK6A/iGeeRSYmwAMd9WQ9MaBAVLajRHjhjGyhHCRpfyteSpz84dub5wtx/x9JMza3A4JZX2meAo8qAzdVLV07VIQbr2egOdEBCgBNnAABIjQgkRxpLt7csusVt0IjXVzXsbtQMf51TRxSyGoOHGDtj3rcc618AXeACFpUOLGwnnBcePYbLMAzpxvSLG6E99v13MDaMJNsw385B1rexbI+cATVPcOJPvehe1kpnUuMUNmqweOg== 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=GfQovHwOwOOb/ZjRzBJKGHQud/6QBqk3DPTjWhSwUIE=; b=I1CUckBb9qYLmar/tCCHHj5/WcDd/1W0IUu2b7mmqhVaMvP+1Daib/goOGiO2nwB0odfuHPYwGEVtrkiEeLp20s9RTRZ3icMGV130bL4Go9O8wwG3xq+VS7Wk313kwNaqvaaS/spL8LwynM/vE2E6aCUjlUsVh8mVtQDsqgfojAVnsP2RvQ2vq/RKh7cGx5npGg2dqOlq8Fe0BCxN7wnLkO+Tee6akAjdQaWe7/SQSpKPbSm7OteamZ4mjV6LdeEKtb8lzA35eOkwp6vza2CICOP/2mfpneidPxJluPDE90Aeb2FxFXCFYMvwPYs8mSfzMlq2LvUYY4Ifa+auR0vpg== 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=GfQovHwOwOOb/ZjRzBJKGHQud/6QBqk3DPTjWhSwUIE=; b=DLL+fLwDQm/Ed4+tESwYh66b8Q+pRoczHSM30Xyxg8mp6cH0QS4ZxUNh4K0YuH3PJ6rwmK8RT89gTyGen5kUwtiBW59hVXtRvImcmNVLED6jQEpN+eLLuLP2xZ3eX9K2qqx+CDUM4DaYawQ4ZOIeMMJCjc6zDRvu+LAc5iww35c= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BLAPR10MB5140.namprd10.prod.outlook.com (2603:10b6:208:320::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 28 Jun 2022 02:30:02 +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 02:30:02 +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 Subject: [PATCH 3/5] scsi: target: Add iblock configure_unmap callout Date: Mon, 27 Jun 2022 21:29:51 -0500 Message-Id: <20220628022953.20948-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628022953.20948-1-michael.christie@oracle.com> References: <20220628022953.20948-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::25) 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: 9a11e666-2a53-4cf4-ed54-08da58ae1a83 X-MS-TrafficTypeDiagnostic: BLAPR10MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1rRNHqBWIgazxwr0cYtCyORydZsaxri76Z57EffEWQMIldWvLiruygyTfZq8yr2Zq8IhFRd2SPflMuTt5wcgJ+GFxgxeLM8jwcVDyYL7DIRaCKCiDmEO0nizOE09QCYQcmnu8vIYbGA+houOINqfsv+YdD19G+8IgTIqE7b/oeq5oiSUUfoDzBedXOsxdqvxM5ZgqEdxRohogv3E3L3SE38eXWX5CZ8gcZw56PcpfEMLW3U/LdMzOxGHT9Zn0hKX4PpQWfDZ3dE+nbeZiSETQstn8rWP30SGd/LUO+PbRMq7AA+85orCbvgjLnVkjPvVeIEDnS9xGnLdT/MdmE/YpPr+GbCtusV2N+ec2hgf//3pZi5u0tVE/Yvkfk3uorgNusZYUZFhyPRmrJG2cscpOIJ/B3hGDnQY1tdezu5Y0DtsQA/reJqfVA6g0A032J5qsOf3daGmVH5ZlAQhntZnz8PZ6SxKCsdNsHMpbzd6jMjSnV5YGSGFtyuw/jxbgOuAeeEaJDHDxwkdbezEN/rCBCn+iQO1XXkO2vEwp+hNqKsJqceJv9CMpIjtMtZ3vTE9yqBa8FStSjmB0vOFjR8Hnf4RKypbQ24ma5MZgt7HBufV8VccHvaeFm8i+MAqAI/A7w+f1kCeSO6nFon+TBGbN+GV9/2xF/ppGc+R36633GtdQndKx3kV/T3UfAOZ660JOrDWZqC4xdyrFmkVaBKOTjsBNosjalgx9lWEbfXHbI4aPnfbPjE6f7QhhOsYJalHE92ZurGO37jZcY153AEQFJ4TARdbx02MekjI3k8Sg3A= 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)(136003)(366004)(39860400002)(396003)(376002)(346002)(478600001)(26005)(83380400001)(2906002)(52116002)(107886003)(6512007)(6486002)(2616005)(4326008)(8676002)(5660300002)(186003)(66946007)(6666004)(66556008)(8936002)(1076003)(38100700002)(36756003)(41300700001)(6506007)(38350700002)(86362001)(66476007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ab8ynY6/8+qjf+uMHiu97gsjv9F0w3v+bTrKdnZyQp92sz7VlzLAvqAeFL03yP8Oq2oa+z+d/XrV7ZPew3MQvTQI3hTUbntW/MotRvnoP8btApjOEP4iWYUDMaT5u72dXeGHoweeZ6wvUaJ+e0l6/XXQcEbVoW138lHvks6U/P9bAfJRaPJOHYNIPA1dmhc1P95POt3HYp5eQgnxSf3Lr8FWYBpdy7NAkzWe0wkv4TJbqk11KGntAuKD9XafGVt8dn7UwbIMg//u60xtRzCGl3ACECipZO1cTE2g7qpRogqA9HX1o+4dT39qaR+NZF9/mPbpm5IUsQ6XZcEjYYAaOzCpTIYbRlFM55IFzTU3q1zLXWRrrmlBFxrudDM7zCLmVekBaeCG1dkFqTD49Lhn0U4WR9DTptKZrEJjHJHj4qCKSNZRy8sAV1ljjhizpoyLVUUFPYfeIEbDqHQP0E5k6jJlgNLied7+owXOpDWdJMcRZL/Zwl+Sy69NZL4ZCOa6BqgZNAo8VJrXqzQcRAy3vDF84D/9R6+TT5qcUarqMEb9kDZ9JjtRjwYm+1aWbN6nuYMMG7niwXMG3fQ9G8uRW8WvGkVZvEqkLdCZcDtMjZ1aygJKnsAkjFU9P81ZdV3+woIbG43LT0NmNShJ7RiFW3GKYGr+OP2HGSFAxUzr6g47yaqPW0lyeocV5lwAm0SwiuvPZxsrm33msumvrrYUFpzG4LZ7e7u7FdGvnDktswT5NDfQK74FBojpVwuR00qCg4wCnIhMzEOJzni/F5aTuG1MOfHobMTyVPByhnVYzYxBuw6p4di/3hSYvkht7H1okyIWkER32AlVBpNyQTarw+pCCSSxSR+TH7xqHuzcPUhCCiY+R+1+ODzaww5yYR/atrnSQAPifcSorwdT14hQqzLIJXQ9y6J3BVh7kSye7wiBOHFSc3AK1YIi/ylaWbcROEvdQVlWsch7JcTa71cBGLtp8WkwdCv6GeVavCYvyARxTptn7EJUq0Cm2ootlD8vzbcBetcttQEyWVRRIFuoBVq3+pYKQTu2RIhdjwrn+BgCt1f71+WMOk/yQ6qY794jKvrXbuG6wawX2EjKYYJ+DcGt3x6VKbWUYrR4U0xZJGswZ5SmilYDC6ktkuF62VXVlZa9U4Qvnz8788xAgxNzogo/kDjNtXh7ame38rCORjtNdBAH+PSWHUnp50QRbIWTqpuWlBS0+dGe/aarsRiZ+roye7K3hIleaTUHkcFh5BX6ezX8mOAd0AWm7XaQC9C8LenoSxgb+Az+WMo3BZVUHGLLEyRir+mGuBYSpwpsACTB4tRdNWXV7LgXHQGYpG2eZ3fXA3dICArPZn49Nu3tzFV79vljXEofXG/9Z0gioYqpQwhBnSLelw7MY4VKHEwLwrqS4KP6jEq6EBYcdWxgW2uQyssNw+Q/fUXboYBmTYGKmiJj81Xx1NHsdlN8unbVQbjcLuopXue4ZGJNFCM/wOjp5mhc8afPU6PlQMiNWrV2upgy3KRoCKqpzIdoth+iuBeqqnUoceBwKUF7fnXEw0dbO2kvWV7Q4UwRiKnTuAvmX4U3yuII0dDE7vidp75IAFN/KCbAl+GuPjs4PrQ4/w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a11e666-2a53-4cf4-ed54-08da58ae1a83 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:30:02.0316 (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: okwnv9nqGIn2z6mo2ean4bG2Jw7JFgrf8UU0GuXS2ilBwhO/11NrrDBtQhkIFLgJEMkmkR5Kke/clVrJhDNn/rVPgavFMUyM2ozfdXc0lZk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5140 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-27_06:2022-06-24, 2022-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280009 X-Proofpoint-ORIG-GUID: FvwpwY-Pa9lVXm2pBaXyd0xSWwx5oVYE X-Proofpoint-GUID: FvwpwY-Pa9lVXm2pBaXyd0xSWwx5oVYE 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 02:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 586048 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 34BB9C43334 for ; Tue, 28 Jun 2022 02:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244844AbiF1CeB (ORCPT ); Mon, 27 Jun 2022 22:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244998AbiF1CbP (ORCPT ); Mon, 27 Jun 2022 22:31:15 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 187E3252A6; Mon, 27 Jun 2022 19:30:13 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25S25Y5Z031567; Tue, 28 Jun 2022 02:30:04 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=ORleO6/yHEf9TjePbV6Aeb4wi3DTE/O980bg3jO9EiA=; b=iFncl9dbCIQsQZDUpZcslf2luEfGQ4h649cfTs3goA2FFnvNqkViWbLusw2fxCYSvEZG tn0Z/yw6jjx/ZDcZ01V6xJgT4wvbChxo4s6c9d2o9dM1zORDpEyVSJ41Gc9MAO399P72 yDuFO4+rM0QI2jecCacdgBQFJ9ythPKJQ0iKtQ6hV2rf+d396Gp3tLhOj3rLJIflcAMl wiFIl8RqRbNC3UXUrZ76S0jp6/y2UYp6B4h6z6Ua8XoMrqSqYGE70Sgum7nw33SJShVp 32Y9dWxG2jc7TiF8NTZ0RP9x5o6qYkpINT7gVLMzT4LnpQyFpb207hmtRGhH3AVOvYpe /Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gwrsccrkp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:04 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25S2KJsE018705; Tue, 28 Jun 2022 02:30:03 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt1t5vh-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWIQye9U8J8x4sNpNO//tmzbYYRCO3+AFunzmThqHHhlU5fFjleF+ez4meIJ4csDwjoR6rGwhiknPrEOn07dDJgWeLL1qm9Q1v28M43HdWnYFYJC1xaXORradD5/JOttP0fWUNvMmFMmga12cB7gMQI/HpJKpiWjywgBbbWM4HBJO3u6dXvcVb6wimQhHCe+TaxMxpS92d9SagMDBN37n5CKShvqUKBDbyk6SXa4uBbp8nEYmd6MidtOtIoE4pVrQVfaeCfyRlYwsa0Iu0PvANL6yp44spcYTJS56SXLi63MYHZsFHL6znKsPa27JXzsewG0gimamUW60qN8BYXO1A== 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=ORleO6/yHEf9TjePbV6Aeb4wi3DTE/O980bg3jO9EiA=; b=VvtxEL2yMDeI9c1+LgzpFS3k8ytG9QR3kh34l5fbDeA1qWplVPPDNB6ul3OneKsBb3d3/NWUgejeolvy9G4gXac5Tor3UbufkKqA0WP/lyTE6GuL6AZz/KrRBg13JqjiAk/8WIYgISscr0+MKH6kkAi5Hhab5mg11blItllR9eeVuWaez6fT1ZuHcRst325MsPmnZtOSzEYvT/vd1gx/g25JjNfElUqdaYo4ZqwWpQu+aWYtTKv/Y/DXCpQdKiPBJ6kzeRHFn83KztfcDCuT4X9hBiQuQ6/GtvTzSV74HuqnpDpf5Fv+RBUQZ26d5Ut6uGpUrcut0gwGkF+2eRjDEA== 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=ORleO6/yHEf9TjePbV6Aeb4wi3DTE/O980bg3jO9EiA=; b=ihypF0ua4Dy1GWL5c0lNDkoIrF8WbaRJobCMdU2KhkH/Imudx9lT+K/lYRd421JWzTqGu/I6p64ZC+zvchyZxmdSakElxHyOD0t9ACiQEXFF/BhdVATS/7hPUFOVH2ovrp81GQFUZkB1+a3X5Rzzf77kP6I5C1gBxFab/XfVJ4k= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BLAPR10MB5140.namprd10.prod.outlook.com (2603:10b6:208:320::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 28 Jun 2022 02:30:02 +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 02:30:02 +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 Subject: [PATCH 4/5] scsi: target: Add file configure_unmap callout Date: Mon, 27 Jun 2022 21:29:52 -0500 Message-Id: <20220628022953.20948-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628022953.20948-1-michael.christie@oracle.com> References: <20220628022953.20948-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::25) 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: 0df3b54a-3b97-416d-5deb-08da58ae1ad7 X-MS-TrafficTypeDiagnostic: BLAPR10MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UShEb2F8c+BcdhSjaZqdPi4d65fEVaL+53iqJuGbFgeHEzcMFooHEz8JWVnSn4GnX/NQuN4o+LJ7BTlBt9QIdfCWhXXvu+z6+941m3kNuLW3FFyKjEX+H7ZVRbWNGEPMHUigTlcs9Ln/KNjDKXOOZZxpM7P4u8KVFZbGLoYbxH5djwQMQmsfh2Xg9QXgLIL1OPKDU0xoLHG6IYy5/AQtAyR8+wZsZKag4x5jOgeBje7fFbtCcJ2RiwEiTyxPmdpO4XimSp3nF4GyvLGmGXytEN+e5w73yFHt7xSsqPU+ALSJbXXf+tvh9KmzdWpKY1jtvyHiy3Y++507HLtlM4rQg14q4P8QG04qclGCpfaM9nnFKs6T7IiIy7fZ/FXsDaNqvAQNeGKUURuIsRI+u41mAoQiE30GpvtKOy9CkzV1Sd9dUlotqUTQEV8l0vwXnXTGlA413ptoqLh/ddZ68D6L9HH+/g08WkyWhFJXcdYHmYm8YuwhnEy0rbrHrpU3m8pj10SE2zDQKXoUBIHO1+ILdvmvMwg//231s7nTvzxmMuxanI67inasOqUrwZ0mwi1GXizhfUAoG9gaSn1dbypPX1tYPb0Qgzq84jEg/vNSiqOX6N7tNciaC7N3zDWXsh9fTA8xECKqxN4q7DpLHFrAgng+a6U/HNsDLD883wAkTTDISXFi/s8FKQ39o6XRgTrgk40X8eBlAaYGty0WY1Gh20v4L5frehqWXK5UezBlbTVbZ78ExO36Co6zJlybdB+Y+TTBebl2IHrcdBiZycVGGaOUsVkANUKiGHp650POfxM= 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)(136003)(366004)(39860400002)(396003)(376002)(346002)(478600001)(26005)(83380400001)(2906002)(52116002)(107886003)(6512007)(6486002)(2616005)(4326008)(8676002)(5660300002)(186003)(66946007)(6666004)(66556008)(8936002)(1076003)(38100700002)(36756003)(41300700001)(6506007)(38350700002)(86362001)(66476007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MsYxzXU3vBC+MZA27aE2yxyxGXzMmb4TlrthP+zvFsM2QguV6OCmmhv7prHvfSZOrfJEbHJ7AvW2Fgx0kGohG08s8dMWsRqyb6ezwVBwAW+GIHL+42ofHcu9jeb+tyTycajr1aerwGjkJFKrpuw+fNWPH4pjqZXKfdWJqrSlafaeZwsMBz602SAv14eDlcUPC9cKqAl3jjit+7CICevBIDPWAB09Ra8OmHccaFUGTYfPH2HFw1o9APuDSuUYOAST5VMMC3VaqSikFA9o8oqoZJcdHZ24d2z4FnJBs9bVpicmF7LZr6MF8XmnAny6QXeWtkZA51KyV0RC6/yKw2pO6orwLO8VtMBiV5bGgdS6W9DWlx8gYh7UP2NZOyCqodYl5wODLNe7+KxuXxDB2kYEdKTQyFLKoyssimLyCFbjIYrLUROECaX87+MvY2b7htLWao2vDMU1wF9Z8eE7/BYImv0kclmSELzUvcKafSki55r0+IIpxQAlAEXCLukg6gOPG4IT4GngeA1PP5ttnmsR6eTJ5rwzgoTKCj+Ur4sOdr87O9NmIsECCGMqMEGdklVT23tiLtLwU/kSSn2dOBOjGCJADJJGuZb3+W9JStrK894OmjFFFjdT4Z+HZGROpvb4JMEMrFyFGDz10+zQvMbofLZ0TReUc47OwLGXYwBQTfQrdmGbrvSUkXve0IU7gcEoU+YskAYKD4jb3/AHJiLETHUzKl4Xj6QtJuc/zC9v2HxrKMSpzyLXhWa8qJFA/7ZTjBDOP2hFRqAXcYWpHEZun8H+CMw/IkiSCpLBZFTJN0yNp53dFaJXfmt7Jsj90Ub04oWdIPJQvXUXOQ099JJV1mIU8XIu15OGRp1e7fZ837QJh5frRKO8ICohC3RJ1ggBhz54qnhs8OgAefBC46gy8+DRdeojIzxykdajOMwWQOIBIwtw+pw+lmZEG6U4sbQABWrgTQhhOkza98ffw/hKrMwySD4+9LVb9jv3MCGeJL4nXjFOoxlJcXRwjGb/l1tHlwKvlP2shDLXXazEd6vMHywKJRji67bfoK7WgxFbHLC5eTYOQPq6/mcnizonV1I0T3Hz1fQ8Z6woPVTErEnQzQLoGdrqEUiHJBJch8XrZ1UYU0siLZuH4v3RALuf824n50zae+pAbJD0EzLgNtss8xaUYRq+XLi/xF1D3LACeOImcpLKNaYuf7ifI5XGcTGD6Fnldnx/bI3S6ADaaw0GNW4DQ96YndGff7uGbZLpn7T2NUDZ+qwguaspD0BZyF0OWwLq4wlUxw9re/y6vK2dO/GwY+ci3pmRysOWEqBHuwZQCqSJ6XZzLqtEd3b9OEhnBS8WuMXRPYffNWnS4n8zbrG6u8lymUxT72ZzcIbdaUVyh310qXYD+rSvRyXoN5Z6puX5rPhqO42/wIb2hjoZzvuXYAQ3MfAg8SND2Fxz42Xbz28Cr/oHNypn3UeWpW7qVqLR36sJQhlv48B1lw1dKH7WYC4dOsTlwOkvNT946MyUnlpEghyCipiNPPBNxxBjdEj/dbu9g9gojhXLlBB6gnQmHGut+Ws92Orgt8eyaJRhiaARxrWiJnuzH08qP7J1Nd5vXgucfMrcOU6Ltywbmw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0df3b54a-3b97-416d-5deb-08da58ae1ad7 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:30:02.5784 (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: 5pzVmlbvexybngO1lJWnMAhuDgisCpuV5hU6CAWkZEvDrq03MzXwx3SzJXzVqs+JsDjXXU2vVnrrgPGBfDw61inl6mtgSSfLSa8Nno15qDA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5140 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-27_06:2022-06-24, 2022-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280009 X-Proofpoint-ORIG-GUID: SFF8KC9ixZCt35kfJza7MK9HtX7t-AGK X-Proofpoint-GUID: SFF8KC9ixZCt35kfJza7MK9HtX7t-AGK 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 --- drivers/target/target_core_file.c | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index e8440e5dd804..08212eadee28 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -86,6 +86,29 @@ 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)); + } else { + /* + * 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 +172,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 +189,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 +932,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 02:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 585786 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 DD8F9CCA485 for ; Tue, 28 Jun 2022 02:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244823AbiF1Cd6 (ORCPT ); Mon, 27 Jun 2022 22:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245051AbiF1CbO (ORCPT ); Mon, 27 Jun 2022 22:31:14 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDF42529F; Mon, 27 Jun 2022 19:30:11 -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 25S1ZGRm002135; Tue, 28 Jun 2022 02:30: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=e7MzWLeMaXDhwCZ+jUEH9rI9JUNlGqVG1qneyQOzjT4=; b=B+hbr46lTbTPzvYg4IWKIdTEFRmTUnDb4X8+yacriwu+4hSJdnNXkEk814N5OlwIFbfV 9LUV32VhTNydTgC1RaIKStB05a7Tfml0AMW5+I16HKolHmTwXsCXfRTtz5h3A2qw4D7T KG+C+ZApf9rutkkzBnrF7Ps09+LLCb1o1omzpO9NS3bxocGq3vp1D6e2o0Oq9IB7Aw+r HDOyy83fu6B9hg3xJh5ZvTJq1tFtpRhI02drgQw3/0XjB+r6c0lcvsZXJukWBJOPY4JC ma84I7YHkyf+KFcVs5wWxfm2Ou998W73kF4yf4EixOKtVsmhl2L/TpGe4DqdzKBhlNqa ew== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gws52cspk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:04 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25S2KJsF018705; Tue, 28 Jun 2022 02:30:04 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gwrt1t5vh-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 02:30:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOjcDZ/OZTS5cyWotDYTotcwV7Th1QOCPhA6URfFWlI4B5/D3Ep/LgeUy5QXB4wQVLf9vz3ArHzMAmW8d+vrIMRQj/X6cnS0HcGYoSxSua736G8g78wF3LTrKsqJEln0rzp8/RAH1lU4yV25cwbYf75rlNdnwD5mJ96qpLN8hdu7pwo76uzY21z4wNCymWsXEtWcoOvJqSbiDJFW35A/xvc4bKnjPbRfkpzDDEiZWl3NYr86H25t+IIikR/kj9Deh56oVUxSqdcssNwDMgunjHNKMK5pNPszSXtdtk9Kt+HjqTsmEhTQk+5A6gFkcHuBnmidgr0g20eZG4HMPtBmnA== 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=e7MzWLeMaXDhwCZ+jUEH9rI9JUNlGqVG1qneyQOzjT4=; b=TwHyrQ8qAVAioy5zP5PkMmgbrFDHlaShdkstljZh7CnvYlWwH9fzhRv6cyH3l570kniHB9Mi/krsj9/FWbsSgvnFIsG/4RrYvTRlVTwlOq6CSWaqwLjx2HEoUI8m7YjHGp9bhE7u6lRmeePVORnU06RIw53lheJ+cwL8YuwjtPt7Cgy5SrPCFpP2rYjNElN5V1/K34+Y3kyp3+Ij1GmsiYIu4J6NMhAP8Bjgy9mUJQeFUHz6lws7/H+nqua6gBgMwUBohg92jOrSll+EMmcjoiovz8ywIb2AYWc1jCWDCblm0JK13Q/164s5oxozKHnYww3HhLuJiUofHnNlq2/b0Q== 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=e7MzWLeMaXDhwCZ+jUEH9rI9JUNlGqVG1qneyQOzjT4=; b=QQMqdsgJQl2L5T32Uguk1fGgYsC04I0Pdr4uzCFon1CIf2o7fvDx0IaW/Oztu8E+NoRiOKo/QB0Yfm7Z1bpBlrfieImMfF7Wp9zK9ODZ3THVq7PbqFkorRrS29Z7+rfSyoZn2fb4/m+VxBlmmZ47VwbHhohU3KFQmQ4oGX1CT18= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BLAPR10MB5140.namprd10.prod.outlook.com (2603:10b6:208:320::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 28 Jun 2022 02:30:03 +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 02:30:03 +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 Subject: [PATCH 5/5] scsi: target: Detect unmap support post configuration Date: Mon, 27 Jun 2022 21:29:53 -0500 Message-Id: <20220628022953.20948-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628022953.20948-1-michael.christie@oracle.com> References: <20220628022953.20948-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::25) 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: 315cdd03-5760-4882-a798-08da58ae1b23 X-MS-TrafficTypeDiagnostic: BLAPR10MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aH8h61QjoIqHPgioLi02JtTiOA+3AFn67Fnwp2m3yqGlKabmtqe3l6kA9I6aPljuEhKLrqa+ncl67thzpn54xp83wItYj5eOLZhKGDWgyfzpPu6tc/mqrqjLncv2JXSF9BHo+rAKTzMjVrktfe1WFUg2BSvrCDOWkeZWCHY0/u9HG6WmtprR8i9KLkHWWMKjUbY3A391hpVrdpM41/vutJ3FpNbNOQn9Jp6aadsz/lwFA9aX7zTq/OzaFyLVzgRFJph8qTrkRoKs1jyEPUcGYtgC6iwQMh59hZZA8lxI75vrwIF0HlC/8/bhbfRypRfvZw1EK1Hl+F0K3Q26x8jctgrrme9QduHSdd1Buw0A/T1BEmdKgsJ8SjE7WeYd/WgumQJnvocqDKytPekkiWVnY/iVPJdBnXwptuvSVEoiFvrG9oodtzDK4quCwT2BL9gCYV8Oy3gpsWCl6fNlSRNGnMqdcZsfP8Y1tVncJY49K86Q6QaL1w4FCl6Yi0R7WUtU+Bedau5PsyMp82qVerJE2WstRNvq67D8QYg7CxC4+sZPkwIvQ4SxpNLNmaVkpmujs2PXR0JUhdi6jjdURTr+2dI/gxTjPUCOcjwDJMg2OyKIiEgc1ywEz/dJQftbf1h4UfRhKQnn+z8R/nVvgllBX7RWism/eikcKZT55wswIg/Xx8ngNi5WG+bKRq6fd6fgw1c2BaOj7hvSKA0JDWvuN1xYV7KS4omNpMcdv4dGjgIhUX7ouSJkj74iu0pbvs/105cP5RWA905rfarDxEzWcDwxfMfEdt+cRRbCEXSrT2A= 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)(136003)(366004)(39860400002)(396003)(376002)(346002)(478600001)(26005)(83380400001)(2906002)(52116002)(107886003)(6512007)(6486002)(2616005)(4326008)(8676002)(5660300002)(186003)(66946007)(6666004)(66556008)(8936002)(1076003)(38100700002)(36756003)(41300700001)(6506007)(38350700002)(86362001)(66476007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ujVaw3VSmMu2wdW7FEJaJ/gbbHX7h+H1rKIDh0NYovKVG/ORtXvECkcFeNzP0fuIeMJth8Omwh5ACltatbQy34zQOagNL8Jsdyj82iKT4nJWhKVCpOKSPdYhDBYR8C5bCw1nUEzHOQkJhieUT7CcJepVfSyIZCQTNggFw/f3QFt6AXA7SqAnj5IoL+/HTZMTDYE5ofg5CUDLbvHedeZR3yQtEn4dIE9SvxInU5SU9m8piT2wsAHbVHzlS8ZIeZC1WWbMX7dvQesMamFQnAxORKmirO9qcHbG6feYnzPF3hg/EVxLiToH+yTDeax7MMN+HPq8OOfP66se6J4c8rNZmWPAc5AfM5zQPSrMM/jJPsoBOeM3Ne5YR5M/pkbpIbym6DzOy9RE+WL8CmT1GPDjyRdwdP524R1uh9HLYz6hgN33kgO7iCVA5tP7Grl2xYf8ZWKlx9CB85CGOU+Y9S9IRocsfRsWFFm0sUqbpt81rJPAUZiMJHOqdAFrllOHg7Cr3wj+CtvIvvQ0QOM6Pz1BgT0NmkOlPrItSL1eQCTxGZ8lXNARvxdsaSGqN45v5L4VNH0S5nyW4EqR3iqMcncbsZU/D4cueGw5UR0n4rWmgoG0eZCfKcBeGd0H0Ug9J4TmzpDowXvnN0gbXrqNkoNJJd/zu3bCUIEQBqp5U0b8uYgcqpQxrynVmDo6SvJijubdV79k0cM43SgQzSadL9nTycOP/tlbfLaR92GNs7MFguvycGd5IHBAn8A8/DI6H6kAjBV3u3cX7AuZCtJEpHZ/X1KfxW0ioOHrqrYyGSCdDVrpmLkJrXQlnM5r1s4CD9vCCGyD6VxxSxyjGx18jAy5SUt8LNcwVH/HvL8gHOx0HoEOVB+xP4yeKOwF9OUcRn7xzAW+1nrKgX7nm5U3P6w77gwHsCAS99peT++tI8Mmy+ITXfiFqduRv80wgj2Stj6+O7KBHGz1Ag93LA8RKDf4tqegsccn0U8YOKwSDoKqClbCP66zSoxWySe4FpSxYvdwAqHibNbGxQPwA5jhdKJINbrkXfqNR1Msfr82ZX95TKcLUmNEZ9DhBWzfvkbQCOC84THkmcdvqRXbEgCFImUg/0fd/ulBQQDogjLsid+C4wP/X6VVmdp/6dB7vsAuZQBFDjjr7WLPfLGYjTgBhw6GyjU4jo8rB35TaLTrcWuwWcDGzePwgJZCAfivgxExiM8k4VevQ+6Imkz1og3QR3gP5oyeiTrbhcBYcL52mE6MWHjyOGwjYVevGJw7jpVTcCeHkVOFSYG+jz87c++i9+SQCYkiKUipxWCtfa/cii3cvq3RSdWDRHKWq5oYkPppucSJ5DYCPTK2LWb/qO3jEeJkzHHz1QKVhJVD2wQxV+jhi/DWs1V12uW0DChOZxWuBxJDAvZBGRYXxWFi+zlFz6cD9E+DpIYiV4EOFIMzhsdbkpniAd8pUijDilDHytlThpwULPZyA/V77pEj2+mhwkbeXPf7LL/RAx68p3fXscxBgXzofpdUXoHBxdLdkVmdTv/+cSE3YQfPxKQL5Lzo4bm5tRrutZr8bjgbfHHrzbUEvB9v/dlUxVRaFbQRzHHleH5uY8ChwkhoejdU/e5yOwgCVw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 315cdd03-5760-4882-a798-08da58ae1b23 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:30:03.1096 (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: dcKLPqQqpib38RkpzFDxiBH6JsjSiqQARE7FIf2kgdemNKlWMQQh2F4n6iKn2jU3VAifuNZ62+qgpSuHCom/FI+s6Ts8HuNLglp3Brwv8K8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5140 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-27_06:2022-06-24, 2022-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280009 X-Proofpoint-ORIG-GUID: BZdXaUHlU3KBQ-TOhsOffT0cDFxWh9Qg X-Proofpoint-GUID: BZdXaUHlU3KBQ-TOhsOffT0cDFxWh9Qg 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",