summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-07-15 05:13:27 +0000
committerAnand Avati <avati@gluster.com>2011-07-29 01:27:19 -0700
commit8bed407e822ab3ae3e5102012282affe06a4cdf6 (patch)
tree6664b9965b3149dfc092222c61f90e329ad1a0b7 /xlators
parenta31fe944e714f75dcd0f6d58d0776c1139548383 (diff)
performance/quick-read: dump inode and fdctx during statedump.
Change-Id: I8641e1f2e9e031c1b443821b16ef4a365926a8a8 BUG: 1059 Reviewed-on: http://review.gluster.com/50 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators')
-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 b97888f13..f894902ee 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -2854,6 +2854,130 @@ qr_forget (xlator_t *this, inode_t *inode)
}
+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)
{
@@ -3318,6 +3442,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[] = {