diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 13 | ||||
-rw-r--r-- | drivers/md/dm.h | 11 |
2 files changed, 21 insertions, 3 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index b42e71bb9e6..d8544e1a4c1 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -482,9 +482,13 @@ static int clone_endio(struct bio *bio, unsigned int done, int error) r = endio(tio->ti, bio, error, &tio->info); if (r < 0) error = r; - else if (r > 0) - /* the target wants another shot at the io */ + else if (r == DM_ENDIO_INCOMPLETE) + /* The target will handle the io */ return 1; + else if (r) { + DMWARN("unimplemented target endio return value: %d", r); + BUG(); + } } dec_pending(tio->io, error); @@ -542,7 +546,7 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, atomic_inc(&tio->io->io_count); sector = clone->bi_sector; r = ti->type->map(ti, clone, &tio->info); - if (r > 0) { + if (r == DM_MAPIO_REMAPPED) { /* the bio has been remapped so dispatch it */ blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, @@ -560,6 +564,9 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, clone->bi_private = md->bs; bio_put(clone); free_tio(md, tio); + } else if (r) { + DMWARN("unimplemented target map return value: %d", r); + BUG(); } } diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 81c98d6e35e..293d5ce62a2 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -33,6 +33,17 @@ #define SECTOR_SHIFT 9 /* + * Definitions of return values from target end_io function. + */ +#define DM_ENDIO_INCOMPLETE 1 + +/* + * Definitions of return values from target map function. + */ +#define DM_MAPIO_SUBMITTED 0 +#define DM_MAPIO_REMAPPED 1 + +/* * Suspend feature flags */ #define DM_SUSPEND_LOCKFS_FLAG (1 << 0) |