summaryrefslogtreecommitdiffstats
path: root/xlators/performance/quick-read/src
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-06-14 01:40:58 +0000
committerAnand Avati <avati@gluster.com>2011-06-14 22:37:25 -0700
commit837f172e8775c908cb90c14a956ed010d468a0ad (patch)
treefdc021f2a310e30da5c2a06444e64cab1d032b11 /xlators/performance/quick-read/src
parentdd4a0d45a91104117c0ad5de85deaabe6df88677 (diff)
performance/quick-read: dump inode and fdctx during statedump.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 1059 (enhancements for getting statistics from performance translators) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059
Diffstat (limited to 'xlators/performance/quick-read/src')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 90663337a70..88f7fd74b13 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -3092,6 +3092,130 @@ out:
}
+int32_t
+qr_inodectx_dump (xlator_t *this, inode_t *inode)
+{
+ qr_inode_t *qr_inode = NULL;
+ uint64_t value = 0;
+ int32_t ret = -1;
+ char key[GF_DUMP_MAX_BUF_LEN] = {0, };
+ char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
+ char buf[256] = {0, };
+ struct tm *tm = NULL;
+ ret = inode_ctx_get (inode, this, &value);
+ if (ret != 0) {
+ goto out;
+ }
+
+ qr_inode = (qr_inode_t *)(long)value;
+ if (qr_inode == NULL) {
+ goto out;
+ }
+
+ gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read",
+ "inodectx");
+ gf_proc_dump_add_section (key_prefix);
+
+ gf_proc_dump_build_key (key, key_prefix, "inode.gfid");
+ uuid_unparse (inode->gfid, buf);
+ gf_proc_dump_write (key, "%s", buf);
+
+ gf_proc_dump_build_key (key, key_prefix, "inode.ino");
+ gf_proc_dump_write (key, "%ld", inode->ino);
+
+ gf_proc_dump_build_key (key, key_prefix, "entire-file-cached");
+ gf_proc_dump_write (key, "%s", qr_inode->xattr ? "yes" : "no");
+
+ tm = localtime (&qr_inode->tv.tv_sec);
+ strftime (buf, 256, "%Y-%m-%d %H:%M:%S", tm);
+ snprintf (buf + strlen (buf), 256 - strlen (buf),
+ ".%"GF_PRI_SUSECONDS, qr_inode->tv.tv_usec);
+
+ gf_proc_dump_build_key (key, key_prefix, "last-cache-validation-time");
+ gf_proc_dump_write (key, "%s", buf);
+
+ ret = 0;
+out:
+ return ret;
+}
+
+int32_t
+qr_fdctx_dump (xlator_t *this, fd_t *fd)
+{
+ qr_fd_ctx_t *fdctx = NULL;
+ uint64_t value = 0;
+ int32_t ret = 0, i = 0;
+ char uuidbuf[256] = {0, };
+ char key[GF_DUMP_MAX_BUF_LEN] = {0, };
+ char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
+ call_stub_t *stub = NULL;
+
+ ret = fd_ctx_get (fd, this, &value);
+ if (ret != 0) {
+ goto out;
+ }
+
+ fdctx = (qr_fd_ctx_t *)(long)value;
+ if (fdctx == NULL) {
+ goto out;
+ }
+
+ gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read",
+ "fdctx");
+ gf_proc_dump_add_section (key_prefix);
+
+ gf_proc_dump_build_key (key, key_prefix, "fd");
+ gf_proc_dump_write (key, "%p", fd);
+
+ gf_proc_dump_build_key (key, key_prefix, "path");
+ gf_proc_dump_write (key, "%s", fdctx->path);
+
+ gf_proc_dump_build_key (key, key_prefix, "fd.inode.gfid");
+ uuid_unparse (fd->inode->gfid, uuidbuf);
+ gf_proc_dump_write (key, "%s", uuidbuf);
+
+ gf_proc_dump_build_key (key, key_prefix, "fd.inode.ino");
+ gf_proc_dump_write (key, "%ld", fd->inode->ino);
+
+ LOCK (&fdctx->lock);
+ {
+ gf_proc_dump_build_key (key, key_prefix, "opened");
+ gf_proc_dump_write (key, "%s", fdctx->opened ? "yes" : "no");
+
+ gf_proc_dump_build_key (key, key_prefix, "open-in-progress");
+ gf_proc_dump_write (key, "%s", fdctx->open_in_transit ?
+ "yes" : "no");
+
+ gf_proc_dump_build_key (key, key_prefix,
+ "caching-disabled (for this fd)");
+ gf_proc_dump_write (key, "%s", fdctx->disabled ? "yes" : "no");
+
+ gf_proc_dump_build_key (key, key_prefix, "flags");
+ gf_proc_dump_write (key, "%d", fdctx->flags);
+
+ gf_proc_dump_build_key (key, key_prefix, "wbflags");
+ gf_proc_dump_write (key, "%d", fdctx->wbflags);
+
+ list_for_each_entry (stub, &fdctx->waiting_ops, list) {
+ gf_proc_dump_build_key (key, key_prefix,
+ "waiting-ops[%d].frame", i);
+ gf_proc_dump_write (key, "%"PRId64,
+ stub->frame->root->unique);
+
+ gf_proc_dump_build_key (key, key_prefix,
+ "waiting-ops[%d].fop", i);
+ gf_proc_dump_write (key, "%s", gf_fop_list[stub->fop]);
+
+ i++;
+ }
+ }
+ UNLOCK (&fdctx->lock);
+
+ ret = 0;
+out:
+ return ret;
+}
+
int
qr_priv_dump (xlator_t *this)
{
@@ -3503,6 +3627,8 @@ struct xlator_cbks cbks = {
struct xlator_dumpops dumpops = {
.priv = qr_priv_dump,
+ .inodectx = qr_inodectx_dump,
+ .fdctx = qr_fdctx_dump
};
struct volume_options options[] = {