glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

meta.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 #ifndef __META_H__
11 #define __META_H__
12 
13 #include <glusterfs/strfd.h>
14 
15 #define DEFAULT_META_DIR_NAME ".meta"
16 
17 #define META_ROOT_GFID "ba926388-bb9c-4eec-ad60-79dba4cc083a"
18 
19 #define IS_META_ROOT_GFID(g) (strcmp(uuid_utoa(g), META_ROOT_GFID) == 0)
20 
21 typedef int (*meta_hook_t)(call_frame_t *frame, xlator_t *this, loc_t *loc,
22  dict_t *xdata);
23 
24 typedef struct {
26 } meta_local_t;
27 
28 typedef struct {
30 } meta_priv_t;
31 
32 struct meta_dirent {
33  const char *name;
36 };
37 
38 #define DOT_DOTDOT \
39  {.name = ".", .type = IA_IFDIR}, { .name = "..", .type = IA_IFDIR }
40 
41 struct meta_ops {
43  int (*dir_fill)(xlator_t *this, inode_t *dir, struct meta_dirent **entries);
44  int (*file_fill)(xlator_t *this, inode_t *file, strfd_t *strfd);
45  int (*iatt_fill)(xlator_t *this, inode_t *inode, struct iatt *iatt);
46  int (*link_fill)(xlator_t *this, inode_t *inode, strfd_t *strfd);
47  int (*file_write)(xlator_t *this, fd_t *fd, struct iovec *iov, int count);
48  struct xlator_fops fops;
49  struct xlator_cbks cbks;
50 };
51 
52 typedef struct {
53  char *data;
55  size_t size;
56 } meta_fd_t;
57 
58 #define COUNT(arr) (sizeof(arr) / sizeof(arr[0]))
59 
60 #define META_HOOK(loc) \
61  (__is_root_gfid(loc->pargfid) && \
62  !strcmp(loc->name, META_PRIV(THIS)->meta_dir_name))
63 
64 #define META_PRIV(t) ((meta_priv_t *)(t->private))
65 
66 #define META_STACK_UNWIND(fop, frame, params...) \
67  do { \
68  meta_local_t *__local = NULL; \
69  xlator_t *__this = NULL; \
70  if (frame) { \
71  __local = frame->local; \
72  __this = frame->this; \
73  frame->local = NULL; \
74  } \
75  STACK_UNWIND_STRICT(fop, frame, params); \
76  if (__local) { \
77  meta_local_cleanup(__local, __this); \
78  } \
79  } while (0)
80 
81 #define META_FOP(i, fop, fr, t, params...) \
82  { \
83  struct xlator_fops *_fops = NULL; \
84  \
85  _fops = meta_fops_get(i, t); \
86  \
87  _fops->fop(fr, t, params); \
88  } \
89  while (0)
90 
91 void
92 meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type);
93 
94 int
96  dict_t *xdata);
97 
98 int
99 meta_ops_set(inode_t *inode, xlator_t *this, struct meta_ops *ops);
100 
101 struct xlator_fops *
102 meta_fops_get(inode_t *inode, xlator_t *this);
103 struct xlator_cbks *
105 struct meta_ops *
106 meta_ops_get(inode_t *inode, xlator_t *this);
107 
108 int
109 meta_ctx_set(inode_t *inode, xlator_t *this, void *ctx);
110 
111 void *
112 meta_ctx_get(inode_t *inode, xlator_t *this);
113 
114 void
116 
117 struct xlator_fops *
119 
120 meta_fd_t *
121 meta_fd_get(fd_t *fd, xlator_t *this);
122 
123 int
124 meta_fd_release(fd_t *fd, xlator_t *this);
125 
126 dict_t *
127 meta_direct_io_mode(dict_t *xdata, call_frame_t *frame);
128 
129 meta_local_t *
130 meta_local(call_frame_t *frame);
131 
132 int
133 meta_file_fill(xlator_t *this, fd_t *fd);
134 
135 int
136 meta_dir_fill(xlator_t *this, fd_t *fd);
137 
138 int
139 fixed_dirents_len(struct meta_dirent *dirents);
140 #endif /* __META_H__ */
meta_dirent
Definition: meta.h:32
fops
struct xlator_fops fops
Definition: glfs-master.c:164
meta_fd_t
Definition: meta.h:52
meta_fd_release
int meta_fd_release(fd_t *fd, xlator_t *this)
Definition: meta-helpers.c:44
iatt
Definition: iatt.h:46
meta_priv_t
Definition: meta.h:28
meta_defaults_init
struct xlator_fops * meta_defaults_init(struct xlator_fops *fops)
Definition: meta-defaults.c:607
meta_dir_fill
int meta_dir_fill(xlator_t *this, fd_t *fd)
Definition: meta-helpers.c:289
meta_fops_get
struct xlator_fops * meta_fops_get(inode_t *inode, xlator_t *this)
Definition: meta-helpers.c:80
_call_frame
Definition: stack.h:63
meta_ops::fixed_dirents
struct meta_dirent * fixed_dirents
Definition: meta.h:42
meta_ops::file_write
int(* file_write)(xlator_t *this, fd_t *fd, struct iovec *iov, int count)
Definition: meta.h:47
meta_ops
Definition: meta.h:41
meta_local_t
Definition: meta.h:24
_inode
Definition: inode.h:99
meta_ctx_set
int meta_ctx_set(inode_t *inode, xlator_t *this, void *ctx)
Definition: meta-helpers.c:120
meta_priv_t::meta_dir_name
char * meta_dir_name
Definition: meta.h:29
meta_fd_t::size
size_t size
Definition: meta.h:55
xlator_fops
Definition: xlator.h:561
meta_ops::link_fill
int(* link_fill)(xlator_t *this, inode_t *inode, strfd_t *strfd)
Definition: meta.h:46
meta_dirent::hook
meta_hook_t hook
Definition: meta.h:35
meta_ops_set
int meta_ops_set(inode_t *inode, xlator_t *this, struct meta_ops *ops)
Definition: meta-helpers.c:92
meta_dirent::type
ia_type_t type
Definition: meta.h:34
generator.ops
dictionary ops
Definition: generator.py:64
meta_file_fill
int meta_file_fill(xlator_t *this, fd_t *fd)
Definition: meta-helpers.c:249
meta_ops::fops
struct xlator_fops fops
Definition: meta.h:48
meta_dirent::name
const char * name
Definition: meta.h:33
fixed_dirents_len
int fixed_dirents_len(struct meta_dirent *dirents)
Definition: meta-helpers.c:319
xlator_cbks
Definition: xlator.h:707
meta_ops::iatt_fill
int(* iatt_fill)(xlator_t *this, inode_t *inode, struct iatt *iatt)
Definition: meta.h:45
_fd
Definition: fd.h:39
ia_type_t
ia_type_t
Definition: iatt.h:24
_xlator
Definition: xlator.h:770
meta_ops_get
struct meta_ops * meta_ops_get(inode_t *inode, xlator_t *this)
Definition: meta-helpers.c:67
meta_ops::cbks
struct xlator_cbks cbks
Definition: meta.h:49
_loc
Definition: xlator.h:66
meta_local_t::xdata
dict_t * xdata
Definition: meta.h:25
meta_fd_t::data
char * data
Definition: meta.h:53
meta_local
meta_local_t * meta_local(call_frame_t *frame)
Definition: meta-helpers.c:146
meta_inode_discover
int meta_inode_discover(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
Definition: meta-helpers.c:235
meta_iatt_fill
void meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type)
Definition: meta-helpers.c:219
meta_ops::dir_fill
int(* dir_fill)(xlator_t *this, inode_t *dir, struct meta_dirent **entries)
Definition: meta.h:43
meta_ops::file_fill
int(* file_fill)(xlator_t *this, inode_t *file, strfd_t *strfd)
Definition: meta.h:44
meta_fd_get
meta_fd_t * meta_fd_get(fd_t *fd, xlator_t *this)
Definition: meta-helpers.c:18
_dict
Definition: dict.h:114
meta_direct_io_mode
dict_t * meta_direct_io_mode(dict_t *xdata, call_frame_t *frame)
Definition: meta-helpers.c:157
meta_cbks_get
struct xlator_cbks * meta_cbks_get(inode_t *inode, xlator_t *this)
meta_ctx_get
void * meta_ctx_get(inode_t *inode, xlator_t *this)
Definition: meta-helpers.c:107
meta_hook_t
int(* meta_hook_t)(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
Definition: meta.h:21
meta_local_cleanup
void meta_local_cleanup(meta_local_t *local, xlator_t *this)
Definition: meta-helpers.c:133
strfd.h
S40ufo-stop.type
type
Definition: S40ufo-stop.py:15
strfd_t
Definition: strfd.h:14
meta_fd_t::dirents
struct meta_dirent * dirents
Definition: meta.h:54