public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: John Garry <john.g.garry@oracle.com>
Cc: hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com,
	martin.petersen@oracle.com,
	james.bottomley@hansenpartnership.com, hare@suse.com,
	jmeneghi@redhat.com, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org, michael.christie@oracle.com,
	snitzer@kernel.org, dm-devel@lists.linux.dev,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/13] libmultipath: Add sysfs helpers
Date: Fri, 27 Feb 2026 14:05:08 -0500	[thread overview]
Message-ID: <aaHq5EjVVYODGxjA@redhat.com> (raw)
In-Reply-To: <20260225153225.1031169-9-john.g.garry@oracle.com>

On Wed, Feb 25, 2026 at 03:32:20PM +0000, John Garry wrote:
> Add helpers for driver sysfs code for the following functionality:
> - get/set iopolicy with mpath_iopolicy_store() and mpath_iopolicy_show()
> - show device path per NUMA node
> - "multipath" attribute group, equivalent to nvme_ns_mpath_attr_group
> - device groups attribute array, similar to nvme_ns_attr_groups but not
>   containing NVMe members.
> 
> Note that mpath_iopolicy_store() has a update callback to allow same
> functionality as nvme_subsys_iopolicy_update() be run for clearing paths.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
>
> diff --git a/lib/multipath.c b/lib/multipath.c
> index 1ce57b9b14d2e..c05b4d25ca223 100644
> --- a/lib/multipath.c
> +++ b/lib/multipath.c
> @@ -745,6 +745,116 @@ void mpath_device_set_live(struct mpath_disk *mpath_disk,
>  }
>  EXPORT_SYMBOL_GPL(mpath_device_set_live);
>  
> +static struct attribute dummy_attr = {
> +	.name = "dummy",
> +};
> +
> +static struct attribute *mpath_attrs[] = {
> +	&dummy_attr,
> +	NULL
> +};
> +
> +static bool multipath_sysfs_group_visible(struct kobject *kobj)
> +{
> +	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct gendisk *disk = dev_to_disk(dev);
> +
> +	return is_mpath_head(disk);
> +}
> +
> +static bool multipath_sysfs_attr_visible(struct kobject *kobj,
> +		struct attribute *attr, int n)
> +{
> +	return false;
> +}
> +
> +DEFINE_SYSFS_GROUP_VISIBLE(multipath_sysfs)

nitpick: this could use DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE instead.

> +
> +const struct attribute_group mpath_attr_group = {
> +	.name           = "multipath",
> +	.attrs		= mpath_attrs,
> +	.is_visible     = SYSFS_GROUP_VISIBLE(multipath_sysfs),
> +};
> +EXPORT_SYMBOL_GPL(mpath_attr_group);
> +
> +const struct attribute_group *mpath_device_groups[] = {
> +	&mpath_attr_group,
> +	NULL
> +};
> +EXPORT_SYMBOL_GPL(mpath_device_groups);
> +
> +ssize_t mpath_iopolicy_show(struct mpath_iopolicy *mpath_iopolicy, char *buf)
> +{
> +	return sysfs_emit(buf, "%s\n",
> +		mpath_iopolicy_names[mpath_read_iopolicy(mpath_iopolicy)]);
> +}
> +EXPORT_SYMBOL_GPL(mpath_iopolicy_show);
> +
> +static void mpath_iopolicy_update(struct mpath_iopolicy *mpath_iopolicy,
> +		int iopolicy, void (*update)(void *), void *data)
> +{
> +	int old_iopolicy = READ_ONCE(mpath_iopolicy->iopolicy);
> +
> +	if (old_iopolicy == iopolicy)
> +		return;
> +
> +	WRITE_ONCE(mpath_iopolicy->iopolicy, iopolicy);
> +
> +	/*
> +	 * iopolicy changes clear the mpath by design, which @update
> +	 * must do.
> +	 */
> +	update(data);
> +
> +	pr_err("iopolicy changed from %s to %s\n",
> +		mpath_iopolicy_names[old_iopolicy],
> +		mpath_iopolicy_names[iopolicy]);

I not sure this warrants a pr_err().

-Ben


  reply	other threads:[~2026-02-27 19:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 15:32 [PATCH 00/13] libmultipath: a generic multipath lib for block drivers John Garry
2026-02-25 15:32 ` [PATCH 01/13] libmultipath: Add initial framework John Garry
2026-03-02 12:08   ` Nilay Shroff
2026-03-02 12:21     ` John Garry
2026-02-25 15:32 ` [PATCH 02/13] libmultipath: Add basic gendisk support John Garry
2026-02-26  2:16   ` Benjamin Marzinski
2026-02-26  9:04     ` John Garry
2026-03-02 12:31   ` Nilay Shroff
2026-03-02 15:39     ` John Garry
2026-03-03 12:39       ` Nilay Shroff
2026-03-03 12:59         ` John Garry
2026-03-03 12:13   ` Markus Elfring
2026-02-25 15:32 ` [PATCH 03/13] libmultipath: Add path selection support John Garry
2026-02-26  3:37   ` Benjamin Marzinski
2026-02-26  9:26     ` John Garry
2026-03-02 12:36   ` Nilay Shroff
2026-03-02 15:11     ` John Garry
2026-03-03 11:01       ` Nilay Shroff
2026-03-03 12:41         ` John Garry
2026-03-04 10:26           ` Nilay Shroff
2026-03-04 11:09             ` John Garry
2026-03-04 13:10   ` Nilay Shroff
2026-03-04 14:38     ` John Garry
2026-02-25 15:32 ` [PATCH 04/13] libmultipath: Add bio handling John Garry
2026-03-02 12:39   ` Nilay Shroff
2026-03-02 15:52     ` John Garry
2026-03-03 14:00       ` Nilay Shroff
2026-02-25 15:32 ` [PATCH 05/13] libmultipath: Add support for mpath_device management John Garry
2026-02-25 15:32 ` [PATCH 06/13] libmultipath: Add cdev support John Garry
2026-02-25 15:32 ` [PATCH 07/13] libmultipath: Add delayed removal support John Garry
2026-03-02 12:41   ` Nilay Shroff
2026-03-02 15:54     ` John Garry
2026-02-25 15:32 ` [PATCH 08/13] libmultipath: Add sysfs helpers John Garry
2026-02-27 19:05   ` Benjamin Marzinski [this message]
2026-03-02 11:11     ` John Garry
2026-02-25 15:32 ` [PATCH 09/13] libmultipath: Add PR support John Garry
2026-02-25 15:49   ` Keith Busch
2026-02-25 16:52     ` John Garry
2026-02-27 18:12     ` Benjamin Marzinski
2026-03-02 10:45       ` John Garry
2026-02-25 15:32 ` [PATCH 10/13] libmultipath: Add mpath_bdev_report_zones() John Garry
2026-02-25 15:32 ` [PATCH 11/13] libmultipath: Add support for block device IOCTL John Garry
2026-02-27 19:52   ` Benjamin Marzinski
2026-03-02 11:19     ` John Garry
2026-02-25 15:32 ` [PATCH 12/13] libmultipath: Add mpath_bdev_getgeo() John Garry
2026-02-25 15:32 ` [PATCH 13/13] libmultipath: Add mpath_bdev_get_unique_id() John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaHq5EjVVYODGxjA@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=axboe@fb.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=jmeneghi@redhat.com \
    --cc=john.g.garry@oracle.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=sagi@grimberg.me \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox