From b2095e5d67b81a6a2b9c0321efff1bdcee43bf71 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 22 May 2012 13:55:34 +1000 Subject: [PATCH] --- yaml --- r: 305967 b: refs/heads/master c: 1dff2b87a34a1ac1d1898ea109bf97ed396aca53 h: refs/heads/master i: 305965: 80ffeb095e9826cb9b59605573d5ebafd34a4e73 305963: e16eeacf40732b7bbc74a781f46f2f92c37c3cde 305959: bc15ff05c5ebc92067f5407893e9587e9fc41796 305951: fb090355c43485ff3754b8d39cdc64966f1a41eb v: v3 --- [refs] | 2 +- trunk/drivers/md/bitmap.c | 7 +++++++ trunk/drivers/md/bitmap.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index b001339a6ebe..facb7b9329d5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 63aced61023a054825ffd6e33ac1ab99036dadd2 +refs/heads/master: 1dff2b87a34a1ac1d1898ea109bf97ed396aca53 diff --git a/trunk/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index 8f681da00277..15dbe03117e4 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -423,6 +423,8 @@ void bitmap_update_sb(struct bitmap *bitmap) /* This might have been changed by a reshape */ sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); sb->chunksize = cpu_to_le32(bitmap->mddev->bitmap_info.chunksize); + sb->sectors_reserved = cpu_to_le32(bitmap->mddev-> + bitmap_info.space); kunmap_atomic(sb); write_page(bitmap, bitmap->storage.sb_page, 1); } @@ -536,6 +538,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) bitmap_super_t *sb; unsigned long chunksize, daemon_sleep, write_behind; unsigned long long events; + unsigned long sectors_reserved = 0; int err = -EINVAL; struct page *sb_page; @@ -573,6 +576,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) chunksize = le32_to_cpu(sb->chunksize); daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; write_behind = le32_to_cpu(sb->write_behind); + sectors_reserved = le32_to_cpu(sb->sectors_reserved); /* verify that the bitmap-specific fields are valid */ if (sb->magic != cpu_to_le32(BITMAP_MAGIC)) @@ -633,6 +637,9 @@ static int bitmap_read_sb(struct bitmap *bitmap) bitmap->mddev->bitmap_info.chunksize = chunksize; bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; bitmap->mddev->bitmap_info.max_write_behind = write_behind; + if (bitmap->mddev->bitmap_info.space == 0 || + bitmap->mddev->bitmap_info.space > sectors_reserved) + bitmap->mddev->bitmap_info.space = sectors_reserved; if (err) bitmap_print_sb(bitmap); return err; diff --git a/trunk/drivers/md/bitmap.h b/trunk/drivers/md/bitmap.h index 04dcde3871be..df4aeb6ac6f0 100644 --- a/trunk/drivers/md/bitmap.h +++ b/trunk/drivers/md/bitmap.h @@ -128,8 +128,10 @@ typedef struct bitmap_super_s { __le32 chunksize; /* 52 the bitmap chunk size in bytes */ __le32 daemon_sleep; /* 56 seconds between disk flushes */ __le32 write_behind; /* 60 number of outstanding write-behind writes */ + __le32 sectors_reserved; /* 64 number of 512-byte sectors that are + * reserved for the bitmap. */ - __u8 pad[256 - 64]; /* set to zero */ + __u8 pad[256 - 68]; /* set to zero */ } bitmap_super_t; /* notes: