diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:38:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:38:19 -0400 |
| commit | 3d30701b58970425e1d45994d6cb82f828924fdd (patch) | |
| tree | 8b14cf462628bebf8548c1b8c205a674564052d1 /drivers/md/bitmap.c | |
| parent | 8cbd84f2dd4e52a8771b191030c374ba3e56d291 (diff) | |
| parent | fd8aa2c1811bf60ccb2d5de0579c6f62aec1772d (diff) | |
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: (24 commits)
md: clean up do_md_stop
md: fix another deadlock with removing sysfs attributes.
md: move revalidate_disk() back outside open_mutex
md/raid10: fix deadlock with unaligned read during resync
md/bitmap: separate out loading a bitmap from initialising the structures.
md/bitmap: prepare for storing write-intent-bitmap via dm-dirty-log.
md/bitmap: optimise scanning of empty bitmaps.
md/bitmap: clean up plugging calls.
md/bitmap: reduce dependence on sysfs.
md/bitmap: white space clean up and similar.
md/raid5: export raid5 unplugging interface.
md/plug: optionally use plugger to unplug an array during resync/recovery.
md/raid5: add simple plugging infrastructure.
md/raid5: export is_congested test
raid5: Don't set read-ahead when there is no queue
md: add support for raising dm events.
md: export various start/stop interfaces
md: split out md_rdev_init
md: be more careful setting MD_CHANGE_CLEAN
md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk
...
Diffstat (limited to 'drivers/md/bitmap.c')
| -rw-r--r-- | drivers/md/bitmap.c | 508 |
1 files changed, 279 insertions, 229 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 1742435ce3ae..1ba1e122e948 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | * Still to do: | 13 | * Still to do: |
| 14 | * | 14 | * |
| 15 | * flush after percent set rather than just time based. (maybe both). | 15 | * flush after percent set rather than just time based. (maybe both). |
| 16 | * wait if count gets too high, wake when it drops to half. | ||
| 17 | */ | 16 | */ |
| 18 | 17 | ||
| 19 | #include <linux/blkdev.h> | 18 | #include <linux/blkdev.h> |
| @@ -30,6 +29,7 @@ | |||
| 30 | #include "md.h" | 29 | #include "md.h" |
| 31 | #include "bitmap.h" | 30 | #include "bitmap.h" |
| 32 | 31 | ||
| 32 | #include <linux/dm-dirty-log.h> | ||
| 33 | /* debug macros */ | 33 | /* debug macros */ |
| 34 | 34 | ||
| 35 | #define DEBUG 0 | 35 | #define DEBUG 0 |
| @@ -51,9 +51,6 @@ | |||
| 51 | #define INJECT_FATAL_FAULT_3 0 /* undef */ | 51 | #define INJECT_FATAL_FAULT_3 0 /* undef */ |
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | //#define DPRINTK PRINTK /* set this NULL to avoid verbose debug output */ | ||
| 55 | #define DPRINTK(x...) do { } while(0) | ||
| 56 | |||
| 57 | #ifndef PRINTK | 54 | #ifndef PRINTK |
| 58 | # if DEBUG > 0 | 55 | # if DEBUG > 0 |
| 59 | # define PRINTK(x...) printk(KERN_DEBUG x) | 56 | # define PRINTK(x...) printk(KERN_DEBUG x) |
| @@ -62,12 +59,11 @@ | |||
| 62 | # endif | 59 | # endif |
| 63 | #endif | 60 | #endif |
| 64 | 61 | ||
| 65 | static inline char * bmname(struct bitmap *bitmap) | 62 | static inline char *bmname(struct bitmap *bitmap) |
| 66 | { | 63 | { |
| 67 | return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; | 64 | return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; |
| 68 | } | 65 | } |
| 69 | 66 | ||
| 70 | |||
| 71 | /* | 67 | /* |
| 72 | * just a placeholder - calls kmalloc for bitmap pages | 68 | * just a placeholder - calls kmalloc for bitmap pages |
| 73 | */ | 69 | */ |
| @@ -78,7 +74,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) | |||
| 78 | #ifdef INJECT_FAULTS_1 | 74 | #ifdef INJECT_FAULTS_1 |
| 79 | page = NULL; | 75 | page = NULL; |
| 80 | #else | 76 | #else |
| 81 | page = kmalloc(PAGE_SIZE, GFP_NOIO); | 77 | page = kzalloc(PAGE_SIZE, GFP_NOIO); |
| 82 | #endif | 78 | #endif |
| 83 | if (!page) | 79 | if (!page) |
| 84 | printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); | 80 | printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); |
| @@ -107,7 +103,8 @@ static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page) | |||
| 107 | * if we find our page, we increment the page's refcount so that it stays | 103 | * if we find our page, we increment the page's refcount so that it stays |
| 108 | * allocated while we're using it | 104 | * allocated while we're using it |
| 109 | */ | 105 | */ |
| 110 | static int bitmap_checkpage(struct bitmap *bitmap, unsigned long page, int create) | 106 | static int bitmap_checkpage(struct bitmap *bitmap, |
| 107 | unsigned long page, int create) | ||
| 111 | __releases(bitmap->lock) | 108 | __releases(bitmap->lock) |
| 112 | __acquires(bitmap->lock) | 109 | __acquires(bitmap->lock) |
| 113 | { | 110 | { |
| @@ -121,7 +118,6 @@ __acquires(bitmap->lock) | |||
| 121 | return -EINVAL; | 118 | return -EINVAL; |
| 122 | } | 119 | } |
| 123 | 120 | ||
| 124 | |||
| 125 | if (bitmap->bp[page].hijacked) /* it's hijacked, don't try to alloc */ | 121 | if (bitmap->bp[page].hijacked) /* it's hijacked, don't try to alloc */ |
| 126 | return 0; | 122 | return 0; |
| 127 | 123 | ||
| @@ -131,43 +127,34 @@ __acquires(bitmap->lock) | |||
| 131 | if (!create) | 127 | if (!create) |
| 132 | return -ENOENT; | 128 | return -ENOENT; |
| 133 | 129 | ||
| 134 | spin_unlock_irq(&bitmap->lock); | ||
| 135 | |||
| 136 | /* this page has not been allocated yet */ | 130 | /* this page has not been allocated yet */ |
| 137 | 131 | ||
| 138 | if ((mappage = bitmap_alloc_page(bitmap)) == NULL) { | 132 | spin_unlock_irq(&bitmap->lock); |
| 133 | mappage = bitmap_alloc_page(bitmap); | ||
| 134 | spin_lock_irq(&bitmap->lock); | ||
| 135 | |||
| 136 | if (mappage == NULL) { | ||
| 139 | PRINTK("%s: bitmap map page allocation failed, hijacking\n", | 137 | PRINTK("%s: bitmap map page allocation failed, hijacking\n", |
| 140 | bmname(bitmap)); | 138 | bmname(bitmap)); |
| 141 | /* failed - set the hijacked flag so that we can use the | 139 | /* failed - set the hijacked flag so that we can use the |
| 142 | * pointer as a counter */ | 140 | * pointer as a counter */ |
| 143 | spin_lock_irq(&bitmap->lock); | ||
| 144 | if (!bitmap->bp[page].map) | 141 | if (!bitmap->bp[page].map) |
| 145 | bitmap->bp[page].hijacked = 1; | 142 | bitmap->bp[page].hijacked = 1; |
| 146 | goto out; | 143 | } else if (bitmap->bp[page].map || |
| 147 | } | 144 | bitmap->bp[page].hijacked) { |
| 148 | |||
| 149 | /* got a page */ | ||
| 150 | |||
| 151 | spin_lock_irq(&bitmap->lock); | ||
| 152 | |||
| 153 | /* recheck the page */ | ||
| 154 | |||
| 155 | if (bitmap->bp[page].map || bitmap->bp[page].hijacked) { | ||
| 156 | /* somebody beat us to getting the page */ | 145 | /* somebody beat us to getting the page */ |
| 157 | bitmap_free_page(bitmap, mappage); | 146 | bitmap_free_page(bitmap, mappage); |
| 158 | return 0; | 147 | return 0; |
| 159 | } | 148 | } else { |
| 160 | 149 | ||
| 161 | /* no page was in place and we have one, so install it */ | 150 | /* no page was in place and we have one, so install it */ |
| 162 | 151 | ||
| 163 | memset(mappage, 0, PAGE_SIZE); | 152 | bitmap->bp[page].map = mappage; |
| 164 | bitmap->bp[page].map = mappage; | 153 | bitmap->missing_pages--; |
| 165 | bitmap->missing_pages--; | 154 | } |
| 166 | out: | ||
| 167 | return 0; | 155 | return 0; |
| 168 | } | 156 | } |
| 169 | 157 | ||
| 170 | |||
| 171 | /* if page is completely empty, put it back on the free list, or dealloc it */ | 158 | /* if page is completely empty, put it back on the free list, or dealloc it */ |
| 172 | /* if page was hijacked, unmark the flag so it might get alloced next time */ | 159 | /* if page was hijacked, unmark the flag so it might get alloced next time */ |
| 173 | /* Note: lock should be held when calling this */ | 160 | /* Note: lock should be held when calling this */ |
| @@ -183,26 +170,15 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) | |||
| 183 | if (bitmap->bp[page].hijacked) { /* page was hijacked, undo this now */ | 170 | if (bitmap->bp[page].hijacked) { /* page was hijacked, undo this now */ |
| 184 | bitmap->bp[page].hijacked = 0; | 171 | bitmap->bp[page].hijacked = 0; |
| 185 | bitmap->bp[page].map = NULL; | 172 | bitmap->bp[page].map = NULL; |
| 186 | return; | 173 | } else { |
| 174 | /* normal case, free the page */ | ||
| 175 | ptr = bitmap->bp[page].map; | ||
| 176 | bitmap->bp[page].map = NULL; | ||
| 177 | bitmap->missing_pages++; | ||
| 178 | bitmap_free_page(bitmap, ptr); | ||
| 187 | } | 179 | } |
| 188 | |||
| 189 | /* normal case, free the page */ | ||
| 190 | |||
| 191 | #if 0 | ||
| 192 | /* actually ... let's not. We will probably need the page again exactly when | ||
| 193 | * memory is tight and we are flusing to disk | ||
| 194 | */ | ||
| 195 | return; | ||
| 196 | #else | ||
| 197 | ptr = bitmap->bp[page].map; | ||
| 198 | bitmap->bp[page].map = NULL; | ||
| 199 | bitmap->missing_pages++; | ||
| 200 | bitmap_free_page(bitmap, ptr); | ||
| 201 | return; | ||
| 202 | #endif | ||
| 203 | } | 180 | } |
| 204 | 181 | ||
| 205 | |||
| 206 | /* | 182 | /* |
| 207 | * bitmap file handling - read and write the bitmap file and its superblock | 183 | * bitmap file handling - read and write the bitmap file and its superblock |
| 208 | */ | 184 | */ |
| @@ -220,11 +196,14 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, | |||
| 220 | 196 | ||
| 221 | mdk_rdev_t *rdev; | 197 | mdk_rdev_t *rdev; |
| 222 | sector_t target; | 198 | sector_t target; |
| 199 | int did_alloc = 0; | ||
| 223 | 200 | ||
| 224 | if (!page) | 201 | if (!page) { |
| 225 | page = alloc_page(GFP_KERNEL); | 202 | page = alloc_page(GFP_KERNEL); |
| 226 | if (!page) | 203 | if (!page) |
| 227 | return ERR_PTR(-ENOMEM); | 204 | return ERR_PTR(-ENOMEM); |
| 205 | did_alloc = 1; | ||
| 206 | } | ||
| 228 | 207 | ||
| 229 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 208 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
| 230 | if (! test_bit(In_sync, &rdev->flags) | 209 | if (! test_bit(In_sync, &rdev->flags) |
| @@ -242,6 +221,8 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, | |||
| 242 | return page; | 221 | return page; |
| 243 | } | 222 | } |
| 244 | } | 223 | } |
| 224 | if (did_alloc) | ||
| 225 | put_page(page); | ||
| 245 | return ERR_PTR(-EIO); | 226 | return ERR_PTR(-EIO); |
| 246 | 227 | ||
| 247 | } | 228 | } |
| @@ -286,49 +267,51 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) | |||
| 286 | mddev_t *mddev = bitmap->mddev; | 267 | mddev_t *mddev = bitmap->mddev; |
| 287 | 268 | ||
| 288 | while ((rdev = next_active_rdev(rdev, mddev)) != NULL) { | 269 | while ((rdev = next_active_rdev(rdev, mddev)) != NULL) { |
| 289 | int size = PAGE_SIZE; | 270 | int size = PAGE_SIZE; |
| 290 | loff_t offset = mddev->bitmap_info.offset; | 271 | loff_t offset = mddev->bitmap_info.offset; |
| 291 | if (page->index == bitmap->file_pages-1) | 272 | if (page->index == bitmap->file_pages-1) |
| 292 | size = roundup(bitmap->last_page_size, | 273 | size = roundup(bitmap->last_page_size, |
| 293 | bdev_logical_block_size(rdev->bdev)); | 274 | bdev_logical_block_size(rdev->bdev)); |
| 294 | /* Just make sure we aren't corrupting data or | 275 | /* Just make sure we aren't corrupting data or |
| 295 | * metadata | 276 | * metadata |
| 296 | */ | 277 | */ |
| 297 | if (mddev->external) { | 278 | if (mddev->external) { |
| 298 | /* Bitmap could be anywhere. */ | 279 | /* Bitmap could be anywhere. */ |
| 299 | if (rdev->sb_start + offset + (page->index *(PAGE_SIZE/512)) > | 280 | if (rdev->sb_start + offset + (page->index |
| 300 | rdev->data_offset && | 281 | * (PAGE_SIZE/512)) |
| 301 | rdev->sb_start + offset < | 282 | > rdev->data_offset |
| 302 | rdev->data_offset + mddev->dev_sectors + | 283 | && |
| 303 | (PAGE_SIZE/512)) | 284 | rdev->sb_start + offset |
| 304 | goto bad_alignment; | 285 | < (rdev->data_offset + mddev->dev_sectors |
| 305 | } else if (offset < 0) { | 286 | + (PAGE_SIZE/512))) |
| 306 | /* DATA BITMAP METADATA */ | 287 | goto bad_alignment; |
| 307 | if (offset | 288 | } else if (offset < 0) { |
| 308 | + (long)(page->index * (PAGE_SIZE/512)) | 289 | /* DATA BITMAP METADATA */ |
| 309 | + size/512 > 0) | 290 | if (offset |
| 310 | /* bitmap runs in to metadata */ | 291 | + (long)(page->index * (PAGE_SIZE/512)) |
| 311 | goto bad_alignment; | 292 | + size/512 > 0) |
| 312 | if (rdev->data_offset + mddev->dev_sectors | 293 | /* bitmap runs in to metadata */ |
| 313 | > rdev->sb_start + offset) | 294 | goto bad_alignment; |
| 314 | /* data runs in to bitmap */ | 295 | if (rdev->data_offset + mddev->dev_sectors |
| 315 | goto bad_alignment; | 296 | > rdev->sb_start + offset) |
| 316 | } else if (rdev->sb_start < rdev->data_offset) { | 297 | /* data runs in to bitmap */ |
| 317 | /* METADATA BITMAP DATA */ | 298 | goto bad_alignment; |
| 318 | if (rdev->sb_start | 299 | } else if (rdev->sb_start < rdev->data_offset) { |
| 319 | + offset | 300 | /* METADATA BITMAP DATA */ |
| 320 | + page->index*(PAGE_SIZE/512) + size/512 | 301 | if (rdev->sb_start |
| 321 | > rdev->data_offset) | 302 | + offset |
| 322 | /* bitmap runs in to data */ | 303 | + page->index*(PAGE_SIZE/512) + size/512 |
| 323 | goto bad_alignment; | 304 | > rdev->data_offset) |
| 324 | } else { | 305 | /* bitmap runs in to data */ |
| 325 | /* DATA METADATA BITMAP - no problems */ | 306 | goto bad_alignment; |
| 326 | } | 307 | } else { |
| 327 | md_super_write(mddev, rdev, | 308 | /* DATA METADATA BITMAP - no problems */ |
| 328 | rdev->sb_start + offset | 309 | } |
| 329 | + page->index * (PAGE_SIZE/512), | 310 | md_super_write(mddev, rdev, |
| 330 | size, | 311 | rdev->sb_start + offset |
| 331 | page); | 312 | + page->index * (PAGE_SIZE/512), |
| 313 | size, | ||
| 314 | page); | ||
| 332 | } | 315 | } |
| 333 | 316 | ||
| 334 | if (wait) | 317 | if (wait) |
| @@ -364,10 +347,9 @@ static void write_page(struct bitmap *bitmap, struct page *page, int wait) | |||
| 364 | bh = bh->b_this_page; | 347 | bh = bh->b_this_page; |
| 365 | } | 348 | } |
| 366 | 349 | ||
| 367 | if (wait) { | 350 | if (wait) |
| 368 | wait_event(bitmap->write_wait, | 351 | wait_event(bitmap->write_wait, |
| 369 | atomic_read(&bitmap->pending_writes)==0); | 352 | atomic_read(&bitmap->pending_writes)==0); |
| 370 | } | ||
| 371 | } | 353 | } |
| 372 | if (bitmap->flags & BITMAP_WRITE_ERROR) | 354 | if (bitmap->flags & BITMAP_WRITE_ERROR) |
| 373 | bitmap_file_kick(bitmap); | 355 | bitmap_file_kick(bitmap); |
| @@ -424,7 +406,7 @@ static struct page *read_page(struct file *file, unsigned long index, | |||
| 424 | struct buffer_head *bh; | 406 | struct buffer_head *bh; |
| 425 | sector_t block; | 407 | sector_t block; |
| 426 | 408 | ||
| 427 | PRINTK("read bitmap file (%dB @ %Lu)\n", (int)PAGE_SIZE, | 409 | PRINTK("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, |
| 428 | (unsigned long long)index << PAGE_SHIFT); | 410 | (unsigned long long)index << PAGE_SHIFT); |
| 429 | 411 | ||
| 430 | page = alloc_page(GFP_KERNEL); | 412 | page = alloc_page(GFP_KERNEL); |
| @@ -478,7 +460,7 @@ static struct page *read_page(struct file *file, unsigned long index, | |||
| 478 | } | 460 | } |
| 479 | out: | 461 | out: |
| 480 | if (IS_ERR(page)) | 462 | if (IS_ERR(page)) |
| 481 | printk(KERN_ALERT "md: bitmap read error: (%dB @ %Lu): %ld\n", | 463 | printk(KERN_ALERT "md: bitmap read error: (%dB @ %llu): %ld\n", |
| 482 | (int)PAGE_SIZE, | 464 | (int)PAGE_SIZE, |
| 483 | (unsigned long long)index << PAGE_SHIFT, | 465 | (unsigned long long)index << PAGE_SHIFT, |
| 484 | PTR_ERR(page)); | 466 | PTR_ERR(page)); |
| @@ -664,11 +646,14 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | |||
| 664 | sb = kmap_atomic(bitmap->sb_page, KM_USER0); | 646 | sb = kmap_atomic(bitmap->sb_page, KM_USER0); |
| 665 | old = le32_to_cpu(sb->state) & bits; | 647 | old = le32_to_cpu(sb->state) & bits; |
| 666 | switch (op) { | 648 | switch (op) { |
| 667 | case MASK_SET: sb->state |= cpu_to_le32(bits); | 649 | case MASK_SET: |
| 668 | break; | 650 | sb->state |= cpu_to_le32(bits); |
| 669 | case MASK_UNSET: sb->state &= cpu_to_le32(~bits); | 651 | break; |
| 670 | break; | 652 | case MASK_UNSET: |
| 671 | default: BUG(); | 653 | sb->state &= cpu_to_le32(~bits); |
| 654 | break; | ||
| 655 | default: | ||
| 656 | BUG(); | ||
| 672 | } | 657 | } |
| 673 | kunmap_atomic(sb, KM_USER0); | 658 | kunmap_atomic(sb, KM_USER0); |
| 674 | return old; | 659 | return old; |
| @@ -710,12 +695,14 @@ static inline unsigned long file_page_offset(struct bitmap *bitmap, unsigned lon | |||
| 710 | static inline struct page *filemap_get_page(struct bitmap *bitmap, | 695 | static inline struct page *filemap_get_page(struct bitmap *bitmap, |
| 711 | unsigned long chunk) | 696 | unsigned long chunk) |
| 712 | { | 697 | { |
| 713 | if (file_page_index(bitmap, chunk) >= bitmap->file_pages) return NULL; | 698 | if (bitmap->filemap == NULL) |
| 699 | return NULL; | ||
| 700 | if (file_page_index(bitmap, chunk) >= bitmap->file_pages) | ||
| 701 | return NULL; | ||
| 714 | return bitmap->filemap[file_page_index(bitmap, chunk) | 702 | return bitmap->filemap[file_page_index(bitmap, chunk) |
| 715 | - file_page_index(bitmap, 0)]; | 703 | - file_page_index(bitmap, 0)]; |
| 716 | } | 704 | } |
| 717 | 705 | ||
| 718 | |||
| 719 | static void bitmap_file_unmap(struct bitmap *bitmap) | 706 | static void bitmap_file_unmap(struct bitmap *bitmap) |
| 720 | { | 707 | { |
| 721 | struct page **map, *sb_page; | 708 | struct page **map, *sb_page; |
| @@ -766,7 +753,6 @@ static void bitmap_file_put(struct bitmap *bitmap) | |||
| 766 | } | 753 | } |
| 767 | } | 754 | } |
| 768 | 755 | ||
| 769 | |||
| 770 | /* | 756 | /* |
| 771 | * bitmap_file_kick - if an error occurs while manipulating the bitmap file | 757 | * bitmap_file_kick - if an error occurs while manipulating the bitmap file |
| 772 | * then it is no longer reliable, so we stop using it and we mark the file | 758 | * then it is no longer reliable, so we stop using it and we mark the file |
| @@ -785,7 +771,6 @@ static void bitmap_file_kick(struct bitmap *bitmap) | |||
| 785 | ptr = d_path(&bitmap->file->f_path, path, | 771 | ptr = d_path(&bitmap->file->f_path, path, |
| 786 | PAGE_SIZE); | 772 | PAGE_SIZE); |
| 787 | 773 | ||
| 788 | |||
| 789 | printk(KERN_ALERT | 774 | printk(KERN_ALERT |
| 790 | "%s: kicking failed bitmap file %s from array!\n", | 775 | "%s: kicking failed bitmap file %s from array!\n", |
| 791 | bmname(bitmap), IS_ERR(ptr) ? "" : ptr); | 776 | bmname(bitmap), IS_ERR(ptr) ? "" : ptr); |
| @@ -803,27 +788,36 @@ static void bitmap_file_kick(struct bitmap *bitmap) | |||
| 803 | } | 788 | } |
| 804 | 789 | ||
| 805 | enum bitmap_page_attr { | 790 | enum bitmap_page_attr { |
| 806 | BITMAP_PAGE_DIRTY = 0, // there are set bits that need to be synced | 791 | BITMAP_PAGE_DIRTY = 0, /* there are set bits that need to be synced */ |
| 807 | BITMAP_PAGE_CLEAN = 1, // there are bits that might need to be cleared | 792 | BITMAP_PAGE_CLEAN = 1, /* there are bits that might need to be cleared */ |
| 808 | BITMAP_PAGE_NEEDWRITE=2, // there are cleared bits that need to be synced | 793 | BITMAP_PAGE_NEEDWRITE = 2, /* there are cleared bits that need to be synced */ |
| 809 | }; | 794 | }; |
| 810 | 795 | ||
| 811 | static inline void set_page_attr(struct bitmap *bitmap, struct page *page, | 796 | static inline void set_page_attr(struct bitmap *bitmap, struct page *page, |
| 812 | enum bitmap_page_attr attr) | 797 | enum bitmap_page_attr attr) |
| 813 | { | 798 | { |
| 814 | __set_bit((page->index<<2) + attr, bitmap->filemap_attr); | 799 | if (page) |
| 800 | __set_bit((page->index<<2) + attr, bitmap->filemap_attr); | ||
| 801 | else | ||
| 802 | __set_bit(attr, &bitmap->logattrs); | ||
| 815 | } | 803 | } |
| 816 | 804 | ||
| 817 | static inline void clear_page_attr(struct bitmap *bitmap, struct page *page, | 805 | static inline void clear_page_attr(struct bitmap *bitmap, struct page *page, |
| 818 | enum bitmap_page_attr attr) | 806 | enum bitmap_page_attr attr) |
| 819 | { | 807 | { |
| 820 | __clear_bit((page->index<<2) + attr, bitmap->filemap_attr); | 808 | if (page) |
| 809 | __clear_bit((page->index<<2) + attr, bitmap->filemap_attr); | ||
| 810 | else | ||
| 811 | __clear_bit(attr, &bitmap->logattrs); | ||
| 821 | } | 812 | } |
| 822 | 813 | ||
| 823 | static inline unsigned long test_page_attr(struct bitmap *bitmap, struct page *page, | 814 | static inline unsigned long test_page_attr(struct bitmap *bitmap, struct page *page, |
| 824 | enum bitmap_page_attr attr) | 815 | enum bitmap_page_attr attr) |
| 825 | { | 816 | { |
| 826 | return test_bit((page->index<<2) + attr, bitmap->filemap_attr); | 817 | if (page) |
| 818 | return test_bit((page->index<<2) + attr, bitmap->filemap_attr); | ||
| 819 | else | ||
| 820 | return test_bit(attr, &bitmap->logattrs); | ||
| 827 | } | 821 | } |
| 828 | 822 | ||
| 829 | /* | 823 | /* |
| @@ -836,30 +830,32 @@ static inline unsigned long test_page_attr(struct bitmap *bitmap, struct page *p | |||
| 836 | static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) | 830 | static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) |
| 837 | { | 831 | { |
| 838 | unsigned long bit; | 832 | unsigned long bit; |
| 839 | struct page *page; | 833 | struct page *page = NULL; |
| 840 | void *kaddr; | 834 | void *kaddr; |
| 841 | unsigned long chunk = block >> CHUNK_BLOCK_SHIFT(bitmap); | 835 | unsigned long chunk = block >> CHUNK_BLOCK_SHIFT(bitmap); |
| 842 | 836 | ||
| 843 | if (!bitmap->filemap) { | 837 | if (!bitmap->filemap) { |
| 844 | return; | 838 | struct dm_dirty_log *log = bitmap->mddev->bitmap_info.log; |
| 845 | } | 839 | if (log) |
| 846 | 840 | log->type->mark_region(log, chunk); | |
| 847 | page = filemap_get_page(bitmap, chunk); | 841 | } else { |
| 848 | if (!page) return; | ||
| 849 | bit = file_page_offset(bitmap, chunk); | ||
| 850 | 842 | ||
| 851 | /* set the bit */ | 843 | page = filemap_get_page(bitmap, chunk); |
| 852 | kaddr = kmap_atomic(page, KM_USER0); | 844 | if (!page) |
| 853 | if (bitmap->flags & BITMAP_HOSTENDIAN) | 845 | return; |
| 854 | set_bit(bit, kaddr); | 846 | bit = file_page_offset(bitmap, chunk); |
| 855 | else | ||
| 856 | ext2_set_bit(bit, kaddr); | ||
| 857 | kunmap_atomic(kaddr, KM_USER0); | ||
| 858 | PRINTK("set file bit %lu page %lu\n", bit, page->index); | ||
| 859 | 847 | ||
| 848 | /* set the bit */ | ||
| 849 | kaddr = kmap_atomic(page, KM_USER0); | ||
| 850 | if (bitmap->flags & BITMAP_HOSTENDIAN) | ||
| 851 | set_bit(bit, kaddr); | ||
| 852 | else | ||
| 853 | ext2_set_bit(bit, kaddr); | ||
| 854 | kunmap_atomic(kaddr, KM_USER0); | ||
| 855 | PRINTK("set file bit %lu page %lu\n", bit, page->index); | ||
| 856 | } | ||
| 860 | /* record page number so it gets flushed to disk when unplug occurs */ | 857 | /* record page number so it gets flushed to disk when unplug occurs */ |
| 861 | set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); | 858 | set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); |
| 862 | |||
| 863 | } | 859 | } |
| 864 | 860 | ||
| 865 | /* this gets called when the md device is ready to unplug its underlying | 861 | /* this gets called when the md device is ready to unplug its underlying |
| @@ -874,6 +870,16 @@ void bitmap_unplug(struct bitmap *bitmap) | |||
| 874 | 870 | ||
| 875 | if (!bitmap) | 871 | if (!bitmap) |
| 876 | return; | 872 | return; |
| 873 | if (!bitmap->filemap) { | ||
| 874 | /* Must be using a dirty_log */ | ||
| 875 | struct dm_dirty_log *log = bitmap->mddev->bitmap_info.log; | ||
| 876 | dirty = test_and_clear_bit(BITMAP_PAGE_DIRTY, &bitmap->logattrs); | ||
| 877 | need_write = test_and_clear_bit(BITMAP_PAGE_NEEDWRITE, &bitmap->logattrs); | ||
| 878 | if (dirty || need_write) | ||
| 879 | if (log->type->flush(log)) | ||
| 880 | bitmap->flags |= BITMAP_WRITE_ERROR; | ||
| 881 | goto out; | ||
| 882 | } | ||
| 877 | 883 | ||
| 878 | /* look at each page to see if there are any set bits that need to be | 884 | /* look at each page to see if there are any set bits that need to be |
| 879 | * flushed out to disk */ | 885 | * flushed out to disk */ |
| @@ -892,7 +898,7 @@ void bitmap_unplug(struct bitmap *bitmap) | |||
| 892 | wait = 1; | 898 | wait = 1; |
| 893 | spin_unlock_irqrestore(&bitmap->lock, flags); | 899 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| 894 | 900 | ||
| 895 | if (dirty | need_write) | 901 | if (dirty || need_write) |
| 896 | write_page(bitmap, page, 0); | 902 | write_page(bitmap, page, 0); |
| 897 | } | 903 | } |
| 898 | if (wait) { /* if any writes were performed, we need to wait on them */ | 904 | if (wait) { /* if any writes were performed, we need to wait on them */ |
| @@ -902,9 +908,11 @@ void bitmap_unplug(struct bitmap *bitmap) | |||
| 902 | else | 908 | else |
| 903 | md_super_wait(bitmap->mddev); | 909 | md_super_wait(bitmap->mddev); |
| 904 | } | 910 | } |
| 911 | out: | ||
| 905 | if (bitmap->flags & BITMAP_WRITE_ERROR) | 912 | if (bitmap->flags & BITMAP_WRITE_ERROR) |
| 906 | bitmap_file_kick(bitmap); | 913 | bitmap_file_kick(bitmap); |
| 907 | } | 914 | } |
| 915 | EXPORT_SYMBOL(bitmap_unplug); | ||
| 908 | 916 | ||
| 909 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed); | 917 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed); |
| 910 | /* * bitmap_init_from_disk -- called at bitmap_create time to initialize | 918 | /* * bitmap_init_from_disk -- called at bitmap_create time to initialize |
| @@ -943,12 +951,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 943 | printk(KERN_INFO "%s: bitmap file is out of date, doing full " | 951 | printk(KERN_INFO "%s: bitmap file is out of date, doing full " |
| 944 | "recovery\n", bmname(bitmap)); | 952 | "recovery\n", bmname(bitmap)); |
| 945 | 953 | ||
| 946 | bytes = (chunks + 7) / 8; | 954 | bytes = DIV_ROUND_UP(bitmap->chunks, 8); |
| 947 | if (!bitmap->mddev->bitmap_info.external) | 955 | if (!bitmap->mddev->bitmap_info.external) |
| 948 | bytes += sizeof(bitmap_super_t); | 956 | bytes += sizeof(bitmap_super_t); |
| 949 | 957 | ||
| 950 | 958 | num_pages = DIV_ROUND_UP(bytes, PAGE_SIZE); | |
| 951 | num_pages = (bytes + PAGE_SIZE - 1) / PAGE_SIZE; | ||
| 952 | 959 | ||
| 953 | if (file && i_size_read(file->f_mapping->host) < bytes) { | 960 | if (file && i_size_read(file->f_mapping->host) < bytes) { |
| 954 | printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n", | 961 | printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n", |
| @@ -966,7 +973,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 966 | 973 | ||
| 967 | /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */ | 974 | /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */ |
| 968 | bitmap->filemap_attr = kzalloc( | 975 | bitmap->filemap_attr = kzalloc( |
| 969 | roundup( DIV_ROUND_UP(num_pages*4, 8), sizeof(unsigned long)), | 976 | roundup(DIV_ROUND_UP(num_pages*4, 8), sizeof(unsigned long)), |
| 970 | GFP_KERNEL); | 977 | GFP_KERNEL); |
| 971 | if (!bitmap->filemap_attr) | 978 | if (!bitmap->filemap_attr) |
| 972 | goto err; | 979 | goto err; |
| @@ -1021,7 +1028,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 1021 | if (outofdate) { | 1028 | if (outofdate) { |
| 1022 | /* | 1029 | /* |
| 1023 | * if bitmap is out of date, dirty the | 1030 | * if bitmap is out of date, dirty the |
| 1024 | * whole page and write it out | 1031 | * whole page and write it out |
| 1025 | */ | 1032 | */ |
| 1026 | paddr = kmap_atomic(page, KM_USER0); | 1033 | paddr = kmap_atomic(page, KM_USER0); |
| 1027 | memset(paddr + offset, 0xff, | 1034 | memset(paddr + offset, 0xff, |
| @@ -1052,7 +1059,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 1052 | } | 1059 | } |
| 1053 | } | 1060 | } |
| 1054 | 1061 | ||
| 1055 | /* everything went OK */ | 1062 | /* everything went OK */ |
| 1056 | ret = 0; | 1063 | ret = 0; |
| 1057 | bitmap_mask_state(bitmap, BITMAP_STALE, MASK_UNSET); | 1064 | bitmap_mask_state(bitmap, BITMAP_STALE, MASK_UNSET); |
| 1058 | 1065 | ||
| @@ -1080,21 +1087,16 @@ void bitmap_write_all(struct bitmap *bitmap) | |||
| 1080 | */ | 1087 | */ |
| 1081 | int i; | 1088 | int i; |
| 1082 | 1089 | ||
| 1083 | for (i=0; i < bitmap->file_pages; i++) | 1090 | for (i = 0; i < bitmap->file_pages; i++) |
| 1084 | set_page_attr(bitmap, bitmap->filemap[i], | 1091 | set_page_attr(bitmap, bitmap->filemap[i], |
| 1085 | BITMAP_PAGE_NEEDWRITE); | 1092 | BITMAP_PAGE_NEEDWRITE); |
| 1086 | } | 1093 | } |
| 1087 | 1094 | ||
| 1088 | |||
| 1089 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) | 1095 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) |
| 1090 | { | 1096 | { |
| 1091 | sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap); | 1097 | sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap); |
| 1092 | unsigned long page = chunk >> PAGE_COUNTER_SHIFT; | 1098 | unsigned long page = chunk >> PAGE_COUNTER_SHIFT; |
| 1093 | bitmap->bp[page].count += inc; | 1099 | bitmap->bp[page].count += inc; |
| 1094 | /* | ||
| 1095 | if (page == 0) printk("count page 0, offset %llu: %d gives %d\n", | ||
| 1096 | (unsigned long long)offset, inc, bitmap->bp[page].count); | ||
| 1097 | */ | ||
| 1098 | bitmap_checkfree(bitmap, page); | 1100 | bitmap_checkfree(bitmap, page); |
| 1099 | } | 1101 | } |
| 1100 | static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap, | 1102 | static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap, |
| @@ -1114,6 +1116,7 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1114 | struct page *page = NULL, *lastpage = NULL; | 1116 | struct page *page = NULL, *lastpage = NULL; |
| 1115 | int blocks; | 1117 | int blocks; |
| 1116 | void *paddr; | 1118 | void *paddr; |
| 1119 | struct dm_dirty_log *log = mddev->bitmap_info.log; | ||
| 1117 | 1120 | ||
| 1118 | /* Use a mutex to guard daemon_work against | 1121 | /* Use a mutex to guard daemon_work against |
| 1119 | * bitmap_destroy. | 1122 | * bitmap_destroy. |
| @@ -1138,11 +1141,12 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1138 | spin_lock_irqsave(&bitmap->lock, flags); | 1141 | spin_lock_irqsave(&bitmap->lock, flags); |
| 1139 | for (j = 0; j < bitmap->chunks; j++) { | 1142 | for (j = 0; j < bitmap->chunks; j++) { |
| 1140 | bitmap_counter_t *bmc; | 1143 | bitmap_counter_t *bmc; |
| 1141 | if (!bitmap->filemap) | 1144 | if (!bitmap->filemap) { |
| 1142 | /* error or shutdown */ | 1145 | if (!log) |
| 1143 | break; | 1146 | /* error or shutdown */ |
| 1144 | 1147 | break; | |
| 1145 | page = filemap_get_page(bitmap, j); | 1148 | } else |
| 1149 | page = filemap_get_page(bitmap, j); | ||
| 1146 | 1150 | ||
| 1147 | if (page != lastpage) { | 1151 | if (page != lastpage) { |
| 1148 | /* skip this page unless it's marked as needing cleaning */ | 1152 | /* skip this page unless it's marked as needing cleaning */ |
| @@ -1197,14 +1201,11 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1197 | (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap), | 1201 | (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap), |
| 1198 | &blocks, 0); | 1202 | &blocks, 0); |
| 1199 | if (bmc) { | 1203 | if (bmc) { |
| 1200 | /* | ||
| 1201 | if (j < 100) printk("bitmap: j=%lu, *bmc = 0x%x\n", j, *bmc); | ||
| 1202 | */ | ||
| 1203 | if (*bmc) | 1204 | if (*bmc) |
| 1204 | bitmap->allclean = 0; | 1205 | bitmap->allclean = 0; |
| 1205 | 1206 | ||
| 1206 | if (*bmc == 2) { | 1207 | if (*bmc == 2) { |
| 1207 | *bmc=1; /* maybe clear the bit next time */ | 1208 | *bmc = 1; /* maybe clear the bit next time */ |
| 1208 | set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); | 1209 | set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); |
| 1209 | } else if (*bmc == 1 && !bitmap->need_sync) { | 1210 | } else if (*bmc == 1 && !bitmap->need_sync) { |
| 1210 | /* we can clear the bit */ | 1211 | /* we can clear the bit */ |
| @@ -1214,14 +1215,17 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1214 | -1); | 1215 | -1); |
| 1215 | 1216 | ||
| 1216 | /* clear the bit */ | 1217 | /* clear the bit */ |
| 1217 | paddr = kmap_atomic(page, KM_USER0); | 1218 | if (page) { |
| 1218 | if (bitmap->flags & BITMAP_HOSTENDIAN) | 1219 | paddr = kmap_atomic(page, KM_USER0); |
| 1219 | clear_bit(file_page_offset(bitmap, j), | 1220 | if (bitmap->flags & BITMAP_HOSTENDIAN) |
| 1220 | paddr); | 1221 | clear_bit(file_page_offset(bitmap, j), |
| 1221 | else | 1222 | paddr); |
| 1222 | ext2_clear_bit(file_page_offset(bitmap, j), | 1223 | else |
| 1223 | paddr); | 1224 | ext2_clear_bit(file_page_offset(bitmap, j), |
| 1224 | kunmap_atomic(paddr, KM_USER0); | 1225 | paddr); |
| 1226 | kunmap_atomic(paddr, KM_USER0); | ||
| 1227 | } else | ||
| 1228 | log->type->clear_region(log, j); | ||
| 1225 | } | 1229 | } |
| 1226 | } else | 1230 | } else |
| 1227 | j |= PAGE_COUNTER_MASK; | 1231 | j |= PAGE_COUNTER_MASK; |
| @@ -1229,12 +1233,16 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1229 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1233 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| 1230 | 1234 | ||
| 1231 | /* now sync the final page */ | 1235 | /* now sync the final page */ |
| 1232 | if (lastpage != NULL) { | 1236 | if (lastpage != NULL || log != NULL) { |
| 1233 | spin_lock_irqsave(&bitmap->lock, flags); | 1237 | spin_lock_irqsave(&bitmap->lock, flags); |
| 1234 | if (test_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE)) { | 1238 | if (test_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE)) { |
| 1235 | clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); | 1239 | clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); |
| 1236 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1240 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| 1237 | write_page(bitmap, lastpage, 0); | 1241 | if (lastpage) |
| 1242 | write_page(bitmap, lastpage, 0); | ||
| 1243 | else | ||
| 1244 | if (log->type->flush(log)) | ||
| 1245 | bitmap->flags |= BITMAP_WRITE_ERROR; | ||
| 1238 | } else { | 1246 | } else { |
| 1239 | set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); | 1247 | set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); |
| 1240 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1248 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| @@ -1243,7 +1251,7 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
| 1243 | 1251 | ||
| 1244 | done: | 1252 | done: |
| 1245 | if (bitmap->allclean == 0) | 1253 | if (bitmap->allclean == 0) |
| 1246 | bitmap->mddev->thread->timeout = | 1254 | bitmap->mddev->thread->timeout = |
| 1247 | bitmap->mddev->bitmap_info.daemon_sleep; | 1255 | bitmap->mddev->bitmap_info.daemon_sleep; |
| 1248 | mutex_unlock(&mddev->bitmap_info.mutex); | 1256 | mutex_unlock(&mddev->bitmap_info.mutex); |
| 1249 | } | 1257 | } |
| @@ -1262,34 +1270,38 @@ __acquires(bitmap->lock) | |||
| 1262 | unsigned long page = chunk >> PAGE_COUNTER_SHIFT; | 1270 | unsigned long page = chunk >> PAGE_COUNTER_SHIFT; |
| 1263 | unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT; | 1271 | unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT; |
| 1264 | sector_t csize; | 1272 | sector_t csize; |
| 1273 | int err; | ||
| 1265 | 1274 | ||
| 1266 | if (bitmap_checkpage(bitmap, page, create) < 0) { | 1275 | err = bitmap_checkpage(bitmap, page, create); |
| 1276 | |||
| 1277 | if (bitmap->bp[page].hijacked || | ||
| 1278 | bitmap->bp[page].map == NULL) | ||
| 1279 | csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap) + | ||
| 1280 | PAGE_COUNTER_SHIFT - 1); | ||
| 1281 | else | ||
| 1267 | csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap)); | 1282 | csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap)); |
| 1268 | *blocks = csize - (offset & (csize- 1)); | 1283 | *blocks = csize - (offset & (csize - 1)); |
| 1284 | |||
| 1285 | if (err < 0) | ||
| 1269 | return NULL; | 1286 | return NULL; |
| 1270 | } | 1287 | |
| 1271 | /* now locked ... */ | 1288 | /* now locked ... */ |
| 1272 | 1289 | ||
| 1273 | if (bitmap->bp[page].hijacked) { /* hijacked pointer */ | 1290 | if (bitmap->bp[page].hijacked) { /* hijacked pointer */ |
| 1274 | /* should we use the first or second counter field | 1291 | /* should we use the first or second counter field |
| 1275 | * of the hijacked pointer? */ | 1292 | * of the hijacked pointer? */ |
| 1276 | int hi = (pageoff > PAGE_COUNTER_MASK); | 1293 | int hi = (pageoff > PAGE_COUNTER_MASK); |
| 1277 | csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap) + | ||
| 1278 | PAGE_COUNTER_SHIFT - 1); | ||
| 1279 | *blocks = csize - (offset & (csize- 1)); | ||
| 1280 | return &((bitmap_counter_t *) | 1294 | return &((bitmap_counter_t *) |
| 1281 | &bitmap->bp[page].map)[hi]; | 1295 | &bitmap->bp[page].map)[hi]; |
| 1282 | } else { /* page is allocated */ | 1296 | } else /* page is allocated */ |
| 1283 | csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap)); | ||
| 1284 | *blocks = csize - (offset & (csize- 1)); | ||
| 1285 | return (bitmap_counter_t *) | 1297 | return (bitmap_counter_t *) |
| 1286 | &(bitmap->bp[page].map[pageoff]); | 1298 | &(bitmap->bp[page].map[pageoff]); |
| 1287 | } | ||
| 1288 | } | 1299 | } |
| 1289 | 1300 | ||
| 1290 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, int behind) | 1301 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, int behind) |
| 1291 | { | 1302 | { |
| 1292 | if (!bitmap) return 0; | 1303 | if (!bitmap) |
| 1304 | return 0; | ||
| 1293 | 1305 | ||
| 1294 | if (behind) { | 1306 | if (behind) { |
| 1295 | int bw; | 1307 | int bw; |
| @@ -1322,17 +1334,16 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect | |||
| 1322 | prepare_to_wait(&bitmap->overflow_wait, &__wait, | 1334 | prepare_to_wait(&bitmap->overflow_wait, &__wait, |
| 1323 | TASK_UNINTERRUPTIBLE); | 1335 | TASK_UNINTERRUPTIBLE); |
| 1324 | spin_unlock_irq(&bitmap->lock); | 1336 | spin_unlock_irq(&bitmap->lock); |
| 1325 | blk_unplug(bitmap->mddev->queue); | 1337 | md_unplug(bitmap->mddev); |
| 1326 | schedule(); | 1338 | schedule(); |
| 1327 | finish_wait(&bitmap->overflow_wait, &__wait); | 1339 | finish_wait(&bitmap->overflow_wait, &__wait); |
| 1328 | continue; | 1340 | continue; |
| 1329 | } | 1341 | } |
| 1330 | 1342 | ||
| 1331 | switch(*bmc) { | 1343 | switch (*bmc) { |
| 1332 | case 0: | 1344 | case 0: |
| 1333 | bitmap_file_set_bit(bitmap, offset); | 1345 | bitmap_file_set_bit(bitmap, offset); |
| 1334 | bitmap_count_page(bitmap,offset, 1); | 1346 | bitmap_count_page(bitmap, offset, 1); |
| 1335 | blk_plug_device_unlocked(bitmap->mddev->queue); | ||
| 1336 | /* fall through */ | 1347 | /* fall through */ |
| 1337 | case 1: | 1348 | case 1: |
| 1338 | *bmc = 2; | 1349 | *bmc = 2; |
| @@ -1345,16 +1356,19 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect | |||
| 1345 | offset += blocks; | 1356 | offset += blocks; |
| 1346 | if (sectors > blocks) | 1357 | if (sectors > blocks) |
| 1347 | sectors -= blocks; | 1358 | sectors -= blocks; |
| 1348 | else sectors = 0; | 1359 | else |
| 1360 | sectors = 0; | ||
| 1349 | } | 1361 | } |
| 1350 | bitmap->allclean = 0; | 1362 | bitmap->allclean = 0; |
| 1351 | return 0; | 1363 | return 0; |
| 1352 | } | 1364 | } |
| 1365 | EXPORT_SYMBOL(bitmap_startwrite); | ||
| 1353 | 1366 | ||
| 1354 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | 1367 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, |
| 1355 | int success, int behind) | 1368 | int success, int behind) |
| 1356 | { | 1369 | { |
| 1357 | if (!bitmap) return; | 1370 | if (!bitmap) |
| 1371 | return; | ||
| 1358 | if (behind) { | 1372 | if (behind) { |
| 1359 | if (atomic_dec_and_test(&bitmap->behind_writes)) | 1373 | if (atomic_dec_and_test(&bitmap->behind_writes)) |
| 1360 | wake_up(&bitmap->behind_wait); | 1374 | wake_up(&bitmap->behind_wait); |
| @@ -1381,7 +1395,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
| 1381 | bitmap->events_cleared < bitmap->mddev->events) { | 1395 | bitmap->events_cleared < bitmap->mddev->events) { |
| 1382 | bitmap->events_cleared = bitmap->mddev->events; | 1396 | bitmap->events_cleared = bitmap->mddev->events; |
| 1383 | bitmap->need_sync = 1; | 1397 | bitmap->need_sync = 1; |
| 1384 | sysfs_notify_dirent(bitmap->sysfs_can_clear); | 1398 | sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); |
| 1385 | } | 1399 | } |
| 1386 | 1400 | ||
| 1387 | if (!success && ! (*bmc & NEEDED_MASK)) | 1401 | if (!success && ! (*bmc & NEEDED_MASK)) |
| @@ -1391,18 +1405,22 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
| 1391 | wake_up(&bitmap->overflow_wait); | 1405 | wake_up(&bitmap->overflow_wait); |
| 1392 | 1406 | ||
| 1393 | (*bmc)--; | 1407 | (*bmc)--; |
| 1394 | if (*bmc <= 2) { | 1408 | if (*bmc <= 2) |
| 1395 | set_page_attr(bitmap, | 1409 | set_page_attr(bitmap, |
| 1396 | filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), | 1410 | filemap_get_page( |
| 1411 | bitmap, | ||
| 1412 | offset >> CHUNK_BLOCK_SHIFT(bitmap)), | ||
| 1397 | BITMAP_PAGE_CLEAN); | 1413 | BITMAP_PAGE_CLEAN); |
| 1398 | } | 1414 | |
| 1399 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1415 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| 1400 | offset += blocks; | 1416 | offset += blocks; |
| 1401 | if (sectors > blocks) | 1417 | if (sectors > blocks) |
| 1402 | sectors -= blocks; | 1418 | sectors -= blocks; |
| 1403 | else sectors = 0; | 1419 | else |
| 1420 | sectors = 0; | ||
| 1404 | } | 1421 | } |
| 1405 | } | 1422 | } |
| 1423 | EXPORT_SYMBOL(bitmap_endwrite); | ||
| 1406 | 1424 | ||
| 1407 | static int __bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, | 1425 | static int __bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, |
| 1408 | int degraded) | 1426 | int degraded) |
| @@ -1455,14 +1473,14 @@ int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, | |||
| 1455 | } | 1473 | } |
| 1456 | return rv; | 1474 | return rv; |
| 1457 | } | 1475 | } |
| 1476 | EXPORT_SYMBOL(bitmap_start_sync); | ||
| 1458 | 1477 | ||
| 1459 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted) | 1478 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted) |
| 1460 | { | 1479 | { |
| 1461 | bitmap_counter_t *bmc; | 1480 | bitmap_counter_t *bmc; |
| 1462 | unsigned long flags; | 1481 | unsigned long flags; |
| 1463 | /* | 1482 | |
| 1464 | if (offset == 0) printk("bitmap_end_sync 0 (%d)\n", aborted); | 1483 | if (bitmap == NULL) { |
| 1465 | */ if (bitmap == NULL) { | ||
| 1466 | *blocks = 1024; | 1484 | *blocks = 1024; |
| 1467 | return; | 1485 | return; |
| 1468 | } | 1486 | } |
| @@ -1471,26 +1489,23 @@ void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int ab | |||
| 1471 | if (bmc == NULL) | 1489 | if (bmc == NULL) |
| 1472 | goto unlock; | 1490 | goto unlock; |
| 1473 | /* locked */ | 1491 | /* locked */ |
| 1474 | /* | ||
| 1475 | if (offset == 0) printk("bitmap_end sync found 0x%x, blocks %d\n", *bmc, *blocks); | ||
| 1476 | */ | ||
| 1477 | if (RESYNC(*bmc)) { | 1492 | if (RESYNC(*bmc)) { |
| 1478 | *bmc &= ~RESYNC_MASK; | 1493 | *bmc &= ~RESYNC_MASK; |
| 1479 | 1494 | ||
| 1480 | if (!NEEDED(*bmc) && aborted) | 1495 | if (!NEEDED(*bmc) && aborted) |
| 1481 | *bmc |= NEEDED_MASK; | 1496 | *bmc |= NEEDED_MASK; |
| 1482 | else { | 1497 | else { |
| 1483 | if (*bmc <= 2) { | 1498 | if (*bmc <= 2) |
| 1484 | set_page_attr(bitmap, | 1499 | set_page_attr(bitmap, |
| 1485 | filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), | 1500 | filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), |
| 1486 | BITMAP_PAGE_CLEAN); | 1501 | BITMAP_PAGE_CLEAN); |
| 1487 | } | ||
| 1488 | } | 1502 | } |
| 1489 | } | 1503 | } |
| 1490 | unlock: | 1504 | unlock: |
| 1491 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1505 | spin_unlock_irqrestore(&bitmap->lock, flags); |
| 1492 | bitmap->allclean = 0; | 1506 | bitmap->allclean = 0; |
| 1493 | } | 1507 | } |
| 1508 | EXPORT_SYMBOL(bitmap_end_sync); | ||
| 1494 | 1509 | ||
| 1495 | void bitmap_close_sync(struct bitmap *bitmap) | 1510 | void bitmap_close_sync(struct bitmap *bitmap) |
| 1496 | { | 1511 | { |
| @@ -1507,6 +1522,7 @@ void bitmap_close_sync(struct bitmap *bitmap) | |||
| 1507 | sector += blocks; | 1522 | sector += blocks; |
| 1508 | } | 1523 | } |
| 1509 | } | 1524 | } |
| 1525 | EXPORT_SYMBOL(bitmap_close_sync); | ||
| 1510 | 1526 | ||
| 1511 | void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | 1527 | void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) |
| 1512 | { | 1528 | { |
| @@ -1526,7 +1542,8 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | |||
| 1526 | atomic_read(&bitmap->mddev->recovery_active) == 0); | 1542 | atomic_read(&bitmap->mddev->recovery_active) == 0); |
| 1527 | 1543 | ||
| 1528 | bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync; | 1544 | bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync; |
| 1529 | set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); | 1545 | if (bitmap->mddev->persistent) |
| 1546 | set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); | ||
| 1530 | sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); | 1547 | sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); |
| 1531 | s = 0; | 1548 | s = 0; |
| 1532 | while (s < sector && s < bitmap->mddev->resync_max_sectors) { | 1549 | while (s < sector && s < bitmap->mddev->resync_max_sectors) { |
| @@ -1536,6 +1553,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | |||
| 1536 | bitmap->last_end_sync = jiffies; | 1553 | bitmap->last_end_sync = jiffies; |
| 1537 | sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed"); | 1554 | sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed"); |
| 1538 | } | 1555 | } |
| 1556 | EXPORT_SYMBOL(bitmap_cond_end_sync); | ||
| 1539 | 1557 | ||
| 1540 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) | 1558 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) |
| 1541 | { | 1559 | { |
| @@ -1552,9 +1570,9 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n | |||
| 1552 | spin_unlock_irq(&bitmap->lock); | 1570 | spin_unlock_irq(&bitmap->lock); |
| 1553 | return; | 1571 | return; |
| 1554 | } | 1572 | } |
| 1555 | if (! *bmc) { | 1573 | if (!*bmc) { |
| 1556 | struct page *page; | 1574 | struct page *page; |
| 1557 | *bmc = 1 | (needed?NEEDED_MASK:0); | 1575 | *bmc = 1 | (needed ? NEEDED_MASK : 0); |
| 1558 | bitmap_count_page(bitmap, offset, 1); | 1576 | bitmap_count_page(bitmap, offset, 1); |
| 1559 | page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); | 1577 | page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); |
| 1560 | set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); | 1578 | set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); |
| @@ -1663,15 +1681,17 @@ int bitmap_create(mddev_t *mddev) | |||
| 1663 | unsigned long pages; | 1681 | unsigned long pages; |
| 1664 | struct file *file = mddev->bitmap_info.file; | 1682 | struct file *file = mddev->bitmap_info.file; |
| 1665 | int err; | 1683 | int err; |
| 1666 | sector_t start; | 1684 | struct sysfs_dirent *bm = NULL; |
| 1667 | struct sysfs_dirent *bm; | ||
| 1668 | 1685 | ||
| 1669 | BUILD_BUG_ON(sizeof(bitmap_super_t) != 256); | 1686 | BUILD_BUG_ON(sizeof(bitmap_super_t) != 256); |
| 1670 | 1687 | ||
| 1671 | if (!file && !mddev->bitmap_info.offset) /* bitmap disabled, nothing to do */ | 1688 | if (!file |
| 1689 | && !mddev->bitmap_info.offset | ||
| 1690 | && !mddev->bitmap_info.log) /* bitmap disabled, nothing to do */ | ||
| 1672 | return 0; | 1691 | return 0; |
| 1673 | 1692 | ||
| 1674 | BUG_ON(file && mddev->bitmap_info.offset); | 1693 | BUG_ON(file && mddev->bitmap_info.offset); |
| 1694 | BUG_ON(mddev->bitmap_info.offset && mddev->bitmap_info.log); | ||
| 1675 | 1695 | ||
| 1676 | bitmap = kzalloc(sizeof(*bitmap), GFP_KERNEL); | 1696 | bitmap = kzalloc(sizeof(*bitmap), GFP_KERNEL); |
| 1677 | if (!bitmap) | 1697 | if (!bitmap) |
| @@ -1685,7 +1705,8 @@ int bitmap_create(mddev_t *mddev) | |||
| 1685 | 1705 | ||
| 1686 | bitmap->mddev = mddev; | 1706 | bitmap->mddev = mddev; |
| 1687 | 1707 | ||
| 1688 | bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); | 1708 | if (mddev->kobj.sd) |
| 1709 | bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); | ||
| 1689 | if (bm) { | 1710 | if (bm) { |
| 1690 | bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear"); | 1711 | bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear"); |
| 1691 | sysfs_put(bm); | 1712 | sysfs_put(bm); |
| @@ -1719,9 +1740,9 @@ int bitmap_create(mddev_t *mddev) | |||
| 1719 | bitmap->chunkshift = ffz(~mddev->bitmap_info.chunksize); | 1740 | bitmap->chunkshift = ffz(~mddev->bitmap_info.chunksize); |
| 1720 | 1741 | ||
| 1721 | /* now that chunksize and chunkshift are set, we can use these macros */ | 1742 | /* now that chunksize and chunkshift are set, we can use these macros */ |
| 1722 | chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >> | 1743 | chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >> |
| 1723 | CHUNK_BLOCK_SHIFT(bitmap); | 1744 | CHUNK_BLOCK_SHIFT(bitmap); |
| 1724 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; | 1745 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; |
| 1725 | 1746 | ||
| 1726 | BUG_ON(!pages); | 1747 | BUG_ON(!pages); |
| 1727 | 1748 | ||
| @@ -1741,27 +1762,11 @@ int bitmap_create(mddev_t *mddev) | |||
| 1741 | if (!bitmap->bp) | 1762 | if (!bitmap->bp) |
| 1742 | goto error; | 1763 | goto error; |
| 1743 | 1764 | ||
| 1744 | /* now that we have some pages available, initialize the in-memory | ||
| 1745 | * bitmap from the on-disk bitmap */ | ||
| 1746 | start = 0; | ||
| 1747 | if (mddev->degraded == 0 | ||
| 1748 | || bitmap->events_cleared == mddev->events) | ||
| 1749 | /* no need to keep dirty bits to optimise a re-add of a missing device */ | ||
| 1750 | start = mddev->recovery_cp; | ||
| 1751 | err = bitmap_init_from_disk(bitmap, start); | ||
| 1752 | |||
| 1753 | if (err) | ||
| 1754 | goto error; | ||
| 1755 | |||
| 1756 | printk(KERN_INFO "created bitmap (%lu pages) for device %s\n", | 1765 | printk(KERN_INFO "created bitmap (%lu pages) for device %s\n", |
| 1757 | pages, bmname(bitmap)); | 1766 | pages, bmname(bitmap)); |
| 1758 | 1767 | ||
| 1759 | mddev->bitmap = bitmap; | 1768 | mddev->bitmap = bitmap; |
| 1760 | 1769 | ||
| 1761 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep; | ||
| 1762 | md_wakeup_thread(mddev->thread); | ||
| 1763 | |||
| 1764 | bitmap_update_sb(bitmap); | ||
| 1765 | 1770 | ||
| 1766 | return (bitmap->flags & BITMAP_WRITE_ERROR) ? -EIO : 0; | 1771 | return (bitmap->flags & BITMAP_WRITE_ERROR) ? -EIO : 0; |
| 1767 | 1772 | ||
| @@ -1770,15 +1775,69 @@ int bitmap_create(mddev_t *mddev) | |||
| 1770 | return err; | 1775 | return err; |
| 1771 | } | 1776 | } |
| 1772 | 1777 | ||
| 1778 | int bitmap_load(mddev_t *mddev) | ||
| 1779 | { | ||
| 1780 | int err = 0; | ||
| 1781 | sector_t sector = 0; | ||
| 1782 | struct bitmap *bitmap = mddev->bitmap; | ||
| 1783 | |||
| 1784 | if (!bitmap) | ||
| 1785 | goto out; | ||
| 1786 | |||
| 1787 | /* Clear out old bitmap info first: Either there is none, or we | ||
| 1788 | * are resuming after someone else has possibly changed things, | ||
| 1789 | * so we should forget old cached info. | ||
| 1790 | * All chunks should be clean, but some might need_sync. | ||
| 1791 | */ | ||
| 1792 | while (sector < mddev->resync_max_sectors) { | ||
| 1793 | int blocks; | ||
| 1794 | bitmap_start_sync(bitmap, sector, &blocks, 0); | ||
| 1795 | sector += blocks; | ||
| 1796 | } | ||
| 1797 | bitmap_close_sync(bitmap); | ||
| 1798 | |||
| 1799 | if (mddev->bitmap_info.log) { | ||
| 1800 | unsigned long i; | ||
| 1801 | struct dm_dirty_log *log = mddev->bitmap_info.log; | ||
| 1802 | for (i = 0; i < bitmap->chunks; i++) | ||
| 1803 | if (!log->type->in_sync(log, i, 1)) | ||
| 1804 | bitmap_set_memory_bits(bitmap, | ||
| 1805 | (sector_t)i << CHUNK_BLOCK_SHIFT(bitmap), | ||
| 1806 | 1); | ||
| 1807 | } else { | ||
| 1808 | sector_t start = 0; | ||
| 1809 | if (mddev->degraded == 0 | ||
| 1810 | || bitmap->events_cleared == mddev->events) | ||
| 1811 | /* no need to keep dirty bits to optimise a | ||
| 1812 | * re-add of a missing device */ | ||
| 1813 | start = mddev->recovery_cp; | ||
| 1814 | |||
| 1815 | err = bitmap_init_from_disk(bitmap, start); | ||
| 1816 | } | ||
| 1817 | if (err) | ||
| 1818 | goto out; | ||
| 1819 | |||
| 1820 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep; | ||
| 1821 | md_wakeup_thread(mddev->thread); | ||
| 1822 | |||
| 1823 | bitmap_update_sb(bitmap); | ||
| 1824 | |||
| 1825 | if (bitmap->flags & BITMAP_WRITE_ERROR) | ||
| 1826 | err = -EIO; | ||
| 1827 | out: | ||
| 1828 | return err; | ||
| 1829 | } | ||
| 1830 | EXPORT_SYMBOL_GPL(bitmap_load); | ||
| 1831 | |||
| 1773 | static ssize_t | 1832 | static ssize_t |
| 1774 | location_show(mddev_t *mddev, char *page) | 1833 | location_show(mddev_t *mddev, char *page) |
| 1775 | { | 1834 | { |
| 1776 | ssize_t len; | 1835 | ssize_t len; |
| 1777 | if (mddev->bitmap_info.file) { | 1836 | if (mddev->bitmap_info.file) |
| 1778 | len = sprintf(page, "file"); | 1837 | len = sprintf(page, "file"); |
| 1779 | } else if (mddev->bitmap_info.offset) { | 1838 | else if (mddev->bitmap_info.offset) |
| 1780 | len = sprintf(page, "%+lld", (long long)mddev->bitmap_info.offset); | 1839 | len = sprintf(page, "%+lld", (long long)mddev->bitmap_info.offset); |
| 1781 | } else | 1840 | else |
| 1782 | len = sprintf(page, "none"); | 1841 | len = sprintf(page, "none"); |
| 1783 | len += sprintf(page+len, "\n"); | 1842 | len += sprintf(page+len, "\n"); |
| 1784 | return len; | 1843 | return len; |
| @@ -1867,7 +1926,7 @@ timeout_show(mddev_t *mddev, char *page) | |||
| 1867 | ssize_t len; | 1926 | ssize_t len; |
| 1868 | unsigned long secs = mddev->bitmap_info.daemon_sleep / HZ; | 1927 | unsigned long secs = mddev->bitmap_info.daemon_sleep / HZ; |
| 1869 | unsigned long jifs = mddev->bitmap_info.daemon_sleep % HZ; | 1928 | unsigned long jifs = mddev->bitmap_info.daemon_sleep % HZ; |
| 1870 | 1929 | ||
| 1871 | len = sprintf(page, "%lu", secs); | 1930 | len = sprintf(page, "%lu", secs); |
| 1872 | if (jifs) | 1931 | if (jifs) |
| 1873 | len += sprintf(page+len, ".%03u", jiffies_to_msecs(jifs)); | 1932 | len += sprintf(page+len, ".%03u", jiffies_to_msecs(jifs)); |
| @@ -2049,12 +2108,3 @@ struct attribute_group md_bitmap_group = { | |||
| 2049 | .attrs = md_bitmap_attrs, | 2108 | .attrs = md_bitmap_attrs, |
| 2050 | }; | 2109 | }; |
| 2051 | 2110 | ||
| 2052 | |||
| 2053 | /* the bitmap API -- for raid personalities */ | ||
| 2054 | EXPORT_SYMBOL(bitmap_startwrite); | ||
| 2055 | EXPORT_SYMBOL(bitmap_endwrite); | ||
| 2056 | EXPORT_SYMBOL(bitmap_start_sync); | ||
| 2057 | EXPORT_SYMBOL(bitmap_end_sync); | ||
| 2058 | EXPORT_SYMBOL(bitmap_unplug); | ||
| 2059 | EXPORT_SYMBOL(bitmap_close_sync); | ||
| 2060 | EXPORT_SYMBOL(bitmap_cond_end_sync); | ||
