aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorPaul Clements <paul.clements@steeleye.com>2006-10-03 04:15:49 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:17 -0400
commit9b1d1dac181d8c1b9492e05cee660a985d035a06 (patch)
treeaf12b1eaac4e0f7f3528ec26a223faeabed35845 /drivers/md/bitmap.c
parent76186dd8b73d2b7b9b4c8629b89c845e97009801 (diff)
[PATCH] md: new sysfs interface for setting bits in the write-intent-bitmap
Add a new sysfs interface that allows the bitmap of an array to be dirtied. The interface is write-only, and is used as follows: echo "1000" > /sys/block/md2/md/bitmap (dirty the bit for chunk 1000 [offset 0] in the in-memory and on-disk bitmaps of array md2) echo "1000-2000" > /sys/block/md1/md/bitmap (dirty the bits for chunks 1000-2000 in md1's bitmap) This is useful, for example, in cluster environments where you may need to combine two disjoint bitmaps into one (following a server failure, after a secondary server has taken over the array). By combining the bitmaps on the two servers, a full resync can be avoided (This was discussed on the list back on March 18, 2005, "[PATCH 1/2] md bitmap bug fixes" thread). Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index ecc56765d949..0a44298fb353 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -613,6 +613,7 @@ static inline unsigned long file_page_offset(unsigned long chunk)
613static inline struct page *filemap_get_page(struct bitmap *bitmap, 613static inline struct page *filemap_get_page(struct bitmap *bitmap,
614 unsigned long chunk) 614 unsigned long chunk)
615{ 615{
616 if (file_page_index(chunk) >= bitmap->file_pages) return NULL;
616 return bitmap->filemap[file_page_index(chunk) - file_page_index(0)]; 617 return bitmap->filemap[file_page_index(chunk) - file_page_index(0)];
617} 618}
618 619
@@ -739,6 +740,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
739 } 740 }
740 741
741 page = filemap_get_page(bitmap, chunk); 742 page = filemap_get_page(bitmap, chunk);
743 if (!page) return;
742 bit = file_page_offset(chunk); 744 bit = file_page_offset(chunk);
743 745
744 /* set the bit */ 746 /* set the bit */
@@ -1322,6 +1324,18 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n
1322 1324
1323} 1325}
1324 1326
1327/* dirty the memory and file bits for bitmap chunks "s" to "e" */
1328void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e)
1329{
1330 unsigned long chunk;
1331
1332 for (chunk = s; chunk <= e; chunk++) {
1333 sector_t sec = chunk << CHUNK_BLOCK_SHIFT(bitmap);
1334 bitmap_set_memory_bits(bitmap, sec, 1);
1335 bitmap_file_set_bit(bitmap, sec);
1336 }
1337}
1338
1325/* 1339/*
1326 * flush out any pending updates 1340 * flush out any pending updates
1327 */ 1341 */