* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
return -EINVAL;
}
- if (copy_from_user(kernbuf, buffer,
- min(count, UC_CACHE_UPCALL_MAXPATH - 1)))
+ if (copy_from_user(kernbuf, buffer, min_t(unsigned long, count,
+ UC_CACHE_UPCALL_MAXPATH - 1)))
return -EFAULT;
/* Remove any extraneous bits from the upcall (e.g. linefeeds) */
{
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,
return count;
}
+static int lprocfs_rd_cos(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+ return snprintf(page, count, "%u\n", mdt_cos_is_enabled(mdt));
+}
+
+static int lprocfs_wr_cos(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+ mdt_enable_cos(mdt, val);
+ return count;
+}
+
static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
{ "capa_count", lprocfs_rd_capa_count, 0, 0 },
{ "site_stats", lprocfs_rd_site_stats, 0, 0 },
{ "evict_client", 0, lprocfs_mdt_wr_evict_client, 0 },
+ { "hash_stats", lprocfs_obd_rd_hash, 0, 0 },
+ { "commit_on_sharing", lprocfs_rd_cos, lprocfs_wr_cos, 0 },
{ 0 }
};