summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_bitmap.c
diff options
context:
space:
mode:
authorPhilipp Reisner2010-03-24 16:23:03 +0100
committerPhilipp Reisner2010-05-18 01:14:43 +0200
commit02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce (patch)
treef8a2c63b8b84e0aef6d7e8fc920b20c5bb14c1c4 /drivers/block/drbd/drbd_bitmap.c
parentdrbd: made determin_dev_size's parameter an flag enum (diff)
downloadkernel-qcow2-linux-02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce.tar.gz
kernel-qcow2-linux-02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce.tar.xz
kernel-qcow2-linux-02d9a94bbb0d4e0fec8db6735bdc4ccfaac8f0ce.zip
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/drbd/drbd_bitmap.c')
-rw-r--r--drivers/block/drbd/drbd_bitmap.c10
1 files changed, 7 insertions, 3 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)
* In case this is actually a resize, we copy the old bitmap into the new one.
* Otherwise, the bitmap is initialized to all bits set.
*/
-int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity)
+int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity, int set_new_bits)
{
struct drbd_bitmap *b = mdev->bitmap;
unsigned long bits, words, owords, obits, *p_addr, *bm;
@@ -526,8 +526,12 @@ int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity)
b->bm_dev_capacity = capacity;
if (growing) {
- bm_memset(b, owords, 0xff, words-owords);
- b->bm_set += bits - obits;
+ if (set_new_bits) {
+ bm_memset(b, owords, 0xff, words-owords);
+ b->bm_set += bits - obits;
+ } else
+ bm_memset(b, owords, 0x00, words-owords);
+
}
if (want < have) {