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>
{
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,
};
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,