]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: getFileBlockSize has an unclear contract, but it's followed better now
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 14 Oct 2009 01:50:46 +0000 (18:50 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 16 Oct 2009 19:21:25 +0000 (12:21 -0700)
src/client/hadoop/ceph/CephFileSystem.java

index e41f86ee6c2c7584a58b28dd0e241e30101d6317..e2c4728129ae8eb07beee0305b7f3cb351ae2a2e 100644 (file)
@@ -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;