summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-09-12 05:24:10 +0000
committerNeil Brown <neilb@suse.de>2005-09-12 05:24:10 +0000
commitf6d75de8e0106a3789ed1a3aada306d197531e47 (patch)
tree9c6941767308f8fcb13f179f99eafbb38be73cf4 /super1.c
parent308e1801baa05edbcfda6e8054fdf90727581c62 (diff)
downloadmdadm-f6d75de8e0106a3789ed1a3aada306d197531e47.tar.gz
mdadm-f6d75de8e0106a3789ed1a3aada306d197531e47.tar.xz
mdadm-f6d75de8e0106a3789ed1a3aada306d197531e47.zip
Fix remaining problems with hot-add bitmap to version-1 superblock
Also some more tests - r5 and r6 bitmaps Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/super1.c b/super1.c
index 00da497..43607ba 100644
--- a/super1.c
+++ b/super1.c
@@ -892,16 +892,21 @@ add_internal_bitmap1(struct supertype *st, void *sbv,
}
-void locate_bitmap1(struct supertype *st, int fd)
+void locate_bitmap1(struct supertype *st, int fd, void *sbv)
{
unsigned long long offset;
struct mdp_superblock_1 *sb;
- if (st->ss->load_super(st, fd, (void**)&sb, NULL))
- return; /* no error I hope... */
+ if (sbv)
+ sb = sbv;
+ else {
+ if (st->ss->load_super(st, fd, (void**)&sb, NULL))
+ return; /* no error I hope... */
+ }
offset = __le64_to_cpu(sb->super_offset);
offset += (long) __le32_to_cpu(sb->bitmap_offset);
-
+ if (!sbv)
+ free(sb);
lseek64(fd, offset<<9, 0);
}
@@ -914,7 +919,7 @@ int write_bitmap1(struct supertype *st, int fd, void *sbv)
int towrite, n;
char buf[4096];
- locate_bitmap1(st, fd);
+ locate_bitmap1(st, fd, sbv);
write(fd, ((char*)sb)+1024, sizeof(bitmap_super_t));
towrite = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9);