]> Pileus Git - ~andy/linux/blobdiff - drivers/md/dm.c
Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
[~andy/linux] / drivers / md / dm.c
index 44a2fa6814ce97cbd05d3e3e34c65672c6dbbebe..8c53b09b9a2c5a3050b22f4fba82af5563f1d59a 100644 (file)
@@ -200,8 +200,8 @@ struct mapped_device {
        /* forced geometry settings */
        struct hd_geometry geometry;
 
-       /* sysfs handle */
-       struct kobject kobj;
+       /* kobject and completion */
+       struct dm_kobject_holder kobj_holder;
 
        /* zero-length flush that will be cloned and submitted to targets */
        struct bio flush_bio;
@@ -1908,6 +1908,7 @@ static struct mapped_device *alloc_dev(int minor)
        init_waitqueue_head(&md->wait);
        INIT_WORK(&md->work, dm_wq_work);
        init_waitqueue_head(&md->eventq);
+       init_completion(&md->kobj_holder.completion);
 
        md->disk->major = _major;
        md->disk->first_minor = minor;
@@ -2769,20 +2770,14 @@ struct gendisk *dm_disk(struct mapped_device *md)
 
 struct kobject *dm_kobject(struct mapped_device *md)
 {
-       return &md->kobj;
+       return &md->kobj_holder.kobj;
 }
 
-/*
- * struct mapped_device should not be exported outside of dm.c
- * so use this check to verify that kobj is part of md structure
- */
 struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
 {
        struct mapped_device *md;
 
-       md = container_of(kobj, struct mapped_device, kobj);
-       if (&md->kobj != kobj)
-               return NULL;
+       md = container_of(kobj, struct mapped_device, kobj_holder.kobj);
 
        if (test_bit(DMF_FREEING, &md->flags) ||
            dm_deleting_md(md))