提交 39730960 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] Two small fixes for md verion-1 superblocks.

1/ Must typecast int to (sector_t) before inverting or we
 might not invert enough bits.

2/ When "bitmap_offset" was added to mdp_superblock_1, we didn't increase
   the count of words-used (96 to 100).
Signed-off-by: NNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7bfa19f2
...@@ -847,7 +847,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) ...@@ -847,7 +847,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
case 0: case 0:
sb_offset = rdev->bdev->bd_inode->i_size >> 9; sb_offset = rdev->bdev->bd_inode->i_size >> 9;
sb_offset -= 8*2; sb_offset -= 8*2;
sb_offset &= ~(4*2-1); sb_offset &= ~(sector_t)(4*2-1);
/* convert from sectors to K */ /* convert from sectors to K */
sb_offset /= 2; sb_offset /= 2;
break; break;
......
...@@ -202,7 +202,7 @@ struct mdp_superblock_1 { ...@@ -202,7 +202,7 @@ struct mdp_superblock_1 {
* NOTE: signed, so bitmap can be before superblock * NOTE: signed, so bitmap can be before superblock
* only meaningful of feature_map[0] is set. * only meaningful of feature_map[0] is set.
*/ */
__u8 pad1[128-96]; /* set to 0 when written */ __u8 pad1[128-100]; /* set to 0 when written */
/* constant this-device information - 64 bytes */ /* constant this-device information - 64 bytes */
__u64 data_offset; /* sector start of data, often 0 */ __u64 data_offset; /* sector start of data, often 0 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册