From 0a2f18941558f72b5de9ebdd91fc99bc7a4919fc Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 21 Mar 2012 08:06:35 +1100 Subject: [PATCH] super1.c: use ROUND_UP/ROUND_UP_PTR Signed-off-by: Jes Sorensen Signed-off-by: NeilBrown --- super1.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/super1.c b/super1.c index 416ecfe..0a3b6d0 100644 --- a/super1.c +++ b/super1.c @@ -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;