Skip to content
Snippets Groups Projects
Commit 43ba9365 authored by Nikita Danilov's avatar Nikita Danilov
Browse files

Separate lu_site stats printing code into a separate function that can be

reused on a client.
b=16450
parent f96cc13e
No related branches found
No related tags found
No related merge requests found
......@@ -1642,6 +1642,12 @@ Details : lu_ref is a debugging module allowing to track references to
explicitly enabled with --enable-lu_ref. See usage description
within the patch.
Severity : minor
Bugzilla : 16450
Description: Factor lu_site procfs stats into a separate function.
Details : Separate lu_site stats printing code into a separate function
that can be reused on a client.
--------------------------------------------------------------------------------
2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com>
......
......@@ -356,28 +356,8 @@ static int lprocfs_rd_site_stats(char *page, char **start, off_t off,
{
struct obd_device *obd = data;
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
struct lu_site *s = mdt->mdt_md_dev.md_lu_dev.ld_site;
int i;
int populated;
/*
* How many hash buckets are not-empty? Don't bother with locks: it's
* an estimation anyway.
*/
for (i = 0, populated = 0; i < s->ls_hash_size; i++)
populated += !hlist_empty(&s->ls_hash[i]);
return snprintf(page, count, "%d %d %d/%d %d %d %d %d %d %d\n",
s->ls_total,
s->ls_busy,
populated,
s->ls_hash_size,
s->ls_stats.s_created,
s->ls_stats.s_cache_hit,
s->ls_stats.s_cache_miss,
s->ls_stats.s_cache_check,
s->ls_stats.s_cache_race,
s->ls_stats.s_lru_purged);
return lu_site_stats_print(mdt_lu_site(mdt), page, count);
}
static int lprocfs_rd_capa_timeout(char *page, char **start, off_t off,
......
......@@ -1530,9 +1530,40 @@ struct lu_buf LU_BUF_NULL = {
};
EXPORT_SYMBOL(LU_BUF_NULL);
/**
* Output site statistical counters into a buffer. Suitable for
* lprocfs_rd_*()-style functions.
*/
int lu_site_stats_print(const struct lu_site *s, char *page, int count)
{
int i;
int populated;
/*
* How many hash buckets are not-empty? Don't bother with locks: it's
* an estimation anyway.
*/
for (i = 0, populated = 0; i < s->ls_hash_size; i++)
populated += !hlist_empty(&s->ls_hash[i]);
return snprintf(page, count, "%d %d %d/%d %d %d %d %d %d %d %d\n",
s->ls_total,
s->ls_busy,
populated,
s->ls_hash_size,
s->ls_stats.s_created,
s->ls_stats.s_cache_hit,
s->ls_stats.s_cache_miss,
s->ls_stats.s_cache_check,
s->ls_stats.s_cache_race,
s->ls_stats.s_cache_death_race,
s->ls_stats.s_lru_purged);
}
EXPORT_SYMBOL(lu_site_stats_print);
/*
* XXX: Functions below logically belong to fid module, but they are used by
* dt_store_open(). Put them here until better place is found.
* XXX: Functions below logically belong to the fid module, but they are used
* by dt_store_open(). Put them here until better place is found.
*/
void fid_pack(struct lu_fid_pack *pack, const struct lu_fid *fid,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment