]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm-emc.c
dm mpath: send uevents
[linux-2.6-omap-h63xx.git] / drivers / md / dm-emc.c
index 2b2d45d7baaaaf55f9cfb45ff9b755587fc83d61..6b91b9ab1d41f537bc81e703ecffa710f0efcdf8 100644 (file)
@@ -38,12 +38,9 @@ static inline void free_bio(struct bio *bio)
        bio_put(bio);
 }
 
-static int emc_endio(struct bio *bio, unsigned int bytes_done, int error)
+static void emc_endio(struct bio *bio, int error)
 {
-       struct path *path = bio->bi_private;
-
-       if (bio->bi_size)
-               return 1;
+       struct dm_path *path = bio->bi_private;
 
        /* We also need to look at the sense keys here whether or not to
         * switch to the next PG etc.
@@ -57,11 +54,9 @@ static int emc_endio(struct bio *bio, unsigned int bytes_done, int error)
 
        /* request is freed in block layer */
        free_bio(bio);
-
-       return 0;
 }
 
-static struct bio *get_failover_bio(struct path *path, unsigned data_size)
+static struct bio *get_failover_bio(struct dm_path *path, unsigned data_size)
 {
        struct bio *bio;
        struct page *page;
@@ -86,7 +81,7 @@ static struct bio *get_failover_bio(struct path *path, unsigned data_size)
        }
 
        if (bio_add_page(bio, page, data_size, 0) != data_size) {
-               DMERR("get_failover_bio: alloc_page() failed.");
+               DMERR("get_failover_bio: bio_add_page() failed.");
                __free_page(page);
                bio_put(bio);
                return NULL;
@@ -96,7 +91,7 @@ static struct bio *get_failover_bio(struct path *path, unsigned data_size)
 }
 
 static struct request *get_failover_req(struct emc_handler *h,
-                                       struct bio *bio, struct path *path)
+                                       struct bio *bio, struct dm_path *path)
 {
        struct request *rq;
        struct block_device *bdev = bio->bi_bdev;
@@ -109,15 +104,7 @@ static struct request *get_failover_req(struct emc_handler *h,
                return NULL;
        }
 
-       rq->bio = rq->biotail = bio;
-       blk_rq_bio_prep(q, rq, bio);
-
-       rq->rq_disk = bdev->bd_contains->bd_disk;
-
-       /* bio backed don't set data */
-       rq->buffer = rq->data = NULL;
-       /* rq data_len used for pc cmd's request_bufflen */
-       rq->data_len = bio->bi_size;
+       blk_rq_append_bio(q, rq, bio);
 
        rq->sense = h->sense;
        memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
@@ -133,7 +120,7 @@ static struct request *get_failover_req(struct emc_handler *h,
 }
 
 static struct request *emc_trespass_get(struct emc_handler *h,
-                                       struct path *path)
+                                       struct dm_path *path)
 {
        struct bio *bio;
        struct request *rq;
@@ -191,7 +178,7 @@ static struct request *emc_trespass_get(struct emc_handler *h,
 }
 
 static void emc_pg_init(struct hw_handler *hwh, unsigned bypassed,
-                       struct path *path)
+                       struct dm_path *path)
 {
        struct request *rq;
        struct request_queue *q = bdev_get_queue(path->dev->bdev);
@@ -224,12 +211,10 @@ fail_path:
 
 static struct emc_handler *alloc_emc_handler(void)
 {
-       struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL);
+       struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL);
 
-       if (h) {
-               memset(h, 0, sizeof(*h));
+       if (h)
                spin_lock_init(&h->lock);
-       }
 
        return h;
 }