Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43838
b: refs/heads/master
c: 45cbcd7
h: refs/heads/master
v: v3
  • Loading branch information
Kiyoshi Ueda authored and Linus Torvalds committed Dec 8, 2006
1 parent 162ab30 commit fe3d911
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a3d77d35be6f416a250c528c3ed5c70013a915e8
refs/heads/master: 45cbcd798354251b99694086af9d57c99e89bb43
13 changes: 10 additions & 3 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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();
}
}

Expand Down
11 changes: 11 additions & 0 deletions trunk/drivers/md/dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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
*/
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef void (*dm_dtr_fn) (struct dm_target *ti);
* The map function must return:
* < 0: error
* = 0: The target will handle the io by resubmitting it later
* > 0: simple remap complete
* = 1: simple remap complete
*/
typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
union map_info *map_context);
Expand Down

0 comments on commit fe3d911

Please sign in to comment.