Require pg_init_fn to use callback when complete. --- diff/drivers/md/dm-hw-handler.h 2004-10-29 15:39:07.000000000 +0100 +++ source/drivers/md/dm-hw-handler.h 2004-10-29 15:39:19.000000000 +0100 @@ -25,8 +25,8 @@ typedef int (*hwh_ctr_fn) (struct hw_handler *hwh, unsigned arc, char **argv); typedef void (*hwh_dtr_fn) (struct hw_handler *hwh); -typedef int (*hwh_pg_init_fn) (struct hw_handler *hwh, struct path *path, - struct block_device *bdev); +typedef void (*hwh_pg_init_fn) (struct hw_handler *hwh, struct path *path, + struct block_device *bdev); typedef unsigned (*hwh_err_fn) (struct hw_handler *hwh, struct bio *bio); typedef int (*hwh_status_fn) (struct hw_handler *hwh, status_type_t type, @@ -63,13 +63,9 @@ /* Callback for hwh_pg_init_fn to use when complete */ void dm_pg_init_complete(struct path *path, unsigned err_flags); -/* hwh_err_fn return flags */ +/* Error flags for hwh_err_fn and dm_pg_init_complete */ #define MP_FAIL_PATH 1 #define MP_BYPASS_PG 2 #define MP_ERROR_IO 4 /* Don't retry this I/O */ -/* hwh_pg_init_fn return values */ -#define MP_PG_INITIALISING 1 -#define MP_PG_FAILED 2 - #endif --- diff/drivers/md/dm-mpath.c 2004-10-29 15:39:13.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-10-29 15:39:19.000000000 +0100 @@ -189,32 +189,17 @@ * The multipath daemon is responsible for resubmitting queued ios. *---------------------------------------------------------------*/ -/* - * Retuns 0 if pg switch failed else 1. - * Clears *path if it's not ready to be used. - */ -static int __switch_pg(struct multipath *m, struct path **path) +static void __switch_pg(struct multipath *m, struct path *path) { - int r; struct hw_handler *hwh = &m->hw_handler; - if (!hwh || !hwh->type->pg_init) - return 1; - - r = hwh->type->pg_init(hwh, *path, (*path)->dev->bdev); - if (r == MP_PG_INITIALISING) { + if (hwh && hwh->type->pg_init) { + hwh->type->pg_init(hwh, path, path->dev->bdev); m->initialising_pg = 1; - *path = NULL; - return 1; - } else if (r == MP_PG_FAILED) { - (*path)->pg->bypass = 1; - return 0; } - - return 1; } -static int __choose_path(struct multipath *m) +static void __choose_path(struct multipath *m) { struct priority_group *pg; struct path *path = NULL; @@ -229,8 +214,8 @@ if (!path) continue; - if (m->current_pg != pg && !__switch_pg(m, &path)) - continue; + if (m->current_pg != pg) + __switch_pg(m, path); break; } @@ -239,8 +224,6 @@ m->current_path = path; if (path) m->current_pg = path->pg; - - return 0; } static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio)