diff options
author | Heinz Mauelshagen <hjm@redhat.com> | 2008-04-24 16:43:17 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-04-25 08:26:43 -0400 |
commit | 22a1ceb1e6a7fbce95a1531ff10bb4fb036d4a37 (patch) | |
tree | 5b6ebebc747a0027626684a153b418a26119d074 /drivers/md | |
parent | e01fd7eeb00f8078103f4ed3e8ef64474c11f300 (diff) |
dm io: clean interface
Clean up the dm-io interface to prepare for publishing it in include/linux.
Signed-off-by: Heinz Mauelshagen <hjm@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-exception-store.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-io.c | 11 | ||||
-rw-r--r-- | drivers/md/dm-io.h | 18 | ||||
-rw-r--r-- | drivers/md/dm-log.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 8 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 2 | ||||
-rw-r--r-- | drivers/md/kcopyd.c | 9 | ||||
-rw-r--r-- | drivers/md/kcopyd.h | 4 |
8 files changed, 33 insertions, 25 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index c7d305bfd838..6933301733df 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c | |||
@@ -159,7 +159,7 @@ static void free_area(struct pstore *ps) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | struct mdata_req { | 161 | struct mdata_req { |
162 | struct io_region *where; | 162 | struct dm_io_region *where; |
163 | struct dm_io_request *io_req; | 163 | struct dm_io_request *io_req; |
164 | struct work_struct work; | 164 | struct work_struct work; |
165 | int result; | 165 | int result; |
@@ -177,7 +177,7 @@ static void do_metadata(struct work_struct *work) | |||
177 | */ | 177 | */ |
178 | static int chunk_io(struct pstore *ps, uint32_t chunk, int rw, int metadata) | 178 | static int chunk_io(struct pstore *ps, uint32_t chunk, int rw, int metadata) |
179 | { | 179 | { |
180 | struct io_region where = { | 180 | struct dm_io_region where = { |
181 | .bdev = ps->snap->cow->bdev, | 181 | .bdev = ps->snap->cow->bdev, |
182 | .sector = ps->snap->chunk_size * chunk, | 182 | .sector = ps->snap->chunk_size * chunk, |
183 | .count = ps->snap->chunk_size, | 183 | .count = ps->snap->chunk_size, |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index c56c7eb86fe2..978c0414cf05 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "dm-io.h" | 8 | #include "dm-io.h" |
9 | #include "dm.h" | ||
9 | 10 | ||
10 | #include <linux/bio.h> | 11 | #include <linux/bio.h> |
11 | #include <linux/mempool.h> | 12 | #include <linux/mempool.h> |
@@ -271,7 +272,7 @@ static void km_dp_init(struct dpages *dp, void *data) | |||
271 | /*----------------------------------------------------------------- | 272 | /*----------------------------------------------------------------- |
272 | * IO routines that accept a list of pages. | 273 | * IO routines that accept a list of pages. |
273 | *---------------------------------------------------------------*/ | 274 | *---------------------------------------------------------------*/ |
274 | static void do_region(int rw, unsigned int region, struct io_region *where, | 275 | static void do_region(int rw, unsigned region, struct dm_io_region *where, |
275 | struct dpages *dp, struct io *io) | 276 | struct dpages *dp, struct io *io) |
276 | { | 277 | { |
277 | struct bio *bio; | 278 | struct bio *bio; |
@@ -320,7 +321,7 @@ static void do_region(int rw, unsigned int region, struct io_region *where, | |||
320 | } | 321 | } |
321 | 322 | ||
322 | static void dispatch_io(int rw, unsigned int num_regions, | 323 | static void dispatch_io(int rw, unsigned int num_regions, |
323 | struct io_region *where, struct dpages *dp, | 324 | struct dm_io_region *where, struct dpages *dp, |
324 | struct io *io, int sync) | 325 | struct io *io, int sync) |
325 | { | 326 | { |
326 | int i; | 327 | int i; |
@@ -347,7 +348,7 @@ static void dispatch_io(int rw, unsigned int num_regions, | |||
347 | } | 348 | } |
348 | 349 | ||
349 | static int sync_io(struct dm_io_client *client, unsigned int num_regions, | 350 | static int sync_io(struct dm_io_client *client, unsigned int num_regions, |
350 | struct io_region *where, int rw, struct dpages *dp, | 351 | struct dm_io_region *where, int rw, struct dpages *dp, |
351 | unsigned long *error_bits) | 352 | unsigned long *error_bits) |
352 | { | 353 | { |
353 | struct io io; | 354 | struct io io; |
@@ -384,7 +385,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
384 | } | 385 | } |
385 | 386 | ||
386 | static int async_io(struct dm_io_client *client, unsigned int num_regions, | 387 | static int async_io(struct dm_io_client *client, unsigned int num_regions, |
387 | struct io_region *where, int rw, struct dpages *dp, | 388 | struct dm_io_region *where, int rw, struct dpages *dp, |
388 | io_notify_fn fn, void *context) | 389 | io_notify_fn fn, void *context) |
389 | { | 390 | { |
390 | struct io *io; | 391 | struct io *io; |
@@ -438,7 +439,7 @@ static int dp_init(struct dm_io_request *io_req, struct dpages *dp) | |||
438 | * New collapsed (a)synchronous interface | 439 | * New collapsed (a)synchronous interface |
439 | */ | 440 | */ |
440 | int dm_io(struct dm_io_request *io_req, unsigned num_regions, | 441 | int dm_io(struct dm_io_request *io_req, unsigned num_regions, |
441 | struct io_region *where, unsigned long *sync_error_bits) | 442 | struct dm_io_region *where, unsigned long *sync_error_bits) |
442 | { | 443 | { |
443 | int r; | 444 | int r; |
444 | struct dpages dp; | 445 | struct dpages dp; |
diff --git a/drivers/md/dm-io.h b/drivers/md/dm-io.h index f647e2cceaa6..b6bf17ee2f61 100644 --- a/drivers/md/dm-io.h +++ b/drivers/md/dm-io.h | |||
@@ -1,15 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Sistina Software | 2 | * Copyright (C) 2003 Sistina Software |
3 | * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * Device-Mapper low-level I/O. | ||
3 | * | 6 | * |
4 | * This file is released under the GPL. | 7 | * This file is released under the GPL. |
5 | */ | 8 | */ |
6 | 9 | ||
7 | #ifndef _DM_IO_H | 10 | #ifndef _LINUX_DM_IO_H |
8 | #define _DM_IO_H | 11 | #define _LINUX_DM_IO_H |
12 | |||
13 | #ifdef __KERNEL__ | ||
9 | 14 | ||
10 | #include "dm.h" | 15 | #include <linux/types.h> |
11 | 16 | ||
12 | struct io_region { | 17 | struct dm_io_region { |
13 | struct block_device *bdev; | 18 | struct block_device *bdev; |
14 | sector_t sector; | 19 | sector_t sector; |
15 | sector_t count; /* If this is zero the region is ignored. */ | 20 | sector_t count; /* If this is zero the region is ignored. */ |
@@ -74,6 +79,7 @@ void dm_io_client_destroy(struct dm_io_client *client); | |||
74 | * error occurred doing io to the corresponding region. | 79 | * error occurred doing io to the corresponding region. |
75 | */ | 80 | */ |
76 | int dm_io(struct dm_io_request *io_req, unsigned num_regions, | 81 | int dm_io(struct dm_io_request *io_req, unsigned num_regions, |
77 | struct io_region *region, unsigned long *sync_error_bits); | 82 | struct dm_io_region *region, unsigned long *sync_error_bits); |
78 | 83 | ||
79 | #endif | 84 | #endif /* __KERNEL__ */ |
85 | #endif /* _LINUX_DM_IO_H */ | ||
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index f6b20def2ac8..14f785fc308a 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
@@ -208,7 +208,7 @@ struct log_c { | |||
208 | struct dm_dev *log_dev; | 208 | struct dm_dev *log_dev; |
209 | struct log_header header; | 209 | struct log_header header; |
210 | 210 | ||
211 | struct io_region header_location; | 211 | struct dm_io_region header_location; |
212 | struct log_header *disk_header; | 212 | struct log_header *disk_header; |
213 | }; | 213 | }; |
214 | 214 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index c4ce01180b6f..0d4e7e9653ff 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -788,7 +788,7 @@ static int recover(struct mirror_set *ms, struct region *reg) | |||
788 | { | 788 | { |
789 | int r; | 789 | int r; |
790 | unsigned int i; | 790 | unsigned int i; |
791 | struct io_region from, to[KCOPYD_MAX_REGIONS], *dest; | 791 | struct dm_io_region from, to[KCOPYD_MAX_REGIONS], *dest; |
792 | struct mirror *m; | 792 | struct mirror *m; |
793 | unsigned long flags = 0; | 793 | unsigned long flags = 0; |
794 | 794 | ||
@@ -907,7 +907,7 @@ static void map_bio(struct mirror *m, struct bio *bio) | |||
907 | bio->bi_sector = map_sector(m, bio); | 907 | bio->bi_sector = map_sector(m, bio); |
908 | } | 908 | } |
909 | 909 | ||
910 | static void map_region(struct io_region *io, struct mirror *m, | 910 | static void map_region(struct dm_io_region *io, struct mirror *m, |
911 | struct bio *bio) | 911 | struct bio *bio) |
912 | { | 912 | { |
913 | io->bdev = m->dev->bdev; | 913 | io->bdev = m->dev->bdev; |
@@ -949,7 +949,7 @@ static void read_callback(unsigned long error, void *context) | |||
949 | /* Asynchronous read. */ | 949 | /* Asynchronous read. */ |
950 | static void read_async_bio(struct mirror *m, struct bio *bio) | 950 | static void read_async_bio(struct mirror *m, struct bio *bio) |
951 | { | 951 | { |
952 | struct io_region io; | 952 | struct dm_io_region io; |
953 | struct dm_io_request io_req = { | 953 | struct dm_io_request io_req = { |
954 | .bi_rw = READ, | 954 | .bi_rw = READ, |
955 | .mem.type = DM_IO_BVEC, | 955 | .mem.type = DM_IO_BVEC, |
@@ -1105,7 +1105,7 @@ out: | |||
1105 | static void do_write(struct mirror_set *ms, struct bio *bio) | 1105 | static void do_write(struct mirror_set *ms, struct bio *bio) |
1106 | { | 1106 | { |
1107 | unsigned int i; | 1107 | unsigned int i; |
1108 | struct io_region io[ms->nr_mirrors], *dest = io; | 1108 | struct dm_io_region io[ms->nr_mirrors], *dest = io; |
1109 | struct mirror *m; | 1109 | struct mirror *m; |
1110 | struct dm_io_request io_req = { | 1110 | struct dm_io_request io_req = { |
1111 | .bi_rw = WRITE, | 1111 | .bi_rw = WRITE, |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 08a8cbddb60d..bab159b77742 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -824,7 +824,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) | |||
824 | static void start_copy(struct dm_snap_pending_exception *pe) | 824 | static void start_copy(struct dm_snap_pending_exception *pe) |
825 | { | 825 | { |
826 | struct dm_snapshot *s = pe->snap; | 826 | struct dm_snapshot *s = pe->snap; |
827 | struct io_region src, dest; | 827 | struct dm_io_region src, dest; |
828 | struct block_device *bdev = s->origin->bdev; | 828 | struct block_device *bdev = s->origin->bdev; |
829 | sector_t dev_size; | 829 | sector_t dev_size; |
830 | 830 | ||
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index e76b52ade690..21fea42c68c4 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | 26 | ||
27 | #include "kcopyd.h" | 27 | #include "kcopyd.h" |
28 | #include "dm.h" | ||
28 | 29 | ||
29 | static struct workqueue_struct *_kcopyd_wq; | 30 | static struct workqueue_struct *_kcopyd_wq; |
30 | static struct work_struct _kcopyd_work; | 31 | static struct work_struct _kcopyd_work; |
@@ -175,13 +176,13 @@ struct kcopyd_job { | |||
175 | * Either READ or WRITE | 176 | * Either READ or WRITE |
176 | */ | 177 | */ |
177 | int rw; | 178 | int rw; |
178 | struct io_region source; | 179 | struct dm_io_region source; |
179 | 180 | ||
180 | /* | 181 | /* |
181 | * The destinations for the transfer. | 182 | * The destinations for the transfer. |
182 | */ | 183 | */ |
183 | unsigned int num_dests; | 184 | unsigned int num_dests; |
184 | struct io_region dests[KCOPYD_MAX_REGIONS]; | 185 | struct dm_io_region dests[KCOPYD_MAX_REGIONS]; |
185 | 186 | ||
186 | sector_t offset; | 187 | sector_t offset; |
187 | unsigned int nr_pages; | 188 | unsigned int nr_pages; |
@@ -526,8 +527,8 @@ static void split_job(struct kcopyd_job *job) | |||
526 | segment_complete(0, 0u, job); | 527 | segment_complete(0, 0u, job); |
527 | } | 528 | } |
528 | 529 | ||
529 | int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, | 530 | int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from, |
530 | unsigned int num_dests, struct io_region *dests, | 531 | unsigned int num_dests, struct dm_io_region *dests, |
531 | unsigned int flags, kcopyd_notify_fn fn, void *context) | 532 | unsigned int flags, kcopyd_notify_fn fn, void *context) |
532 | { | 533 | { |
533 | struct kcopyd_job *job; | 534 | struct kcopyd_job *job; |
diff --git a/drivers/md/kcopyd.h b/drivers/md/kcopyd.h index 4845f2a0c676..588f05dffbe1 100644 --- a/drivers/md/kcopyd.h +++ b/drivers/md/kcopyd.h | |||
@@ -35,8 +35,8 @@ void kcopyd_client_destroy(struct kcopyd_client *kc); | |||
35 | typedef void (*kcopyd_notify_fn)(int read_err, unsigned long write_err, | 35 | typedef void (*kcopyd_notify_fn)(int read_err, unsigned long write_err, |
36 | void *context); | 36 | void *context); |
37 | 37 | ||
38 | int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, | 38 | int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from, |
39 | unsigned int num_dests, struct io_region *dests, | 39 | unsigned num_dests, struct dm_io_region *dests, |
40 | unsigned int flags, kcopyd_notify_fn fn, void *context); | 40 | unsigned int flags, kcopyd_notify_fn fn, void *context); |
41 | 41 | ||
42 | #endif | 42 | #endif |