diff options
author | Sage Weil <sage@inktank.com> | 2013-08-27 15:15:16 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-27 15:26:29 -0400 |
commit | b314a90d8f3f1d16ec45744e5e2141ea6e14e034 (patch) | |
tree | da7c19d362ab97d8de74614fb1a72575640ed445 /fs/ceph | |
parent | ad7a60de882aca31afb58721db166f7e77afcd92 (diff) |
ceph: fix fallocate division
We need to use do_div to divide by a 64-bit value.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/file.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 68af489c2abd..d5e12f580671 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -960,13 +960,17 @@ static int ceph_zero_objects(struct inode *inode, loff_t offset, loff_t length) | |||
960 | { | 960 | { |
961 | int ret = 0; | 961 | int ret = 0; |
962 | struct ceph_inode_info *ci = ceph_inode(inode); | 962 | struct ceph_inode_info *ci = ceph_inode(inode); |
963 | __s32 stripe_unit = ceph_file_layout_su(ci->i_layout); | 963 | s32 stripe_unit = ceph_file_layout_su(ci->i_layout); |
964 | __s32 stripe_count = ceph_file_layout_stripe_count(ci->i_layout); | 964 | s32 stripe_count = ceph_file_layout_stripe_count(ci->i_layout); |
965 | __s32 object_size = ceph_file_layout_object_size(ci->i_layout); | 965 | s32 object_size = ceph_file_layout_object_size(ci->i_layout); |
966 | loff_t object_set_size = (loff_t)object_size * stripe_count; | 966 | u64 object_set_size = object_size * stripe_count; |
967 | u64 nearly, t; | ||
968 | |||
969 | /* round offset up to next period boundary */ | ||
970 | nearly = offset + object_set_size - 1; | ||
971 | t = nearly; | ||
972 | nearly -= do_div(t, object_set_size); | ||
967 | 973 | ||
968 | loff_t nearly = (offset + object_set_size - 1) | ||
969 | / object_set_size * object_set_size; | ||
970 | while (length && offset < nearly) { | 974 | while (length && offset < nearly) { |
971 | loff_t size = length; | 975 | loff_t size = length; |
972 | ret = ceph_zero_partial_object(inode, offset, &size); | 976 | ret = ceph_zero_partial_object(inode, offset, &size); |