diff options
author | Kiyoshi Ueda <k-ueda@ct.jp.nec.com> | 2006-12-08 05:41:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:09 -0500 |
commit | d2a7ad29a810441e9dacbaddcc2f0c6045390008 (patch) | |
tree | 36bea90fa2f286f525a3b4f05adf40ec4d28221c | |
parent | 45cbcd798354251b99694086af9d57c99e89bb43 (diff) |
[PATCH] dm: map and endio symbolic return codes
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>
-rw-r--r-- | drivers/md/dm-crypt.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-linear.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-mpath.c | 10 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 8 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 12 | ||||
-rw-r--r-- | drivers/md/dm-stripe.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-zero.c | 2 |
7 files changed, 19 insertions, 19 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 96152868525b..4c2471ee054a 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -962,7 +962,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, | |||
962 | atomic_set(&io->pending, 0); | 962 | atomic_set(&io->pending, 0); |
963 | kcryptd_queue_io(io); | 963 | kcryptd_queue_io(io); |
964 | 964 | ||
965 | return 0; | 965 | return DM_MAPIO_SUBMITTED; |
966 | } | 966 | } |
967 | 967 | ||
968 | static int crypt_status(struct dm_target *ti, status_type_t type, | 968 | static int crypt_status(struct dm_target *ti, status_type_t type, |
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 4a1cee48e652..17753d80ad22 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c | |||
@@ -77,7 +77,7 @@ static int linear_map(struct dm_target *ti, struct bio *bio, | |||
77 | bio->bi_bdev = lc->dev->bdev; | 77 | bio->bi_bdev = lc->dev->bdev; |
78 | bio->bi_sector = lc->start + (bio->bi_sector - ti->begin); | 78 | bio->bi_sector = lc->start + (bio->bi_sector - ti->begin); |
79 | 79 | ||
80 | return 1; | 80 | return DM_MAPIO_REMAPPED; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int linear_status(struct dm_target *ti, status_type_t type, | 83 | static int linear_status(struct dm_target *ti, status_type_t type, |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index dda4109292bc..d325edcbb3f5 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -285,7 +285,7 @@ failed: | |||
285 | static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, | 285 | static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, |
286 | unsigned was_queued) | 286 | unsigned was_queued) |
287 | { | 287 | { |
288 | int r = 1; | 288 | int r = DM_MAPIO_REMAPPED; |
289 | unsigned long flags; | 289 | unsigned long flags; |
290 | struct pgpath *pgpath; | 290 | struct pgpath *pgpath; |
291 | 291 | ||
@@ -310,7 +310,7 @@ static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, | |||
310 | !m->queue_io) | 310 | !m->queue_io) |
311 | queue_work(kmultipathd, &m->process_queued_ios); | 311 | queue_work(kmultipathd, &m->process_queued_ios); |
312 | pgpath = NULL; | 312 | pgpath = NULL; |
313 | r = 0; | 313 | r = DM_MAPIO_SUBMITTED; |
314 | } else if (!pgpath) | 314 | } else if (!pgpath) |
315 | r = -EIO; /* Failed */ | 315 | r = -EIO; /* Failed */ |
316 | else | 316 | else |
@@ -372,7 +372,7 @@ static void dispatch_queued_ios(struct multipath *m) | |||
372 | r = map_io(m, bio, mpio, 1); | 372 | r = map_io(m, bio, mpio, 1); |
373 | if (r < 0) | 373 | if (r < 0) |
374 | bio_endio(bio, bio->bi_size, r); | 374 | bio_endio(bio, bio->bi_size, r); |
375 | else if (r == 1) | 375 | else if (r == DM_MAPIO_REMAPPED) |
376 | generic_make_request(bio); | 376 | generic_make_request(bio); |
377 | 377 | ||
378 | bio = next; | 378 | bio = next; |
@@ -1042,7 +1042,7 @@ static int do_end_io(struct multipath *m, struct bio *bio, | |||
1042 | queue_work(kmultipathd, &m->process_queued_ios); | 1042 | queue_work(kmultipathd, &m->process_queued_ios); |
1043 | spin_unlock_irqrestore(&m->lock, flags); | 1043 | spin_unlock_irqrestore(&m->lock, flags); |
1044 | 1044 | ||
1045 | return 1; /* io not complete */ | 1045 | return DM_ENDIO_INCOMPLETE; /* io not complete */ |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | static int multipath_end_io(struct dm_target *ti, struct bio *bio, | 1048 | 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, | |||
1060 | if (ps->type->end_io) | 1060 | if (ps->type->end_io) |
1061 | ps->type->end_io(ps, &pgpath->path); | 1061 | ps->type->end_io(ps, &pgpath->path); |
1062 | } | 1062 | } |
1063 | if (r <= 0) | 1063 | if (r != DM_ENDIO_INCOMPLETE) |
1064 | mempool_free(mpio, m->mpio_pool); | 1064 | mempool_free(mpio, m->mpio_pool); |
1065 | 1065 | ||
1066 | return r; | 1066 | return r; |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index fc8cbb168e3e..3b3f4c9c3f09 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -1137,7 +1137,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio, | |||
1137 | 1137 | ||
1138 | if (rw == WRITE) { | 1138 | if (rw == WRITE) { |
1139 | queue_bio(ms, bio, rw); | 1139 | queue_bio(ms, bio, rw); |
1140 | return 0; | 1140 | return DM_MAPIO_SUBMITTED; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | r = ms->rh.log->type->in_sync(ms->rh.log, | 1143 | 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, | |||
1146 | return r; | 1146 | return r; |
1147 | 1147 | ||
1148 | if (r == -EWOULDBLOCK) /* FIXME: ugly */ | 1148 | if (r == -EWOULDBLOCK) /* FIXME: ugly */ |
1149 | r = 0; | 1149 | r = DM_MAPIO_SUBMITTED; |
1150 | 1150 | ||
1151 | /* | 1151 | /* |
1152 | * We don't want to fast track a recovery just for a read | 1152 | * 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, | |||
1159 | if (!r) { | 1159 | if (!r) { |
1160 | /* Pass this io over to the daemon */ | 1160 | /* Pass this io over to the daemon */ |
1161 | queue_bio(ms, bio, rw); | 1161 | queue_bio(ms, bio, rw); |
1162 | return 0; | 1162 | return DM_MAPIO_SUBMITTED; |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | m = choose_mirror(ms, bio->bi_sector); | 1165 | m = choose_mirror(ms, bio->bi_sector); |
@@ -1167,7 +1167,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio, | |||
1167 | return -EIO; | 1167 | return -EIO; |
1168 | 1168 | ||
1169 | map_bio(ms, m, bio); | 1169 | map_bio(ms, m, bio); |
1170 | return 1; | 1170 | return DM_MAPIO_REMAPPED; |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | static int mirror_end_io(struct dm_target *ti, struct bio *bio, | 1173 | static int mirror_end_io(struct dm_target *ti, struct bio *bio, |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index b0ce2ce82278..bbf861e4fed1 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -868,7 +868,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio, | |||
868 | { | 868 | { |
869 | struct exception *e; | 869 | struct exception *e; |
870 | struct dm_snapshot *s = (struct dm_snapshot *) ti->private; | 870 | struct dm_snapshot *s = (struct dm_snapshot *) ti->private; |
871 | int r = 1; | 871 | int r = DM_MAPIO_REMAPPED; |
872 | chunk_t chunk; | 872 | chunk_t chunk; |
873 | struct pending_exception *pe = NULL; | 873 | struct pending_exception *pe = NULL; |
874 | 874 | ||
@@ -914,7 +914,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio, | |||
914 | remap_exception(s, &pe->e, bio); | 914 | remap_exception(s, &pe->e, bio); |
915 | bio_list_add(&pe->snapshot_bios, bio); | 915 | bio_list_add(&pe->snapshot_bios, bio); |
916 | 916 | ||
917 | r = 0; | 917 | r = DM_MAPIO_SUBMITTED; |
918 | 918 | ||
919 | if (!pe->started) { | 919 | if (!pe->started) { |
920 | /* this is protected by snap->lock */ | 920 | /* this is protected by snap->lock */ |
@@ -992,7 +992,7 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
992 | *---------------------------------------------------------------*/ | 992 | *---------------------------------------------------------------*/ |
993 | static int __origin_write(struct list_head *snapshots, struct bio *bio) | 993 | static int __origin_write(struct list_head *snapshots, struct bio *bio) |
994 | { | 994 | { |
995 | int r = 1, first = 0; | 995 | int r = DM_MAPIO_REMAPPED, first = 0; |
996 | struct dm_snapshot *snap; | 996 | struct dm_snapshot *snap; |
997 | struct exception *e; | 997 | struct exception *e; |
998 | struct pending_exception *pe, *next_pe, *primary_pe = NULL; | 998 | struct pending_exception *pe, *next_pe, *primary_pe = NULL; |
@@ -1050,7 +1050,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio) | |||
1050 | 1050 | ||
1051 | bio_list_add(&primary_pe->origin_bios, bio); | 1051 | bio_list_add(&primary_pe->origin_bios, bio); |
1052 | 1052 | ||
1053 | r = 0; | 1053 | r = DM_MAPIO_SUBMITTED; |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | if (!pe->primary_pe) { | 1056 | if (!pe->primary_pe) { |
@@ -1099,7 +1099,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio) | |||
1099 | static int do_origin(struct dm_dev *origin, struct bio *bio) | 1099 | static int do_origin(struct dm_dev *origin, struct bio *bio) |
1100 | { | 1100 | { |
1101 | struct origin *o; | 1101 | struct origin *o; |
1102 | int r = 1; | 1102 | int r = DM_MAPIO_REMAPPED; |
1103 | 1103 | ||
1104 | down_read(&_origins_lock); | 1104 | down_read(&_origins_lock); |
1105 | o = __lookup_origin(origin->bdev); | 1105 | o = __lookup_origin(origin->bdev); |
@@ -1156,7 +1156,7 @@ static int origin_map(struct dm_target *ti, struct bio *bio, | |||
1156 | return -EOPNOTSUPP; | 1156 | return -EOPNOTSUPP; |
1157 | 1157 | ||
1158 | /* Only tell snapshots if this is a write */ | 1158 | /* Only tell snapshots if this is a write */ |
1159 | return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : 1; | 1159 | return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : DM_MAPIO_REMAPPED; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r)) | 1162 | #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r)) |
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 6c29fcecd892..51f5e0760012 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -186,7 +186,7 @@ static int stripe_map(struct dm_target *ti, struct bio *bio, | |||
186 | bio->bi_bdev = sc->stripe[stripe].dev->bdev; | 186 | bio->bi_bdev = sc->stripe[stripe].dev->bdev; |
187 | bio->bi_sector = sc->stripe[stripe].physical_start + | 187 | bio->bi_sector = sc->stripe[stripe].physical_start + |
188 | (chunk << sc->chunk_shift) + (offset & sc->chunk_mask); | 188 | (chunk << sc->chunk_shift) + (offset & sc->chunk_mask); |
189 | return 1; | 189 | return DM_MAPIO_REMAPPED; |
190 | } | 190 | } |
191 | 191 | ||
192 | static int stripe_status(struct dm_target *ti, | 192 | static int stripe_status(struct dm_target *ti, |
diff --git a/drivers/md/dm-zero.c b/drivers/md/dm-zero.c index ea569f7348d2..f314d7dc9c26 100644 --- a/drivers/md/dm-zero.c +++ b/drivers/md/dm-zero.c | |||
@@ -46,7 +46,7 @@ static int zero_map(struct dm_target *ti, struct bio *bio, | |||
46 | bio_endio(bio, bio->bi_size, 0); | 46 | bio_endio(bio, bio->bi_size, 0); |
47 | 47 | ||
48 | /* accepted bio, don't make new request */ | 48 | /* accepted bio, don't make new request */ |
49 | return 0; | 49 | return DM_MAPIO_SUBMITTED; |
50 | } | 50 | } |
51 | 51 | ||
52 | static struct target_type zero_target = { | 52 | static struct target_type zero_target = { |