From 9bec695f9138ab70982add3768544e70eb8eb416 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 13 Oct 2009 18:50:46 -0700 Subject: [PATCH] Hadoop: getFileBlockSize has an unclear contract, but it's followed better now --- src/client/hadoop/ceph/CephFileSystem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index e41f86ee6c2c7..e2c4728129ae8 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -744,13 +744,14 @@ public class CephFileSystem extends FileSystem { //get the block size long blockSize = ceph_getblocksize(abs_path.toString()); BlockLocation[] locations = - new BlockLocation[(int)Math.ceil((len-start)/(float)blockSize)]; + new BlockLocation[(int)Math.ceil(len/(float)blockSize)]; for (int i = 0; i < locations.length; ++i) { String host = ceph_hosts(fh, start + i*blockSize); String[] hostArray = new String[1]; hostArray[0] = host; locations[i] = new BlockLocation(hostArray, hostArray, - start+i*blockSize, blockSize); + start+i*blockSize-(start % blockSize), + blockSize); } ceph_close(fh); return locations; -- 2.39.5