]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super1.c don't keep recalculating bitmap pointer
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 20 Mar 2012 16:54:06 +0000 (17:54 +0100)
committerNeilBrown <neilb@suse.de>
Tue, 20 Mar 2012 20:42:48 +0000 (07:42 +1100)
We just calculated the pointer to the bitmap, so use it instead of
recalculating.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super1.c

index af0abe659413a9c9eba684e4f40ac032e5d4a4a1..5ed99456c58f9bb1154b7a830a144c79b2ea3b7e 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1395,8 +1395,7 @@ static int load_super1(struct supertype *st, int fd, char *devname)
         * should get that written out.
         */
        locate_bitmap1(st, fd);
-       if (aread(fd, ((char*)super)+MAX_SB_SIZE, 512)
-           != 512)
+       if (aread(fd, bsb, 512) != 512)
                goto no_bitmap;
 
        uuid_from_super1(st, uuid);
@@ -1663,7 +1662,7 @@ static int write_bitmap1(struct supertype *st, int fd)
                return -ENOMEM;
 
        memset(buf, 0xff, 4096);
-       memcpy(buf, ((char*)sb)+MAX_SB_SIZE, sizeof(bitmap_super_t));
+       memcpy(buf, (char *)bms, sizeof(bitmap_super_t));
 
        towrite = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9);
        towrite = (towrite+7) >> 3; /* bits to bytes */