Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Kiyoshi Ueda and committed by
Linus Torvalds
d2a7ad29 45cbcd79

+19 -19
+1 -1
drivers/md/dm-crypt.c
··· 962 962 atomic_set(&io->pending, 0); 963 963 kcryptd_queue_io(io); 964 964 965 - return 0; 965 + return DM_MAPIO_SUBMITTED; 966 966 } 967 967 968 968 static int crypt_status(struct dm_target *ti, status_type_t type,
+1 -1
drivers/md/dm-linear.c
··· 77 77 bio->bi_bdev = lc->dev->bdev; 78 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 83 static int linear_status(struct dm_target *ti, status_type_t type,
+5 -5
drivers/md/dm-mpath.c
··· 285 285 static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, 286 286 unsigned was_queued) 287 287 { 288 - int r = 1; 288 + int r = DM_MAPIO_REMAPPED; 289 289 unsigned long flags; 290 290 struct pgpath *pgpath; 291 291 ··· 310 310 !m->queue_io) 311 311 queue_work(kmultipathd, &m->process_queued_ios); 312 312 pgpath = NULL; 313 - r = 0; 313 + r = DM_MAPIO_SUBMITTED; 314 314 } else if (!pgpath) 315 315 r = -EIO; /* Failed */ 316 316 else ··· 372 372 r = map_io(m, bio, mpio, 1); 373 373 if (r < 0) 374 374 bio_endio(bio, bio->bi_size, r); 375 - else if (r == 1) 375 + else if (r == DM_MAPIO_REMAPPED) 376 376 generic_make_request(bio); 377 377 378 378 bio = next; ··· 1042 1042 queue_work(kmultipathd, &m->process_queued_ios); 1043 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 1048 static int multipath_end_io(struct dm_target *ti, struct bio *bio, ··· 1060 1060 if (ps->type->end_io) 1061 1061 ps->type->end_io(ps, &pgpath->path); 1062 1062 } 1063 - if (r <= 0) 1063 + if (r != DM_ENDIO_INCOMPLETE) 1064 1064 mempool_free(mpio, m->mpio_pool); 1065 1065 1066 1066 return r;
+4 -4
drivers/md/dm-raid1.c
··· 1137 1137 1138 1138 if (rw == WRITE) { 1139 1139 queue_bio(ms, bio, rw); 1140 - return 0; 1140 + return DM_MAPIO_SUBMITTED; 1141 1141 } 1142 1142 1143 1143 r = ms->rh.log->type->in_sync(ms->rh.log, ··· 1146 1146 return r; 1147 1147 1148 1148 if (r == -EWOULDBLOCK) /* FIXME: ugly */ 1149 - r = 0; 1149 + r = DM_MAPIO_SUBMITTED; 1150 1150 1151 1151 /* 1152 1152 * We don't want to fast track a recovery just for a read ··· 1159 1159 if (!r) { 1160 1160 /* Pass this io over to the daemon */ 1161 1161 queue_bio(ms, bio, rw); 1162 - return 0; 1162 + return DM_MAPIO_SUBMITTED; 1163 1163 } 1164 1164 1165 1165 m = choose_mirror(ms, bio->bi_sector); ··· 1167 1167 return -EIO; 1168 1168 1169 1169 map_bio(ms, m, bio); 1170 - return 1; 1170 + return DM_MAPIO_REMAPPED; 1171 1171 } 1172 1172 1173 1173 static int mirror_end_io(struct dm_target *ti, struct bio *bio,
+6 -6
drivers/md/dm-snap.c
··· 868 868 { 869 869 struct exception *e; 870 870 struct dm_snapshot *s = (struct dm_snapshot *) ti->private; 871 - int r = 1; 871 + int r = DM_MAPIO_REMAPPED; 872 872 chunk_t chunk; 873 873 struct pending_exception *pe = NULL; 874 874 ··· 914 914 remap_exception(s, &pe->e, bio); 915 915 bio_list_add(&pe->snapshot_bios, bio); 916 916 917 - r = 0; 917 + r = DM_MAPIO_SUBMITTED; 918 918 919 919 if (!pe->started) { 920 920 /* this is protected by snap->lock */ ··· 992 992 *---------------------------------------------------------------*/ 993 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 996 struct dm_snapshot *snap; 997 997 struct exception *e; 998 998 struct pending_exception *pe, *next_pe, *primary_pe = NULL; ··· 1050 1050 1051 1051 bio_list_add(&primary_pe->origin_bios, bio); 1052 1052 1053 - r = 0; 1053 + r = DM_MAPIO_SUBMITTED; 1054 1054 } 1055 1055 1056 1056 if (!pe->primary_pe) { ··· 1099 1099 static int do_origin(struct dm_dev *origin, struct bio *bio) 1100 1100 { 1101 1101 struct origin *o; 1102 - int r = 1; 1102 + int r = DM_MAPIO_REMAPPED; 1103 1103 1104 1104 down_read(&_origins_lock); 1105 1105 o = __lookup_origin(origin->bdev); ··· 1156 1156 return -EOPNOTSUPP; 1157 1157 1158 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 1162 #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
+1 -1
drivers/md/dm-stripe.c
··· 186 186 bio->bi_bdev = sc->stripe[stripe].dev->bdev; 187 187 bio->bi_sector = sc->stripe[stripe].physical_start + 188 188 (chunk << sc->chunk_shift) + (offset & sc->chunk_mask); 189 - return 1; 189 + return DM_MAPIO_REMAPPED; 190 190 } 191 191 192 192 static int stripe_status(struct dm_target *ti,
+1 -1
drivers/md/dm-zero.c
··· 46 46 bio_endio(bio, bio->bi_size, 0); 47 47 48 48 /* accepted bio, don't make new request */ 49 - return 0; 49 + return DM_MAPIO_SUBMITTED; 50 50 } 51 51 52 52 static struct target_type zero_target = {