diff options
Diffstat (limited to 'xlators/meta/src')
33 files changed, 118 insertions, 103 deletions
diff --git a/xlators/meta/src/active-link.c b/xlators/meta/src/active-link.c index 6c060455887..7ee780d89e9 100644 --- a/xlators/meta/src/active-link.c +++ b/xlators/meta/src/active-link.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/cmdline-file.c b/xlators/meta/src/cmdline-file.c index 3d6a020ac6c..eb24e985af9 100644 --- a/xlators/meta/src/cmdline-file.c +++ b/xlators/meta/src/cmdline-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int cmdline_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/frames-file.c b/xlators/meta/src/frames-file.c index 1316aa71ce8..9a13db9a934 100644 --- a/xlators/meta/src/frames-file.c +++ b/xlators/meta/src/frames-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int frames_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) @@ -30,9 +30,10 @@ frames_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) pool = this->ctx->pool; + strprintf(strfd, "{ \n\t\"Stack\": [\n"); + LOCK(&pool->lock); { - strprintf(strfd, "{ \n\t\"Stack\": [\n"); list_for_each_entry(stack, &pool->all_frames, all_frames) { strprintf(strfd, "\t {\n"); diff --git a/xlators/meta/src/graph-dir.c b/xlators/meta/src/graph-dir.c index 606fea904be..a8f4787880d 100644 --- a/xlators/meta/src/graph-dir.c +++ b/xlators/meta/src/graph-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/graphs-dir.c b/xlators/meta/src/graphs-dir.c index 7c8f4276c03..a1ffbca7d5a 100644 --- a/xlators/meta/src/graphs-dir.c +++ b/xlators/meta/src/graphs-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/history-file.c b/xlators/meta/src/history-file.c index a78fe27a54a..7742a635fed 100644 --- a/xlators/meta/src/history-file.c +++ b/xlators/meta/src/history-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "statedump.h" +#include <glusterfs/strfd.h> +#include <glusterfs/statedump.h> static int history_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/logfile-link.c b/xlators/meta/src/logfile-link.c index 61cd4fee852..616a54518c0 100644 --- a/xlators/meta/src/logfile-link.c +++ b/xlators/meta/src/logfile-link.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/logging-dir.c b/xlators/meta/src/logging-dir.c index 590b5532b38..46e6f9e95dd 100644 --- a/xlators/meta/src/logging-dir.c +++ b/xlators/meta/src/logging-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/loglevel-file.c b/xlators/meta/src/loglevel-file.c index 3f3f2707dc0..eeeeeaa5907 100644 --- a/xlators/meta/src/loglevel-file.c +++ b/xlators/meta/src/loglevel-file.c @@ -8,12 +8,12 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" +#include <glusterfs/strfd.h> static int loglevel_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/mallinfo-file.c b/xlators/meta/src/mallinfo-file.c index d04fe9f4c1e..b4396d72189 100644 --- a/xlators/meta/src/mallinfo-file.c +++ b/xlators/meta/src/mallinfo-file.c @@ -8,12 +8,12 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "statedump.h" +#include <glusterfs/statedump.h> static int mallinfo_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/measure-file.c b/xlators/meta/src/measure-file.c index 1529608bb25..52e92e48590 100644 --- a/xlators/meta/src/measure-file.c +++ b/xlators/meta/src/measure-file.c @@ -8,12 +8,12 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" +#include <glusterfs/strfd.h> static int measure_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/meminfo-file.c b/xlators/meta/src/meminfo-file.c index d6122ae5013..d889dfb2ae8 100644 --- a/xlators/meta/src/meminfo-file.c +++ b/xlators/meta/src/meminfo-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "statedump.h" +#include <glusterfs/strfd.h> +#include <glusterfs/statedump.h> static int meminfo_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/meta-defaults.c b/xlators/meta/src/meta-defaults.c index 8b0d786483f..91c328473f8 100644 --- a/xlators/meta/src/meta-defaults.c +++ b/xlators/meta/src/meta-defaults.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "compat-errno.h" +#include <glusterfs/compat-errno.h> int meta_default_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, @@ -119,7 +119,7 @@ meta_default_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, struct iobuf *iobuf = NULL; struct iobref *iobref = NULL; off_t copy_offset = 0; - size_t copy_size = 0; + int copy_size = 0; struct iatt iatt = {}; meta_fd = meta_fd_get(fd, this); @@ -145,11 +145,11 @@ meta_default_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, return default_readv_failure_cbk(frame, ENOMEM); } + iov.iov_base = iobuf_ptr(iobuf); + /* iobref would have taken a ref */ iobuf_unref(iobuf); - iov.iov_base = iobuf_ptr(iobuf); - copy_offset = min(meta_fd->size, offset); copy_size = min(size, (meta_fd->size - copy_offset)); @@ -241,9 +241,10 @@ meta_default_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, struct meta_ops *ops = NULL; strfd_t *strfd = NULL; struct iatt iatt = {}; + int len = -1; ops = meta_ops_get(loc->inode, this); - if (!ops->link_fill) { + if (!ops || !ops->link_fill) { META_STACK_UNWIND(readlink, frame, -1, EPERM, 0, 0, 0); return 0; } @@ -258,10 +259,10 @@ meta_default_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, meta_iatt_fill(&iatt, loc->inode, IA_IFLNK); - if (strfd->data) - META_STACK_UNWIND(readlink, frame, strlen(strfd->data), 0, strfd->data, - &iatt, xdata); - else + if (strfd->data) { + len = strlen(strfd->data); + META_STACK_UNWIND(readlink, frame, len, 0, strfd->data, &iatt, xdata); + } else META_STACK_UNWIND(readlink, frame, -1, ENODATA, 0, 0, 0); strfd_close(strfd); diff --git a/xlators/meta/src/meta-helpers.c b/xlators/meta/src/meta-helpers.c index d7d59c71296..cb54f547468 100644 --- a/xlators/meta/src/meta-helpers.c +++ b/xlators/meta/src/meta-helpers.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" @@ -182,14 +182,15 @@ meta_uuid_copy(uuid_t dst, uuid_t src) } static void -default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type) +default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type, + gf_boolean_t is_tunable) { struct timeval tv = {}; iatt->ia_type = type; switch (type) { case IA_IFDIR: - iatt->ia_prot = ia_prot_from_st_mode(0755); + iatt->ia_prot = ia_prot_from_st_mode(0555); iatt->ia_nlink = 2; break; case IA_IFLNK: @@ -197,7 +198,7 @@ default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type) iatt->ia_nlink = 1; break; default: - iatt->ia_prot = ia_prot_from_st_mode(0644); + iatt->ia_prot = ia_prot_from_st_mode(is_tunable ? 0644 : 0444); iatt->ia_nlink = 1; break; } @@ -225,7 +226,7 @@ meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type) return; if (!ops->iatt_fill) - default_meta_iatt_fill(iatt, inode, type); + default_meta_iatt_fill(iatt, inode, type, !!ops->file_write); else ops->iatt_fill(THIS, inode, iatt); return; diff --git a/xlators/meta/src/meta-hooks.h b/xlators/meta/src/meta-hooks.h index 2ee006f7876..7208641398a 100644 --- a/xlators/meta/src/meta-hooks.h +++ b/xlators/meta/src/meta-hooks.h @@ -10,7 +10,7 @@ #ifndef __META_HOOKS_H #define __META_HOOKS_H -#include "xlator.h" +#include <glusterfs/xlator.h> #define DECLARE_HOOK(name) \ int meta_##name##_hook(call_frame_t *frame, xlator_t *this, loc_t *loc, \ diff --git a/xlators/meta/src/meta-mem-types.h b/xlators/meta/src/meta-mem-types.h index 0fdfea4fac6..033c306682f 100644 --- a/xlators/meta/src/meta-mem-types.h +++ b/xlators/meta/src/meta-mem-types.h @@ -11,7 +11,7 @@ #ifndef __META_MEM_TYPES_H__ #define __META_MEM_TYPES_H__ -#include "mem-types.h" +#include <glusterfs/mem-types.h> enum gf_meta_mem_types_ { gf_meta_mt_priv_t = gf_common_mt_end + 1, diff --git a/xlators/meta/src/meta.c b/xlators/meta/src/meta.c index 9294bbdae0c..e1b9a2b6581 100644 --- a/xlators/meta/src/meta.c +++ b/xlators/meta/src/meta.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" @@ -226,11 +226,11 @@ out: return ret; } -int +void fini(xlator_t *this) { GF_FREE(this->private); - return 0; + return; } struct xlator_fops fops = {.lookup = meta_lookup, @@ -262,3 +262,15 @@ struct volume_options options[] = { .description = "Name of default meta directory."}, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .mem_acct_init = mem_acct_init, + .op_version = {1}, /* Present from the initial version */ + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "meta", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/meta/src/meta.h b/xlators/meta/src/meta.h index 10609a9ec05..7f0cf28808a 100644 --- a/xlators/meta/src/meta.h +++ b/xlators/meta/src/meta.h @@ -10,7 +10,7 @@ #ifndef __META_H__ #define __META_H__ -#include "strfd.h" +#include <glusterfs/strfd.h> #define DEFAULT_META_DIR_NAME ".meta" diff --git a/xlators/meta/src/name-file.c b/xlators/meta/src/name-file.c index edba7142a69..5874a24d78a 100644 --- a/xlators/meta/src/name-file.c +++ b/xlators/meta/src/name-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int name_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/option-file.c b/xlators/meta/src/option-file.c index 132b28fa86a..ff55eca592f 100644 --- a/xlators/meta/src/option-file.c +++ b/xlators/meta/src/option-file.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/options-dir.c b/xlators/meta/src/options-dir.c index bf2d07a3701..d68a7eeaffc 100644 --- a/xlators/meta/src/options-dir.c +++ b/xlators/meta/src/options-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/private-file.c b/xlators/meta/src/private-file.c index 068c8ebf191..23ec319456b 100644 --- a/xlators/meta/src/private-file.c +++ b/xlators/meta/src/private-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "statedump.h" +#include <glusterfs/strfd.h> +#include <glusterfs/statedump.h> static int private_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/process_uuid-file.c b/xlators/meta/src/process_uuid-file.c index bbf2e19f86e..a24c1b57ab3 100644 --- a/xlators/meta/src/process_uuid-file.c +++ b/xlators/meta/src/process_uuid-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int process_uuid_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/profile-file.c b/xlators/meta/src/profile-file.c index 9eb5c050dbe..829dcb77451 100644 --- a/xlators/meta/src/profile-file.c +++ b/xlators/meta/src/profile-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "statedump.h" +#include <glusterfs/strfd.h> +#include <glusterfs/statedump.h> static int profile_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/root-dir.c b/xlators/meta/src/root-dir.c index 18d4fd6b8ec..80292bd3dda 100644 --- a/xlators/meta/src/root-dir.c +++ b/xlators/meta/src/root-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/subvolume-link.c b/xlators/meta/src/subvolume-link.c index 45d909daca2..5b1f752efd0 100644 --- a/xlators/meta/src/subvolume-link.c +++ b/xlators/meta/src/subvolume-link.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/subvolumes-dir.c b/xlators/meta/src/subvolumes-dir.c index e9582c53cf7..3cb170ea1f4 100644 --- a/xlators/meta/src/subvolumes-dir.c +++ b/xlators/meta/src/subvolumes-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/top-link.c b/xlators/meta/src/top-link.c index bfee742a1be..33f0d407411 100644 --- a/xlators/meta/src/top-link.c +++ b/xlators/meta/src/top-link.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/type-file.c b/xlators/meta/src/type-file.c index 00141275957..ece342a0b2a 100644 --- a/xlators/meta/src/type-file.c +++ b/xlators/meta/src/type-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int type_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/version-file.c b/xlators/meta/src/version-file.c index 7331684238c..36276fb810a 100644 --- a/xlators/meta/src/version-file.c +++ b/xlators/meta/src/version-file.c @@ -8,13 +8,13 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" -#include "lkowner.h" +#include <glusterfs/strfd.h> +#include <glusterfs/lkowner.h> static int version_file_fill(xlator_t *this, inode_t *file, strfd_t *strfd) diff --git a/xlators/meta/src/view-dir.c b/xlators/meta/src/view-dir.c index 313bf6d7124..30931061567 100644 --- a/xlators/meta/src/view-dir.c +++ b/xlators/meta/src/view-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" diff --git a/xlators/meta/src/volfile-file.c b/xlators/meta/src/volfile-file.c index 5242a14bb8c..b2e2562ab8b 100644 --- a/xlators/meta/src/volfile-file.c +++ b/xlators/meta/src/volfile-file.c @@ -8,12 +8,12 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" -#include "strfd.h" +#include <glusterfs/strfd.h> static int xldump_options(dict_t *this, char *key, data_t *value, void *strfd) diff --git a/xlators/meta/src/xlator-dir.c b/xlators/meta/src/xlator-dir.c index 1715cbb56a0..86189715790 100644 --- a/xlators/meta/src/xlator-dir.c +++ b/xlators/meta/src/xlator-dir.c @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "meta-mem-types.h" #include "meta.h" |
