aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-log.c
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2007-05-09 05:33:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:47 -0400
commit5d234d1e03d0a4cef4da32177be6657b45cc513f (patch)
tree6f1cd0cedbd2a9ad276b1a92195f00925ce517fd /drivers/md/dm-log.c
parent6cca1e7af543aa396b3e4919c251080741a49e69 (diff)
dm log: update dm io interface
This patch ports dm-log.c to the new dm-io interface in order to make it scalable to have a large number of persistent dirty logs active in parallel. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Cc: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/dm-log.c')
-rw-r--r--drivers/md/dm-log.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 8d301409d814..a60acf8d385a 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -149,6 +149,8 @@ struct log_c {
149 FORCESYNC, /* Force a sync to happen */ 149 FORCESYNC, /* Force a sync to happen */
150 } sync; 150 } sync;
151 151
152 struct dm_io_request io_req;
153
152 /* 154 /*
153 * Disk log fields 155 * Disk log fields
154 */ 156 */
@@ -200,13 +202,20 @@ static void header_from_disk(struct log_header *core, struct log_header *disk)
200 core->nr_regions = le64_to_cpu(disk->nr_regions); 202 core->nr_regions = le64_to_cpu(disk->nr_regions);
201} 203}
202 204
205static int rw_header(struct log_c *lc, int rw)
206{
207 lc->io_req.bi_rw = rw;
208 lc->io_req.mem.ptr.vma = lc->disk_header;
209 lc->io_req.notify.fn = NULL;
210
211 return dm_io(&lc->io_req, 1, &lc->header_location, NULL);
212}
213
203static int read_header(struct log_c *log) 214static int read_header(struct log_c *log)
204{ 215{
205 int r; 216 int r;
206 unsigned long ebits;
207 217
208 r = dm_io_sync_vm(1, &log->header_location, READ, 218 r = rw_header(log, READ);
209 log->disk_header, &ebits);
210 if (r) 219 if (r)
211 return r; 220 return r;
212 221
@@ -234,11 +243,8 @@ static int read_header(struct log_c *log)
234 243
235static inline int write_header(struct log_c *log) 244static inline int write_header(struct log_c *log)
236{ 245{
237 unsigned long ebits;
238
239 header_to_disk(&log->header, log->disk_header); 246 header_to_disk(&log->header, log->disk_header);
240 return dm_io_sync_vm(1, &log->header_location, WRITE, 247 return rw_header(log, WRITE);
241 log->disk_header, &ebits);
242} 248}
243 249
244/*---------------------------------------------------------------- 250/*----------------------------------------------------------------
@@ -257,6 +263,7 @@ static int create_log_context(struct dirty_log *log, struct dm_target *ti,
257 uint32_t region_size; 263 uint32_t region_size;
258 unsigned int region_count; 264 unsigned int region_count;
259 size_t bitset_size, buf_size; 265 size_t bitset_size, buf_size;
266 int r;
260 267
261 if (argc < 1 || argc > 2) { 268 if (argc < 1 || argc > 2) {
262 DMWARN("wrong number of arguments to mirror log"); 269 DMWARN("wrong number of arguments to mirror log");
@@ -326,6 +333,15 @@ static int create_log_context(struct dirty_log *log, struct dm_target *ti,
326 buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) + 333 buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
327 bitset_size, ti->limits.hardsect_size); 334 bitset_size, ti->limits.hardsect_size);
328 lc->header_location.count = buf_size >> SECTOR_SHIFT; 335 lc->header_location.count = buf_size >> SECTOR_SHIFT;
336 lc->io_req.mem.type = DM_IO_VMA;
337 lc->io_req.client = dm_io_client_create(dm_div_up(buf_size,
338 PAGE_SIZE));
339 if (IS_ERR(lc->io_req.client)) {
340 r = PTR_ERR(lc->io_req.client);
341 DMWARN("couldn't allocate disk io client");
342 kfree(lc);
343 return -ENOMEM;
344 }
329 345
330 lc->disk_header = vmalloc(buf_size); 346 lc->disk_header = vmalloc(buf_size);
331 if (!lc->disk_header) { 347 if (!lc->disk_header) {
@@ -426,6 +442,7 @@ static void disk_dtr(struct dirty_log *log)
426 442
427 dm_put_device(lc->ti, lc->log_dev); 443 dm_put_device(lc->ti, lc->log_dev);
428 vfree(lc->disk_header); 444 vfree(lc->disk_header);
445 dm_io_client_destroy(lc->io_req.client);
429 destroy_log_context(lc); 446 destroy_log_context(lc);
430} 447}
431 448