summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/fd.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-09-16 04:04:58 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-16 06:38:38 -0700
commit279fbb6f71f36b90480f19e5a98d0b1d27215733 (patch)
tree86801a1c9c37bd303433991595064a2e24ec4a55 /libglusterfs/src/fd.c
parent27d45ce245376cb012b0dd80dee6ccb26cc12645 (diff)
performance/write-behind: dump contents of wb-file
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.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 'libglusterfs/src/fd.c')
-rw-r--r--libglusterfs/src/fd.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 870c85e3f32..9e91cdb8341 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -806,3 +806,56 @@ fdtable_dump (fdtable_t *fdtable, char *prefix)
pthread_mutex_unlock(&fdtable->lock);
}
+
+
+void
+fd_ctx_dump (fd_t *fd, char *prefix)
+{
+ struct _fd_ctx *fd_ctx = NULL;
+ xlator_t *xl = NULL;
+ int i = 0;
+
+
+ if ((fd == NULL) || (fd->_ctx == NULL)) {
+ goto out;
+ }
+
+ LOCK (&fd->lock);
+ {
+ if (fd->_ctx != NULL) {
+ fd_ctx = GF_CALLOC (fd->inode->table->xl->graph->xl_count,
+ sizeof (*fd_ctx),
+ gf_common_mt_fd_ctx);
+ if (fd_ctx == NULL) {
+ gf_log ("fd", GF_LOG_ERROR, "out of memory");
+ goto unlock;
+ }
+
+ for (i = 0; i < fd->inode->table->xl->graph->xl_count;
+ i++) {
+ fd_ctx[i] = fd->_ctx[i];
+ }
+ }
+ }
+unlock:
+ UNLOCK (&fd->lock);
+
+ if (fd_ctx == NULL) {
+ goto out;
+ }
+
+ for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) {
+ if (fd_ctx[i].xl_key) {
+ xl = (xlator_t *)(long)fd_ctx[i].xl_key;
+ if (xl->dumpops && xl->dumpops->fdctx)
+ xl->dumpops->fdctx (xl, fd);
+ }
+ }
+
+out:
+ if (fd_ctx != NULL) {
+ GF_FREE (fd_ctx);
+ }
+
+ return;
+}