summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-07-24 02:21:27 +0200
committerNeilBrown <neilb@suse.de>2013-07-24 02:21:27 +0200
commit419e0182849b93582290fe89cf760320f021285c (patch)
treec3212a7a611e0c65a69d2070e9efec9e18270113 /super1.c
parentsuper-ddf: allow mdassemble to compile. (diff)
downloadmdadm-419e0182849b93582290fe89cf760320f021285c.tar.xz
mdadm-419e0182849b93582290fe89cf760320f021285c.zip
super1: update data_size when performing "revert-reshape".
The "data_size" is with respect to "data_offset". When the kernel changes "data_offset" it modifies "data_size" to match - see md_finish_reshape() in the kernel. So when mdadm switches the data_offset for the new data_offset, it must update data_size correspondingly. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/super1.c b/super1.c
index 04272057..6ec8542b 100644
--- a/super1.c
+++ b/super1.c
@@ -1304,9 +1304,10 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
sb->chunksize = temp;
if (sb->feature_map & __cpu_to_le32(MD_FEATURE_NEW_OFFSET)) {
- sb->data_offset = __cpu_to_le64(__le64_to_cpu(sb->data_offset) +
- (long)(int32_t)__le32_to_cpu(sb->new_offset));
- sb->new_offset = __cpu_to_le32(-(int32_t)__le32_to_cpu(sb->new_offset));
+ long offset_delta = (int32_t)__le32_to_cpu(sb->new_offset);
+ sb->data_offset = __cpu_to_le64(__le64_to_cpu(sb->data_offset) + offset_delta);
+ sb->new_offset = __cpu_to_le32(-offset_delta);
+ sb->data_size = __cpu_to_le64(__le64_to_cpu(sb->data_size) - offset_delta);
}
}
} else if (strcmp(update, "_reshape_progress")==0)