super1.c: use ROUND_UP/ROUND_UP_PTR

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2012-03-21 08:06:35 +11:00 committed by NeilBrown
parent de89706515
commit 0a2f189415
1 changed files with 3 additions and 4 deletions

View File

@ -179,7 +179,7 @@ static int aread(struct align_fd *afd, void *buf, int len)
"invalid block size\n");
return -1;
}
b = (char*)(((long)(abuf+4096))&~4095UL);
b = ROUND_UP_PTR((char *)abuf, 4096);
for (iosize = 0; iosize < len; iosize += bsize)
;
@ -212,7 +212,7 @@ static int awrite(struct align_fd *afd, void *buf, int len)
"invalid block size\n");
return -1;
}
b = (char*)(((long)(abuf+4096))&~4095UL);
b = ROUND_UP_PTR((char *)abuf, 4096);
for (iosize = 0; iosize < len ; iosize += bsize)
;
@ -1044,8 +1044,7 @@ static int store_super1(struct supertype *st, int fd)
if (lseek64(fd, sb_offset << 9, 0)< 0LL)
return 3;
sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev);
sbsize = (sbsize+511)&(~511UL);
sbsize = ROUND_UP(sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev), 512);
if (awrite(&afd, sb, sbsize) != sbsize)
return 4;