aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2018-08-01 20:58:55 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-08-01 20:58:55 -0400
commit5d81a787bd4d896238c0c8d73d514290abd1d0d2 (patch)
tree4dc44d5247cc172b08e0e194aa395ee2282449cf
parent955c594ed1a729fc8b0af24d6cbd93eea1f3f46b (diff)
parentc42b65e363ce97a828f81b59033c3558f8fa7f70 (diff)
Merge branch 'ib/4.17-bitmap' into next
Bring in bitmap API improvements.
-rw-r--r--drivers/md/dm-raid.c6
-rw-r--r--drivers/md/md-bitmap.c305
-rw-r--r--drivers/md/md-bitmap.h60
-rw-r--r--drivers/md/md-cluster.c18
-rw-r--r--drivers/md/md.c44
-rw-r--r--drivers/md/persistent-data/dm-space-map-common.c20
-rw-r--r--drivers/md/raid1.c35
-rw-r--r--drivers/md/raid10.c52
-rw-r--r--drivers/md/raid5-cache.c8
-rw-r--r--drivers/md/raid5.c44
-rw-r--r--include/linux/bitmap.h8
-rw-r--r--lib/bitmap.c20
12 files changed, 316 insertions, 304 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 6f823f44b4aa..e0acbcefb2ba 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3859,7 +3859,7 @@ static int __load_dirty_region_bitmap(struct raid_set *rs)
3859 /* Try loading the bitmap unless "raid0", which does not have one */ 3859 /* Try loading the bitmap unless "raid0", which does not have one */
3860 if (!rs_is_raid0(rs) && 3860 if (!rs_is_raid0(rs) &&
3861 !test_and_set_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags)) { 3861 !test_and_set_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags)) {
3862 r = bitmap_load(&rs->md); 3862 r = md_bitmap_load(&rs->md);
3863 if (r) 3863 if (r)
3864 DMERR("Failed to load bitmap"); 3864 DMERR("Failed to load bitmap");
3865 } 3865 }
@@ -3987,8 +3987,8 @@ static int raid_preresume(struct dm_target *ti)
3987 /* Resize bitmap to adjust to changed region size (aka MD bitmap chunksize) */ 3987 /* Resize bitmap to adjust to changed region size (aka MD bitmap chunksize) */
3988 if (test_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags) && mddev->bitmap && 3988 if (test_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags) && mddev->bitmap &&
3989 mddev->bitmap_info.chunksize != to_bytes(rs->requested_bitmap_chunk_sectors)) { 3989 mddev->bitmap_info.chunksize != to_bytes(rs->requested_bitmap_chunk_sectors)) {
3990 r = bitmap_resize(mddev->bitmap, mddev->dev_sectors, 3990 r = md_bitmap_resize(mddev->bitmap, mddev->dev_sectors,
3991 to_bytes(rs->requested_bitmap_chunk_sectors), 0); 3991 to_bytes(rs->requested_bitmap_chunk_sectors), 0);
3992 if (r) 3992 if (r)
3993 DMERR("Failed to resize bitmap"); 3993 DMERR("Failed to resize bitmap");
3994 } 3994 }
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 239c7bb3929b..712a20c4608c 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -46,8 +46,8 @@ static inline char *bmname(struct bitmap *bitmap)
46 * if we find our page, we increment the page's refcount so that it stays 46 * if we find our page, we increment the page's refcount so that it stays
47 * allocated while we're using it 47 * allocated while we're using it
48 */ 48 */
49static int bitmap_checkpage(struct bitmap_counts *bitmap, 49static int md_bitmap_checkpage(struct bitmap_counts *bitmap,
50 unsigned long page, int create, int no_hijack) 50 unsigned long page, int create, int no_hijack)
51__releases(bitmap->lock) 51__releases(bitmap->lock)
52__acquires(bitmap->lock) 52__acquires(bitmap->lock)
53{ 53{
@@ -115,7 +115,7 @@ __acquires(bitmap->lock)
115/* if page is completely empty, put it back on the free list, or dealloc it */ 115/* if page is completely empty, put it back on the free list, or dealloc it */
116/* if page was hijacked, unmark the flag so it might get alloced next time */ 116/* if page was hijacked, unmark the flag so it might get alloced next time */
117/* Note: lock should be held when calling this */ 117/* Note: lock should be held when calling this */
118static void bitmap_checkfree(struct bitmap_counts *bitmap, unsigned long page) 118static void md_bitmap_checkfree(struct bitmap_counts *bitmap, unsigned long page)
119{ 119{
120 char *ptr; 120 char *ptr;
121 121
@@ -280,7 +280,7 @@ restart:
280 return -EINVAL; 280 return -EINVAL;
281} 281}
282 282
283static void bitmap_file_kick(struct bitmap *bitmap); 283static void md_bitmap_file_kick(struct bitmap *bitmap);
284/* 284/*
285 * write out a page to a file 285 * write out a page to a file
286 */ 286 */
@@ -310,7 +310,7 @@ static void write_page(struct bitmap *bitmap, struct page *page, int wait)
310 atomic_read(&bitmap->pending_writes)==0); 310 atomic_read(&bitmap->pending_writes)==0);
311 } 311 }
312 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) 312 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))
313 bitmap_file_kick(bitmap); 313 md_bitmap_file_kick(bitmap);
314} 314}
315 315
316static void end_bitmap_write(struct buffer_head *bh, int uptodate) 316static void end_bitmap_write(struct buffer_head *bh, int uptodate)
@@ -421,11 +421,11 @@ out:
421 */ 421 */
422 422
423/* 423/*
424 * bitmap_wait_writes() should be called before writing any bitmap 424 * md_bitmap_wait_writes() should be called before writing any bitmap
425 * blocks, to ensure previous writes, particularly from 425 * blocks, to ensure previous writes, particularly from
426 * bitmap_daemon_work(), have completed. 426 * md_bitmap_daemon_work(), have completed.
427 */ 427 */
428static void bitmap_wait_writes(struct bitmap *bitmap) 428static void md_bitmap_wait_writes(struct bitmap *bitmap)
429{ 429{
430 if (bitmap->storage.file) 430 if (bitmap->storage.file)
431 wait_event(bitmap->write_wait, 431 wait_event(bitmap->write_wait,
@@ -443,7 +443,7 @@ static void bitmap_wait_writes(struct bitmap *bitmap)
443 443
444 444
445/* update the event counter and sync the superblock to disk */ 445/* update the event counter and sync the superblock to disk */
446void bitmap_update_sb(struct bitmap *bitmap) 446void md_bitmap_update_sb(struct bitmap *bitmap)
447{ 447{
448 bitmap_super_t *sb; 448 bitmap_super_t *sb;
449 449
@@ -476,10 +476,10 @@ void bitmap_update_sb(struct bitmap *bitmap)
476 kunmap_atomic(sb); 476 kunmap_atomic(sb);
477 write_page(bitmap, bitmap->storage.sb_page, 1); 477 write_page(bitmap, bitmap->storage.sb_page, 1);
478} 478}
479EXPORT_SYMBOL(bitmap_update_sb); 479EXPORT_SYMBOL(md_bitmap_update_sb);
480 480
481/* print out the bitmap file superblock */ 481/* print out the bitmap file superblock */
482void bitmap_print_sb(struct bitmap *bitmap) 482void md_bitmap_print_sb(struct bitmap *bitmap)
483{ 483{
484 bitmap_super_t *sb; 484 bitmap_super_t *sb;
485 485
@@ -518,7 +518,7 @@ void bitmap_print_sb(struct bitmap *bitmap)
518 * 518 *
519 * Returns: 0 on success, -Exxx on error 519 * Returns: 0 on success, -Exxx on error
520 */ 520 */
521static int bitmap_new_disk_sb(struct bitmap *bitmap) 521static int md_bitmap_new_disk_sb(struct bitmap *bitmap)
522{ 522{
523 bitmap_super_t *sb; 523 bitmap_super_t *sb;
524 unsigned long chunksize, daemon_sleep, write_behind; 524 unsigned long chunksize, daemon_sleep, write_behind;
@@ -577,7 +577,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
577} 577}
578 578
579/* read the superblock from the bitmap file and initialize some bitmap fields */ 579/* read the superblock from the bitmap file and initialize some bitmap fields */
580static int bitmap_read_sb(struct bitmap *bitmap) 580static int md_bitmap_read_sb(struct bitmap *bitmap)
581{ 581{
582 char *reason = NULL; 582 char *reason = NULL;
583 bitmap_super_t *sb; 583 bitmap_super_t *sb;
@@ -727,7 +727,7 @@ out_no_sb:
727 bitmap->mddev->bitmap_info.space > sectors_reserved) 727 bitmap->mddev->bitmap_info.space > sectors_reserved)
728 bitmap->mddev->bitmap_info.space = sectors_reserved; 728 bitmap->mddev->bitmap_info.space = sectors_reserved;
729 if (err) { 729 if (err) {
730 bitmap_print_sb(bitmap); 730 md_bitmap_print_sb(bitmap);
731 if (bitmap->cluster_slot < 0) 731 if (bitmap->cluster_slot < 0)
732 md_cluster_stop(bitmap->mddev); 732 md_cluster_stop(bitmap->mddev);
733 } 733 }
@@ -774,9 +774,9 @@ static inline struct page *filemap_get_page(struct bitmap_storage *store,
774 return store->filemap[file_page_index(store, chunk)]; 774 return store->filemap[file_page_index(store, chunk)];
775} 775}
776 776
777static int bitmap_storage_alloc(struct bitmap_storage *store, 777static int md_bitmap_storage_alloc(struct bitmap_storage *store,
778 unsigned long chunks, int with_super, 778 unsigned long chunks, int with_super,
779 int slot_number) 779 int slot_number)
780{ 780{
781 int pnum, offset = 0; 781 int pnum, offset = 0;
782 unsigned long num_pages; 782 unsigned long num_pages;
@@ -830,7 +830,7 @@ static int bitmap_storage_alloc(struct bitmap_storage *store,
830 return 0; 830 return 0;
831} 831}
832 832
833static void bitmap_file_unmap(struct bitmap_storage *store) 833static void md_bitmap_file_unmap(struct bitmap_storage *store)
834{ 834{
835 struct page **map, *sb_page; 835 struct page **map, *sb_page;
836 int pages; 836 int pages;
@@ -862,12 +862,12 @@ static void bitmap_file_unmap(struct bitmap_storage *store)
862 * then it is no longer reliable, so we stop using it and we mark the file 862 * then it is no longer reliable, so we stop using it and we mark the file
863 * as failed in the superblock 863 * as failed in the superblock
864 */ 864 */
865static void bitmap_file_kick(struct bitmap *bitmap) 865static void md_bitmap_file_kick(struct bitmap *bitmap)
866{ 866{
867 char *path, *ptr = NULL; 867 char *path, *ptr = NULL;
868 868
869 if (!test_and_set_bit(BITMAP_STALE, &bitmap->flags)) {