From patchwork Fri Jun 3 06:55: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: 12868639 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 49D56CCA480 for ; Fri, 3 Jun 2022 06:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241732AbiFCG4F (ORCPT ); Fri, 3 Jun 2022 02:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241459AbiFCG4E (ORCPT ); Fri, 3 Jun 2022 02:56:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC2BB38BF8; Thu, 2 Jun 2022 23:56:00 -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 2533AiJV010186; Fri, 3 Jun 2022 06:55:52 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=s7TiXyeIfyUugeBJ1sUfhbikzNNoui9aqCOCPKFZCxo=; b=ggGwlthBe9D9UR6Ojo5t4Cp1fCKtj0nXWxbDvIhRrXYnvW5cOMIp7SFN3W4cyDaXKkvp WZEcJupn1UAWv397/v+H09qInN5h5lSl0Awsj9WcDeEKoiNjFd9LXUPm+amU+Vz/9+fN owx0Djh5GVcp+eWKvigqpfYrzwfb46lcjZ00GIEgTf0Irh1KU3CuphRkMLGBQQrKNEpI HEEy1mlV76ghTFGp4Y9ESorvOJL3kOISo2wP3VAUAtLGcBALEUmBjiZWVCR89K9MXN0Z sTo1GYGQ6/ydHWQZttvZzGYa6y5+e8z2RjH2GFtVZWZupQb+Q3mPJKxaFzRmGIa2LUb+ 9A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gbc4xv7sv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 03 Jun 2022 06:55:52 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 2536oNhc025389; Fri, 3 Jun 2022 06:55:51 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gc8p5nyqv-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 03 Jun 2022 06:55:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RWJ9jXQsCSPrr6l0oDB00n9nK4QPAdPKYg1pto57hPI0DNmGNpyS5c5CePJacU9KZY8zvwZP/Q0F0FQjV+ne9BmpPep4iWGGKC0YQpwVSjphlUv916ER6WI1uYmYmA5pPV3nAZxIWGZVUSYOSgtHB9XFcX8GZPpAylfVgPjjzbuufUxu88FU9m7LRiSyadiBfFuJ+oIi3De0VCrpw+M810NRPEzX4iJTnZQLETVakbpyq8OyYpgWqkJI63JG3vBSbImNh4Wb7RBWi9+e718GbC5h5nljP+Up9BPZMiqbxmeSj9nWSQhgesCF1HfPzodrmJ1ZvgZs12bs6NZnSxTLpA== 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=s7TiXyeIfyUugeBJ1sUfhbikzNNoui9aqCOCPKFZCxo=; b=j2JQGAcBsTe+/LOuZLKJn+PSuTp+gzK8tDNF17sIFvMKnAvkkG7YxaG9WraPTIO5W02KwTpe4sT5S0ZBg6eBZGxrBQQbcqWpEZpIVDhPFqGkMXdg8CpzacuFwRIELOV6VC7t2JxbAJQquM4CCjaFAhT9JmpBV6DG/r78HS/6PYKLUBXVYj/i3CvSWD7lsUuC5vxC5XY8w9KZ15bi9DX1lF03hBFURZ9hPOsfPvRDMSPENak7auOSBwvzUPrwILwyH51WSO0lX/Uyd7ygeMcf228XnaQnZ/8jYhmYPSmdHbqebNtuv33UiUdED2vF7YDD3eSSx1C2kYDz8miVkHQnQg== 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=s7TiXyeIfyUugeBJ1sUfhbikzNNoui9aqCOCPKFZCxo=; b=l7MH4tAt74a/aI6bfdN0YuwT4Fy8UtMiFevAtC+IUSAyOkkU8687uOZ5EqQkOTV8ZRpLU395fU429A5t8BvvvY9j8qXOo+i4Cr+GTgY2DmHnwpN5ope6NPqI4X/mM8rY70nWWp6XRWgzwgPbpt1MvajVByPpHrdPTDuGzCOUTBk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BYAPR10MB2789.namprd10.prod.outlook.com (2603:10b6:a03:82::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19; Fri, 3 Jun 2022 06:55: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.5293.019; Fri, 3 Jun 2022 06:55:49 +0000 From: Mike Christie To: linux-block@vger.kernel.org, dm-devel@redhat.com, snitzer@kernel.org, hch@lst.de, axboe@kernel.dk, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 04/11] block: Add PR callouts for read keys and reservation Date: Fri, 3 Jun 2022 01:55:29 -0500 Message-Id: <20220603065536.5641-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220603065536.5641-1-michael.christie@oracle.com> References: <20220603065536.5641-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR16CA0012.namprd16.prod.outlook.com (2603:10b6:3:c0::22) 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: b3834d5f-bc5a-49ad-b456-08da452e176a X-MS-TrafficTypeDiagnostic: BYAPR10MB2789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TTw0BtoMvlrTbC/la2h4ZsZYxenE1okmCjtLrorXweFslk+QJTA3vMutGuMSjS021tkaOhiWt9vwUWgFYGgeS2scUb9bczd9A+iSii4TbBdM/5SL4U5p++V+FjyB4R5AMypzF47HmtF4uHxCLf89a6/aw23naioyGKpIS7Jpc3zL/ibZB36Y+RsUlv1IX1eSFacmIgi72QtLhB1hKlVrgEYgar+/hCKK4Jr80cUipw8SHJMQmlPtr92YffdMesTXoMyk/apsDPYm0A9e6EVRsdRGMlUUHRL0ocAmxJ29k9Utm+8j93sWjAgm/9Y3C3CiRMQ7seJnAHb8bpn2iALCHyhDFe9k0M8SjaeEXukIFTFJQnhakhj3fC1yuC/88CN4KB+CV/mCWbkuPIEBQ/ytoQ4EQ8JVKjo/x9nCHYSGGskIBUdF8ytPL34WCEUwrypwToCgkNKzw5JKOZdeQtLhAYNweLdQv0R8UeMmH/H2UrLHl/yuEsFx7N8FQbNxgO0k/HNvIuczm/PxNaLuFDgelw4heZxlwrEgXq9neUJx2c9zdJv+9Lcn7DBL6A1lz9X27J9RSM90s6fXxLK0l6W1jcKXiyIrvB663dy6hZ+1Sf3RuJGsrjxzWFoDRg81ysJkGe7jOvux1RutObF2dnrOEDs3hozeq3X+yHvlEHsu/iowsxNZtB14A1e9AseE6IzX8/Fbt3xbKp0v4La+SPAPLA== 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:(13230001)(366004)(66946007)(8676002)(38350700002)(38100700002)(66476007)(4326008)(66556008)(86362001)(83380400001)(36756003)(8936002)(107886003)(6486002)(2616005)(316002)(5660300002)(1076003)(6512007)(26005)(2906002)(6506007)(52116002)(186003)(6666004)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q7B+2KzXDdKVaa7mfc2pF9DubtoSL1H2ql7Uv5IUza3lSjNOEA5xw5n/XXiN5D7amh/5blIHTXIc+PIL+aP1BChN2cyvZunCOCuwna4dFJZlcu2yWOav6mNeG3OUcWZv3M9Vj18fncf7qPunJ138rZMUBAmcQdjF+4N3F2edP52BwX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fN+L3SVjgyIDF7Zucw3j/NW2AGwpNHDCoc8gbzv6eGUFFJm7Q06oVZg5qGVsoG/q9l8Kwqi0Bpp9W2OqIcYxjEQrs+oAPlF72xnuSK6tMQQS7Y1pW0qH38yHgkV69I2OVO0OMi1nFVNlF12aewAKvaeC6fwIIAU9pgCGbK08STiLE541OEXBQBjku7byrFl4sWx1+XGdpLhnwF0Ie3JjOpaOxn0dqVaZAyv1HFGaxLfg7QZSJdXLUiH76HLBMX99BU1vD0S1A3r9+8InjFihqzlIBAbBF4EjVyfeXpoonEWvlRhxOR3Eze5cDaQm3eArHhfpDpXc8e2cyxVcrASfuErcZiDbKF+qGeAwkr3CGHyRhDDSIDor3es3cHyKmVHXPi03xo2cdD3v8f5itos95hXM2qTqPp+6lSR5S96Ua9I+WpUBh703eOoZQys2SKwGIKUB0kEGMgyWlQTaS+qXzb+ysQ4vSXbV+sIHmRk8/IPRoIznZcsQt9c+2op0p2fmkoVerBcNQ408RK3RxIsJ8ks= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3834d5f-bc5a-49ad-b456-08da452e176a X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2022 06:55:49.1746 (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: Zv8EKqhi/AIaEwusXmn78d7CFPIPxuQA+PDKCFggltSppARlwUai73pDUzFKsTcZc05UQGyRSUvuzwEsMoAsBRoRHqLtm4mnx5z8nn5yads= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2789 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.874 definitions=2022-06-03_02:2022-06-02,2022-06-03 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206030029 X-Proofpoint-GUID: 55Clha1AkpeCod82uKrc2wirAmUI9ZKb X-Proofpoint-ORIG-GUID: 55Clha1AkpeCod82uKrc2wirAmUI9ZKb Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Add callouts for reading keys and reservations. Note: This only initially adds the struct definitions in the kernel as I'm not sure if we wanted to export the interface to userspace yet. We may want to refine internally for LIO and when we can enable it for NVMe then add the finished interface to userspace. The latter is not done, because NVMe's report reservation command is similar to SCSI's read full status where they return a remote and local ID as well as the key/reservation info. However, a lot of SCSI devices don't do remote/local ID parts correctly. It seems that read full status might not be used very often so does not get a lot of testing. Signed-off-by: Mike Christie --- include/linux/pr.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/pr.h b/include/linux/pr.h index 94ceec713afe..21a8eb8b34b5 100644 --- a/include/linux/pr.h +++ b/include/linux/pr.h @@ -4,6 +4,18 @@ #include +struct pr_keys { + u32 generation; + u32 num_keys; + u64 keys[]; +}; + +struct pr_held_reservation { + u64 key; + u32 type; + u32 generation; +}; + struct pr_ops { int (*pr_register)(struct block_device *bdev, u64 old_key, u64 new_key, u32 flags); @@ -14,6 +26,10 @@ struct pr_ops { int (*pr_preempt)(struct block_device *bdev, u64 old_key, u64 new_key, enum pr_type type, bool abort); int (*pr_clear)(struct block_device *bdev, u64 key); + int (*pr_read_keys)(struct block_device *bdev, + struct pr_keys *keys_info, int keys_info_len); + int (*pr_read_reservation)(struct block_device *bdev, + struct pr_held_reservation *rsv); }; #endif /* LINUX_PR_H */