提交 fe60b014 编写于 作者: N NeilBrown

md: factor do_md_run to separate accesses to ->gendisk

As part of relaxing the binding between an mddev and gendisk,
we separate do_md_run into two functions.
  md_run does all the work internal to md
  do_md_run calls md_run and makes and changes to gendisk
     that are required.
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 b821eaa5
......@@ -4297,11 +4297,10 @@ static void md_safemode_timeout(unsigned long data)
static int start_dirty_degraded;
static int do_md_run(mddev_t * mddev)
static int md_run(mddev_t *mddev)
{
int err;
mdk_rdev_t *rdev;
struct gendisk *disk;
struct mdk_personality *pers;
if (list_empty(&mddev->disks))
......@@ -4366,8 +4365,6 @@ static int do_md_run(mddev_t * mddev)
sysfs_notify_dirent(rdev->sysfs_state);
}
disk = mddev->gendisk;
spin_lock(&pers_lock);
pers = find_pers(mddev->level, mddev->clevel);
if (!pers || !try_module_get(pers->owner)) {
......@@ -4495,21 +4492,32 @@ static int do_md_run(mddev_t * mddev)
if (mddev->flags)
md_update_sb(mddev, 0);
set_capacity(disk, mddev->array_sectors);
md_wakeup_thread(mddev->thread);
md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
revalidate_disk(mddev->gendisk);
md_new_event(mddev);
sysfs_notify_dirent(mddev->sysfs_state);
if (mddev->sysfs_action)
sysfs_notify_dirent(mddev->sysfs_action);
sysfs_notify(&mddev->kobj, NULL, "degraded");
kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
return 0;
}
static int do_md_run(mddev_t *mddev)
{
int err;
err = md_run(mddev);
if (err)
goto out;
set_capacity(mddev->gendisk, mddev->array_sectors);
revalidate_disk(mddev->gendisk);
kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
out:
return err;
}
static int restart_array(mddev_t *mddev)
{
struct gendisk *disk = mddev->gendisk;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册