]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm-snap.c
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / md / dm-snap.c
index 638c8d90da0e177aedf44c855c31786165185eaa..b0ce2ce82278a0bc93e1ca345ed227f4c9198339 100644 (file)
@@ -40,7 +40,7 @@
 #define SNAPSHOT_PAGES 256
 
 struct workqueue_struct *ksnapd;
-static void flush_queued_bios(void *data);
+static void flush_queued_bios(struct work_struct *work);
 
 struct pending_exception {
        struct exception e;
@@ -88,8 +88,8 @@ struct pending_exception {
  * Hash table mapping origin volumes to lists of snapshots and
  * a lock to protect it
  */
-static kmem_cache_t *exception_cache;
-static kmem_cache_t *pending_cache;
+static struct kmem_cache *exception_cache;
+static struct kmem_cache *pending_cache;
 static mempool_t *pending_pool;
 
 /*
@@ -228,7 +228,7 @@ static int init_exception_table(struct exception_table *et, uint32_t size)
        return 0;
 }
 
-static void exit_exception_table(struct exception_table *et, kmem_cache_t *mem)
+static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem)
 {
        struct list_head *slot;
        struct exception *ex, *next;
@@ -528,7 +528,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        bio_list_init(&s->queued_bios);
-       INIT_WORK(&s->queued_bios_work, flush_queued_bios, s);
+       INIT_WORK(&s->queued_bios_work, flush_queued_bios);
 
        /* Add snapshot to the list of snapshots for this origin */
        /* Exceptions aren't triggered till snapshot_resume() is called */
@@ -603,9 +603,10 @@ static void flush_bios(struct bio *bio)
        }
 }
 
-static void flush_queued_bios(void *data)
+static void flush_queued_bios(struct work_struct *work)
 {
-       struct dm_snapshot *s = (struct dm_snapshot *) data;
+       struct dm_snapshot *s =
+               container_of(work, struct dm_snapshot, queued_bios_work);
        struct bio *queued_bios;
        unsigned long flags;
 
@@ -631,8 +632,7 @@ static void error_bios(struct bio *bio)
        }
 }
 
-static void __invalidate_snapshot(struct dm_snapshot *s,
-                               struct pending_exception *pe, int err)
+static void __invalidate_snapshot(struct dm_snapshot *s, int err)
 {
        if (!s->valid)
                return;
@@ -642,9 +642,6 @@ static void __invalidate_snapshot(struct dm_snapshot *s,
        else if (err == -ENOMEM)
                DMERR("Invalidating snapshot: Unable to allocate exception.");
 
-       if (pe)
-               remove_exception(&pe->e);
-
        if (s->store.drop_snapshot)
                s->store.drop_snapshot(&s->store);
 
@@ -701,7 +698,7 @@ static void pending_complete(struct pending_exception *pe, int success)
        if (!success) {
                /* Read/write error - snapshot is unusable */
                down_write(&s->lock);
-               __invalidate_snapshot(s, pe, -EIO);
+               __invalidate_snapshot(s, -EIO);
                error = 1;
                goto out;
        }
@@ -709,7 +706,7 @@ static void pending_complete(struct pending_exception *pe, int success)
        e = alloc_exception();
        if (!e) {
                down_write(&s->lock);
-               __invalidate_snapshot(s, pe, -ENOMEM);
+               __invalidate_snapshot(s, -ENOMEM);
                error = 1;
                goto out;
        }
@@ -727,9 +724,9 @@ static void pending_complete(struct pending_exception *pe, int success)
         * in-flight exception from the list.
         */
        insert_exception(&s->complete, e);
-       remove_exception(&pe->e);
 
  out:
+       remove_exception(&pe->e);
        snapshot_bios = bio_list_get(&pe->snapshot_bios);
        origin_bios = put_pending_exception(pe);
 
@@ -909,7 +906,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio,
        if (bio_rw(bio) == WRITE) {
                pe = __find_pending_exception(s, bio);
                if (!pe) {
-                       __invalidate_snapshot(s, pe, -ENOMEM);
+                       __invalidate_snapshot(s, -ENOMEM);
                        r = -EIO;
                        goto out_unlock;
                }
@@ -1035,7 +1032,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
 
                pe = __find_pending_exception(snap, bio);
                if (!pe) {
-                       __invalidate_snapshot(snap, pe, -ENOMEM);
+                       __invalidate_snapshot(snap, -ENOMEM);
                        goto next_snapshot;
                }