Move content of __flush_deferred_io to the calling function: dm_wq_work. There's no need to have a function that has only one caller. It makes further patches more clean (i.e. no more dropping a lock inside a subfunction that was took by the parent function) Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Index: linux-2.6.29-rc1-devel/drivers/md/dm.c =================================================================== --- linux-2.6.29-rc1-devel.orig/drivers/md/dm.c 2009-01-19 02:20:59.000000000 +0100 +++ linux-2.6.29-rc1-devel/drivers/md/dm.c 2009-01-19 02:21:37.000000000 +0100 @@ -1402,10 +1402,13 @@ static int dm_wait_for_completion(struct /* * Process the deferred bios */ -static void __flush_deferred_io(struct mapped_device *md) +static void dm_wq_work(struct work_struct *work) { + struct mapped_device *md = container_of(work, struct mapped_device, work); struct bio *c; + down_write(&md->io_lock); + next_bio: spin_lock_irq(&md->deferred_lock); c = bio_list_pop(&md->deferred); @@ -1417,14 +1420,6 @@ next_bio: } clear_bit(DMF_BLOCK_IO, &md->flags); -} - -static void dm_wq_work(struct work_struct *work) -{ - struct mapped_device *md = container_of(work, struct mapped_device, work); - - down_write(&md->io_lock); - __flush_deferred_io(md); up_write(&md->io_lock); }