Thread (2 messages) flat view 2 messages, 2 authors, 2004-02-24

Re: [PATCH] md: fix device size calculation with non-persistent superblock

From: Neil Brown <hidden>
Date: 2004-02-24 01:13:35

On Monday February 23, Paul.Clements@SteelEye.com wrote:
Neil,

Currently, the device size calculation is not correct when hot-adding
devices to arrays with non-persistent superblocks. Device size is always
calculated as if there were a physical superblock on every device. The
attached simple change to hot_add_disk() fixes the problem.

Hmm.. I had always assumed that non-persistent superblocks only worked
for linear and raid0.  I'm not sure I would trust any other
configuration.

Are you seriously using raid1 with non-persistent superblocks?  How do
you ensure reliable re-assembly after a device failure followed by
shutdown?

NeilBrown
quoted hunk
Thanks,
Paul--- 2_6_3_rc2/drivers/md/md.c.PRISTINE	Mon Feb 23 11:01:57 2004
+++ 2_6_3_rc2/drivers/md/md.c	Mon Feb 23 11:29:10 2004
@@ -2365,7 +2365,12 @@ static int hot_add_disk(mddev_t * mddev,
 		return -EINVAL;
 	}
 
-	rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	if (mddev->persistent)
+		rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	else
+		rdev->sb_offset = rdev->bdev->bd_inode->i_size
+							>> BLOCK_SIZE_BITS;
+
 	size = calc_dev_size(rdev, mddev->chunk_size);
 	rdev->size = size;
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help