Skip to contentSkip to conversation

md separate meta and data devs

PATCH New Jonathan Brassow 1 participant 1 message Dec 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md separate meta and data devs

Patch name: md-separate-meta-and-data-devs.patch

Allow the metadata to be on a separate device from the data.

This doesn't mean the data and metadata will by on separate physical devices - it simply gives device-mapper and userspace tools more flexibility.

drivers/md/bitmap.c +5 -1
Index: linux-2.6/drivers/md/bitmap.c
===================================================================
@@ -263,14 +263,18 @@ static mdk_rdev_t *next_active_rdev(mdk_
 static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
 {
 	mdk_rdev_t *rdev = NULL;
+	struct block_device *bdev;
 	mddev_t *mddev = bitmap->mddev;
 
 	while ((rdev = next_active_rdev(rdev, mddev)) != NULL) {
 		int size = PAGE_SIZE;
 		loff_t offset = mddev->bitmap_info.offset;
+
+		bdev = (rdev->meta_bdev) ? rdev->meta_bdev : rdev->bdev;
+
 		if (page->index == bitmap->file_pages-1)
 			size = roundup(bitmap->last_page_size,
-				       bdev_logical_block_size(rdev->bdev));
+				       bdev_logical_block_size(bdev));
 		/* Just make sure we aren't corrupting data or
 		 * metadata
 		 */
drivers/md/md.c +38 -7

117 lines not on this page · raw message

drivers/md/md.h +6 -0
Index: linux-2.6/drivers/md/md.h
===================================================================
@@ -60,6 +60,12 @@ struct mdk_rdev_s
 	mddev_t *mddev;			/* RAID array if running */
 	int last_events;		/* IO event timestamp */
 
+	/*
+	 * If meta_bdev is non-NULL, it means that a separate device is
+	 * being used to store the metadata (superblock/bitmap) which
+	 * would otherwise be contained on the same device as the data (bdev).
+	 */
+	struct block_device *meta_bdev;
 	struct block_device *bdev;	/* block device handle */
 
 	struct page	*sb_page;