From f01626d5bad8eb0298897e90a124301008cdd0da Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sat, 29 Mar 2014 06:01:36 -0700 Subject: meta: export process state dump Various parts of process state dump are exposed through most appropriate virual files/dirs Change-Id: Iff30f8ea76552f2f6d9c98def688c5ec4bc6f2af BUG: 1089216 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/7542 Tested-by: Gluster Build System Reviewed-by: Harshavardhana --- xlators/meta/src/Makefile.am | 48 ++++++------ xlators/meta/src/active-link.c | 44 +++++++++++ xlators/meta/src/cmdline-file.c | 47 ++++++++++++ xlators/meta/src/frames-file.c | 96 ++++++++++++++++++++++++ xlators/meta/src/graph-dir.c | 106 +++++++++++++++++++++++++++ xlators/meta/src/graphs-dir.c | 79 ++++++++++++++++++++ xlators/meta/src/history-file.c | 52 +++++++++++++ xlators/meta/src/logfile-link.c | 44 +++++++++++ xlators/meta/src/logging-dir.c | 51 +++++++++++++ xlators/meta/src/loglevel-file.c | 93 +++++++++++++++++++++++ xlators/meta/src/mallinfo-file.c | 44 +++++++++++ xlators/meta/src/measure-file.c | 92 +++++++++++++++++++++++ xlators/meta/src/meminfo-file.c | 52 +++++++++++++ xlators/meta/src/meta-defaults.c | 2 +- xlators/meta/src/meta-hooks.h | 7 ++ xlators/meta/src/name-file.c | 53 ++++++++++++++ xlators/meta/src/option-file.c | 56 ++++++++++++++ xlators/meta/src/options-dir.c | 76 +++++++++++++++++++ xlators/meta/src/plugins/active-link.c | 44 ----------- xlators/meta/src/plugins/cmdline-file.c | 47 ------------ xlators/meta/src/plugins/frames-file.c | 96 ------------------------ xlators/meta/src/plugins/graph-dir.c | 106 --------------------------- xlators/meta/src/plugins/graphs-dir.c | 79 -------------------- xlators/meta/src/plugins/logfile-link.c | 44 ----------- xlators/meta/src/plugins/logging-dir.c | 51 ------------- xlators/meta/src/plugins/loglevel-file.c | 93 ----------------------- xlators/meta/src/plugins/name-file.c | 53 -------------- xlators/meta/src/plugins/option-file.c | 56 -------------- xlators/meta/src/plugins/options-dir.c | 76 ------------------- xlators/meta/src/plugins/process_uuid-file.c | 46 ------------ xlators/meta/src/plugins/root-dir.c | 67 ----------------- xlators/meta/src/plugins/subvolume-link.c | 66 ----------------- xlators/meta/src/plugins/subvolumes-dir.c | 72 ------------------ xlators/meta/src/plugins/top-link.c | 50 ------------- xlators/meta/src/plugins/type-file.c | 53 -------------- xlators/meta/src/plugins/version-file.c | 46 ------------ xlators/meta/src/plugins/view-dir.c | 45 ------------ xlators/meta/src/plugins/volfile-file.c | 91 ----------------------- xlators/meta/src/plugins/xlator-dir.c | 72 ------------------ xlators/meta/src/private-file.c | 52 +++++++++++++ xlators/meta/src/process_uuid-file.c | 46 ++++++++++++ xlators/meta/src/profile-file.c | 52 +++++++++++++ xlators/meta/src/root-dir.c | 79 ++++++++++++++++++++ xlators/meta/src/subvolume-link.c | 66 +++++++++++++++++ xlators/meta/src/subvolumes-dir.c | 72 ++++++++++++++++++ xlators/meta/src/top-link.c | 50 +++++++++++++ xlators/meta/src/type-file.c | 53 ++++++++++++++ xlators/meta/src/version-file.c | 46 ++++++++++++ xlators/meta/src/view-dir.c | 45 ++++++++++++ xlators/meta/src/volfile-file.c | 91 +++++++++++++++++++++++ xlators/meta/src/xlator-dir.c | 100 +++++++++++++++++++++++++ 51 files changed, 1772 insertions(+), 1375 deletions(-) create mode 100644 xlators/meta/src/active-link.c create mode 100644 xlators/meta/src/cmdline-file.c create mode 100644 xlators/meta/src/frames-file.c create mode 100644 xlators/meta/src/graph-dir.c create mode 100644 xlators/meta/src/graphs-dir.c create mode 100644 xlators/meta/src/history-file.c create mode 100644 xlators/meta/src/logfile-link.c create mode 100644 xlators/meta/src/logging-dir.c create mode 100644 xlators/meta/src/loglevel-file.c create mode 100644 xlators/meta/src/mallinfo-file.c create mode 100644 xlators/meta/src/measure-file.c create mode 100644 xlators/meta/src/meminfo-file.c create mode 100644 xlators/meta/src/name-file.c create mode 100644 xlators/meta/src/option-file.c create mode 100644 xlators/meta/src/options-dir.c delete mode 100644 xlators/meta/src/plugins/active-link.c delete mode 100644 xlators/meta/src/plugins/cmdline-file.c delete mode 100644 xlators/meta/src/plugins/frames-file.c delete mode 100644 xlators/meta/src/plugins/graph-dir.c delete mode 100644 xlators/meta/src/plugins/graphs-dir.c delete mode 100644 xlators/meta/src/plugins/logfile-link.c delete mode 100644 xlators/meta/src/plugins/logging-dir.c delete mode 100644 xlators/meta/src/plugins/loglevel-file.c delete mode 100644 xlators/meta/src/plugins/name-file.c delete mode 100644 xlators/meta/src/plugins/option-file.c delete mode 100644 xlators/meta/src/plugins/options-dir.c delete mode 100644 xlators/meta/src/plugins/process_uuid-file.c delete mode 100644 xlators/meta/src/plugins/root-dir.c delete mode 100644 xlators/meta/src/plugins/subvolume-link.c delete mode 100644 xlators/meta/src/plugins/subvolumes-dir.c delete mode 100644 xlators/meta/src/plugins/top-link.c delete mode 100644 xlators/meta/src/plugins/type-file.c delete mode 100644 xlators/meta/src/plugins/version-file.c delete mode 100644 xlators/meta/src/plugins/view-dir.c delete mode 100644 xlators/meta/src/plugins/volfile-file.c delete mode 100644 xlators/meta/src/plugins/xlator-dir.c create mode 100644 xlators/meta/src/private-file.c create mode 100644 xlators/meta/src/process_uuid-file.c create mode 100644 xlators/meta/src/profile-file.c create mode 100644 xlators/meta/src/root-dir.c create mode 100644 xlators/meta/src/subvolume-link.c create mode 100644 xlators/meta/src/subvolumes-dir.c create mode 100644 xlators/meta/src/top-link.c create mode 100644 xlators/meta/src/type-file.c create mode 100644 xlators/meta/src/version-file.c create mode 100644 xlators/meta/src/view-dir.c create mode 100644 xlators/meta/src/volfile-file.c create mode 100644 xlators/meta/src/xlator-dir.c (limited to 'xlators') diff --git a/xlators/meta/src/Makefile.am b/xlators/meta/src/Makefile.am index 530fea9792b..b705e86b60a 100644 --- a/xlators/meta/src/Makefile.am +++ b/xlators/meta/src/Makefile.am @@ -4,27 +4,33 @@ xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator meta_la_LDFLAGS = -module -avoid-version meta_la_SOURCES = meta.c meta-helpers.c meta-defaults.c \ - plugins/root-dir.c \ - plugins/graphs-dir.c \ - plugins/frames-file.c \ - plugins/graph-dir.c \ - plugins/active-link.c \ - plugins/xlator-dir.c \ - plugins/top-link.c \ - plugins/logging-dir.c \ - plugins/logfile-link.c \ - plugins/loglevel-file.c \ - plugins/process_uuid-file.c \ - plugins/volfile-file.c \ - plugins/view-dir.c \ - plugins/subvolumes-dir.c \ - plugins/subvolume-link.c \ - plugins/type-file.c \ - plugins/version-file.c \ - plugins/options-dir.c \ - plugins/option-file.c \ - plugins/cmdline-file.c \ - plugins/name-file.c + root-dir.c \ + graphs-dir.c \ + frames-file.c \ + graph-dir.c \ + active-link.c \ + xlator-dir.c \ + top-link.c \ + logging-dir.c \ + logfile-link.c \ + loglevel-file.c \ + process_uuid-file.c \ + volfile-file.c \ + view-dir.c \ + subvolumes-dir.c \ + subvolume-link.c \ + type-file.c \ + version-file.c \ + options-dir.c \ + option-file.c \ + cmdline-file.c \ + name-file.c \ + private-file.c \ + history-file.c \ + mallinfo-file.c \ + meminfo-file.c \ + measure-file.c \ + profile-file.c meta_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la diff --git a/xlators/meta/src/active-link.c b/xlators/meta/src/active-link.c new file mode 100644 index 00000000000..99d38597bdf --- /dev/null +++ b/xlators/meta/src/active-link.c @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" + + +static int +active_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) +{ + strprintf (strfd, "%s", this->ctx->active->graph_uuid); + + return 0; +} + + +struct meta_ops active_link_ops = { + .link_fill = active_link_fill +}; + + +int +meta_active_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &active_link_ops); + + return 0; +} diff --git a/xlators/meta/src/cmdline-file.c b/xlators/meta/src/cmdline-file.c new file mode 100644 index 00000000000..1eded6d19b8 --- /dev/null +++ b/xlators/meta/src/cmdline-file.c @@ -0,0 +1,47 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +cmdline_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + if (this->ctx->cmdlinestr) + strprintf (strfd, "%s\n", this->ctx->cmdlinestr); + return strfd->size; +} + + +static struct meta_ops cmdline_file_ops = { + .file_fill = cmdline_file_fill, +}; + + +int +meta_cmdline_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &cmdline_file_ops); + + return 0; +} diff --git a/xlators/meta/src/frames-file.c b/xlators/meta/src/frames-file.c new file mode 100644 index 00000000000..0c3b9a2eb71 --- /dev/null +++ b/xlators/meta/src/frames-file.c @@ -0,0 +1,96 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +frames_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + struct call_pool *pool = NULL; + call_stack_t *stack = NULL; + call_frame_t *frame = NULL; + int i = 0; + int j = 0; + + pool = this->ctx->pool; + + LOCK (&pool->lock); + { + strprintf (strfd, "Call_Count: %d\n", (int)pool->cnt); + + list_for_each_entry (stack, &pool->all_frames, all_frames) { + strprintf (strfd, "== Stack %d ==\n", i++); + strprintf (strfd, "Unique: %"PRId64"\n", stack->unique); + strprintf (strfd, "Type: %s\n", gf_fop_list[stack->op]); + strprintf (strfd, "UID: %d\n", stack->uid); + strprintf (strfd, "GID: %d\n", stack->gid); + strprintf (strfd, "LK_owner: %s\n", + lkowner_utoa (&stack->lk_owner)); + + j = 0; + for (frame = &stack->frames; frame; frame = frame->next) { + strprintf (strfd, "\t-- Frame %d --\n", j++); + strprintf (strfd, "\tXlator: %s\n", frame->this->name); + if (frame->begin.tv_sec) + strprintf (strfd, "\tCreation_time: %d.%d\n", + (int)frame->begin.tv_sec, + (int)frame->begin.tv_usec); + strprintf (strfd, "\tRefcount: %d\n", frame->ref_count); + strprintf (strfd, "\tComplete: %d\n", frame->complete); + if (frame->parent) + strprintf (strfd, "\tParent: %s\n", + frame->parent->this->name); + if (frame->wind_from) + strprintf (strfd, "\tWind_from: %s\n", + frame->wind_from); + if (frame->wind_to) + strprintf (strfd, "\tWind_to: %s\n", + frame->wind_to); + if (frame->unwind_from) + strprintf (strfd, "\tUnwind_from: %s\n", + frame->unwind_from); + if (frame->unwind_to) + strprintf (strfd, "\tUnwind_to: %s\n", + frame->unwind_to); + } + } + } + UNLOCK (&pool->lock); + + return strfd->size; +} + + +static struct meta_ops frames_file_ops = { + .file_fill = frames_file_fill, +}; + + +int +meta_frames_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &frames_file_ops); + + return 0; +} diff --git a/xlators/meta/src/graph-dir.c b/xlators/meta/src/graph-dir.c new file mode 100644 index 00000000000..3cd6b482e74 --- /dev/null +++ b/xlators/meta/src/graph-dir.c @@ -0,0 +1,106 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent graph_dir_dirents[] = { + DOT_DOTDOT, + + { .name = "top", + .type = IA_IFLNK, + .hook = meta_top_link_hook, + }, + { .name = "volfile", + .type = IA_IFREG, + .hook = meta_volfile_file_hook, + }, + { .name = NULL } +}; + + +static int +graph_dir_fill (xlator_t *this, inode_t *inode, struct meta_dirent **dp) +{ + struct meta_dirent *dirents = NULL; + glusterfs_graph_t *graph = NULL; + int i = 0; + int count = 0; + xlator_t *xl = NULL; + + graph = meta_ctx_get (inode, this); + + for (xl = graph->first; xl; xl = xl->next) + count++; + + dirents = GF_CALLOC (sizeof (*dirents), count, gf_meta_mt_dirents_t); + if (!dirents) + return -1; + + i = 0; + for (xl = graph->first; xl; xl = xl->next) { + dirents[i].name = gf_strdup (xl->name); + dirents[i].type = IA_IFDIR; + dirents[i].hook = meta_xlator_dir_hook; + i++; + } + + *dp = dirents; + return i; +} + + +struct meta_ops graph_dir_ops = { + .fixed_dirents = graph_dir_dirents, + .dir_fill = graph_dir_fill, +}; + + +static glusterfs_graph_t * +glusterfs_graph_lookup (xlator_t *this, const char *graph_uuid) +{ + glusterfs_graph_t *graph = NULL; + glusterfs_graph_t *tmp = NULL; + + list_for_each_entry (tmp, &this->ctx->graphs, list) { + if (strcmp (graph_uuid, tmp->graph_uuid) == 0) { + graph = tmp; + break; + } + } + + return graph; +} + + +int +meta_graph_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + glusterfs_graph_t *graph = NULL; + + graph = glusterfs_graph_lookup (this, loc->name); + + meta_ops_set (loc->inode, this, &graph_dir_ops); + + meta_ctx_set (loc->inode, this, (void *) graph); + + return 0; +} diff --git a/xlators/meta/src/graphs-dir.c b/xlators/meta/src/graphs-dir.c new file mode 100644 index 00000000000..4a538fb6176 --- /dev/null +++ b/xlators/meta/src/graphs-dir.c @@ -0,0 +1,79 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent graphs_dir_dirents[] = { + DOT_DOTDOT, + + { .name = "active", + .type = IA_IFLNK, + .hook = meta_active_link_hook, + }, + { .name = NULL } +}; + + +static int +graphs_dir_fill (xlator_t *this, inode_t *dir, struct meta_dirent **dp) +{ + glusterfs_graph_t *graph = NULL; + int graphs_count = 0; + int i = 0; + struct meta_dirent *dirents = NULL; + + list_for_each_entry (graph, &this->ctx->graphs, list) { + graphs_count++; + } + + dirents = GF_CALLOC (sizeof (*dirents), graphs_count + 3, + gf_meta_mt_dirents_t); + if (!dirents) + return -1; + + i = 0; + list_for_each_entry (graph, &this->ctx->graphs, list) { + dirents[i].name = gf_strdup (graph->graph_uuid); + dirents[i].type = IA_IFDIR; + dirents[i].hook = meta_graph_dir_hook; + i++; + } + + *dp = dirents; + + return i; +} + + +struct meta_ops graphs_dir_ops = { + .fixed_dirents = graphs_dir_dirents, + .dir_fill = graphs_dir_fill +}; + + +int +meta_graphs_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &graphs_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/history-file.c b/xlators/meta/src/history-file.c new file mode 100644 index 00000000000..d88040fe58f --- /dev/null +++ b/xlators/meta/src/history-file.c @@ -0,0 +1,52 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "statedump.h" + + +static int +history_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + gf_proc_dump_xlator_history (xl, strfd); + + return strfd->size; +} + + +static struct meta_ops history_file_ops = { + .file_fill = history_file_fill, +}; + + +int +meta_history_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &history_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/logfile-link.c b/xlators/meta/src/logfile-link.c new file mode 100644 index 00000000000..435cab80c33 --- /dev/null +++ b/xlators/meta/src/logfile-link.c @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" + + +static int +logfile_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) +{ + strprintf (strfd, "%s", this->ctx->log.filename); + + return 0; +} + + +struct meta_ops logfile_link_ops = { + .link_fill = logfile_link_fill +}; + + +int +meta_logfile_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &logfile_link_ops); + + return 0; +} diff --git a/xlators/meta/src/logging-dir.c b/xlators/meta/src/logging-dir.c new file mode 100644 index 00000000000..783d38e8e12 --- /dev/null +++ b/xlators/meta/src/logging-dir.c @@ -0,0 +1,51 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent logging_dir_dirents[] = { + DOT_DOTDOT, + + { .name = "logfile", + .type = IA_IFLNK, + .hook = meta_logfile_link_hook, + }, + { .name = "loglevel", + .type = IA_IFREG, + .hook = meta_loglevel_file_hook, + }, + { .name = NULL } +}; + + +struct meta_ops logging_dir_ops = { + .fixed_dirents = logging_dir_dirents, +}; + + +int +meta_logging_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &logging_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/loglevel-file.c b/xlators/meta/src/loglevel-file.c new file mode 100644 index 00000000000..24ac68ddc69 --- /dev/null +++ b/xlators/meta/src/loglevel-file.c @@ -0,0 +1,93 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" + + +static int +loglevel_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + strprintf (strfd, "%d\n", this->ctx->log.loglevel); + + return strfd->size; +} + + +static int +loglevel_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, + struct iovec *iov, int count, off_t offset, + uint32_t flags, struct iobref *iobref, dict_t *xdata) +{ + struct iatt dummy = { }; + long int level = -1; + + level = strtol (iov[0].iov_base, NULL, 0); + if (level >= GF_LOG_NONE && level <= GF_LOG_TRACE) + gf_log_set_loglevel (level); + + META_STACK_UNWIND (writev, frame, iov_length (iov, count), 0, + &dummy, &dummy, xdata); + return 0; +} + + +int +loglevel_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, + off_t offset, dict_t *xdata) +{ + struct iatt iatt = { }; + + meta_iatt_fill (&iatt, loc->inode, IA_IFREG); + + META_STACK_UNWIND (truncate, frame, 0, 0, &iatt, &iatt, xdata); + return 0; +} + + +int +loglevel_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, + off_t offset, dict_t *xdata) +{ + struct iatt iatt = { }; + + meta_iatt_fill (&iatt, fd->inode, IA_IFREG); + + META_STACK_UNWIND (ftruncate, frame, 0, 0, &iatt, &iatt, xdata); + return 0; +} + +static struct meta_ops loglevel_file_ops = { + .file_fill = loglevel_file_fill, + .fops = { + .truncate = loglevel_truncate, + .ftruncate = loglevel_ftruncate, + .writev = loglevel_writev + } +}; + + +int +meta_loglevel_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &loglevel_file_ops); + + return 0; +} diff --git a/xlators/meta/src/mallinfo-file.c b/xlators/meta/src/mallinfo-file.c new file mode 100644 index 00000000000..38589f515ff --- /dev/null +++ b/xlators/meta/src/mallinfo-file.c @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "statedump.h" + + +static int +mallinfo_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + gf_proc_dump_mallinfo (strfd); + return strfd->size; +} + + +static struct meta_ops mallinfo_file_ops = { + .file_fill = mallinfo_file_fill, +}; + + +int +meta_mallinfo_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &mallinfo_file_ops); + + return 0; +} diff --git a/xlators/meta/src/measure-file.c b/xlators/meta/src/measure-file.c new file mode 100644 index 00000000000..ccc78232dfe --- /dev/null +++ b/xlators/meta/src/measure-file.c @@ -0,0 +1,92 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" + + +static int +measure_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + strprintf (strfd, "%d\n", this->ctx->measure_latency); + + return strfd->size; +} + + +static int +measure_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, + struct iovec *iov, int count, off_t offset, + uint32_t flags, struct iobref *iobref, dict_t *xdata) +{ + struct iatt dummy = { }; + long int num = -1; + + num = strtol (iov[0].iov_base, NULL, 0); + this->ctx->measure_latency = !!num; + + META_STACK_UNWIND (writev, frame, iov_length (iov, count), 0, + &dummy, &dummy, xdata); + return 0; +} + + +int +measure_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, + off_t offset, dict_t *xdata) +{ + struct iatt iatt = { }; + + meta_iatt_fill (&iatt, loc->inode, IA_IFREG); + + META_STACK_UNWIND (truncate, frame, 0, 0, &iatt, &iatt, xdata); + return 0; +} + + +int +measure_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, + off_t offset, dict_t *xdata) +{ + struct iatt iatt = { }; + + meta_iatt_fill (&iatt, fd->inode, IA_IFREG); + + META_STACK_UNWIND (ftruncate, frame, 0, 0, &iatt, &iatt, xdata); + return 0; +} + +static struct meta_ops measure_file_ops = { + .file_fill = measure_file_fill, + .fops = { + .truncate = measure_truncate, + .ftruncate = measure_ftruncate, + .writev = measure_writev + } +}; + + +int +meta_measure_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &measure_file_ops); + + return 0; +} diff --git a/xlators/meta/src/meminfo-file.c b/xlators/meta/src/meminfo-file.c new file mode 100644 index 00000000000..807446cfdc4 --- /dev/null +++ b/xlators/meta/src/meminfo-file.c @@ -0,0 +1,52 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "statedump.h" + + +static int +meminfo_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + gf_proc_dump_xlator_meminfo (xl, strfd); + + return strfd->size; +} + + +static struct meta_ops meminfo_file_ops = { + .file_fill = meminfo_file_fill, +}; + + +int +meta_meminfo_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &meminfo_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/meta-defaults.c b/xlators/meta/src/meta-defaults.c index f2b637fa28a..905b38554a0 100644 --- a/xlators/meta/src/meta-defaults.c +++ b/xlators/meta/src/meta-defaults.c @@ -138,7 +138,7 @@ meta_default_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, iov.iov_base = iobuf_ptr (iobuf); copy_offset = min (meta_fd->size, offset); - copy_size = min (size, meta_fd->size) - copy_offset; + copy_size = min (size, (meta_fd->size - copy_offset)); if (copy_size) memcpy (iov.iov_base, meta_fd->data + copy_offset, copy_size); diff --git a/xlators/meta/src/meta-hooks.h b/xlators/meta/src/meta-hooks.h index f8ce3b61e4c..bcf3643d223 100644 --- a/xlators/meta/src/meta-hooks.h +++ b/xlators/meta/src/meta-hooks.h @@ -35,5 +35,12 @@ DECLARE_HOOK(options_dir); DECLARE_HOOK(option_file); DECLARE_HOOK(cmdline_file); DECLARE_HOOK(name_file); +DECLARE_HOOK(private_file); +DECLARE_HOOK(mallinfo_file); +DECLARE_HOOK(history_file); +DECLARE_HOOK(master_dir); +DECLARE_HOOK(meminfo_file); +DECLARE_HOOK(measure_file); +DECLARE_HOOK(profile_file); #endif diff --git a/xlators/meta/src/name-file.c b/xlators/meta/src/name-file.c new file mode 100644 index 00000000000..8ddd42945d7 --- /dev/null +++ b/xlators/meta/src/name-file.c @@ -0,0 +1,53 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +name_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + strprintf (strfd, "%s\n", xl->name); + + return strfd->size; +} + + +static struct meta_ops name_file_ops = { + .file_fill = name_file_fill, +}; + + +int +meta_name_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &name_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/option-file.c b/xlators/meta/src/option-file.c new file mode 100644 index 00000000000..4f9067e1490 --- /dev/null +++ b/xlators/meta/src/option-file.c @@ -0,0 +1,56 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static int +option_file_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) +{ + data_t *data = NULL; + + data = meta_ctx_get (inode, this); + + strprintf (strfd, "%s\n", data_to_str (data)); + + return strfd->size; +} + + +static struct meta_ops option_file_ops = { + .file_fill = option_file_fill +}; + + +int +meta_option_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (loc->parent, this); + + meta_ctx_set (loc->inode, this, + dict_get (xl->options, (char *) loc->name)); + + meta_ops_set (loc->inode, this, &option_file_ops); + + return 0; +} diff --git a/xlators/meta/src/options-dir.c b/xlators/meta/src/options-dir.c new file mode 100644 index 00000000000..229d365a9c7 --- /dev/null +++ b/xlators/meta/src/options-dir.c @@ -0,0 +1,76 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static int +dict_key_add (dict_t *dict, char *key, data_t *value, void *data) +{ + struct meta_dirent **direntp = data; + + (*direntp)->name = gf_strdup (key); + (*direntp)->type = IA_IFREG; + (*direntp)->hook = meta_option_file_hook; + + (*direntp)++; + return 0; +} + + +static int +options_dir_fill (xlator_t *this, inode_t *inode, struct meta_dirent **dp) +{ + struct meta_dirent *dirent = NULL; + struct meta_dirent *direntp = NULL; + xlator_t *xl = NULL; + + xl = meta_ctx_get (inode, this); + + dirent = GF_CALLOC (sizeof (*dirent), xl->options->count, + gf_meta_mt_dirents_t); + if (!dirent) + return -1; + + direntp = dirent; + + dict_foreach (xl->options, dict_key_add, &direntp); + + *dp = dirent; + + return xl->options->count; +} + + +static struct meta_ops options_dir_ops = { + .dir_fill = options_dir_fill +}; + + +int +meta_options_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + meta_ops_set (loc->inode, this, &options_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/plugins/active-link.c b/xlators/meta/src/plugins/active-link.c deleted file mode 100644 index 99d38597bdf..00000000000 --- a/xlators/meta/src/plugins/active-link.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" - - -static int -active_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) -{ - strprintf (strfd, "%s", this->ctx->active->graph_uuid); - - return 0; -} - - -struct meta_ops active_link_ops = { - .link_fill = active_link_fill -}; - - -int -meta_active_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &active_link_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/cmdline-file.c b/xlators/meta/src/plugins/cmdline-file.c deleted file mode 100644 index 1eded6d19b8..00000000000 --- a/xlators/meta/src/plugins/cmdline-file.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -cmdline_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - if (this->ctx->cmdlinestr) - strprintf (strfd, "%s\n", this->ctx->cmdlinestr); - return strfd->size; -} - - -static struct meta_ops cmdline_file_ops = { - .file_fill = cmdline_file_fill, -}; - - -int -meta_cmdline_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &cmdline_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/frames-file.c b/xlators/meta/src/plugins/frames-file.c deleted file mode 100644 index 0c3b9a2eb71..00000000000 --- a/xlators/meta/src/plugins/frames-file.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -frames_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - struct call_pool *pool = NULL; - call_stack_t *stack = NULL; - call_frame_t *frame = NULL; - int i = 0; - int j = 0; - - pool = this->ctx->pool; - - LOCK (&pool->lock); - { - strprintf (strfd, "Call_Count: %d\n", (int)pool->cnt); - - list_for_each_entry (stack, &pool->all_frames, all_frames) { - strprintf (strfd, "== Stack %d ==\n", i++); - strprintf (strfd, "Unique: %"PRId64"\n", stack->unique); - strprintf (strfd, "Type: %s\n", gf_fop_list[stack->op]); - strprintf (strfd, "UID: %d\n", stack->uid); - strprintf (strfd, "GID: %d\n", stack->gid); - strprintf (strfd, "LK_owner: %s\n", - lkowner_utoa (&stack->lk_owner)); - - j = 0; - for (frame = &stack->frames; frame; frame = frame->next) { - strprintf (strfd, "\t-- Frame %d --\n", j++); - strprintf (strfd, "\tXlator: %s\n", frame->this->name); - if (frame->begin.tv_sec) - strprintf (strfd, "\tCreation_time: %d.%d\n", - (int)frame->begin.tv_sec, - (int)frame->begin.tv_usec); - strprintf (strfd, "\tRefcount: %d\n", frame->ref_count); - strprintf (strfd, "\tComplete: %d\n", frame->complete); - if (frame->parent) - strprintf (strfd, "\tParent: %s\n", - frame->parent->this->name); - if (frame->wind_from) - strprintf (strfd, "\tWind_from: %s\n", - frame->wind_from); - if (frame->wind_to) - strprintf (strfd, "\tWind_to: %s\n", - frame->wind_to); - if (frame->unwind_from) - strprintf (strfd, "\tUnwind_from: %s\n", - frame->unwind_from); - if (frame->unwind_to) - strprintf (strfd, "\tUnwind_to: %s\n", - frame->unwind_to); - } - } - } - UNLOCK (&pool->lock); - - return strfd->size; -} - - -static struct meta_ops frames_file_ops = { - .file_fill = frames_file_fill, -}; - - -int -meta_frames_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &frames_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/graph-dir.c b/xlators/meta/src/plugins/graph-dir.c deleted file mode 100644 index 3cd6b482e74..00000000000 --- a/xlators/meta/src/plugins/graph-dir.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent graph_dir_dirents[] = { - DOT_DOTDOT, - - { .name = "top", - .type = IA_IFLNK, - .hook = meta_top_link_hook, - }, - { .name = "volfile", - .type = IA_IFREG, - .hook = meta_volfile_file_hook, - }, - { .name = NULL } -}; - - -static int -graph_dir_fill (xlator_t *this, inode_t *inode, struct meta_dirent **dp) -{ - struct meta_dirent *dirents = NULL; - glusterfs_graph_t *graph = NULL; - int i = 0; - int count = 0; - xlator_t *xl = NULL; - - graph = meta_ctx_get (inode, this); - - for (xl = graph->first; xl; xl = xl->next) - count++; - - dirents = GF_CALLOC (sizeof (*dirents), count, gf_meta_mt_dirents_t); - if (!dirents) - return -1; - - i = 0; - for (xl = graph->first; xl; xl = xl->next) { - dirents[i].name = gf_strdup (xl->name); - dirents[i].type = IA_IFDIR; - dirents[i].hook = meta_xlator_dir_hook; - i++; - } - - *dp = dirents; - return i; -} - - -struct meta_ops graph_dir_ops = { - .fixed_dirents = graph_dir_dirents, - .dir_fill = graph_dir_fill, -}; - - -static glusterfs_graph_t * -glusterfs_graph_lookup (xlator_t *this, const char *graph_uuid) -{ - glusterfs_graph_t *graph = NULL; - glusterfs_graph_t *tmp = NULL; - - list_for_each_entry (tmp, &this->ctx->graphs, list) { - if (strcmp (graph_uuid, tmp->graph_uuid) == 0) { - graph = tmp; - break; - } - } - - return graph; -} - - -int -meta_graph_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - glusterfs_graph_t *graph = NULL; - - graph = glusterfs_graph_lookup (this, loc->name); - - meta_ops_set (loc->inode, this, &graph_dir_ops); - - meta_ctx_set (loc->inode, this, (void *) graph); - - return 0; -} diff --git a/xlators/meta/src/plugins/graphs-dir.c b/xlators/meta/src/plugins/graphs-dir.c deleted file mode 100644 index 4a538fb6176..00000000000 --- a/xlators/meta/src/plugins/graphs-dir.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent graphs_dir_dirents[] = { - DOT_DOTDOT, - - { .name = "active", - .type = IA_IFLNK, - .hook = meta_active_link_hook, - }, - { .name = NULL } -}; - - -static int -graphs_dir_fill (xlator_t *this, inode_t *dir, struct meta_dirent **dp) -{ - glusterfs_graph_t *graph = NULL; - int graphs_count = 0; - int i = 0; - struct meta_dirent *dirents = NULL; - - list_for_each_entry (graph, &this->ctx->graphs, list) { - graphs_count++; - } - - dirents = GF_CALLOC (sizeof (*dirents), graphs_count + 3, - gf_meta_mt_dirents_t); - if (!dirents) - return -1; - - i = 0; - list_for_each_entry (graph, &this->ctx->graphs, list) { - dirents[i].name = gf_strdup (graph->graph_uuid); - dirents[i].type = IA_IFDIR; - dirents[i].hook = meta_graph_dir_hook; - i++; - } - - *dp = dirents; - - return i; -} - - -struct meta_ops graphs_dir_ops = { - .fixed_dirents = graphs_dir_dirents, - .dir_fill = graphs_dir_fill -}; - - -int -meta_graphs_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &graphs_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/logfile-link.c b/xlators/meta/src/plugins/logfile-link.c deleted file mode 100644 index 435cab80c33..00000000000 --- a/xlators/meta/src/plugins/logfile-link.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" - - -static int -logfile_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) -{ - strprintf (strfd, "%s", this->ctx->log.filename); - - return 0; -} - - -struct meta_ops logfile_link_ops = { - .link_fill = logfile_link_fill -}; - - -int -meta_logfile_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &logfile_link_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/logging-dir.c b/xlators/meta/src/plugins/logging-dir.c deleted file mode 100644 index 783d38e8e12..00000000000 --- a/xlators/meta/src/plugins/logging-dir.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent logging_dir_dirents[] = { - DOT_DOTDOT, - - { .name = "logfile", - .type = IA_IFLNK, - .hook = meta_logfile_link_hook, - }, - { .name = "loglevel", - .type = IA_IFREG, - .hook = meta_loglevel_file_hook, - }, - { .name = NULL } -}; - - -struct meta_ops logging_dir_ops = { - .fixed_dirents = logging_dir_dirents, -}; - - -int -meta_logging_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &logging_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/loglevel-file.c b/xlators/meta/src/plugins/loglevel-file.c deleted file mode 100644 index 24ac68ddc69..00000000000 --- a/xlators/meta/src/plugins/loglevel-file.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" - - -static int -loglevel_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - strprintf (strfd, "%d\n", this->ctx->log.loglevel); - - return strfd->size; -} - - -static int -loglevel_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iovec *iov, int count, off_t offset, - uint32_t flags, struct iobref *iobref, dict_t *xdata) -{ - struct iatt dummy = { }; - long int level = -1; - - level = strtol (iov[0].iov_base, NULL, 0); - if (level >= GF_LOG_NONE && level <= GF_LOG_TRACE) - gf_log_set_loglevel (level); - - META_STACK_UNWIND (writev, frame, iov_length (iov, count), 0, - &dummy, &dummy, xdata); - return 0; -} - - -int -loglevel_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, - off_t offset, dict_t *xdata) -{ - struct iatt iatt = { }; - - meta_iatt_fill (&iatt, loc->inode, IA_IFREG); - - META_STACK_UNWIND (truncate, frame, 0, 0, &iatt, &iatt, xdata); - return 0; -} - - -int -loglevel_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, dict_t *xdata) -{ - struct iatt iatt = { }; - - meta_iatt_fill (&iatt, fd->inode, IA_IFREG); - - META_STACK_UNWIND (ftruncate, frame, 0, 0, &iatt, &iatt, xdata); - return 0; -} - -static struct meta_ops loglevel_file_ops = { - .file_fill = loglevel_file_fill, - .fops = { - .truncate = loglevel_truncate, - .ftruncate = loglevel_ftruncate, - .writev = loglevel_writev - } -}; - - -int -meta_loglevel_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &loglevel_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/name-file.c b/xlators/meta/src/plugins/name-file.c deleted file mode 100644 index 8ddd42945d7..00000000000 --- a/xlators/meta/src/plugins/name-file.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -name_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - xlator_t *xl = NULL; - - xl = meta_ctx_get (file, this); - - strprintf (strfd, "%s\n", xl->name); - - return strfd->size; -} - - -static struct meta_ops name_file_ops = { - .file_fill = name_file_fill, -}; - - -int -meta_name_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &name_file_ops); - - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - return 0; -} diff --git a/xlators/meta/src/plugins/option-file.c b/xlators/meta/src/plugins/option-file.c deleted file mode 100644 index 4f9067e1490..00000000000 --- a/xlators/meta/src/plugins/option-file.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static int -option_file_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) -{ - data_t *data = NULL; - - data = meta_ctx_get (inode, this); - - strprintf (strfd, "%s\n", data_to_str (data)); - - return strfd->size; -} - - -static struct meta_ops option_file_ops = { - .file_fill = option_file_fill -}; - - -int -meta_option_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - xlator_t *xl = NULL; - - xl = meta_ctx_get (loc->parent, this); - - meta_ctx_set (loc->inode, this, - dict_get (xl->options, (char *) loc->name)); - - meta_ops_set (loc->inode, this, &option_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/options-dir.c b/xlators/meta/src/plugins/options-dir.c deleted file mode 100644 index 229d365a9c7..00000000000 --- a/xlators/meta/src/plugins/options-dir.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static int -dict_key_add (dict_t *dict, char *key, data_t *value, void *data) -{ - struct meta_dirent **direntp = data; - - (*direntp)->name = gf_strdup (key); - (*direntp)->type = IA_IFREG; - (*direntp)->hook = meta_option_file_hook; - - (*direntp)++; - return 0; -} - - -static int -options_dir_fill (xlator_t *this, inode_t *inode, struct meta_dirent **dp) -{ - struct meta_dirent *dirent = NULL; - struct meta_dirent *direntp = NULL; - xlator_t *xl = NULL; - - xl = meta_ctx_get (inode, this); - - dirent = GF_CALLOC (sizeof (*dirent), xl->options->count, - gf_meta_mt_dirents_t); - if (!dirent) - return -1; - - direntp = dirent; - - dict_foreach (xl->options, dict_key_add, &direntp); - - *dp = dirent; - - return xl->options->count; -} - - -static struct meta_ops options_dir_ops = { - .dir_fill = options_dir_fill -}; - - -int -meta_options_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - meta_ops_set (loc->inode, this, &options_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/process_uuid-file.c b/xlators/meta/src/plugins/process_uuid-file.c deleted file mode 100644 index c16ceaac150..00000000000 --- a/xlators/meta/src/plugins/process_uuid-file.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -process_uuid_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - strprintf (strfd, "%s\n", this->ctx->process_uuid); - return strfd->size; -} - - -static struct meta_ops process_uuid_file_ops = { - .file_fill = process_uuid_file_fill, -}; - - -int -meta_process_uuid_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &process_uuid_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/root-dir.c b/xlators/meta/src/plugins/root-dir.c deleted file mode 100644 index bd6870b21d7..00000000000 --- a/xlators/meta/src/plugins/root-dir.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent root_dir_dirents[] = { - DOT_DOTDOT, - - { .name = "graphs", - .type = IA_IFDIR, - .hook = meta_graphs_dir_hook, - }, - { .name = "frames", - .type = IA_IFREG, - .hook = meta_frames_file_hook, - }, - { .name = "logging", - .type = IA_IFDIR, - .hook = meta_logging_dir_hook, - }, - { .name = "process_uuid", - .type = IA_IFREG, - .hook = meta_process_uuid_file_hook, - }, - { .name = "version", - .type = IA_IFREG, - .hook = meta_version_file_hook, - }, - { .name = "cmdline", - .type = IA_IFREG, - .hook = meta_cmdline_file_hook, - }, - { .name = NULL } -}; - - -static struct meta_ops meta_root_dir_ops = { - .fixed_dirents = root_dir_dirents -}; - - -int -meta_root_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &meta_root_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/subvolume-link.c b/xlators/meta/src/plugins/subvolume-link.c deleted file mode 100644 index ca71a751541..00000000000 --- a/xlators/meta/src/plugins/subvolume-link.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" - - -static int -subvolume_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) -{ - xlator_t *xl = NULL; - - xl = meta_ctx_get (inode, this); - - strprintf (strfd, "../../%s", xl->name); - - return 0; -} - - -struct meta_ops subvolume_link_ops = { - .link_fill = subvolume_link_fill -}; - - -int -meta_subvolume_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - int count = 0; - int i = 0; - xlator_t *xl = NULL; - xlator_list_t *subv = NULL; - xlator_t *subvol = NULL; - - count = strtol (loc->name, 0, 0); - xl = meta_ctx_get (loc->parent, this); - - for (subv = xl->children; subv; subv = subv->next) { - if (i == count) { - subvol = subv->xlator; - break; - } - i++; - } - - meta_ctx_set (loc->inode, this, subvol); - - meta_ops_set (loc->inode, this, &subvolume_link_ops); - return 0; -} diff --git a/xlators/meta/src/plugins/subvolumes-dir.c b/xlators/meta/src/plugins/subvolumes-dir.c deleted file mode 100644 index f8d0e8039a1..00000000000 --- a/xlators/meta/src/plugins/subvolumes-dir.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static int -subvolumes_dir_fill (xlator_t *this, inode_t *dir, struct meta_dirent **dp) -{ - struct meta_dirent *dirents = NULL; - xlator_t *xl = NULL; - xlator_list_t *subv = NULL; - int i = 0; - int count = 0; - - xl = meta_ctx_get (dir, this); - - for (subv = xl->children; subv; subv = subv->next) - count++; - - dirents = GF_CALLOC (sizeof (*dirents), count, gf_meta_mt_dirents_t); - if (!dirents) - return -1; - - for (subv = xl->children; subv; subv = subv->next) { - char num[16] = { }; - snprintf (num, 16, "%d", i); - - dirents[i].name = gf_strdup (num); - dirents[i].type = IA_IFLNK; - dirents[i].hook = meta_subvolume_link_hook; - i++; - } - - *dp = dirents; - - return count; -} - - -static struct meta_ops subvolumes_dir_ops = { - .dir_fill = subvolumes_dir_fill -}; - - -int -meta_subvolumes_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - meta_ops_set (loc->inode, this, &subvolumes_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/top-link.c b/xlators/meta/src/plugins/top-link.c deleted file mode 100644 index 94b7f7a9f56..00000000000 --- a/xlators/meta/src/plugins/top-link.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" - - -static int -top_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) -{ - glusterfs_graph_t *graph = NULL; - - graph = meta_ctx_get (inode, this); - - strprintf (strfd, "%s", ((xlator_t *)graph->top)->name); - - return 0; -} - - -struct meta_ops top_link_ops = { - .link_fill = top_link_fill -}; - - -int -meta_top_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &top_link_ops); - - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - return 0; -} diff --git a/xlators/meta/src/plugins/type-file.c b/xlators/meta/src/plugins/type-file.c deleted file mode 100644 index 1970f4e33e8..00000000000 --- a/xlators/meta/src/plugins/type-file.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -type_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - xlator_t *xl = NULL; - - xl = meta_ctx_get (file, this); - - strprintf (strfd, "%s\n", xl->type); - - return strfd->size; -} - - -static struct meta_ops type_file_ops = { - .file_fill = type_file_fill, -}; - - -int -meta_type_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &type_file_ops); - - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - return 0; -} diff --git a/xlators/meta/src/plugins/version-file.c b/xlators/meta/src/plugins/version-file.c deleted file mode 100644 index 77f2dea3d66..00000000000 --- a/xlators/meta/src/plugins/version-file.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" -#include "globals.h" -#include "lkowner.h" - - -static int -version_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - strprintf (strfd, "%s\n", PACKAGE_VERSION); - return strfd->size; -} - - -static struct meta_ops version_file_ops = { - .file_fill = version_file_fill, -}; - - -int -meta_version_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &version_file_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/view-dir.c b/xlators/meta/src/plugins/view-dir.c deleted file mode 100644 index 6edd455b072..00000000000 --- a/xlators/meta/src/plugins/view-dir.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent view_dir_dirents[] = { - DOT_DOTDOT, - - { .name = NULL } -}; - - -static struct meta_ops view_dir_ops = { - .fixed_dirents = view_dir_dirents -}; - - -int -meta_view_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - meta_ops_set (loc->inode, this, &view_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/plugins/volfile-file.c b/xlators/meta/src/plugins/volfile-file.c deleted file mode 100644 index 899285763e0..00000000000 --- a/xlators/meta/src/plugins/volfile-file.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "strfd.h" - - - -static int -xldump_options (dict_t *this, char *key, data_t *value, void *strfd) -{ - strprintf (strfd, " option %s %s\n", key, value->data); - return 0; -} - - -static void -xldump_subvolumes (xlator_t *this, void *strfd) -{ - xlator_list_t *subv = NULL; - - if (!this->children) - return; - - strprintf (strfd, " subvolumes"); - - for (subv = this->children; subv; subv= subv->next) - strprintf (strfd, " %s", subv->xlator->name); - - strprintf (strfd, "\n"); -} - - -static void -xldump (xlator_t *each, void *strfd) -{ - strprintf (strfd, "volume %s\n", each->name); - strprintf (strfd, " type %s\n", each->type); - dict_foreach (each->options, xldump_options, strfd); - - xldump_subvolumes (each, strfd); - - strprintf (strfd, "end-volume\n"); - strprintf (strfd, "\n"); -} - - -static int -volfile_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) -{ - glusterfs_graph_t *graph = NULL; - - graph = meta_ctx_get (file, this); - - xlator_foreach_depth_first (graph->top, xldump, strfd); - - return strfd->size; -} - - -static struct meta_ops volfile_file_ops = { - .file_fill = volfile_file_fill, -}; - - -int -meta_volfile_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - meta_ops_set (loc->inode, this, &volfile_file_ops); - - meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); - - return 0; -} diff --git a/xlators/meta/src/plugins/xlator-dir.c b/xlators/meta/src/plugins/xlator-dir.c deleted file mode 100644 index 279df385cef..00000000000 --- a/xlators/meta/src/plugins/xlator-dir.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2014 Red Hat, Inc. - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "xlator.h" -#include "defaults.h" - -#include "meta-mem-types.h" -#include "meta.h" -#include "meta-hooks.h" - - -static struct meta_dirent xlator_dir_dirents[] = { - DOT_DOTDOT, - - { .name = "view", - .type = IA_IFDIR, - .hook = meta_view_dir_hook, - }, - { .name = "type", - .type = IA_IFREG, - .hook = meta_type_file_hook, - }, - { .name = "name", - .type = IA_IFREG, - .hook = meta_name_file_hook, - }, - { .name = "subvolumes", - .type = IA_IFDIR, - .hook = meta_subvolumes_dir_hook, - }, - { .name = "options", - .type = IA_IFDIR, - .hook = meta_options_dir_hook, - }, - { .name = NULL } -}; - - -static struct meta_ops xlator_dir_ops = { - .fixed_dirents = xlator_dir_dirents -}; - - -int -meta_xlator_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - glusterfs_graph_t *graph = NULL; - xlator_t *xl = NULL; - - graph = meta_ctx_get (loc->parent, this); - - xl = xlator_search_by_name (graph->first, loc->name); - - meta_ctx_set (loc->inode, this, xl); - - meta_ops_set (loc->inode, this, &xlator_dir_ops); - - return 0; -} diff --git a/xlators/meta/src/private-file.c b/xlators/meta/src/private-file.c new file mode 100644 index 00000000000..d2402c08bb4 --- /dev/null +++ b/xlators/meta/src/private-file.c @@ -0,0 +1,52 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "statedump.h" + + +static int +private_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + gf_proc_dump_xlator_private (xl, strfd); + + return strfd->size; +} + + +static struct meta_ops private_file_ops = { + .file_fill = private_file_fill, +}; + + +int +meta_private_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &private_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/process_uuid-file.c b/xlators/meta/src/process_uuid-file.c new file mode 100644 index 00000000000..c16ceaac150 --- /dev/null +++ b/xlators/meta/src/process_uuid-file.c @@ -0,0 +1,46 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +process_uuid_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + strprintf (strfd, "%s\n", this->ctx->process_uuid); + return strfd->size; +} + + +static struct meta_ops process_uuid_file_ops = { + .file_fill = process_uuid_file_fill, +}; + + +int +meta_process_uuid_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &process_uuid_file_ops); + + return 0; +} diff --git a/xlators/meta/src/profile-file.c b/xlators/meta/src/profile-file.c new file mode 100644 index 00000000000..2a25c154699 --- /dev/null +++ b/xlators/meta/src/profile-file.c @@ -0,0 +1,52 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "statedump.h" + + +static int +profile_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + gf_proc_dump_xlator_profile (xl, strfd); + + return strfd->size; +} + + +static struct meta_ops profile_file_ops = { + .file_fill = profile_file_fill, +}; + + +int +meta_profile_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &profile_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/root-dir.c b/xlators/meta/src/root-dir.c new file mode 100644 index 00000000000..d104d842cf9 --- /dev/null +++ b/xlators/meta/src/root-dir.c @@ -0,0 +1,79 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent root_dir_dirents[] = { + DOT_DOTDOT, + + { .name = "graphs", + .type = IA_IFDIR, + .hook = meta_graphs_dir_hook, + }, + { .name = "frames", + .type = IA_IFREG, + .hook = meta_frames_file_hook, + }, + { .name = "logging", + .type = IA_IFDIR, + .hook = meta_logging_dir_hook, + }, + { .name = "process_uuid", + .type = IA_IFREG, + .hook = meta_process_uuid_file_hook, + }, + { .name = "version", + .type = IA_IFREG, + .hook = meta_version_file_hook, + }, + { .name = "cmdline", + .type = IA_IFREG, + .hook = meta_cmdline_file_hook, + }, + { .name = "mallinfo", + .type = IA_IFREG, + .hook = meta_mallinfo_file_hook, + }, + { .name = "master", + .type = IA_IFDIR, + .hook = meta_master_dir_hook, + }, + { .name = "measure_latency", + .type = IA_IFREG, + .hook = meta_measure_file_hook, + }, + { .name = NULL } +}; + + +static struct meta_ops meta_root_dir_ops = { + .fixed_dirents = root_dir_dirents +}; + + +int +meta_root_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &meta_root_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/subvolume-link.c b/xlators/meta/src/subvolume-link.c new file mode 100644 index 00000000000..ca71a751541 --- /dev/null +++ b/xlators/meta/src/subvolume-link.c @@ -0,0 +1,66 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" + + +static int +subvolume_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (inode, this); + + strprintf (strfd, "../../%s", xl->name); + + return 0; +} + + +struct meta_ops subvolume_link_ops = { + .link_fill = subvolume_link_fill +}; + + +int +meta_subvolume_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + int count = 0; + int i = 0; + xlator_t *xl = NULL; + xlator_list_t *subv = NULL; + xlator_t *subvol = NULL; + + count = strtol (loc->name, 0, 0); + xl = meta_ctx_get (loc->parent, this); + + for (subv = xl->children; subv; subv = subv->next) { + if (i == count) { + subvol = subv->xlator; + break; + } + i++; + } + + meta_ctx_set (loc->inode, this, subvol); + + meta_ops_set (loc->inode, this, &subvolume_link_ops); + return 0; +} diff --git a/xlators/meta/src/subvolumes-dir.c b/xlators/meta/src/subvolumes-dir.c new file mode 100644 index 00000000000..f8d0e8039a1 --- /dev/null +++ b/xlators/meta/src/subvolumes-dir.c @@ -0,0 +1,72 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static int +subvolumes_dir_fill (xlator_t *this, inode_t *dir, struct meta_dirent **dp) +{ + struct meta_dirent *dirents = NULL; + xlator_t *xl = NULL; + xlator_list_t *subv = NULL; + int i = 0; + int count = 0; + + xl = meta_ctx_get (dir, this); + + for (subv = xl->children; subv; subv = subv->next) + count++; + + dirents = GF_CALLOC (sizeof (*dirents), count, gf_meta_mt_dirents_t); + if (!dirents) + return -1; + + for (subv = xl->children; subv; subv = subv->next) { + char num[16] = { }; + snprintf (num, 16, "%d", i); + + dirents[i].name = gf_strdup (num); + dirents[i].type = IA_IFLNK; + dirents[i].hook = meta_subvolume_link_hook; + i++; + } + + *dp = dirents; + + return count; +} + + +static struct meta_ops subvolumes_dir_ops = { + .dir_fill = subvolumes_dir_fill +}; + + +int +meta_subvolumes_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + meta_ops_set (loc->inode, this, &subvolumes_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/top-link.c b/xlators/meta/src/top-link.c new file mode 100644 index 00000000000..94b7f7a9f56 --- /dev/null +++ b/xlators/meta/src/top-link.c @@ -0,0 +1,50 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" + + +static int +top_link_fill (xlator_t *this, inode_t *inode, strfd_t *strfd) +{ + glusterfs_graph_t *graph = NULL; + + graph = meta_ctx_get (inode, this); + + strprintf (strfd, "%s", ((xlator_t *)graph->top)->name); + + return 0; +} + + +struct meta_ops top_link_ops = { + .link_fill = top_link_fill +}; + + +int +meta_top_link_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &top_link_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/type-file.c b/xlators/meta/src/type-file.c new file mode 100644 index 00000000000..1970f4e33e8 --- /dev/null +++ b/xlators/meta/src/type-file.c @@ -0,0 +1,53 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +type_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + xlator_t *xl = NULL; + + xl = meta_ctx_get (file, this); + + strprintf (strfd, "%s\n", xl->type); + + return strfd->size; +} + + +static struct meta_ops type_file_ops = { + .file_fill = type_file_fill, +}; + + +int +meta_type_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &type_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/version-file.c b/xlators/meta/src/version-file.c new file mode 100644 index 00000000000..77f2dea3d66 --- /dev/null +++ b/xlators/meta/src/version-file.c @@ -0,0 +1,46 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" +#include "globals.h" +#include "lkowner.h" + + +static int +version_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + strprintf (strfd, "%s\n", PACKAGE_VERSION); + return strfd->size; +} + + +static struct meta_ops version_file_ops = { + .file_fill = version_file_fill, +}; + + +int +meta_version_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &version_file_ops); + + return 0; +} diff --git a/xlators/meta/src/view-dir.c b/xlators/meta/src/view-dir.c new file mode 100644 index 00000000000..6edd455b072 --- /dev/null +++ b/xlators/meta/src/view-dir.c @@ -0,0 +1,45 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent view_dir_dirents[] = { + DOT_DOTDOT, + + { .name = NULL } +}; + + +static struct meta_ops view_dir_ops = { + .fixed_dirents = view_dir_dirents +}; + + +int +meta_view_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + meta_ops_set (loc->inode, this, &view_dir_ops); + + return 0; +} diff --git a/xlators/meta/src/volfile-file.c b/xlators/meta/src/volfile-file.c new file mode 100644 index 00000000000..899285763e0 --- /dev/null +++ b/xlators/meta/src/volfile-file.c @@ -0,0 +1,91 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "strfd.h" + + + +static int +xldump_options (dict_t *this, char *key, data_t *value, void *strfd) +{ + strprintf (strfd, " option %s %s\n", key, value->data); + return 0; +} + + +static void +xldump_subvolumes (xlator_t *this, void *strfd) +{ + xlator_list_t *subv = NULL; + + if (!this->children) + return; + + strprintf (strfd, " subvolumes"); + + for (subv = this->children; subv; subv= subv->next) + strprintf (strfd, " %s", subv->xlator->name); + + strprintf (strfd, "\n"); +} + + +static void +xldump (xlator_t *each, void *strfd) +{ + strprintf (strfd, "volume %s\n", each->name); + strprintf (strfd, " type %s\n", each->type); + dict_foreach (each->options, xldump_options, strfd); + + xldump_subvolumes (each, strfd); + + strprintf (strfd, "end-volume\n"); + strprintf (strfd, "\n"); +} + + +static int +volfile_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd) +{ + glusterfs_graph_t *graph = NULL; + + graph = meta_ctx_get (file, this); + + xlator_foreach_depth_first (graph->top, xldump, strfd); + + return strfd->size; +} + + +static struct meta_ops volfile_file_ops = { + .file_fill = volfile_file_fill, +}; + + +int +meta_volfile_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ops_set (loc->inode, this, &volfile_file_ops); + + meta_ctx_set (loc->inode, this, meta_ctx_get (loc->parent, this)); + + return 0; +} diff --git a/xlators/meta/src/xlator-dir.c b/xlators/meta/src/xlator-dir.c new file mode 100644 index 00000000000..09b7bde62de --- /dev/null +++ b/xlators/meta/src/xlator-dir.c @@ -0,0 +1,100 @@ +/* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "xlator.h" +#include "defaults.h" + +#include "meta-mem-types.h" +#include "meta.h" +#include "meta-hooks.h" + + +static struct meta_dirent xlator_dir_dirents[] = { + DOT_DOTDOT, + + { .name = "view", + .type = IA_IFDIR, + .hook = meta_view_dir_hook, + }, + { .name = "type", + .type = IA_IFREG, + .hook = meta_type_file_hook, + }, + { .name = "name", + .type = IA_IFREG, + .hook = meta_name_file_hook, + }, + { .name = "subvolumes", + .type = IA_IFDIR, + .hook = meta_subvolumes_dir_hook, + }, + { .name = "options", + .type = IA_IFDIR, + .hook = meta_options_dir_hook, + }, + { .name = "private", + .type = IA_IFREG, + .hook = meta_private_file_hook, + }, + { .name = "history", + .type = IA_IFREG, + .hook = meta_history_file_hook, + }, + { .name = "meminfo", + .type = IA_IFREG, + .hook = meta_meminfo_file_hook, + }, + { .name = "profile", + .type = IA_IFREG, + .hook = meta_profile_file_hook, + }, + { .name = NULL } +}; + + +static struct meta_ops xlator_dir_ops = { + .fixed_dirents = xlator_dir_dirents +}; + + +int +meta_xlator_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + glusterfs_graph_t *graph = NULL; + xlator_t *xl = NULL; + + graph = meta_ctx_get (loc->parent, this); + + xl = xlator_search_by_name (graph->first, loc->name); + + meta_ctx_set (loc->inode, this, xl); + + meta_ops_set (loc->inode, this, &xlator_dir_ops); + + return 0; +} + + +int +meta_master_dir_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + meta_ctx_set (loc->inode, this, this->ctx->master); + + meta_ops_set (loc->inode, this, &xlator_dir_ops); + + return 0; +} -- cgit