From: Douglas Fuller Date: Mon, 17 Jul 2017 21:24:24 +0000 (-0400) Subject: client: Support new, filtered MStatfs X-Git-Tag: v12.1.3~24^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aeeeb43da90b61f8dad83251991088d667b7be47;p=ceph.git client: Support new, filtered MStatfs When statfs() is called for a filesystem with a single data pool, add that as an argument to receive statistics for that pool only. Signed-off-by: Douglas Fuller --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 6b34e4a330e4..7d8903aadc4b 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9430,7 +9430,13 @@ int Client::statfs(const char *path, struct statvfs *stbuf, ceph_statfs stats; C_SaferCond cond; - objecter->get_fs_stats(stats, &cond); + + const vector &data_pools = mdsmap->get_data_pools(); + if (data_pools.size() == 1) { + objecter->get_fs_stats(stats, data_pools[0], &cond); + } else { + objecter->get_fs_stats(stats, boost::optional(), &cond); + } client_lock.Unlock(); int rval = cond.wait(); @@ -9501,7 +9507,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf, stbuf->f_bfree = free; stbuf->f_bavail = free; } else { - // General case: report the overall RADOS cluster's statistics. Because + // General case: report the cluster statistics returned from RADOS. Because // multiple pools may be used without one filesystem namespace via // layouts, this is the most correct thing we can do. stbuf->f_blocks = stats.kb >> (CEPH_BLOCK_SHIFT - 10); diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc index 7131aa838acd..904fe57c4b1d 100644 --- a/src/librados/RadosClient.cc +++ b/src/librados/RadosClient.cc @@ -641,7 +641,8 @@ int librados::RadosClient::get_fs_stats(ceph_statfs& stats) int ret = 0; lock.Lock(); - objecter->get_fs_stats(stats, new C_SafeCond(&mylock, &cond, &done, &ret)); + objecter->get_fs_stats(stats, boost::optional (), + new C_SafeCond(&mylock, &cond, &done, &ret)); lock.Unlock(); mylock.Lock();