]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] dm: map and endio symbolic return codes
authorKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Fri, 8 Dec 2006 10:41:06 +0000 (02:41 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:29:09 +0000 (08:29 -0800)
Update existing targets to use the new symbols for return values from target
map and end_io functions.

There is no effect on behaviour.

Test results:
Done build test without errors.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-crypt.c
drivers/md/dm-linear.c
drivers/md/dm-mpath.c
drivers/md/dm-raid1.c
drivers/md/dm-snap.c
drivers/md/dm-stripe.c
drivers/md/dm-zero.c

index 96152868525b7715282ac36ac84d58ce38e66378..4c2471ee054aa099a8777de111e7b219fe6c6eb9 100644 (file)
@@ -962,7 +962,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio,
        atomic_set(&io->pending, 0);
        kcryptd_queue_io(io);
 
-       return 0;
+       return DM_MAPIO_SUBMITTED;
 }
 
 static int crypt_status(struct dm_target *ti, status_type_t type,
index 4a1cee48e65239aece4c96c8baee98d484c193b4..17753d80ad228022b2575e46ee28f867cfd93d6f 100644 (file)
@@ -77,7 +77,7 @@ static int linear_map(struct dm_target *ti, struct bio *bio,
        bio->bi_bdev = lc->dev->bdev;
        bio->bi_sector = lc->start + (bio->bi_sector - ti->begin);
 
-       return 1;
+       return DM_MAPIO_REMAPPED;
 }
 
 static int linear_status(struct dm_target *ti, status_type_t type,
index dda4109292bc0f8db063501bc9a835594fa8ad82..d325edcbb3f5eac5e66911c842870ef8b03a0fbc 100644 (file)
@@ -285,7 +285,7 @@ failed:
 static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio,
                  unsigned was_queued)
 {
-       int r = 1;
+       int r = DM_MAPIO_REMAPPED;
        unsigned long flags;
        struct pgpath *pgpath;
 
@@ -310,7 +310,7 @@ static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio,
                    !m->queue_io)
                        queue_work(kmultipathd, &m->process_queued_ios);
                pgpath = NULL;
-               r = 0;
+               r = DM_MAPIO_SUBMITTED;
        } else if (!pgpath)
                r = -EIO;               /* Failed */
        else
@@ -372,7 +372,7 @@ static void dispatch_queued_ios(struct multipath *m)
                r = map_io(m, bio, mpio, 1);
                if (r < 0)
                        bio_endio(bio, bio->bi_size, r);
-               else if (r == 1)
+               else if (r == DM_MAPIO_REMAPPED)
                        generic_make_request(bio);
 
                bio = next;
@@ -1042,7 +1042,7 @@ static int do_end_io(struct multipath *m, struct bio *bio,
                queue_work(kmultipathd, &m->process_queued_ios);
        spin_unlock_irqrestore(&m->lock, flags);
 
-       return 1;       /* io not complete */
+       return DM_ENDIO_INCOMPLETE;     /* io not complete */
 }
 
 static int multipath_end_io(struct dm_target *ti, struct bio *bio,
@@ -1060,7 +1060,7 @@ static int multipath_end_io(struct dm_target *ti, struct bio *bio,
                if (ps->type->end_io)
                        ps->type->end_io(ps, &pgpath->path);
        }
-       if (r <= 0)
+       if (r != DM_ENDIO_INCOMPLETE)
                mempool_free(mpio, m->mpio_pool);
 
        return r;
index fc8cbb168e3ed2d5f8ae53bcec7762d0cc53008b..3b3f4c9c3f0917f90ad706588ec87dc45498c70c 100644 (file)
@@ -1137,7 +1137,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio,
 
        if (rw == WRITE) {
                queue_bio(ms, bio, rw);
-               return 0;
+               return DM_MAPIO_SUBMITTED;
        }
 
        r = ms->rh.log->type->in_sync(ms->rh.log,
@@ -1146,7 +1146,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio,
                return r;
 
        if (r == -EWOULDBLOCK)  /* FIXME: ugly */
-               r = 0;
+               r = DM_MAPIO_SUBMITTED;
 
        /*
         * We don't want to fast track a recovery just for a read
@@ -1159,7 +1159,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio,
        if (!r) {
                /* Pass this io over to the daemon */
                queue_bio(ms, bio, rw);
-               return 0;
+               return DM_MAPIO_SUBMITTED;
        }
 
        m = choose_mirror(ms, bio->bi_sector);
@@ -1167,7 +1167,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio,
                return -EIO;
 
        map_bio(ms, m, bio);
-       return 1;
+       return DM_MAPIO_REMAPPED;
 }
 
 static int mirror_end_io(struct dm_target *ti, struct bio *bio,
index b0ce2ce82278a0bc93e1ca345ed227f4c9198339..bbf861e4fed1e7b8fbf8247b896abe40c6407249 100644 (file)
@@ -868,7 +868,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio,
 {
        struct exception *e;
        struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
-       int r = 1;
+       int r = DM_MAPIO_REMAPPED;
        chunk_t chunk;
        struct pending_exception *pe = NULL;
 
@@ -914,7 +914,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio,
                remap_exception(s, &pe->e, bio);
                bio_list_add(&pe->snapshot_bios, bio);
 
-               r = 0;
+               r = DM_MAPIO_SUBMITTED;
 
                if (!pe->started) {
                        /* this is protected by snap->lock */
@@ -992,7 +992,7 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
  *---------------------------------------------------------------*/
 static int __origin_write(struct list_head *snapshots, struct bio *bio)
 {
-       int r = 1, first = 0;
+       int r = DM_MAPIO_REMAPPED, first = 0;
        struct dm_snapshot *snap;
        struct exception *e;
        struct pending_exception *pe, *next_pe, *primary_pe = NULL;
@@ -1050,7 +1050,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
 
                        bio_list_add(&primary_pe->origin_bios, bio);
 
-                       r = 0;
+                       r = DM_MAPIO_SUBMITTED;
                }
 
                if (!pe->primary_pe) {
@@ -1099,7 +1099,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
 static int do_origin(struct dm_dev *origin, struct bio *bio)
 {
        struct origin *o;
-       int r = 1;
+       int r = DM_MAPIO_REMAPPED;
 
        down_read(&_origins_lock);
        o = __lookup_origin(origin->bdev);
@@ -1156,7 +1156,7 @@ static int origin_map(struct dm_target *ti, struct bio *bio,
                return -EOPNOTSUPP;
 
        /* Only tell snapshots if this is a write */
-       return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : 1;
+       return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : DM_MAPIO_REMAPPED;
 }
 
 #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
index 6c29fcecd8921d46503d51d23bf1f8be619c7ead..51f5e0760012dd76c35d939bb18862a20e2ee435 100644 (file)
@@ -186,7 +186,7 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
        bio->bi_bdev = sc->stripe[stripe].dev->bdev;
        bio->bi_sector = sc->stripe[stripe].physical_start +
            (chunk << sc->chunk_shift) + (offset & sc->chunk_mask);
-       return 1;
+       return DM_MAPIO_REMAPPED;
 }
 
 static int stripe_status(struct dm_target *ti,
index ea569f7348d2a284b983d766614d1ff8d8fb82ac..f314d7dc9c26cae52123b38c6422e375aba600c3 100644 (file)
@@ -46,7 +46,7 @@ static int zero_map(struct dm_target *ti, struct bio *bio,
        bio_endio(bio, bio->bi_size, 0);
 
        /* accepted bio, don't make new request */
-       return 0;
+       return DM_MAPIO_SUBMITTED;
 }
 
 static struct target_type zero_target = {