diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 13:02:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 13:02:45 -0400 |
commit | d9b9be024a6628a01d8730d1fd0b5f25658a2794 (patch) | |
tree | 9f8e606f975f6dff4213747e85fedaccd148eb60 /drivers/md/dm-exception-store.h | |
parent | 9b59f0316bc556a1b63518f0b1224cf9be48467b (diff) | |
parent | 99360b4c18f7675b50d283301d46d755affe75fd (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm: (36 commits)
dm: set queue ordered mode
dm: move wait queue declaration
dm: merge pushback and deferred bio lists
dm: allow uninterruptible wait for pending io
dm: merge __flush_deferred_io into caller
dm: move bio_io_error into __split_and_process_bio
dm: rename __split_bio
dm: remove unnecessary struct dm_wq_req
dm: remove unnecessary work queue context field
dm: remove unnecessary work queue type field
dm: bio list add bio_list_add_head
dm snapshot: persistent fix dtr cleanup
dm snapshot: move status to exception store
dm snapshot: move ctr parsing to exception store
dm snapshot: use DMEMIT macro for status
dm snapshot: remove dm_snap header
dm snapshot: remove dm_snap header use
dm exception store: move cow pointer
dm exception store: move chunk_fields
dm exception store: move dm_target pointer
...
Diffstat (limited to 'drivers/md/dm-exception-store.h')
-rw-r--r-- | drivers/md/dm-exception-store.h | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h index bb9f33d5daa2..0a2e6e7f67b3 100644 --- a/drivers/md/dm-exception-store.h +++ b/drivers/md/dm-exception-store.h | |||
@@ -37,11 +37,18 @@ struct dm_snap_exception { | |||
37 | * Abstraction to handle the meta/layout of exception stores (the | 37 | * Abstraction to handle the meta/layout of exception stores (the |
38 | * COW device). | 38 | * COW device). |
39 | */ | 39 | */ |
40 | struct dm_exception_store { | 40 | struct dm_exception_store; |
41 | struct dm_exception_store_type { | ||
42 | const char *name; | ||
43 | struct module *module; | ||
44 | |||
45 | int (*ctr) (struct dm_exception_store *store, | ||
46 | unsigned argc, char **argv); | ||
47 | |||
41 | /* | 48 | /* |
42 | * Destroys this object when you've finished with it. | 49 | * Destroys this object when you've finished with it. |
43 | */ | 50 | */ |
44 | void (*destroy) (struct dm_exception_store *store); | 51 | void (*dtr) (struct dm_exception_store *store); |
45 | 52 | ||
46 | /* | 53 | /* |
47 | * The target shouldn't read the COW device until this is | 54 | * The target shouldn't read the COW device until this is |
@@ -72,8 +79,9 @@ struct dm_exception_store { | |||
72 | */ | 79 | */ |
73 | void (*drop_snapshot) (struct dm_exception_store *store); | 80 | void (*drop_snapshot) (struct dm_exception_store *store); |
74 | 81 | ||
75 | int (*status) (struct dm_exception_store *store, status_type_t status, | 82 | unsigned (*status) (struct dm_exception_store *store, |
76 | char *result, unsigned int maxlen); | 83 | status_type_t status, char *result, |
84 | unsigned maxlen); | ||
77 | 85 | ||
78 | /* | 86 | /* |
79 | * Return how full the snapshot is. | 87 | * Return how full the snapshot is. |
@@ -82,7 +90,21 @@ struct dm_exception_store { | |||
82 | sector_t *numerator, | 90 | sector_t *numerator, |
83 | sector_t *denominator); | 91 | sector_t *denominator); |
84 | 92 | ||
85 | struct dm_snapshot *snap; | 93 | /* For internal device-mapper use only. */ |
94 | struct list_head list; | ||
95 | }; | ||
96 | |||
97 | struct dm_exception_store { | ||
98 | struct dm_exception_store_type *type; | ||
99 | struct dm_target *ti; | ||
100 | |||
101 | struct dm_dev *cow; | ||
102 | |||
103 | /* Size of data blocks saved - must be a power of 2 */ | ||
104 | chunk_t chunk_size; | ||
105 | chunk_t chunk_mask; | ||
106 | chunk_t chunk_shift; | ||
107 | |||
86 | void *context; | 108 | void *context; |
87 | }; | 109 | }; |
88 | 110 | ||
@@ -129,6 +151,28 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e) | |||
129 | 151 | ||
130 | # endif | 152 | # endif |
131 | 153 | ||
154 | /* | ||
155 | * Return the number of sectors in the device. | ||
156 | */ | ||
157 | static inline sector_t get_dev_size(struct block_device *bdev) | ||
158 | { | ||
159 | return bdev->bd_inode->i_size >> SECTOR_SHIFT; | ||
160 | } | ||
161 | |||
162 | static inline chunk_t sector_to_chunk(struct dm_exception_store *store, | ||
163 | sector_t sector) | ||
164 | { | ||
165 | return (sector & ~store->chunk_mask) >> store->chunk_shift; | ||
166 | } | ||
167 | |||
168 | int dm_exception_store_type_register(struct dm_exception_store_type *type); | ||
169 | int dm_exception_store_type_unregister(struct dm_exception_store_type *type); | ||
170 | |||
171 | int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, | ||
172 | unsigned *args_used, | ||
173 | struct dm_exception_store **store); | ||
174 | void dm_exception_store_destroy(struct dm_exception_store *store); | ||
175 | |||
132 | int dm_exception_store_init(void); | 176 | int dm_exception_store_init(void); |
133 | void dm_exception_store_exit(void); | 177 | void dm_exception_store_exit(void); |
134 | 178 | ||
@@ -141,8 +185,4 @@ void dm_persistent_snapshot_exit(void); | |||
141 | int dm_transient_snapshot_init(void); | 185 | int dm_transient_snapshot_init(void); |
142 | void dm_transient_snapshot_exit(void); | 186 | void dm_transient_snapshot_exit(void); |
143 | 187 | ||
144 | int dm_create_persistent(struct dm_exception_store *store); | ||
145 | |||
146 | int dm_create_transient(struct dm_exception_store *store); | ||
147 | |||
148 | #endif /* _LINUX_DM_EXCEPTION_STORE */ | 188 | #endif /* _LINUX_DM_EXCEPTION_STORE */ |