Skip to content

Commit

Permalink
Merge tag 'md-6.12-20240906' of https://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/song/md into for-6.12/block

Pull MD updates from Song:

"This patch, by Xiao Ni, adds a sysfs entry 'new_level'."

* tag 'md-6.12-20240906' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md: Add new_level sysfs interface
  • Loading branch information
Jens Axboe committed Sep 6, 2024
2 parents 9814143 + d981ed8 commit 68f31e8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4052,6 +4052,34 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
static struct md_sysfs_entry md_level =
__ATTR(level, S_IRUGO|S_IWUSR, level_show, level_store);

static ssize_t
new_level_show(struct mddev *mddev, char *page)
{
return sprintf(page, "%d\n", mddev->new_level);
}

static ssize_t
new_level_store(struct mddev *mddev, const char *buf, size_t len)
{
unsigned int n;
int err;

err = kstrtouint(buf, 10, &n);
if (err < 0)
return err;
err = mddev_lock(mddev);
if (err)
return err;

mddev->new_level = n;
md_update_sb(mddev, 1);

mddev_unlock(mddev);
return len;
}
static struct md_sysfs_entry md_new_level =
__ATTR(new_level, 0664, new_level_show, new_level_store);

static ssize_t
layout_show(struct mddev *mddev, char *page)
{
Expand Down Expand Up @@ -5583,6 +5611,7 @@ __ATTR(serialize_policy, S_IRUGO | S_IWUSR, serialize_policy_show,

static struct attribute *md_default_attrs[] = {
&md_level.attr,
&md_new_level.attr,
&md_layout.attr,
&md_raid_disks.attr,
&md_uuid.attr,
Expand Down

0 comments on commit 68f31e8

Please sign in to comment.