Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heinz Mauelshagen and committed by
Alasdair G Kergon
22a1ceb1 e01fd7ee

+33 -25
+2 -2
drivers/md/dm-exception-store.c
··· 159 159 } 160 160 161 161 struct mdata_req { 162 - struct io_region *where; 162 + struct dm_io_region *where; 163 163 struct dm_io_request *io_req; 164 164 struct work_struct work; 165 165 int result; ··· 177 177 */ 178 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 181 .bdev = ps->snap->cow->bdev, 182 182 .sector = ps->snap->chunk_size * chunk, 183 183 .count = ps->snap->chunk_size,
+6 -5
drivers/md/dm-io.c
··· 6 6 */ 7 7 8 8 #include "dm-io.h" 9 + #include "dm.h" 9 10 10 11 #include <linux/bio.h> 11 12 #include <linux/mempool.h> ··· 272 271 /*----------------------------------------------------------------- 273 272 * IO routines that accept a list of pages. 274 273 *---------------------------------------------------------------*/ 275 - static void do_region(int rw, unsigned int region, struct io_region *where, 274 + static void do_region(int rw, unsigned region, struct dm_io_region *where, 276 275 struct dpages *dp, struct io *io) 277 276 { 278 277 struct bio *bio; ··· 321 320 } 322 321 323 322 static void dispatch_io(int rw, unsigned int num_regions, 324 - struct io_region *where, struct dpages *dp, 323 + struct dm_io_region *where, struct dpages *dp, 325 324 struct io *io, int sync) 326 325 { 327 326 int i; ··· 348 347 } 349 348 350 349 static int sync_io(struct dm_io_client *client, unsigned int num_regions, 351 - struct io_region *where, int rw, struct dpages *dp, 350 + struct dm_io_region *where, int rw, struct dpages *dp, 352 351 unsigned long *error_bits) 353 352 { 354 353 struct io io; ··· 385 384 } 386 385 387 386 static int async_io(struct dm_io_client *client, unsigned int num_regions, 388 - struct io_region *where, int rw, struct dpages *dp, 387 + struct dm_io_region *where, int rw, struct dpages *dp, 389 388 io_notify_fn fn, void *context) 390 389 { 391 390 struct io *io; ··· 439 438 * New collapsed (a)synchronous interface 440 439 */ 441 440 int dm_io(struct dm_io_request *io_req, unsigned num_regions, 442 - struct io_region *where, unsigned long *sync_error_bits) 441 + struct dm_io_region *where, unsigned long *sync_error_bits) 443 442 { 444 443 int r; 445 444 struct dpages dp;
+12 -6
drivers/md/dm-io.h
··· 1 1 /* 2 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 7 * This file is released under the GPL. 5 8 */ 6 9 7 - #ifndef _DM_IO_H 8 - #define _DM_IO_H 10 + #ifndef _LINUX_DM_IO_H 11 + #define _LINUX_DM_IO_H 9 12 10 - #include "dm.h" 13 + #ifdef __KERNEL__ 11 14 12 - struct io_region { 15 + #include <linux/types.h> 16 + 17 + struct dm_io_region { 13 18 struct block_device *bdev; 14 19 sector_t sector; 15 20 sector_t count; /* If this is zero the region is ignored. */ ··· 79 74 * error occurred doing io to the corresponding region. 80 75 */ 81 76 int dm_io(struct dm_io_request *io_req, unsigned num_regions, 82 - struct io_region *region, unsigned long *sync_error_bits); 77 + struct dm_io_region *region, unsigned long *sync_error_bits); 83 78 84 - #endif 79 + #endif /* __KERNEL__ */ 80 + #endif /* _LINUX_DM_IO_H */
+1 -1
drivers/md/dm-log.c
··· 208 208 struct dm_dev *log_dev; 209 209 struct log_header header; 210 210 211 - struct io_region header_location; 211 + struct dm_io_region header_location; 212 212 struct log_header *disk_header; 213 213 }; 214 214
+4 -4
drivers/md/dm-raid1.c
··· 788 788 { 789 789 int r; 790 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 792 struct mirror *m; 793 793 unsigned long flags = 0; 794 794 ··· 907 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 911 struct bio *bio) 912 912 { 913 913 io->bdev = m->dev->bdev; ··· 949 949 /* Asynchronous read. */ 950 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 953 struct dm_io_request io_req = { 954 954 .bi_rw = READ, 955 955 .mem.type = DM_IO_BVEC, ··· 1105 1105 static void do_write(struct mirror_set *ms, struct bio *bio) 1106 1106 { 1107 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 1109 struct mirror *m; 1110 1110 struct dm_io_request io_req = { 1111 1111 .bi_rw = WRITE,
+1 -1
drivers/md/dm-snap.c
··· 824 824 static void start_copy(struct dm_snap_pending_exception *pe) 825 825 { 826 826 struct dm_snapshot *s = pe->snap; 827 - struct io_region src, dest; 827 + struct dm_io_region src, dest; 828 828 struct block_device *bdev = s->origin->bdev; 829 829 sector_t dev_size; 830 830
+5 -4
drivers/md/kcopyd.c
··· 25 25 #include <linux/mutex.h> 26 26 27 27 #include "kcopyd.h" 28 + #include "dm.h" 28 29 29 30 static struct workqueue_struct *_kcopyd_wq; 30 31 static struct work_struct _kcopyd_work; ··· 176 175 * Either READ or WRITE 177 176 */ 178 177 int rw; 179 - struct io_region source; 178 + struct dm_io_region source; 180 179 181 180 /* 182 181 * The destinations for the transfer. 183 182 */ 184 183 unsigned int num_dests; 185 - struct io_region dests[KCOPYD_MAX_REGIONS]; 184 + struct dm_io_region dests[KCOPYD_MAX_REGIONS]; 186 185 187 186 sector_t offset; 188 187 unsigned int nr_pages; ··· 527 526 segment_complete(0, 0u, job); 528 527 } 529 528 530 - int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, 531 - unsigned int num_dests, struct io_region *dests, 529 + int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from, 530 + unsigned int num_dests, struct dm_io_region *dests, 532 531 unsigned int flags, kcopyd_notify_fn fn, void *context) 533 532 { 534 533 struct kcopyd_job *job;
+2 -2
drivers/md/kcopyd.h
··· 35 35 typedef void (*kcopyd_notify_fn)(int read_err, unsigned long write_err, 36 36 void *context); 37 37 38 - int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, 39 - unsigned int num_dests, struct io_region *dests, 38 + int kcopyd_copy(struct kcopyd_client *kc, struct dm_io_region *from, 39 + unsigned num_dests, struct dm_io_region *dests, 40 40 unsigned int flags, kcopyd_notify_fn fn, void *context); 41 41 42 42 #endif