[PATCH 09/11] super1.c: use ROUND_UP/ROUND_UP_PTR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
---
 super1.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/super1.c b/super1.c
index 350e27a..612ae98 100644
--- a/super1.c
+++ b/super1.c
@@ -174,7 +174,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)
 		;
@@ -207,7 +207,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)
 		;
@@ -1037,8 +1037,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;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux