Remove old dm-io interface. --- drivers/md/dm-io.c | 140 +---------------------------------------------------- drivers/md/dm-io.h | 43 ---------------- 2 files changed, 4 insertions(+), 179 deletions(-) Index: linux-2.6.20.1/drivers/md/dm-io.c =================================================================== --- linux-2.6.20.1.orig/drivers/md/dm-io.c 2007-02-21 20:43:13.000000000 +0000 +++ linux-2.6.20.1/drivers/md/dm-io.c 2007-02-21 20:43:49.000000000 +0000 @@ -13,8 +13,6 @@ #include #include -static struct bio_set *_bios; - struct io_client { mempool_t *pool; struct bio_set *bios; @@ -35,77 +33,12 @@ struct io { * io. Since async io is likely to be the majority of io we'll * have the same number of io contexts as bios! (FIXME: must reduce this). */ -static unsigned _num_ios; -static mempool_t *_io_pool; - -/* - * Temporary functions to allow old and new interfaces to co-exist. - */ -static struct bio_set *bios(struct io_client *client) -{ - return client ? client->bios : _bios; -} - -static mempool_t *io_pool(struct io_client *client) -{ - return client ? client->pool : _io_pool; -} static unsigned int pages_to_ios(unsigned int pages) { return 4 * pages; /* too many ? */ } -static int resize_pool(unsigned int new_ios) -{ - int r = 0; - - if (_io_pool) { - if (new_ios == 0) { - /* free off the pool */ - mempool_destroy(_io_pool); - _io_pool = NULL; - bioset_free(_bios); - - } else { - /* resize the pool */ - r = mempool_resize(_io_pool, new_ios, GFP_KERNEL); - } - - } else { - /* create new pool */ - _io_pool = mempool_create_kmalloc_pool(new_ios, - sizeof(struct io)); - if (!_io_pool) - return -ENOMEM; - - _bios = bioset_create(16, 16, 4); - if (!_bios) { - mempool_destroy(_io_pool); - _io_pool = NULL; - return -ENOMEM; - } - } - - if (!r) - _num_ios = new_ios; - - return r; -} - -/* - * FIXME: not multi-threaded - */ -int dm_io_get(unsigned int num_pages) -{ - return resize_pool(_num_ios + pages_to_ios(num_pages)); -} - -void dm_io_put(unsigned int num_pages) -{ - resize_pool(_num_ios - pages_to_ios(num_pages)); -} - /* * Create a mempool for a client */ @@ -189,7 +122,7 @@ static void dec_count(struct io *io, uns io_notify_fn fn = io->callback; void *context = io->context; - mempool_free(io, io_pool(io->client)); + mempool_free(io, io->client->pool); fn(r, context); } } @@ -314,7 +247,7 @@ static void dm_bio_destructor(struct bio { struct io *io = bio->bi_private; - bio_free(bio, bios(io->client)); + bio_free(bio, io->client->bios); } /*----------------------------------------------------------------- @@ -337,7 +270,7 @@ static void do_region(int rw, unsigned i * to hide it from bio_add_page(). */ num_bvecs = (remaining / (PAGE_SIZE >> SECTOR_SHIFT)) + 2; - bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, bios(io->client)); + bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io->client->bios); bio->bi_sector = where->sector + (where->count - remaining); bio->bi_bdev = where->bdev; bio->bi_end_io = endio; @@ -441,7 +374,7 @@ static int async_io(struct io_client *cl return -EIO; } - io = mempool_alloc(io_pool(client), GFP_NOIO); + io = mempool_alloc(client->pool, GFP_NOIO); io->error = 0; atomic_set(&io->count, 1); /* see dispatch_io() */ io->sleeper = NULL; @@ -453,62 +386,6 @@ static int async_io(struct io_client *cl return 0; } -/* - * Synchronuos IO API - */ -int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw, - struct page_list *pl, unsigned int offset, - unsigned long *error_bits) -{ - struct dpages dp; - list_dp_init(&dp, pl, offset); - return sync_io(NULL, num_regions, where, rw, &dp, error_bits); -} - -int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, int rw, - struct bio_vec *bvec, unsigned long *error_bits) -{ - struct dpages dp; - bvec_dp_init(&dp, bvec); - return sync_io(NULL, num_regions, where, rw, &dp, error_bits); -} - -int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw, - void *data, unsigned long *error_bits) -{ - struct dpages dp; - vm_dp_init(&dp, data); - return sync_io(NULL, num_regions, where, rw, &dp, error_bits); -} - -/* - * Asynchronuos IO API - */ -int dm_io_async(unsigned int num_regions, struct io_region *where, int rw, - struct page_list *pl, unsigned int offset, - io_notify_fn fn, void *context) -{ - struct dpages dp; - list_dp_init(&dp, pl, offset); - return async_io(NULL, num_regions, where, rw, &dp, fn, context); -} - -int dm_io_async_bvec(unsigned int num_regions, struct io_region *where, int rw, - struct bio_vec *bvec, io_notify_fn fn, void *context) -{ - struct dpages dp; - bvec_dp_init(&dp, bvec); - return async_io(NULL, num_regions, where, rw, &dp, fn, context); -} - -int dm_io_async_vm(unsigned int num_regions, struct io_region *where, int rw, - void *data, io_notify_fn fn, void *context) -{ - struct dpages dp; - vm_dp_init(&dp, data); - return async_io(NULL, num_regions, where, rw, &dp, fn, context); -} - static int dp_init(struct io_memory *mem, struct dpages *dp) { /* Set up dpages based on memory type */ @@ -550,12 +427,3 @@ int dm_io(void *client, struct io_contro &dp, control->notify.fn, control->notify.context); } EXPORT_SYMBOL(dm_io); - -EXPORT_SYMBOL(dm_io_get); -EXPORT_SYMBOL(dm_io_put); -EXPORT_SYMBOL(dm_io_sync); -EXPORT_SYMBOL(dm_io_async); -EXPORT_SYMBOL(dm_io_sync_bvec); -EXPORT_SYMBOL(dm_io_async_bvec); -EXPORT_SYMBOL(dm_io_sync_vm); -EXPORT_SYMBOL(dm_io_async_vm); Index: linux-2.6.20.1/drivers/md/dm-io.h =================================================================== --- linux-2.6.20.1.orig/drivers/md/dm-io.h 2007-02-21 20:43:13.000000000 +0000 +++ linux-2.6.20.1/drivers/md/dm-io.h 2007-02-21 20:43:19.000000000 +0000 @@ -51,16 +51,6 @@ struct io_control { }; /* - * Before anyone uses the asynchronous IO interface they should call - * dm_io_get(), specifying roughly how many pages they are - * expecting to perform io on concurrently. - * - * This function may block. - */ -int dm_io_get(unsigned int num_pages); -void dm_io_put(unsigned int num_pages); - -/* * For async io calls, use dm_io_client_create() to create * private mempools for the client. It returns a client handle * to pass into the dm_io() function below. @@ -71,39 +61,6 @@ void dm_io_client_destroy(void *client); int dm_io_client_resize(void *client, unsigned num_pages); /* - * Synchronous IO. - * - * Please ensure that the rw flag in the next two functions is - * either READ or WRITE, ie. we don't take READA. Any - * regions with a zero count field will be ignored. - */ -int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw, - struct page_list *pl, unsigned int offset, - unsigned long *error_bits); - -int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, int rw, - struct bio_vec *bvec, unsigned long *error_bits); - -int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw, - void *data, unsigned long *error_bits); - -/* - * Aynchronous IO. - * - * The 'where' array may be safely allocated on the stack since - * the function takes a copy. - */ -int dm_io_async(unsigned int num_regions, struct io_region *where, int rw, - struct page_list *pl, unsigned int offset, - io_notify_fn fn, void *context); - -int dm_io_async_bvec(unsigned int num_regions, struct io_region *where, int rw, - struct bio_vec *bvec, io_notify_fn fn, void *context); - -int dm_io_async_vm(unsigned int num_regions, struct io_region *where, int rw, - void *data, io_notify_fn fn, void *context); - -/* * (A)synchronous I/O interface using private per-client pools. */ int dm_io(void *client, struct io_control *control, unsigned num_regions,