From 39467a2c95815a495d75a9ced119975bfe62616c Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 30 Jul 2018 05:15:08 +0000 Subject: [PATCH] client: set f_files to the total number of files in the filesystem Fixes: http://tracker.ceph.com/issues/24849 Signed-off-by: Rishabh Dave --- src/client/Client.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index e585ed90164e4..afc9a44edcb3d 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9769,6 +9769,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf, { Mutex::Locker l(client_lock); tout(cct) << __func__ << std::endl; + unsigned long int total_files_on_fs; if (unmounting) return -ENOTCONN; @@ -9785,6 +9786,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf, client_lock.Unlock(); int rval = cond.wait(); + assert(root); + total_files_on_fs = root->rstat.rfiles + root->rstat.rsubdirs; client_lock.Lock(); if (rval < 0) { @@ -9806,8 +9809,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf, const int CEPH_BLOCK_SHIFT = 22; stbuf->f_frsize = 1 << CEPH_BLOCK_SHIFT; stbuf->f_bsize = 1 << CEPH_BLOCK_SHIFT; - stbuf->f_files = stats.num_objects; - stbuf->f_ffree = -1; + stbuf->f_files = total_files_on_fs; + stbuf->f_ffree = 0; stbuf->f_favail = -1; stbuf->f_fsid = -1; // ?? stbuf->f_flag = 0; // ?? -- 2.39.5