From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DD9C7E9B36D for ; Mon, 2 Mar 2026 12:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+6wgKiboEuRhujtj6K4i1c0td5216fd90e8Ko+/ZwV0=; b=V885IQhu1A3ePaJGAKCk2ZfAi3 pM9lFx+tQkzuJi1YGC9CnLE5Fy5J6FUTSfJSHRA/wh9cqhJzjbSyfR3ls6gOQpjH73HN0t4rUMLDc +U444NSqdglkFYoVNfubkwjeznDLJkiXQDda4aEwyWRwWQc851aLjFY6Nn/G3iVVK/SJ4QqxOjyrO gXJX3AWm8zBWXdJcdjx5WbOgEiPhOFb/H1n/VVM9QdjW4sjtcR9A39dw8Av6wAc4dhDTWMcC8f+7u W6MNLvQcTM33PdzTC519tLAx2SlsquKMpGggE68jTBdH45fk2mN1KlntFlQF2KChDOeaIb+Yi98Un YCS4Sazg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vx24r-0000000CuDR-1t8r; Mon, 02 Mar 2026 12:08:45 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vx24o-0000000CuD0-1WfH for linux-nvme@lists.infradead.org; Mon, 02 Mar 2026 12:08:43 +0000 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 621HZfPE1875826; Mon, 2 Mar 2026 12:08:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=+6wgKi boEuRhujtj6K4i1c0td5216fd90e8Ko+/ZwV0=; b=ZEpYMunGM/7RnMHEx6o6HE WoC3VAw5yjPhB33RMvMrQ1zs30EkS4W/17FyaRtuijaynZOkh8yprFJobJiyfHUG Q1Uosbg38QMgLg2K87WyAnTFqGNw1r5W5QYFwE8yHV9EEVUNqQCesMQCh+vXzg73 8ECROJOK64wRwMT0shFnYfz5Yuy7OXw8wSrpfiGJNXCF9dU0ubPiH+fj+BDhwIQz qzUNxnUwZ5OMla7BT0tGhDO+s73y+sjaA4z52XS7pPcWcrUl6QXjK73efXAYyqGJ 6efucI0CgHGEpvjPQ1rfRUKQJvNpdTXzRhRerQEDkRQRS/K2T+7QaFN4Q5fC4/2g == Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4cksrhxdj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Mar 2026 12:08:26 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 6229YM2x016756; Mon, 2 Mar 2026 12:08:25 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4cmbpmwwat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Mar 2026 12:08:25 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 622C8OPN25887464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Mar 2026 12:08:24 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 759C65805A; Mon, 2 Mar 2026 12:08:24 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E728858051; Mon, 2 Mar 2026 12:08:18 +0000 (GMT) Received: from [9.79.192.112] (unknown [9.79.192.112]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 2 Mar 2026 12:08:18 +0000 (GMT) Message-ID: Date: Mon, 2 Mar 2026 17:38:17 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 01/13] libmultipath: Add initial framework To: John Garry , hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, martin.petersen@oracle.com, james.bottomley@hansenpartnership.com, hare@suse.com Cc: jmeneghi@redhat.com, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, michael.christie@oracle.com, snitzer@kernel.org, bmarzins@redhat.com, dm-devel@lists.linux.dev, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260225153225.1031169-1-john.g.garry@oracle.com> <20260225153225.1031169-2-john.g.garry@oracle.com> Content-Language: en-US From: Nilay Shroff In-Reply-To: <20260225153225.1031169-2-john.g.garry@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=Rp/I7SmK c=1 sm=1 tr=0 ts=69a57dba cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=yPCof4ZbAAAA:8 a=ipGkAlj-h5eCv5jo-WsA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAyMDA5NyBTYWx0ZWRfX10vyWKWe9S3H 32/dSDHmxQSlvD3F0zBx88ZzvX8QFVrqkRFbzi70y8O31FOsIMk4o/PEbCic/rgtELA8+RJPmn3 wxh/nYPfQWPdPzLewdVW7qpt+fHKsNudS/yQZ36fsLcLQ5+GnBe9Zbo+ee6+9mvTVhQwwd/baXf A5OjRBXzdekGjZbiGjZCXkWOUCZH1o0k+EGTh/Iu7Apt+s3Mh8TefcgNUn2u1jbQmuXyIXRjAIs +Wc63V02WZMQXNA5M5G5cueIswrrEdq/t4dj4ULGg7hSqRwZV28r8Kp1yX0ZHP/yQG1qGiy/9QG 43SsAV/OmglMx8q6qsHMSH5gqV9cisXh8t7fKTtenuN8celtUjwSLL9jX9jcQb7ZoYJ3HRp8j9p OzOOB/FnjM50PVVNuv2AuGE9K2rq0H14y5pViTBsr1/Z/TDsslX67orWbmVJhrjYvpw/jWEh0pd ig+NDSJDWTtfThA5nBg== X-Proofpoint-GUID: b3UupQHymc8PL0cFXZ2oDgvX-8hnY94k X-Proofpoint-ORIG-GUID: b3UupQHymc8PL0cFXZ2oDgvX-8hnY94k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-02_03,2026-02-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1011 impostorscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603020097 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260302_040842_417743_304D2B57 X-CRM114-Status: GOOD ( 28.73 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Hi John, On 2/25/26 9:02 PM, John Garry wrote: > Add initial framework for libmultipath. libmultipath is a library for > multipath-capable block drivers, such as NVMe. The main function is to > support path management, path selection, and failover handling. > > Basic support to add and remove the head structure - mpath_head - is > included. > > This main purpose of this structure is to manage available paths and path > selection. It is quite similar to the multipath functionality in > nvme_ns_head. However a separate structure will introduced after to manage > the multipath gendisk. > > Each path is represented by the mpath_device structure. It should hold a > pointer to the per-path gendisk and also a list element for all siblings > of paths. For NVMe, there would be a mpath_device per nvme_ns. > > All the libmultipath code is more or less taken from > drivers/nvme/host/multipath.c, which was originally authored by Christoph > Hellwig . > > Signed-off-by: John Garry > --- > include/linux/multipath.h | 28 +++++++++++++++ > lib/Kconfig | 6 ++++ > lib/Makefile | 2 ++ > lib/multipath.c | 74 +++++++++++++++++++++++++++++++++++++++ > 4 files changed, 110 insertions(+) > create mode 100644 include/linux/multipath.h > create mode 100644 lib/multipath.c > > diff --git a/include/linux/multipath.h b/include/linux/multipath.h > new file mode 100644 > index 0000000000000..18cd133b7ca21 > --- /dev/null > +++ b/include/linux/multipath.h > @@ -0,0 +1,28 @@ > + > +#ifndef _LIBMULTIPATH_H > +#define _LIBMULTIPATH_H > + > +#include > +#include > + > +struct mpath_device { > + struct list_head siblings; > + struct gendisk *disk; > +}; > + > +struct mpath_head { > + struct srcu_struct srcu; > + struct list_head dev_list; /* list of all mpath_devs */ > + struct mutex lock; > + > + struct kref ref; > + > + struct mpath_device __rcu *current_path[MAX_NUMNODES]; > + void *drvdata; > +}; Can we use current_path[] as last element and flex array (same as what we have today under struct nvme_ns_head) so that we don't need to allocate array as big as MAX_NUMANODES? With flex array we can use num_possible_nodes() which may be much smaller than MAX_NUMANODES. Thanks, --Nilay