summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-22 15:15:27 -0800
committerSage Weil <sage@inktank.com>2013-03-21 11:52:39 -0700
commit7e7ea8266ee45d96863e1edc5a567dcc2977680c (patch)
treea91bf513805da73c5117c2dd1c544bd9c2ac09bf
parent66dca7730006dffbce12e6b27016ea5469b7691b (diff)
downloadceph-7e7ea8266ee45d96863e1edc5a567dcc2977680c.tar.gz
client: use 4MB f_bsize and f_frsize for statfs
Old stat(1) reports: Block size: 1048576 Fundamental block size: 1048576 and the df(1) arithmetic works out. New stat(1) reports: Block size: 1048576 Fundamental block size: 4096 which is what we are shoving into statvfs, but we have the b_size and fr_size arithmetic swapped. However, doing the *correct* reporting would then break the old stat by making both sizes appear to be 4KB (or whatever). Sidestep the issue by making *both* values 4MB.. which is both large enough to report large FS sizes, and also the default stripe size and thus a "reasonable" value to report for a block size. Perhaps in the future, when we no longer care about old userland, we can report the page size for f_bsize, which is probably the "most correct" thing to do. Fixes: #3794. See also #3793. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Greg Farnum <greg@inktank.com> (cherry picked from commit 7c94083643891c9d66a117352f312b268bdb1135)
-rw-r--r--src/client/Client.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 94b976c510e..9081d99a178 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -5956,17 +5956,20 @@ int Client::statfs(const char *path, struct statvfs *stbuf)
memset(stbuf, 0, sizeof(*stbuf));
- /* we're going to set a block size of 1MB so we can represent larger
- * FSes without overflowing. Additionally convert the space measurements
- * from KB to bytes while making them in terms of blocks.
+ /*
+ * we're going to set a block size of 4MB so we can represent larger
+ * FSes without overflowing. Additionally convert the space
+ * measurements from KB to bytes while making them in terms of
+ * blocks. We use 4MB only because it is big enough, and because it
+ * actually *is* the (ceph) default block size.
*/
- const int CEPH_BLOCK_SHIFT = 20;
+ const int CEPH_BLOCK_SHIFT = 22;
+ stbuf->f_frsize = 1 << CEPH_BLOCK_SHIFT;
stbuf->f_bsize = 1 << CEPH_BLOCK_SHIFT;
stbuf->f_blocks = stats.kb >> (CEPH_BLOCK_SHIFT - 10);
stbuf->f_bfree = stats.kb_avail >> (CEPH_BLOCK_SHIFT - 10);
stbuf->f_bavail = stats.kb_avail >> (CEPH_BLOCK_SHIFT - 10);
stbuf->f_files = stats.num_objects;
- stbuf->f_frsize = CEPH_PAGE_SIZE;
stbuf->f_ffree = -1;
stbuf->f_favail = -1;
stbuf->f_fsid = -1; // ??