]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: set st_blocks correctly
authorSage Weil <sage@newdream.net>
Fri, 23 May 2008 22:17:06 +0000 (15:17 -0700)
committerSage Weil <sage@newdream.net>
Fri, 23 May 2008 22:17:06 +0000 (15:17 -0700)
src/client/Client.cc

index 3c5930840a7fd25b61f3c54237606728829b15b0..6b2a782c8fb42ad5d45364b39e7b7156ede8cb2f 100644 (file)
@@ -2245,12 +2245,14 @@ int Client::fill_stat(Inode *in, struct stat *st)
   st->st_ctime = MAX(in->inode.ctime, in->inode.mtime);
   st->st_atime = in->inode.atime;
   st->st_mtime = in->inode.mtime;
-  if (in->inode.is_dir())
+  if (in->inode.is_dir()) {
     st->st_size = in->inode.nested.rbytes;
-  else
+    st->st_blocks = 1;
+  } else {
     st->st_size = in->inode.size;
+    st->st_blocks = (in->inode.size + 511) >> 9;
+  }
   st->st_blksize = MAX(ceph_file_layout_su(in->inode.layout), 4096);
-  st->st_blocks = in->inode.size ? DIV_ROUND_UP(in->inode.size, st->st_blksize):0;
   return in->lease_mask;
 }