Remove an unused workqueue and associated kernel thread. The "ksnapd" thread is never used in this snapshot implementation (data copies are done with kcopyd), so it can be removed. Signed-off-by: Mikulas Patocka --- drivers/md/dm-snap.c | 34 ---------------------------------- drivers/md/dm-snap.h | 10 ---------- 2 files changed, 44 deletions(-) Index: linux-2.6.28-rc5-devel/drivers/md/dm-snap.c =================================================================== --- linux-2.6.28-rc5-devel.orig/drivers/md/dm-snap.c 2008-11-25 16:08:59.000000000 +0100 +++ linux-2.6.28-rc5-devel/drivers/md/dm-snap.c 2008-11-25 16:10:10.000000000 +0100 @@ -46,9 +46,6 @@ */ #define MIN_IOS 256 -static struct workqueue_struct *ksnapd; -static void flush_queued_bios(struct work_struct *work); - struct dm_snap_pending_exception { struct dm_snap_exception e; @@ -610,7 +607,6 @@ static int snapshot_ctr(struct dm_target s->active = 0; atomic_set(&s->pending_exceptions_count, 0); init_rwsem(&s->lock); - spin_lock_init(&s->pe_lock); s->ti = ti; /* Allocate hash table for COW data */ @@ -668,9 +664,6 @@ static int snapshot_ctr(struct dm_target DMWARN("Snapshot is marked invalid."); } - bio_list_init(&s->queued_bios); - INIT_WORK(&s->queued_bios_work, flush_queued_bios); - /* Add snapshot to the list of snapshots for this origin */ /* Exceptions aren't triggered till snapshot_resume() is called */ if (register_snapshot(s)) { @@ -729,8 +722,6 @@ static void snapshot_dtr(struct dm_targe #endif struct dm_snapshot *s = ti->private; - flush_workqueue(ksnapd); - /* Prevent further origin writes from using this snapshot. */ /* After this returns there can be no new kcopyd jobs. */ unregister_snapshot(s); @@ -775,20 +766,6 @@ static void flush_bios(struct bio *bio) } } -static void flush_queued_bios(struct work_struct *work) -{ - struct dm_snapshot *s = - container_of(work, struct dm_snapshot, queued_bios_work); - struct bio *queued_bios; - unsigned long flags; - - spin_lock_irqsave(&s->pe_lock, flags); - queued_bios = bio_list_get(&s->queued_bios); - spin_unlock_irqrestore(&s->pe_lock, flags); - - flush_bios(queued_bios); -} - /* * Error a list of buffers. */ @@ -1444,17 +1421,8 @@ static int __init dm_snapshot_init(void) goto bad5; } - ksnapd = create_singlethread_workqueue("ksnapd"); - if (!ksnapd) { - DMERR("Failed to create ksnapd workqueue."); - r = -ENOMEM; - goto bad_pending_pool; - } - return 0; - bad_pending_pool: - kmem_cache_destroy(tracked_chunk_cache); bad5: kmem_cache_destroy(pending_cache); bad4: @@ -1470,8 +1438,6 @@ static int __init dm_snapshot_init(void) static void __exit dm_snapshot_exit(void) { - destroy_workqueue(ksnapd); - dm_unregister_target(&snapshot_target); dm_unregister_target(&origin_target); Index: linux-2.6.28-rc5-devel/drivers/md/dm-snap.h =================================================================== --- linux-2.6.28-rc5-devel.orig/drivers/md/dm-snap.h 2008-11-25 15:08:51.000000000 +0100 +++ linux-2.6.28-rc5-devel/drivers/md/dm-snap.h 2008-11-25 16:10:10.000000000 +0100 @@ -165,21 +165,11 @@ struct dm_snapshot { struct exception_table pending; struct exception_table complete; - /* - * pe_lock protects all pending_exception operations and access - * as well as the snapshot_bios list. - */ - spinlock_t pe_lock; - /* The on disk metadata handler */ struct exception_store store; struct dm_kcopyd_client *kcopyd_client; - /* Queue of snapshot writes for ksnapd to flush */ - struct bio_list queued_bios; - struct work_struct queued_bios_work; - /* Chunks with outstanding reads */ mempool_t *tracked_chunk_pool; spinlock_t tracked_chunk_lock;