dm: cleanup for request-based dm-multipath
cover dm: cleanup for request-based dm-multipath
Hi Alasdair,
The following patches are clean-ups of dm for preparation of request-based dm-multipath.
The patches are created on top of 2.6.27-rc6 + your linux-next patches (*1). But there is no functional dependency to the linux-next patches.
(*1) The patches shown between "NEXT_PATCHES_START" and "NEXT_PATCHES_END" ftp://sources.redhat.com/pub/dm/patches/2.6-unstable/editing-quilt/patches/series.html
Please review and apply.
The request-based dm-multipath patches (*2) depend on these clean-ups. I hope both patches are pushed to linux-next for 2.6.28.
(*2) http://lkml.org/lkml/2008/9/12/100
Summary of the patches:
1/2: dm core: remove unused DM_WQ_FLUSH_ALL
2/2: dm core: tidy local_init
(PATCH 1/2 is also included in the Milan's barrier support patch-set.)
Thanks,
Kiyoshi Ueda
PATCH 1/2 dm core: remove unused DM_WQ_FLUSH_ALL
This patch removes dead codes for the noflush suspend. No functional change.
The dm_queue_flush(md, DM_WQ_FLUSH_ALL, NULL) in dm_suspend() is never invoked because:
- The 'goto flush_and_out' is same as 'goto out', because the 'goto flush_and_out' is called only when '!noflush'
- If the 'r && noflush' is true, the interrupt check code above is invoked and 'goto out'
--- drivers/md/dm.c | 14 +------------- 1 files changed, 1 insertion(+), 13 deletions(-)
drivers/md/dm.c +1 -13
@@ -76,7 +76,6 @@ union map_info *dm_get_mapinfo(struct bi*/ struct dm_wq_req {enum { -DM_WQ_FLUSH_ALL ,DM_WQ_FLUSH_DEFERRED , } type;struct work_struct work;
@@ -1388,9 +1387,6 @@ static void dm_wq_work(struct work_strucdown_write (&md->io_lock);switch (req->type) { -case DM_WQ_FLUSH_ALL : -__merge_pushback_list (md); -/* pass through */ case DM_WQ_FLUSH_DEFERRED :__flush_deferred_io (md);break ;
@@ -1520,7 +1516,7 @@ int dm_suspend(struct mapped_device *md,if (!md->suspended_bdev) {DMWARN ("bdget failed in dm_suspend" ); r = -ENOMEM ; - goto flush_and_out; + goto out; }/*
@@ -1571,14 +1567,6 @@ int dm_suspend(struct mapped_device *md,set_bit (DMF_SUSPENDED , &md->flags); -flush_and_out: -if (r && noflush) -/* -* Because there may be already I/Os in the pushback list, -* flush them before return. -*/ -dm_queue_flush (md,DM_WQ_FLUSH_ALL ,NULL ); - out:if (r && md->suspended_bdev) {bdput (md->suspended_bdev);
PATCH 2/2 dm core: tidy local_init
In reply to Kiyoshi UedaThis patch tidies local_init() as preparation for another patch, which creates some kmem_cache for request-based dm.
No functional change.
--- drivers/md/dm.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-)
drivers/md/dm.c +17 -17
@@ -150,40 +150,40 @@ static struct kmem_cache *_tio_cache;static int __init local_init (void ) { -int r; +int r = -ENOMEM ;/* allocate a slab for the dm_ios */ _io_cache =KMEM_CACHE (dm_io,0 );if (!_io_cache) -return -ENOMEM ; +return r;/* allocate a slab for the target ios */ _tio_cache =KMEM_CACHE (dm_target_io,0 ); -if (!_tio_cache) { -kmem_cache_destroy (_io_cache); -return -ENOMEM ; - } +if (!_tio_cache) + goto out_free_io_cache; r =dm_uevent_init (); -if (r) { -kmem_cache_destroy (_tio_cache); -kmem_cache_destroy (_io_cache); -return r; - } +if (r) + goto out_free_tio_cache; _major = major; r =register_blkdev (_major, _name); -if (r <0 ) { -kmem_cache_destroy (_tio_cache); -kmem_cache_destroy (_io_cache); -dm_uevent_exit (); -return r; - } +if (r <0 ) + goto out_uevent_exit;if (!_major) _major = r;return 0 ; + +out_uevent_exit: +dm_uevent_exit (); +out_free_tio_cache: +kmem_cache_destroy (_tio_cache); +out_free_io_cache: +kmem_cache_destroy (_io_cache); + +return r; }static void local_exit (void )