Skip to content

Commit

Permalink
client: Support new, filtered MStatfs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Douglas Fuller committed Aug 3, 2017
1 parent 76fc99a commit aeeeb43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t> &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<int64_t>(), &cond);
}

client_lock.Unlock();
int rval = cond.wait();
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/librados/RadosClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t> (),
new C_SafeCond(&mylock, &cond, &done, &ret));
lock.Unlock();

mylock.Lock();
Expand Down

0 comments on commit aeeeb43

Please sign in to comment.