vsnprintf(key->lck_area + used,
ARRAY_SIZE(key->lck_area) - used, format, args);
if (complete) {
+ if (cdebug_show(info->lpi_mask, info->lpi_subsys))
libcfs_debug_msg(NULL, info->lpi_subsys, info->lpi_mask,
(char *)info->lpi_file, info->lpi_fn,
info->lpi_line, "%s", key->lck_area);
}
EXPORT_SYMBOL(lu_cdebug_printer);
-/*
+/**
* Print object header.
*/
-static void lu_object_header_print(const struct lu_env *env,
- void *cookie, lu_printer_t printer,
+void lu_object_header_print(const struct lu_env *env, void *cookie,
+ lu_printer_t printer,
const struct lu_object_header *hdr)
{
(*printer)(env, cookie, "header@%p[%#lx, %d, "DFID"%s%s%s]",
hdr, hdr->loh_flags, atomic_read(&hdr->loh_ref),
PFID(&hdr->loh_fid),
hlist_unhashed(&hdr->loh_hash) ? "" : " hash",
- list_empty(&hdr->loh_lru) ? "" : " lru",
+ list_empty((struct list_head *)&hdr->loh_lru) ? "" : " lru",
hdr->loh_attr & LOHA_EXISTS ? " exist":"");
}
+EXPORT_SYMBOL(lu_object_header_print);
-/*
- * Print human readable representation of the @o to the @printer.
+/**
+ * Print human readable representation of the \a o to the \a printer.
*/
void lu_object_print(const struct lu_env *env, void *cookie,
lu_printer_t printer, const struct lu_object *o)
top = o->lo_header;
lu_object_header_print(env, cookie, printer, top);
- (*printer)(env, cookie, "\n");
+ (*printer)(env, cookie, "{ \n");
list_for_each_entry(o, &top->loh_layers, lo_linkage) {
depth = o->lo_depth + 4;
- LASSERT(o->lo_ops->loo_object_print != NULL);
+
/*
- * print `.' @depth times.
+ * print `.' \a depth times followed by type name and address
*/
- (*printer)(env, cookie, "%*.*s", depth, depth, ruler);
+ (*printer)(env, cookie, "%*.*s%s@%p", depth, depth, ruler,
+ o->lo_dev->ld_type->ldt_name, o);
+ if (o->lo_ops->loo_object_print != NULL)
o->lo_ops->loo_object_print(env, cookie, printer, o);
(*printer)(env, cookie, "\n");
}
+ (*printer)(env, cookie, "} header@%p\n", top);
}
EXPORT_SYMBOL(lu_object_print);
-/*
+/**
* Check object consistency.
*/
int lu_object_invariant(const struct lu_object *o)
/**
* Finalize and free devices in the device stack.
- *
+ *
* Finalize device stack by purging object cache, and calling
* lu_device_type_operations::ldto_device_fini() and
* lu_device_type_operations::ldto_device_free() on all devices in the stack.
};
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,
} else {
unsigned char *small_befider;
- small_befider = (char *)befider;
+ small_befider = (unsigned char *)befider;
small_befider[0] = seq >> 16;
small_befider[1] = seq >> 8;
case 6: {
const unsigned char *area;
- area = pack->fp_area;
+ area = (unsigned char *)pack->fp_area;
fid->f_seq = (area[0] << 16) | (area[1] << 8) | area[2];
fid->f_oid = (area[3] << 8) | area[4];
fid->f_ver = 0;