aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-03-24 11:23:03 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-05-17 19:14:43 -0400
commit02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce (patch)
treef8a2c63b8b84e0aef6d7e8fc920b20c5bb14c1c4 /drivers/block
parentd845030f21859dd11bcecc7e1b8575fb845eb425 (diff)
drbd: Implemented the set_new_bits parameter for drbd_bm_resize()
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_bitmap.c10
-rw-r--r--drivers/block/drbd/drbd_int.h2
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/drbd/drbd_nl.c2
4 files changed, 10 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index 3390716898d5..695fb64cba00 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -441,7 +441,7 @@ static void bm_memset(struct drbd_bitmap *b, size_t offset, int c, size_t len)
441 * In case this is actually a resize, we copy the old bitmap into the new one. 441 * In case this is actually a resize, we copy the old bitmap into the new one.
442 * Otherwise, the bitmap is initialized to all bits set. 442 * Otherwise, the bitmap is initialized to all bits set.
443 */ 443 */
444int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity) 444int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity, int set_new_bits)
445{ 445{
446 struct drbd_bitmap *b = mdev->bitmap; 446 struct drbd_bitmap *b = mdev->bitmap;
447 unsigned long bits, words, owords, obits, *p_addr, *bm; 447 unsigned long bits, words, owords, obits, *p_addr, *bm;
@@ -526,8 +526,12 @@ int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity)
526 b->bm_dev_capacity = capacity; 526 b->bm_dev_capacity = capacity;
527 527
528 if (growing) { 528 if (growing) {
529 bm_memset(b, owords, 0xff, words-owords); 529 if (set_new_bits) {
530 b->bm_set += bits - obits; 530 bm_memset(b, owords, 0xff, words-owords);
531 b->bm_set += bits - obits;
532 } else
533 bm_memset(b, owords, 0x00, words-owords);
534
531 } 535 }
532 536
533 if (want < have) { 537 if (want < have) {
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index f5c56f4fd2a3..37a25a6084dd 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1311,7 +1311,7 @@ struct bm_extent {
1311#define APP_R_HSIZE 15 1311#define APP_R_HSIZE 15
1312 1312
1313extern int drbd_bm_init(struct drbd_conf *mdev); 1313extern int drbd_bm_init(struct drbd_conf *mdev);
1314extern int drbd_bm_resize(struct drbd_conf *mdev, sector_t sectors); 1314extern int drbd_bm_resize(struct drbd_conf *mdev, sector_t sectors, int set_new_bits);
1315extern void drbd_bm_cleanup(struct drbd_conf *mdev); 1315extern void drbd_bm_cleanup(struct drbd_conf *mdev);
1316extern void drbd_bm_set_all(struct drbd_conf *mdev); 1316extern void drbd_bm_set_all(struct drbd_conf *mdev);
1317extern void drbd_bm_clear_all(struct drbd_conf *mdev); 1317extern void drbd_bm_clear_all(struct drbd_conf *mdev);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index e181e405e244..65c2a65d3d64 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2688,7 +2688,7 @@ void drbd_mdev_cleanup(struct drbd_conf *mdev)
2688 drbd_set_my_capacity(mdev, 0); 2688 drbd_set_my_capacity(mdev, 0);
2689 if (mdev->bitmap) { 2689 if (mdev->bitmap) {
2690 /* maybe never allocated. */ 2690 /* maybe never allocated. */
2691 drbd_bm_resize(mdev, 0); 2691 drbd_bm_resize(mdev, 0, 1);
2692 drbd_bm_cleanup(mdev); 2692 drbd_bm_cleanup(mdev);
2693 } 2693 }
2694 2694
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 97abbc2acc5c..360e506426b0 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -546,7 +546,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, enum dds_
546 if (drbd_get_capacity(mdev->this_bdev) != size || 546 if (drbd_get_capacity(mdev->this_bdev) != size ||
547 drbd_bm_capacity(mdev) != size) { 547 drbd_bm_capacity(mdev) != size) {
548 int err; 548 int err;
549 err = drbd_bm_resize(mdev, size); 549 err = drbd_bm_resize(mdev, size, !(flags & DDSF_NO_RESYNC));
550 if (unlikely(err)) { 550 if (unlikely(err)) {
551 /* currently there is only one error: ENOMEM! */ 551 /* currently there is only one error: ENOMEM! */
552 size = drbd_bm_capacity(mdev)>>1; 552 size = drbd_bm_capacity(mdev)>>1;