@@ -47,15 +47,9 @@ xfs_is_falloc_aligned(
{
unsigned int alloc_unit = xfs_inode_alloc_unitsize(ip);
- if (XFS_IS_REALTIME_INODE(ip) && !is_power_of_2(alloc_unit)) {
- u32 mod;
-
- div_u64_rem(pos, alloc_unit, &mod);
- if (mod)
- return false;
- div_u64_rem(len, alloc_unit, &mod);
- return mod == 0;
- }
+ if (XFS_IS_REALTIME_INODE(ip) && !is_power_of_2(alloc_unit))
+ return isaligned_64(pos, alloc_unit) &&
+ isaligned_64(len, alloc_unit);
return !((pos | len) & (alloc_unit - 1));
}
@@ -199,6 +199,11 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
return x;
}
+static inline bool isaligned_64(uint64_t x, uint32_t y)
+{
+ return do_div(x, y) == 0;
+}
+
int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
char *data, enum req_op op);