aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2010-10-19 03:13:04 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-10-19 03:13:04 -0400
commitfa251f89903d73989e2f63e13d0eaed1e07ce0da (patch)
tree3f7fe779941e3b6d67754dd7c44a32f48ea47c74 /drivers/md
parentdd3932eddf428571762596e17b65f5dc92ca361b (diff)
parentcd07202cc8262e1669edff0d97715f3dd9260917 (diff)
Merge branch 'v2.6.36-rc8' into for-2.6.37/barrier
Conflicts: block/blk-core.c drivers/block/loop.c mm/swapfile.c Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/.gitignore4
-rw-r--r--drivers/md/bitmap.c12
-rw-r--r--drivers/md/md.c31
-rw-r--r--drivers/md/md.h2
-rw-r--r--drivers/md/raid1.c4
5 files changed, 24 insertions, 29 deletions
diff --git a/drivers/md/.gitignore b/drivers/md/.gitignore
deleted file mode 100644
index a7afec6b19c6..000000000000
--- a/drivers/md/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
1mktables
2raid6altivec*.c
3raid6int*.c
4raid6tables.c
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 1ba1e122e948..e4fb58db5454 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1000,10 +1000,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
1000 page = bitmap->sb_page; 1000 page = bitmap->sb_page;
1001 offset = sizeof(bitmap_super_t); 1001 offset = sizeof(bitmap_super_t);
1002 if (!file) 1002 if (!file)
1003 read_sb_page(bitmap->mddev, 1003 page = read_sb_page(
1004 bitmap->mddev->bitmap_info.offset, 1004 bitmap->mddev,
1005 page, 1005 bitmap->mddev->bitmap_info.offset,
1006 index, count); 1006 page,
1007 index, count);
1007 } else if (file) { 1008 } else if (file) {
1008 page = read_page(file, index, bitmap, count); 1009 page = read_page(file, index, bitmap, count);
1009 offset = 0; 1010 offset = 0;
@@ -1542,8 +1543,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector)
1542 atomic_read(&bitmap->mddev->recovery_active) == 0); 1543 atomic_read(&bitmap->mddev->recovery_active) == 0);
1543 1544
1544 bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync; 1545 bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync;
1545 if (bitmap->mddev->persistent) 1546 set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags);
1546 set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags);
1547 sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); 1547 sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1);
1548 s = 0; 1548 s = 0;
1549 while (s < sector && s < bitmap->mddev->resync_max_sectors) { 1549 while (s < sector && s < bitmap->mddev->resync_max_sectors) {
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3640f025cb72..ed075d19db37 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1578,7 +1578,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1578 bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1; 1578 bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1;
1579 if (rdev->sb_size & bmask) 1579 if (rdev->sb_size & bmask)
1580 rdev->sb_size = (rdev->sb_size | bmask) + 1; 1580 rdev->sb_size = (rdev->sb_size | bmask) + 1;
1581 } 1581 } else
1582 max_dev = le32_to_cpu(sb->max_dev);
1583
1582 for (i=0; i<max_dev;i++) 1584 for (i=0; i<max_dev;i++)
1583 sb->dev_roles[i] = cpu_to_le16(0xfffe); 1585 sb->dev_roles[i] = cpu_to_le16(0xfffe);
1584 1586
@@ -2102,9 +2104,9 @@ repeat:
2102 rdev->recovery_offset = mddev->curr_resync_completed; 2104 rdev->recovery_offset = mddev->curr_resync_completed;
2103 2105
2104 } 2106 }
2105 if (mddev->external || !mddev->persistent) { 2107 if (!mddev->persistent) {
2106 clear_bit(MD_CHANGE_DEVS, &mddev->flags);
2107 clear_bit(MD_CHANGE_CLEAN, &mddev->flags); 2108 clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
2109 clear_bit(MD_CHANGE_DEVS, &mddev->flags);
2108 wake_up(&mddev->sb_wait); 2110 wake_up(&mddev->sb_wait);
2109 return; 2111 return;
2110 } 2112 }
@@ -2113,7 +2115,6 @@ repeat:
2113 2115
2114 mddev->utime = get_seconds(); 2116 mddev->utime = get_seconds();
2115 2117
2116 set_bit(MD_CHANGE_PENDING, &mddev->flags);
2117 if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags)) 2118 if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags))
2118 force_change = 1; 2119 force_change = 1;
2119 if (test_and_clear_bit(MD_CHANGE_CLEAN, &mddev->flags)) 2120 if (test_and_clear_bit(MD_CHANGE_CLEAN, &mddev->flags))
@@ -3306,7 +3307,7 @@ array_state_show(mddev_t *mddev, char *page)
3306 case 0: 3307 case 0:
3307 if (mddev->in_sync) 3308 if (mddev->in_sync)
3308 st = clean; 3309 st = clean;
3309 else if (test_bit(MD_CHANGE_CLEAN, &mddev->flags)) 3310 else if (test_bit(MD_CHANGE_PENDING, &mddev->flags))
3310 st = write_pending; 3311 st = write_pending;
3311 else if (mddev->safemode) 3312 else if (mddev->safemode)
3312 st = active_idle; 3313 st = active_idle;
@@ -3387,9 +3388,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
3387 mddev->in_sync = 1; 3388 mddev->in_sync = 1;
3388 if (mddev->safemode == 1) 3389 if (mddev->safemode == 1)
3389 mddev->safemode = 0; 3390 mddev->safemode = 0;
3390 if (mddev->persistent) 3391 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
3391 set_bit(MD_CHANGE_CLEAN,
3392 &mddev->flags);
3393 } 3392 }
3394 err = 0; 3393 err = 0;
3395 } else 3394 } else
@@ -3401,8 +3400,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
3401 case active: 3400 case active:
3402 if (mddev->pers) { 3401 if (mddev->pers) {
3403 restart_array(mddev); 3402 restart_array(mddev);
3404 if (mddev->external) 3403 clear_bit(MD_CHANGE_PENDING, &mddev->flags);
3405 clear_bit(MD_CHANGE_CLEAN, &mddev->flags);
3406 wake_up(&mddev->sb_wait); 3404 wake_up(&mddev->sb_wait);
3407 err = 0; 3405 err = 0;
3408 } else { 3406 } else {
@@ -6505,6 +6503,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi)
6505 if (mddev->in_sync) { 6503 if (mddev->in_sync) {
6506 mddev->in_sync = 0; 6504 mddev->in_sync = 0;
6507 set_bit(MD_CHANGE_CLEAN, &mddev->flags); 6505 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
6506 set_bit(MD_CHANGE_PENDING, &mddev->flags);
6508 md_wakeup_thread(mddev->thread); 6507 md_wakeup_thread(mddev->thread);
6509 did_change = 1; 6508 did_change = 1;
6510 } 6509 }
@@ -6513,7 +6512,6 @@ void md_write_start(mddev_t *mddev, struct bio *bi)
6513 if (did_change) 6512 if (did_change)
6514 sysfs_notify_dirent_safe(mddev->sysfs_state); 6513 sysfs_notify_dirent_safe(mddev->sysfs_state);
6515 wait_event(mddev->sb_wait, 6514 wait_event(mddev->sb_wait,
6516 !test_bit(MD_CHANGE_CLEAN, &mddev->flags) &&
6517 !test_bit(MD_CHANGE_PENDING, &mddev->flags)); 6515 !test_bit(MD_CHANGE_PENDING, &mddev->flags));
6518} 6516}
6519 6517
@@ -6549,6 +6547,7 @@ int md_allow_write(mddev_t *mddev)
6549 if (mddev->in_sync) { 6547 if (mddev->in_sync) {
6550 mddev->in_sync = 0; 6548 mddev->in_sync = 0;
6551 set_bit(MD_CHANGE_CLEAN, &mddev->flags); 6549 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
6550 set_bit(MD_CHANGE_PENDING, &mddev->flags);
6552 if (mddev->safemode_delay && 6551 if (mddev->safemode_delay &&
6553 mddev->safemode == 0) 6552 mddev->safemode == 0)
6554 mddev->safemode = 1; 6553 mddev->safemode = 1;
@@ -6558,7 +6557,7 @@ int md_allow_write(mddev_t *mddev)
6558 } else 6557 } else
6559 spin_unlock_irq(&mddev->write_lock); 6558 spin_unlock_irq(&mddev->write_lock);
6560 6559
6561 if (test_bit(MD_CHANGE_CLEAN, &mddev->flags)) 6560 if (test_bit(MD_CHANGE_PENDING, &mddev->flags))
6562 return -EAGAIN; 6561 return -EAGAIN;
6563 else 6562 else
6564 return 0; 6563 return 0;
@@ -6756,8 +6755,7 @@ void md_do_sync(mddev_t *mddev)
6756 atomic_read(&mddev->recovery_active) == 0); 6755 atomic_read(&mddev->recovery_active) == 0);
6757 mddev->curr_resync_completed = 6756 mddev->curr_resync_completed =
6758 mddev->curr_resync; 6757 mddev->curr_resync;
6759 if (mddev->persistent) 6758 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
6760 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
6761 sysfs_notify(&mddev->kobj, NULL, "sync_completed"); 6759 sysfs_notify(&mddev->kobj, NULL, "sync_completed");
6762 } 6760 }
6763 6761
@@ -7006,7 +7004,7 @@ void md_check_recovery(mddev_t *mddev)
7006 if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) 7004 if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
7007 return; 7005 return;
7008 if ( ! ( 7006 if ( ! (
7009 (mddev->flags && !mddev->external) || 7007 (mddev->flags & ~ (1<<MD_CHANGE_PENDING)) ||
7010 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || 7008 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
7011 test_bit(MD_RECOVERY_DONE, &mddev->recovery) || 7009 test_bit(MD_RECOVERY_DONE, &mddev->recovery) ||
7012 (mddev->external == 0 && mddev->safemode == 1) || 7010 (mddev->external == 0 && mddev->safemode == 1) ||
@@ -7036,8 +7034,7 @@ void md_check_recovery(mddev_t *mddev)
7036 mddev->recovery_cp == MaxSector) { 7034 mddev->recovery_cp == MaxSector) {
7037 mddev->in_sync = 1; 7035 mddev->in_sync = 1;
7038 did_change = 1; 7036 did_change = 1;
7039 if (mddev->persistent) 7037 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
7040 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
7041 } 7038 }
7042 if (mddev->safemode == 1) 7039 if (mddev->safemode == 1)
7043 mddev->safemode = 0; 7040 mddev->safemode = 0;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index d8e2ab25103b..112a2c32db0c 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -139,7 +139,7 @@ struct mddev_s
139 unsigned long flags; 139 unsigned long flags;
140#define MD_CHANGE_DEVS 0 /* Some device status has changed */ 140#define MD_CHANGE_DEVS 0 /* Some device status has changed */
141#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ 141#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
142#define MD_CHANGE_PENDING 2 /* superblock update in progress */ 142#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */
143 143
144 int suspended; 144 int suspended;
145 atomic_t active_io; 145 atomic_t active_io;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 886a9d865488..378a25894c57 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1781,7 +1781,9 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1781 1781
1782 /* take from bio_init */ 1782 /* take from bio_init */
1783 bio->bi_next = NULL; 1783 bio->bi_next = NULL;
1784 bio->bi_flags &= ~(BIO_POOL_MASK-1);
1784 bio->bi_flags |= 1 << BIO_UPTODATE; 1785 bio->bi_flags |= 1 << BIO_UPTODATE;
1786 bio->bi_comp_cpu = -1;
1785 bio->bi_rw = READ; 1787 bio->bi_rw = READ;
1786 bio->bi_vcnt = 0; 1788 bio->bi_vcnt = 0;
1787 bio->bi_idx = 0; 1789 bio->bi_idx = 0;
@@ -1854,7 +1856,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1854 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) 1856 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
1855 break; 1857 break;
1856 BUG_ON(sync_blocks < (PAGE_SIZE>>9)); 1858 BUG_ON(sync_blocks < (PAGE_SIZE>>9));
1857 if (len > (sync_blocks<<9)) 1859 if ((len >> 9) > sync_blocks)
1858 len = sync_blocks<<9; 1860 len = sync_blocks<<9;
1859 } 1861 }
1860 1862