From patchwork Fri Feb 24 17:44:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13152885 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CA94C7EE32 for ; Mon, 27 Feb 2023 07:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677481421; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cCpi1BVF6SNmdKSHLaMBDcR/Ee92KYV6f/52DgtxsMY=; b=bFJh/TjHErDiajVQsp/IcPOFVZ/on+2dPCUZqaL+Nt7Zmu1EnIdLExKmKofa70vELi4Te9 o+eFGEI3iYoJCGkBqrScULTVYrX0Wz+fHF+INYT2hYt+yEtRWVPVvN55R91ySBaxuYjVRh 4HxSdDjx0jYKN+f7cxWQaGbynyWc1ag= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-MNNhoQw6P2a2YjmDEh-mjg-1; Mon, 27 Feb 2023 02:03:37 -0500 X-MC-Unique: MNNhoQw6P2a2YjmDEh-mjg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EEED38149A1; Mon, 27 Feb 2023 07:03:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A20D2026D4B; Mon, 27 Feb 2023 07:03:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7D32A1946A4F; Mon, 27 Feb 2023 07:03:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B145419465B1 for ; Fri, 24 Feb 2023 17:47:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 896A2492B08; Fri, 24 Feb 2023 17:47:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80FE4492B07 for ; Fri, 24 Feb 2023 17:47:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CAB78588E7 for ; Fri, 24 Feb 2023 17:47:52 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-z1OCcGcGMM66yOIuhvy0Ig-1; Fri, 24 Feb 2023 12:47:50 -0500 X-MC-Unique: z1OCcGcGMM66yOIuhvy0Ig-1 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31OHho7T007318; Fri, 24 Feb 2023 17:45:23 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ntn3dwpyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Feb 2023 17:45:22 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 31OHJGXX031548; Fri, 24 Feb 2023 17:45:22 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ntn49wjuh-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Feb 2023 17:45:22 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CH0PR10MB7535.namprd10.prod.outlook.com (2603:10b6:610:187::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.7; Fri, 24 Feb 2023 17:45:20 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::7dd7:8d22:104:8d64]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::7dd7:8d22:104:8d64%7]) with mapi id 15.20.6156.007; Fri, 24 Feb 2023 17:45:20 +0000 From: Mike Christie To: bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com, linux-block@vger.kernel.org, dm-devel@redhat.com, snitzer@kernel.org, axboe@kernel.dk, linux-nvme@lists.infradead.org, chaitanyak@nvidia.com, kbusch@kernel.org, target-devel@vger.kernel.org Date: Fri, 24 Feb 2023 11:44:54 -0600 Message-Id: <20230224174502.321490-11-michael.christie@oracle.com> In-Reply-To: <20230224174502.321490-1-michael.christie@oracle.com> References: <20230224174502.321490-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0326.namprd03.prod.outlook.com (2603:10b6:8:2b::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CH0PR10MB7535:EE_ X-MS-Office365-Filtering-Correlation-Id: 211feb96-6bf0-416d-16b9-08db168ee5dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: VRy4eALglemKT+6kf/0fpJ9ZJKX2ucgSW258QMBa2C2xXjrl5QEBh6OMqGC3SSpsKolwD/O+25GsrP+M/LHRbz0J6QQA71vX2oAUh4XcsrAdlUMlGr3Rk9FjWsTgLmzosws5U1YmRIIndG4tazQuUcURKy2yAvZON0NAqBMPQ717e/yVxQ/5jfGh+GkzBt1yY/XOHm7PdZYu5VjLMtUbidAUYwqkRJuK6x7FAVdypvXondUwcLvuYeCWMzSosv4aBjHTX4N5rmhoczNtcf3QYNqXGEevMHieeMb+W08Ecms4HPWSwEoyI+P2KEG7hz3k1xbPyWKrvMKT9ktv+fFi8nC0tySlqyAlyc9IOZCS5J2eyrjCxqWQWrNpYuXtwABuFUrsPOOXLcLu9PVXR8KgxWCxP3cmEQqeeXPh3vg8Yoz2zMKpwJnZ8drQylkRXiiL8gLvnYt0A/X2+lHPHhqvtUU+JoXyUixMEEc1c3kW7lZeHSA5BdRyy6xRzkfx1afwhNKcKYtfBsgVLsEKVXEQrY7J2u0r6/54HBC8rqqr0lffGEHM8mt1g0r0jYchUYqLT7j6H/NeYJ11lzuZMhmjbBlQJguyANAjd7/xI+sS3Qb8OL5ynVIiuAl7Z72BbE225f53JC8xlEawl7BxOa6tkhlBdu1kLhAHSPOTGHjYIcYOZ43dvFq4yjGnq8ERhNM3 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:(13230025)(346002)(366004)(376002)(39860400002)(136003)(396003)(451199018)(4326008)(66476007)(66556008)(66946007)(8676002)(83380400001)(41300700001)(316002)(36756003)(186003)(8936002)(26005)(5660300002)(2616005)(38100700002)(7416002)(6512007)(921005)(86362001)(478600001)(2906002)(6486002)(6506007)(107886003)(1076003)(6666004); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4K+Y95CKTM2MAsg/ZEU1jxOeC7miBfY5a2FkEtr44nYHt5capRu0qVs5i1s4IdEqPuKj4r0IJlhO3fvFj/n0RjL/ioYgZaHKxDPTE6DDik0AlpZA9oozA/q1ryTtdlNAD5KYnjXI82kAWrsOU5UYfxl7upUo0Zay9ubmkQz06+fwfDRglP1f/gojRB8JpMeG6LqZWmoZSRnHDVDx1YcqjnSWnzvYHFwYXuubmRd5ekDSWc47GB8HHzdOrWtRDyOBVisJWzJzHiLBs9g8pM5Fy7fq7FvWPTHJdpfvz1Z+iL1VpgjUvGnc+EMrNV+s9tg9ybECxjJuENyc4SjeopWb4BpABGZHiihD2jimDIqzUOEk7Ge1h0yZSgEdtVJr/biE0GrkXTSYr9sgEyOVVctYBDYdVsil4xu7F2THU+dx6mAV31+/ttz1w4BpuIBwb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LzuDQuyyDWoWK9Nli75x5NXO/s8cnfgBpKX2KL30T8jAuN9Q0eC/As1qPdD15h1ycKqCV61iATbNVukEQMZVkhWUN0FFwO3vnJ7ePNSXhsIkTMiHsH9b0Fas/HrQ97Z65A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 211feb96-6bf0-416d-16b9-08db168ee5dc X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2023 17:45:20.2036 (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: PZExdwekgjO2sO7eALSWdlhC91w1Usnzm8+VuiomCZLb3f5Lw6l0dKuej7tclLTCx6iw/izvlOpqmNMbaYezTe+zHqQHrNOYZ9yi9Au9frw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB7535 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-24_12,2023-02-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302240139 X-Proofpoint-GUID: Irxz52Esgb89BfOIaa9Bftvy9oduZNAF X-Proofpoint-ORIG-GUID: Irxz52Esgb89BfOIaa9Bftvy9oduZNAF X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mailman-Approved-At: Mon, 27 Feb 2023 07:03:30 +0000 Subject: [dm-devel] [PATCH v4 10/18] nvme: Add helper to send pr command X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Christie Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Move the code that checks for multipath support and sends the pr command to a new helper so it can be used by the reservation report support added in the next patches. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/nvme/host/pr.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/pr.c b/drivers/nvme/host/pr.c index 26ad25f7280b..7a1d93da4970 100644 --- a/drivers/nvme/host/pr.c +++ b/drivers/nvme/host/pr.c @@ -27,7 +27,7 @@ static char nvme_pr_type(enum pr_type type) } static int nvme_send_ns_head_pr_command(struct block_device *bdev, - struct nvme_command *c, u8 *data, unsigned int data_len) + struct nvme_command *c, void *data, unsigned int data_len) { struct nvme_ns_head *head = bdev->bd_disk->private_data; int srcu_idx = srcu_read_lock(&head->srcu); @@ -43,7 +43,7 @@ static int nvme_send_ns_head_pr_command(struct block_device *bdev, } static int nvme_send_ns_pr_command(struct nvme_ns *ns, struct nvme_command *c, - u8 *data, unsigned int data_len) + void *data, unsigned int data_len) { c->common.nsid = cpu_to_le32(ns->head->ns_id); return nvme_submit_sync_cmd(ns->queue, c, data, data_len); @@ -71,6 +71,17 @@ static int nvme_sc_to_pr_err(int nvme_sc) } } +static int nvme_send_pr_command(struct block_device *bdev, + struct nvme_command *c, void *data, unsigned int data_len) +{ + if (IS_ENABLED(CONFIG_NVME_MULTIPATH) && + bdev->bd_disk->fops == &nvme_ns_head_ops) + return nvme_send_ns_head_pr_command(bdev, c, data, data_len); + else + return nvme_send_ns_pr_command(bdev->bd_disk->private_data, c, + data, data_len); +} + static int nvme_pr_command(struct block_device *bdev, u32 cdw10, u64 key, u64 sa_key, u8 op) { @@ -84,13 +95,7 @@ static int nvme_pr_command(struct block_device *bdev, u32 cdw10, c.common.opcode = op; c.common.cdw10 = cpu_to_le32(cdw10); - if (IS_ENABLED(CONFIG_NVME_MULTIPATH) && - bdev->bd_disk->fops == &nvme_ns_head_ops) - ret = nvme_send_ns_head_pr_command(bdev, &c, data, - sizeof(data)); - else - ret = nvme_send_ns_pr_command(bdev->bd_disk->private_data, &c, - data, sizeof(data)); + ret = nvme_send_pr_command(bdev, &c, data, sizeof(data)); if (ret < 0) return ret;