mirror of https://gitee.com/openkylin/linux.git
[PATCH] md: split off some md attributes in sysfs to a separate group
Some, but not all, md array support data redundancy and hence support checking and restoring that redundancy (resync, rebuild). Some attributes apply specifically to functions involving this redundancy, and so should only appear for md arrays for which they are meaningful. i.e. they should not appear for raid0, linear, multpath, faulty. This patch separates these into a distinct group and creates the group only if the personality supports sync_request. Signed-off-by: Neil Brown <neilb@suse.de> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
96de1e663c
commit
411036fa19
|
@ -1807,10 +1807,19 @@ md_mismatches = __ATTR_RO(mismatch_cnt);
|
||||||
static struct attribute *md_default_attrs[] = {
|
static struct attribute *md_default_attrs[] = {
|
||||||
&md_level.attr,
|
&md_level.attr,
|
||||||
&md_raid_disks.attr,
|
&md_raid_disks.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute *md_redundancy_attrs[] = {
|
||||||
&md_scan_mode.attr,
|
&md_scan_mode.attr,
|
||||||
&md_mismatches.attr,
|
&md_mismatches.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
static struct attribute_group md_redundancy_group = {
|
||||||
|
.name = NULL,
|
||||||
|
.attrs = md_redundancy_attrs,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
|
md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
|
||||||
|
@ -2047,6 +2056,8 @@ static int do_md_run(mddev_t * mddev)
|
||||||
bitmap_destroy(mddev);
|
bitmap_destroy(mddev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
if (mddev->pers->sync_request)
|
||||||
|
sysfs_create_group(&mddev->kobj, &md_redundancy_group);
|
||||||
atomic_set(&mddev->writes_pending,0);
|
atomic_set(&mddev->writes_pending,0);
|
||||||
mddev->safemode = 0;
|
mddev->safemode = 0;
|
||||||
mddev->safemode_timer.function = md_safemode_timeout;
|
mddev->safemode_timer.function = md_safemode_timeout;
|
||||||
|
@ -2155,6 +2166,9 @@ static int do_md_stop(mddev_t * mddev, int ro)
|
||||||
set_disk_ro(disk, 0);
|
set_disk_ro(disk, 0);
|
||||||
blk_queue_make_request(mddev->queue, md_fail_request);
|
blk_queue_make_request(mddev->queue, md_fail_request);
|
||||||
mddev->pers->stop(mddev);
|
mddev->pers->stop(mddev);
|
||||||
|
if (mddev->pers->sync_request)
|
||||||
|
sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
|
||||||
|
|
||||||
module_put(mddev->pers->owner);
|
module_put(mddev->pers->owner);
|
||||||
mddev->pers = NULL;
|
mddev->pers = NULL;
|
||||||
if (mddev->ro)
|
if (mddev->ro)
|
||||||
|
|
Loading…
Reference in New Issue