aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-04-02 14:55:37 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 14:55:37 -0400
commit53d5914f288b67ddc4d594d6a09568fe114bb909 (patch)
treee4f8e2442b85564a3f8f90f32228d5efeb3bd033
parent9a1fb46448cac50e93115322ad28f417936f7852 (diff)
dm: remove unnecessary struct dm_wq_req
Remove struct dm_wq_req and move "work" directly into struct mapped_device. In the revised implementation, the thread will do just one type of work (processing the queue). Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f913b507fc81..dac79d11458d 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -99,11 +99,6 @@ union map_info *dm_get_mapinfo(struct bio *bio)
99/* 99/*
100 * Work processed by per-device workqueue. 100 * Work processed by per-device workqueue.
101 */ 101 */
102struct dm_wq_req {
103 struct work_struct work;
104 struct mapped_device *md;
105};
106
107struct mapped_device { 102struct mapped_device {
108 struct rw_semaphore io_lock; 103 struct rw_semaphore io_lock;
109 struct mutex suspend_lock; 104 struct mutex suspend_lock;
@@ -125,6 +120,7 @@ struct mapped_device {
125 */ 120 */
126 atomic_t pending; 121 atomic_t pending;
127 wait_queue_head_t wait; 122 wait_queue_head_t wait;
123 struct work_struct work;
128 struct bio_list deferred; 124 struct bio_list deferred;
129 struct bio_list pushback; 125 struct bio_list pushback;
130 126
@@ -1070,6 +1066,8 @@ out:
1070 1066
1071static struct block_device_operations dm_blk_dops; 1067static struct block_device_operations dm_blk_dops;
1072 1068
1069static void dm_wq_work(struct work_struct *work);
1070
1073/* 1071/*
1074 * Allocate and initialise a blank device with a given minor. 1072 * Allocate and initialise a blank device with a given minor.
1075 */ 1073 */
@@ -1136,6 +1134,7 @@ static struct mapped_device *alloc_dev(int minor)
1136 1134
1137 atomic_set(&md->pending, 0); 1135 atomic_set(&md->pending, 0);
1138 init_waitqueue_head(&md->wait); 1136 init_waitqueue_head(&md->wait);
1137 INIT_WORK(&md->work, dm_wq_work);
1139 init_waitqueue_head(&md->eventq); 1138 init_waitqueue_head(&md->eventq);
1140 1139
1141 md->disk->major = _major; 1140 md->disk->major = _major;
@@ -1426,26 +1425,17 @@ static void __merge_pushback_list(struct mapped_device *md)
1426 1425
1427static void dm_wq_work(struct work_struct *work) 1426static void dm_wq_work(struct work_struct *work)
1428{ 1427{
1429 struct dm_wq_req *req = container_of(work, struct dm_wq_req, work); 1428 struct mapped_device *md = container_of(work, struct mapped_device,
1430 struct mapped_device *md = req->md; 1429 work);
1431 1430
1432 down_write(&md->io_lock); 1431 down_write(&md->io_lock);
1433 __flush_deferred_io(md); 1432 __flush_deferred_io(md);
1434 up_write(&md->io_lock); 1433 up_write(&md->io_lock);
1435} 1434}
1436 1435
1437static void dm_wq_queue(struct mapped_device *md, struct dm_wq_req *req)
1438{
1439 req->md = md;
1440 INIT_WORK(&req->work, dm_wq_work);
1441 queue_work(md->wq, &req->work);
1442}
1443
1444static void dm_queue_flush(struct mapped_device *md) 1436static void dm_queue_flush(struct mapped_device *md)
1445{ 1437{
1446 struct dm_wq_req req; 1438 queue_work(md->wq, &md->work);
1447
1448 dm_wq_queue(md, &req);
1449 flush_workqueue(md->wq); 1439 flush_workqueue(md->wq);
1450} 1440}
1451 1441