diff options
Diffstat (limited to 'drivers/md/bitmap.h')
-rw-r--r-- | drivers/md/bitmap.h | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index b44b0aba2d47..df4aeb6ac6f0 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -111,9 +111,9 @@ typedef __u16 bitmap_counter_t; | |||
111 | 111 | ||
112 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ | 112 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ |
113 | enum bitmap_state { | 113 | enum bitmap_state { |
114 | BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ | 114 | BITMAP_STALE = 1, /* the bitmap file is out of date or had -EIO */ |
115 | BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */ | 115 | BITMAP_WRITE_ERROR = 2, /* A write error has occurred */ |
116 | BITMAP_HOSTENDIAN = 0x8000, | 116 | BITMAP_HOSTENDIAN =15, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | /* the superblock at the front of the bitmap file -- little endian */ | 119 | /* the superblock at the front of the bitmap file -- little endian */ |
@@ -128,8 +128,10 @@ typedef struct bitmap_super_s { | |||
128 | __le32 chunksize; /* 52 the bitmap chunk size in bytes */ | 128 | __le32 chunksize; /* 52 the bitmap chunk size in bytes */ |
129 | __le32 daemon_sleep; /* 56 seconds between disk flushes */ | 129 | __le32 daemon_sleep; /* 56 seconds between disk flushes */ |
130 | __le32 write_behind; /* 60 number of outstanding write-behind writes */ | 130 | __le32 write_behind; /* 60 number of outstanding write-behind writes */ |
131 | __le32 sectors_reserved; /* 64 number of 512-byte sectors that are | ||
132 | * reserved for the bitmap. */ | ||
131 | 133 | ||
132 | __u8 pad[256 - 64]; /* set to zero */ | 134 | __u8 pad[256 - 68]; /* set to zero */ |
133 | } bitmap_super_t; | 135 | } bitmap_super_t; |
134 | 136 | ||
135 | /* notes: | 137 | /* notes: |
@@ -160,35 +162,48 @@ struct bitmap_page { | |||
160 | */ | 162 | */ |
161 | unsigned int hijacked:1; | 163 | unsigned int hijacked:1; |
162 | /* | 164 | /* |
165 | * If any counter in this page is '1' or '2' - and so could be | ||
166 | * cleared then that page is marked as 'pending' | ||
167 | */ | ||
168 | unsigned int pending:1; | ||
169 | /* | ||
163 | * count of dirty bits on the page | 170 | * count of dirty bits on the page |
164 | */ | 171 | */ |
165 | unsigned int count:31; | 172 | unsigned int count:30; |
166 | }; | 173 | }; |
167 | 174 | ||
168 | /* the main bitmap structure - one per mddev */ | 175 | /* the main bitmap structure - one per mddev */ |
169 | struct bitmap { | 176 | struct bitmap { |
170 | struct bitmap_page *bp; | ||
171 | unsigned long pages; /* total number of pages in the bitmap */ | ||
172 | unsigned long missing_pages; /* number of pages not yet allocated */ | ||
173 | 177 | ||
174 | struct mddev *mddev; /* the md device that the bitmap is for */ | 178 | struct bitmap_counts { |
179 | spinlock_t lock; | ||
180 | struct bitmap_page *bp; | ||
181 | unsigned long pages; /* total number of pages | ||
182 | * in the bitmap */ | ||
183 | unsigned long missing_pages; /* number of pages | ||
184 | * not yet allocated */ | ||
185 | unsigned long chunkshift; /* chunksize = 2^chunkshift | ||
186 | * (for bitops) */ | ||
187 | unsigned long chunks; /* Total number of data | ||
188 | * chunks for the array */ | ||
189 | } counts; | ||
175 | 190 | ||
176 | /* bitmap chunksize -- how much data does each bit represent? */ | 191 | struct mddev *mddev; /* the md device that the bitmap is for */ |
177 | unsigned long chunkshift; /* chunksize = 2^(chunkshift+9) (for bitops) */ | ||
178 | unsigned long chunks; /* total number of data chunks for the array */ | ||
179 | 192 | ||
180 | __u64 events_cleared; | 193 | __u64 events_cleared; |
181 | int need_sync; | 194 | int need_sync; |
182 | 195 | ||
183 | /* bitmap spinlock */ | 196 | struct bitmap_storage { |
184 | spinlock_t lock; | 197 | struct file *file; /* backing disk file */ |
185 | 198 | struct page *sb_page; /* cached copy of the bitmap | |
186 | struct file *file; /* backing disk file */ | 199 | * file superblock */ |
187 | struct page *sb_page; /* cached copy of the bitmap file superblock */ | 200 | struct page **filemap; /* list of cache pages for |
188 | struct page **filemap; /* list of cache pages for the file */ | 201 | * the file */ |
189 | unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ | 202 | unsigned long *filemap_attr; /* attributes associated |
190 | unsigned long file_pages; /* number of pages in the file */ | 203 | * w/ filemap pages */ |
191 | int last_page_size; /* bytes in the last page */ | 204 | unsigned long file_pages; /* number of pages in the file*/ |
205 | unsigned long bytes; /* total bytes in the bitmap */ | ||
206 | } storage; | ||
192 | 207 | ||
193 | unsigned long flags; | 208 | unsigned long flags; |
194 | 209 | ||
@@ -242,6 +257,9 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector); | |||
242 | 257 | ||
243 | void bitmap_unplug(struct bitmap *bitmap); | 258 | void bitmap_unplug(struct bitmap *bitmap); |
244 | void bitmap_daemon_work(struct mddev *mddev); | 259 | void bitmap_daemon_work(struct mddev *mddev); |
260 | |||
261 | int bitmap_resize(struct bitmap *bitmap, sector_t blocks, | ||
262 | int chunksize, int init); | ||
245 | #endif | 263 | #endif |
246 | 264 | ||
247 | #endif | 265 | #endif |