diff options
author | Alasdair G Kergon <agk@redhat.com> | 2008-04-24 17:02:01 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-04-25 08:26:55 -0400 |
commit | a765e20eeb423d0fa6a02ffab51141e53bbd93cb (patch) | |
tree | fc7279fa73a21518373e1ba2efad27dab89a2214 /drivers | |
parent | 2d1e580afe23287871529ce54429e249809525a1 (diff) |
dm: move include files
Publish the dm-io, dm-log and dm-kcopyd headers in include/linux.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/Makefile | 2 | ||||
-rw-r--r-- | drivers/md/dm-exception-store.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-io.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-io.h | 85 | ||||
-rw-r--r-- | drivers/md/dm-kcopyd.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-kcopyd.h | 47 | ||||
-rw-r--r-- | drivers/md/dm-log.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-log.h | 131 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 6 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 2 |
10 files changed, 11 insertions, 274 deletions
diff --git a/drivers/md/Makefile b/drivers/md/Makefile index be4b069bbc58..7be09eeea293 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | dm-mod-objs := dm.o dm-table.o dm-target.o dm-linear.o dm-stripe.o \ | 5 | dm-mod-objs := dm.o dm-table.o dm-target.o dm-linear.o dm-stripe.o \ |
6 | dm-ioctl.o dm-io.o kcopyd.o | 6 | dm-ioctl.o dm-io.o dm-kcopyd.o |
7 | dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o | 7 | dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o |
8 | dm-snapshot-objs := dm-snap.o dm-exception-store.o | 8 | dm-snapshot-objs := dm-snap.o dm-exception-store.o |
9 | dm-mirror-objs := dm-raid1.o | 9 | dm-mirror-objs := dm-raid1.o |
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 6933301733df..41f408068a7c 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c | |||
@@ -9,13 +9,13 @@ | |||
9 | 9 | ||
10 | #include "dm.h" | 10 | #include "dm.h" |
11 | #include "dm-snap.h" | 11 | #include "dm-snap.h" |
12 | #include "dm-io.h" | ||
13 | #include "kcopyd.h" | ||
14 | 12 | ||
15 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
16 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
17 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
18 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/dm-io.h> | ||
18 | #include <linux/dm-kcopyd.h> | ||
19 | 19 | ||
20 | #define DM_MSG_PREFIX "snapshots" | 20 | #define DM_MSG_PREFIX "snapshots" |
21 | #define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ | 21 | #define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 978c0414cf05..ed9c86cd053e 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * This file is released under the GPL. | 5 | * This file is released under the GPL. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "dm-io.h" | ||
9 | #include "dm.h" | 8 | #include "dm.h" |
10 | 9 | ||
11 | #include <linux/bio.h> | 10 | #include <linux/bio.h> |
@@ -13,6 +12,7 @@ | |||
13 | #include <linux/module.h> | 12 | #include <linux/module.h> |
14 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
15 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/dm-io.h> | ||
16 | 16 | ||
17 | struct dm_io_client { | 17 | struct dm_io_client { |
18 | mempool_t *pool; | 18 | mempool_t *pool; |
diff --git a/drivers/md/dm-io.h b/drivers/md/dm-io.h deleted file mode 100644 index b6bf17ee2f61..000000000000 --- a/drivers/md/dm-io.h +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* | ||
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. | ||
6 | * | ||
7 | * This file is released under the GPL. | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_DM_IO_H | ||
11 | #define _LINUX_DM_IO_H | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | struct dm_io_region { | ||
18 | struct block_device *bdev; | ||
19 | sector_t sector; | ||
20 | sector_t count; /* If this is zero the region is ignored. */ | ||
21 | }; | ||
22 | |||
23 | struct page_list { | ||
24 | struct page_list *next; | ||
25 | struct page *page; | ||
26 | }; | ||
27 | |||
28 | typedef void (*io_notify_fn)(unsigned long error, void *context); | ||
29 | |||
30 | enum dm_io_mem_type { | ||
31 | DM_IO_PAGE_LIST,/* Page list */ | ||
32 | DM_IO_BVEC, /* Bio vector */ | ||
33 | DM_IO_VMA, /* Virtual memory area */ | ||
34 | DM_IO_KMEM, /* Kernel memory */ | ||
35 | }; | ||
36 | |||
37 | struct dm_io_memory { | ||
38 | enum dm_io_mem_type type; | ||
39 | |||
40 | union { | ||
41 | struct page_list *pl; | ||
42 | struct bio_vec *bvec; | ||
43 | void *vma; | ||
44 | void *addr; | ||
45 | } ptr; | ||
46 | |||
47 | unsigned offset; | ||
48 | }; | ||
49 | |||
50 | struct dm_io_notify { | ||
51 | io_notify_fn fn; /* Callback for asynchronous requests */ | ||
52 | void *context; /* Passed to callback */ | ||
53 | }; | ||
54 | |||
55 | /* | ||
56 | * IO request structure | ||
57 | */ | ||
58 | struct dm_io_client; | ||
59 | struct dm_io_request { | ||
60 | int bi_rw; /* READ|WRITE - not READA */ | ||
61 | struct dm_io_memory mem; /* Memory to use for io */ | ||
62 | struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */ | ||
63 | struct dm_io_client *client; /* Client memory handler */ | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * For async io calls, users can alternatively use the dm_io() function below | ||
68 | * and dm_io_client_create() to create private mempools for the client. | ||
69 | * | ||
70 | * Create/destroy may block. | ||
71 | */ | ||
72 | struct dm_io_client *dm_io_client_create(unsigned num_pages); | ||
73 | int dm_io_client_resize(unsigned num_pages, struct dm_io_client *client); | ||
74 | void dm_io_client_destroy(struct dm_io_client *client); | ||
75 | |||
76 | /* | ||
77 | * IO interface using private per-client pools. | ||
78 | * Each bit in the optional 'sync_error_bits' bitset indicates whether an | ||
79 | * error occurred doing io to the corresponding region. | ||
80 | */ | ||
81 | int dm_io(struct dm_io_request *io_req, unsigned num_regions, | ||
82 | struct dm_io_region *region, unsigned long *sync_error_bits); | ||
83 | |||
84 | #endif /* __KERNEL__ */ | ||
85 | #endif /* _LINUX_DM_IO_H */ | ||
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 17345844b03e..ee9583bee04d 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
23 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/dm-kcopyd.h> | ||
25 | 26 | ||
26 | #include "kcopyd.h" | ||
27 | #include "dm.h" | 27 | #include "dm.h" |
28 | 28 | ||
29 | /*----------------------------------------------------------------- | 29 | /*----------------------------------------------------------------- |
diff --git a/drivers/md/dm-kcopyd.h b/drivers/md/dm-kcopyd.h deleted file mode 100644 index d3057846b0b0..000000000000 --- a/drivers/md/dm-kcopyd.h +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 - 2003 Sistina Software | ||
3 | * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * kcopyd provides a simple interface for copying an area of one | ||
6 | * block-device to one or more other block-devices, either synchronous | ||
7 | * or with an asynchronous completion notification. | ||
8 | * | ||
9 | * This file is released under the GPL. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_DM_KCOPYD_H | ||
13 | #define _LINUX_DM_KCOPYD_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include "dm-io.h" | ||
18 | |||
19 | /* FIXME: make this configurable */ | ||
20 | #define DM_KCOPYD_MAX_REGIONS 8 | ||
21 | |||
22 | #define DM_KCOPYD_IGNORE_ERROR 1 | ||
23 | |||
24 | /* | ||
25 | * To use kcopyd you must first create a dm_kcopyd_client object. | ||
26 | */ | ||
27 | struct dm_kcopyd_client; | ||
28 | int dm_kcopyd_client_create(unsigned num_pages, | ||
29 | struct dm_kcopyd_client **result); | ||
30 | void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); | ||
31 | |||
32 | /* | ||
33 | * Submit a copy job to kcopyd. This is built on top of the | ||
34 | * previous three fns. | ||
35 | * | ||
36 | * read_err is a boolean, | ||
37 | * write_err is a bitset, with 1 bit for each destination region | ||
38 | */ | ||
39 | typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err, | ||
40 | void *context); | ||
41 | |||
42 | int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, | ||
43 | unsigned num_dests, struct dm_io_region *dests, | ||
44 | unsigned flags, dm_kcopyd_notify_fn fn, void *context); | ||
45 | |||
46 | #endif /* __KERNEL__ */ | ||
47 | #endif /* _LINUX_DM_KCOPYD_H */ | ||
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index e6b6a9d5fdd2..67a6f31b7fc3 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
@@ -9,9 +9,9 @@ | |||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/vmalloc.h> | 11 | #include <linux/vmalloc.h> |
12 | #include <linux/dm-io.h> | ||
13 | #include <linux/dm-dirty-log.h> | ||
12 | 14 | ||
13 | #include "dm-log.h" | ||
14 | #include "dm-io.h" | ||
15 | #include "dm.h" | 15 | #include "dm.h" |
16 | 16 | ||
17 | #define DM_MSG_PREFIX "dirty region log" | 17 | #define DM_MSG_PREFIX "dirty region log" |
diff --git a/drivers/md/dm-log.h b/drivers/md/dm-log.h deleted file mode 100644 index 600c5fb2daad..000000000000 --- a/drivers/md/dm-log.h +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003 Sistina Software | ||
3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * Device-Mapper dirty region log. | ||
6 | * | ||
7 | * This file is released under the LGPL. | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_DM_DIRTY_LOG | ||
11 | #define _LINUX_DM_DIRTY_LOG | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/device-mapper.h> | ||
17 | |||
18 | typedef sector_t region_t; | ||
19 | |||
20 | struct dm_dirty_log_type; | ||
21 | |||
22 | struct dm_dirty_log { | ||
23 | struct dm_dirty_log_type *type; | ||
24 | void *context; | ||
25 | }; | ||
26 | |||
27 | struct dm_dirty_log_type { | ||
28 | const char *name; | ||
29 | struct module *module; | ||
30 | |||
31 | int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, | ||
32 | unsigned argc, char **argv); | ||
33 | void (*dtr)(struct dm_dirty_log *log); | ||
34 | |||
35 | /* | ||
36 | * There are times when we don't want the log to touch | ||
37 | * the disk. | ||
38 | */ | ||
39 | int (*presuspend)(struct dm_dirty_log *log); | ||
40 | int (*postsuspend)(struct dm_dirty_log *log); | ||
41 | int (*resume)(struct dm_dirty_log *log); | ||
42 | |||
43 | /* | ||
44 | * Retrieves the smallest size of region that the log can | ||
45 | * deal with. | ||
46 | */ | ||
47 | uint32_t (*get_region_size)(struct dm_dirty_log *log); | ||
48 | |||
49 | /* | ||
50 | * A predicate to say whether a region is clean or not. | ||
51 | * May block. | ||
52 | */ | ||
53 | int (*is_clean)(struct dm_dirty_log *log, region_t region); | ||
54 | |||
55 | /* | ||
56 | * Returns: 0, 1, -EWOULDBLOCK, < 0 | ||
57 | * | ||
58 | * A predicate function to check the area given by | ||
59 | * [sector, sector + len) is in sync. | ||
60 | * | ||
61 | * If -EWOULDBLOCK is returned the state of the region is | ||
62 | * unknown, typically this will result in a read being | ||
63 | * passed to a daemon to deal with, since a daemon is | ||
64 | * allowed to block. | ||
65 | */ | ||
66 | int (*in_sync)(struct dm_dirty_log *log, region_t region, | ||
67 | int can_block); | ||
68 | |||
69 | /* | ||
70 | * Flush the current log state (eg, to disk). This | ||
71 | * function may block. | ||
72 | */ | ||
73 | int (*flush)(struct dm_dirty_log *log); | ||
74 | |||
75 | /* | ||
76 | * Mark an area as clean or dirty. These functions may | ||
77 | * block, though for performance reasons blocking should | ||
78 | * be extremely rare (eg, allocating another chunk of | ||
79 | * memory for some reason). | ||
80 | */ | ||
81 | void (*mark_region)(struct dm_dirty_log *log, region_t region); | ||
82 | void (*clear_region)(struct dm_dirty_log *log, region_t region); | ||
83 | |||
84 | /* | ||
85 | * Returns: <0 (error), 0 (no region), 1 (region) | ||
86 | * | ||
87 | * The mirrord will need perform recovery on regions of | ||
88 | * the mirror that are in the NOSYNC state. This | ||
89 | * function asks the log to tell the caller about the | ||
90 | * next region that this machine should recover. | ||
91 | * | ||
92 | * Do not confuse this function with 'in_sync()', one | ||
93 | * tells you if an area is synchronised, the other | ||
94 | * assigns recovery work. | ||
95 | */ | ||
96 | int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); | ||
97 | |||
98 | /* | ||
99 | * This notifies the log that the resync status of a region | ||
100 | * has changed. It also clears the region from the recovering | ||
101 | * list (if present). | ||
102 | */ | ||
103 | void (*set_region_sync)(struct dm_dirty_log *log, | ||
104 | region_t region, int in_sync); | ||
105 | |||
106 | /* | ||
107 | * Returns the number of regions that are in sync. | ||
108 | */ | ||
109 | region_t (*get_sync_count)(struct dm_dirty_log *log); | ||
110 | |||
111 | /* | ||
112 | * Support function for mirror status requests. | ||
113 | */ | ||
114 | int (*status)(struct dm_dirty_log *log, status_type_t status_type, | ||
115 | char *result, unsigned maxlen); | ||
116 | }; | ||
117 | |||
118 | int dm_dirty_log_type_register(struct dm_dirty_log_type *type); | ||
119 | int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type); | ||
120 | |||
121 | /* | ||
122 | * Make sure you use these two functions, rather than calling | ||
123 | * type->constructor/destructor() directly. | ||
124 | */ | ||
125 | struct dm_dirty_log *dm_dirty_log_create(const char *type_name, | ||
126 | struct dm_target *ti, | ||
127 | unsigned argc, char **argv); | ||
128 | void dm_dirty_log_destroy(struct dm_dirty_log *log); | ||
129 | |||
130 | #endif /* __KERNEL__ */ | ||
131 | #endif /* _LINUX_DM_DIRTY_LOG_H */ | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 5beeced4e522..6692e5a84bb1 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -7,9 +7,6 @@ | |||
7 | #include "dm.h" | 7 | #include "dm.h" |
8 | #include "dm-bio-list.h" | 8 | #include "dm-bio-list.h" |
9 | #include "dm-bio-record.h" | 9 | #include "dm-bio-record.h" |
10 | #include "dm-io.h" | ||
11 | #include "dm-log.h" | ||
12 | #include "kcopyd.h" | ||
13 | 10 | ||
14 | #include <linux/ctype.h> | 11 | #include <linux/ctype.h> |
15 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -22,6 +19,9 @@ | |||
22 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
23 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
24 | #include <linux/hardirq.h> | 21 | #include <linux/hardirq.h> |
22 | #include <linux/dm-io.h> | ||
23 | #include <linux/dm-dirty-log.h> | ||
24 | #include <linux/dm-kcopyd.h> | ||
25 | 25 | ||
26 | #define DM_MSG_PREFIX "raid1" | 26 | #define DM_MSG_PREFIX "raid1" |
27 | #define DM_IO_PAGES 64 | 27 | #define DM_IO_PAGES 64 |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index e1dcca99392e..1ba8a47d61b1 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -18,10 +18,10 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/dm-kcopyd.h> | ||
21 | 22 | ||
22 | #include "dm-snap.h" | 23 | #include "dm-snap.h" |
23 | #include "dm-bio-list.h" | 24 | #include "dm-bio-list.h" |
24 | #include "kcopyd.h" | ||
25 | 25 | ||
26 | #define DM_MSG_PREFIX "snapshots" | 26 | #define DM_MSG_PREFIX "snapshots" |
27 | 27 | ||