summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/bd/src/bd-aio.h22
-rw-r--r--xlators/storage/bd/src/bd-mem-types.h15
-rw-r--r--xlators/storage/bd/src/bd.h191
-rw-r--r--xlators/storage/posix/src/posix-aio.h23
-rw-r--r--xlators/storage/posix/src/posix-gfid-path.h12
-rw-r--r--xlators/storage/posix/src/posix-handle.h343
-rw-r--r--xlators/storage/posix/src/posix-inode-handle.h141
-rw-r--r--xlators/storage/posix/src/posix-mem-types.h23
-rw-r--r--xlators/storage/posix/src/posix-messages.h165
-rw-r--r--xlators/storage/posix/src/posix-metadata-disk.h20
-rw-r--r--xlators/storage/posix/src/posix-metadata.h42
-rw-r--r--xlators/storage/posix/src/posix.h788
12 files changed, 870 insertions, 915 deletions
diff --git a/xlators/storage/bd/src/bd-aio.h b/xlators/storage/bd/src/bd-aio.h
index 82386e0b072..1332622050d 100644
--- a/xlators/storage/bd/src/bd-aio.h
+++ b/xlators/storage/bd/src/bd-aio.h
@@ -23,14 +23,18 @@
/* Maximum number of completed IO operations to reap per getevents syscall */
#define BD_AIO_MAX_NR_GETEVENTS 16
-int bd_aio_on (xlator_t *this);
-int bd_aio_off (xlator_t *this);
-
-int bd_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata);
-
-int bd_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count, off_t offset,
- uint32_t flags, struct iobref *iobref, dict_t *xdata);
+int
+bd_aio_on(xlator_t *this);
+int
+bd_aio_off(xlator_t *this);
+
+int
+bd_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata);
+
+int
+bd_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
+ int32_t count, off_t offset, uint32_t flags, struct iobref *iobref,
+ dict_t *xdata);
#endif /* !_BD_AIO_H */
diff --git a/xlators/storage/bd/src/bd-mem-types.h b/xlators/storage/bd/src/bd-mem-types.h
index 58b44834247..a63df819754 100644
--- a/xlators/storage/bd/src/bd-mem-types.h
+++ b/xlators/storage/bd/src/bd-mem-types.h
@@ -8,20 +8,19 @@
cases as published by the Free Software Foundation.
*/
-
#ifndef __BD_MEM_TYPES_H__
#define __BD_MEM_TYPES_H__
#include "mem-types.h"
enum gf_bd_mem_types_ {
- gf_bd_private = gf_common_mt_end + 1,
- gf_bd_attr,
- gf_bd_fd,
- gf_bd_loc_t,
- gf_bd_int32_t,
- gf_bd_aio_cb,
- gf_bd_mt_end
+ gf_bd_private = gf_common_mt_end + 1,
+ gf_bd_attr,
+ gf_bd_fd,
+ gf_bd_loc_t,
+ gf_bd_int32_t,
+ gf_bd_aio_cb,
+ gf_bd_mt_end
};
#endif
diff --git a/xlators/storage/bd/src/bd.h b/xlators/storage/bd/src/bd.h
index bdaf6f032d9..769affbb70c 100644
--- a/xlators/storage/bd/src/bd.h
+++ b/xlators/storage/bd/src/bd.h
@@ -38,18 +38,18 @@
#define ALIGN_SIZE 4096
-#define BD_CAPS_BD 0x01
-#define BD_CAPS_THIN 0x02
-#define BD_CAPS_OFFLOAD_COPY 0x04
+#define BD_CAPS_BD 0x01
+#define BD_CAPS_THIN 0x02
+#define BD_CAPS_OFFLOAD_COPY 0x04
#define BD_CAPS_OFFLOAD_SNAPSHOT 0x08
-#define BD_CAPS_OFFLOAD_ZERO 0x20
+#define BD_CAPS_OFFLOAD_ZERO 0x20
#define BD_CLONE "clone"
#define BD_SNAPSHOT "snapshot"
#define BD_MERGE "merge"
#define BD_ORIGIN "list-origin"
-#define IOV_NR 4
+#define IOV_NR 4
#define IOV_SIZE (64 * 1024)
#define ALIGN_SIZE 4096
@@ -57,29 +57,29 @@
#define MAX_NO_VECT 1024
-
-#define BD_VALIDATE_MEM_ALLOC(buff, op_errno, label) \
- if (!buff) { \
- op_errno = ENOMEM; \
- gf_log (this->name, GF_LOG_ERROR, "out of memory"); \
- goto label; \
- }
-
-#define BD_VALIDATE_LOCAL_OR_GOTO(local, op_errno, label) \
- if (!local) { \
- op_errno = EINVAL; \
- goto label; \
- }
-
-#define BD_STACK_UNWIND(typ, frame, args ...) do { \
- bd_local_t *__local = frame->local; \
- xlator_t *__this = frame->this; \
- \
- frame->local = NULL; \
- STACK_UNWIND_STRICT (typ, frame, args); \
- if (__local) \
- bd_local_free (__this, __local); \
- } while (0)
+#define BD_VALIDATE_MEM_ALLOC(buff, op_errno, label) \
+ if (!buff) { \
+ op_errno = ENOMEM; \
+ gf_log(this->name, GF_LOG_ERROR, "out of memory"); \
+ goto label; \
+ }
+
+#define BD_VALIDATE_LOCAL_OR_GOTO(local, op_errno, label) \
+ if (!local) { \
+ op_errno = EINVAL; \
+ goto label; \
+ }
+
+#define BD_STACK_UNWIND(typ, frame, args...) \
+ do { \
+ bd_local_t *__local = frame->local; \
+ xlator_t *__this = frame->this; \
+ \
+ frame->local = NULL; \
+ STACK_UNWIND_STRICT(typ, frame, args); \
+ if (__local) \
+ bd_local_free(__this, __local); \
+ } while (0)
typedef char bd_gfid_t[GF_UUID_BUF_SIZE];
@@ -87,82 +87,103 @@ typedef char bd_gfid_t[GF_UUID_BUF_SIZE];
* bd_fd - internal structure
*/
typedef struct bd_fd {
- int fd;
- int32_t flag;
- int odirect;
+ int fd;
+ int32_t flag;
+ int odirect;
} bd_fd_t;
typedef struct bd_priv {
- lvm_t handle;
- char *vg;
- char *pool;
- int caps;
- gf_boolean_t aio_init_done;
- gf_boolean_t aio_capable;
- gf_boolean_t aio_configured;
+ lvm_t handle;
+ char *vg;
+ char *pool;
+ int caps;
+ gf_boolean_t aio_init_done;
+ gf_boolean_t aio_capable;
+ gf_boolean_t aio_configured;
#ifdef HAVE_LIBAIO
- io_context_t ctxp;
- pthread_t aiothread;
+ io_context_t ctxp;
+ pthread_t aiothread;
#endif
} bd_priv_t;
-
typedef enum bd_type {
- BD_TYPE_NONE,
- BD_TYPE_LV,
+ BD_TYPE_NONE,
+ BD_TYPE_LV,
} bd_type_t;
typedef struct {
- struct iatt iatt;
- char *type;
+ struct iatt iatt;
+ char *type;
} bd_attr_t;
typedef enum {
- BD_OF_NONE,
- BD_OF_CLONE,
- BD_OF_SNAPSHOT,
- BD_OF_MERGE,
+ BD_OF_NONE,
+ BD_OF_CLONE,
+ BD_OF_SNAPSHOT,
+ BD_OF_MERGE,
} bd_offload_t;
typedef struct {
- dict_t *dict;
- bd_attr_t *bdatt;
- inode_t *inode;
- loc_t loc;
- fd_t *fd;
- data_t *data; /* for setxattr */
- bd_offload_t offload;
- uint64_t size;
- loc_t *dloc;
+ dict_t *dict;
+ bd_attr_t *bdatt;
+ inode_t *inode;
+ loc_t loc;
+ fd_t *fd;
+ data_t *data; /* for setxattr */
+ bd_offload_t offload;
+ uint64_t size;
+ loc_t *dloc;
} bd_local_t;
/* Prototypes */
-int bd_inode_ctx_set (inode_t *inode, xlator_t *this, bd_attr_t *ctx);
-int bd_inode_ctx_get (inode_t *inode, xlator_t *this, bd_attr_t **ctx);
-int bd_scan_vg (xlator_t *this, bd_priv_t *priv);
-bd_local_t *bd_local_init (call_frame_t *frame, xlator_t *this);
-void bd_local_free (xlator_t *this, bd_local_t *local);
-int bd_fd_ctx_get (xlator_t *this, fd_t *fd, bd_fd_t **bdfd);
-char *page_aligned_alloc (size_t size, char **aligned_buf);
-int bd_validate_bd_xattr (xlator_t *this, char *bd, char **type,
- uint64_t *lv_size, uuid_t uuid);
-uint64_t bd_get_default_extent (bd_priv_t *priv);
-uint64_t bd_adjust_size (bd_priv_t *priv, size_t size);
-int bd_create (uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv);
-int bd_resize (bd_priv_t *priv, uuid_t uuid, size_t size);
-int bd_delete_lv (bd_priv_t *priv, const char *lv_name, int *op_errno);
-int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv);
-int bd_clone (bd_local_t *local, bd_priv_t *priv);
-
-int bd_merge (bd_priv_t *priv, uuid_t gfid);
-int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
-void bd_update_amtime(struct iatt *iatt, int flag);
-int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv);
-int bd_clone (bd_local_t *local, bd_priv_t *priv);
-int bd_merge (bd_priv_t *priv, uuid_t gfid);
-int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
-int bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd,
- off_t offset, size_t len, struct iatt *prebuf,
- struct iatt *postbuf);
+int
+bd_inode_ctx_set(inode_t *inode, xlator_t *this, bd_attr_t *ctx);
+int
+bd_inode_ctx_get(inode_t *inode, xlator_t *this, bd_attr_t **ctx);
+int
+bd_scan_vg(xlator_t *this, bd_priv_t *priv);
+bd_local_t *
+bd_local_init(call_frame_t *frame, xlator_t *this);
+void
+bd_local_free(xlator_t *this, bd_local_t *local);
+int
+bd_fd_ctx_get(xlator_t *this, fd_t *fd, bd_fd_t **bdfd);
+char *
+page_aligned_alloc(size_t size, char **aligned_buf);
+int
+bd_validate_bd_xattr(xlator_t *this, char *bd, char **type, uint64_t *lv_size,
+ uuid_t uuid);
+uint64_t
+bd_get_default_extent(bd_priv_t *priv);
+uint64_t
+bd_adjust_size(bd_priv_t *priv, size_t size);
+int
+bd_create(uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv);
+int
+bd_resize(bd_priv_t *priv, uuid_t uuid, size_t size);
+int
+bd_delete_lv(bd_priv_t *priv, const char *lv_name, int *op_errno);
+int
+bd_snapshot_create(bd_local_t *local, bd_priv_t *priv);
+int
+bd_clone(bd_local_t *local, bd_priv_t *priv);
+
+int
+bd_merge(bd_priv_t *priv, uuid_t gfid);
+int
+bd_get_origin(bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
+void
+bd_update_amtime(struct iatt *iatt, int flag);
+int
+bd_snapshot_create(bd_local_t *local, bd_priv_t *priv);
+int
+bd_clone(bd_local_t *local, bd_priv_t *priv);
+int
+bd_merge(bd_priv_t *priv, uuid_t gfid);
+int
+bd_get_origin(bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
+int
+bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ size_t len, struct iatt *prebuf, struct iatt *postbuf);
#endif
diff --git a/xlators/storage/posix/src/posix-aio.h b/xlators/storage/posix/src/posix-aio.h
index e9dd6467e5e..9b4a7078ecf 100644
--- a/xlators/storage/posix/src/posix-aio.h
+++ b/xlators/storage/posix/src/posix-aio.h
@@ -20,15 +20,18 @@
// Maximum number of completed IO operations to reap per getevents syscall
#define POSIX_AIO_MAX_NR_GETEVENTS 16
-
-int posix_aio_on (xlator_t *this);
-int posix_aio_off (xlator_t *this);
-
-int posix_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata);
-
-int posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count, off_t offset,
- uint32_t flags, struct iobref *iobref, dict_t *xdata);
+int
+posix_aio_on(xlator_t *this);
+int
+posix_aio_off(xlator_t *this);
+
+int
+posix_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata);
+
+int
+posix_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct iovec *vector, int32_t count, off_t offset, uint32_t flags,
+ struct iobref *iobref, dict_t *xdata);
#endif /* !_POSIX_AIO_H */
diff --git a/xlators/storage/posix/src/posix-gfid-path.h b/xlators/storage/posix/src/posix-gfid-path.h
index 59799125bbb..21f849dd276 100644
--- a/xlators/storage/posix/src/posix-gfid-path.h
+++ b/xlators/storage/posix/src/posix-gfid-path.h
@@ -18,14 +18,12 @@
#define MAX_GFID2PATH_LINK_SUP 500
int32_t
-posix_set_gfid2path_xattr (xlator_t *, const char *, uuid_t,
- const char *);
+posix_set_gfid2path_xattr(xlator_t *, const char *, uuid_t, const char *);
int32_t
-posix_remove_gfid2path_xattr (xlator_t *, const char *, uuid_t,
- const char *);
+posix_remove_gfid2path_xattr(xlator_t *, const char *, uuid_t, const char *);
gf_boolean_t
-posix_is_gfid2path_xattr (const char *name);
+posix_is_gfid2path_xattr(const char *name);
int32_t
-posix_get_gfid2path (xlator_t *this, inode_t *inode, const char *real_path,
- int *op_errno, dict_t *dict);
+posix_get_gfid2path(xlator_t *this, inode_t *inode, const char *real_path,
+ int *op_errno, dict_t *dict);
#endif /* _POSIX_GFID_PATH_H */
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h
index 621f8f4d450..7c79b569128 100644
--- a/xlators/storage/posix/src/posix-handle.h
+++ b/xlators/storage/posix/src/posix-handle.h
@@ -12,192 +12,199 @@
#include "posix-inode-handle.h"
-#define HANDLE_ABSPATH_LEN(this) (POSIX_BASE_PATH_LEN(this) + \
- SLEN("/" GF_HIDDEN_PATH "/00/00/" \
- UUID0_STR) + 1)
-
-#define MAKE_PGFID_XATTR_KEY(var, prefix, pgfid) do { \
- var = alloca (strlen (prefix) + UUID_CANONICAL_FORM_LEN + 1); \
- strcpy (var, prefix); \
- strcat (var, uuid_utoa (pgfid)); \
- } while (0)
-
-#define SET_PGFID_XATTR(path, key, value, flags, op_ret, this, label) do { \
- value = hton32 (value); \
- op_ret = sys_lsetxattr (path, key, &value, sizeof (value), \
- flags); \
- if (op_ret == -1) { \
- op_errno = errno; \
- gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP, \
- "setting xattr failed on %s: key = %s ", \
- path, key); \
- goto label; \
- } \
- } while (0)
-
-#define SET_PGFID_XATTR_IF_ABSENT(path, key, value, flags, op_ret, this, label)\
- do { \
- op_ret = sys_lgetxattr (path, key, &value, sizeof (value)); \
- if (op_ret == -1) { \
- op_errno = errno; \
- if (op_errno == ENOATTR) { \
- value = 1; \
- SET_PGFID_XATTR (path, key, value, flags, \
- op_ret, this, label); \
- } else { \
- gf_msg (this->name, GF_LOG_WARNING, op_errno, \
- P_MSG_PGFID_OP, "getting xattr " \
- "failed on %s: key = %s ", \
- path, key); \
- } \
- } \
- } while (0)
-
-#define REMOVE_PGFID_XATTR(path, key, op_ret, this, label) do { \
- op_ret = sys_lremovexattr (path, key); \
- if (op_ret == -1) { \
- op_errno = errno; \
- gf_msg (this->name, GF_LOG_WARNING, op_errno, \
- P_MSG_PGFID_OP, \
- "removing xattr failed" \
- "on %s: key = %s", path, key); \
- goto label; \
- } \
- } while (0)
+#define HANDLE_ABSPATH_LEN(this) \
+ (POSIX_BASE_PATH_LEN(this) + \
+ SLEN("/" GF_HIDDEN_PATH "/00/00/" UUID0_STR) + 1)
+
+#define MAKE_PGFID_XATTR_KEY(var, prefix, pgfid) \
+ do { \
+ var = alloca(strlen(prefix) + UUID_CANONICAL_FORM_LEN + 1); \
+ strcpy(var, prefix); \
+ strcat(var, uuid_utoa(pgfid)); \
+ } while (0)
+
+#define SET_PGFID_XATTR(path, key, value, flags, op_ret, this, label) \
+ do { \
+ value = hton32(value); \
+ op_ret = sys_lsetxattr(path, key, &value, sizeof(value), flags); \
+ if (op_ret == -1) { \
+ op_errno = errno; \
+ gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP, \
+ "setting xattr failed on %s: key = %s ", path, key); \
+ goto label; \
+ } \
+ } while (0)
+
+#define SET_PGFID_XATTR_IF_ABSENT(path, key, value, flags, op_ret, this, \
+ label) \
+ do { \
+ op_ret = sys_lgetxattr(path, key, &value, sizeof(value)); \
+ if (op_ret == -1) { \
+ op_errno = errno; \
+ if (op_errno == ENOATTR) { \
+ value = 1; \
+ SET_PGFID_XATTR(path, key, value, flags, op_ret, this, label); \
+ } else { \
+ gf_msg(this->name, GF_LOG_WARNING, op_errno, P_MSG_PGFID_OP, \
+ "getting xattr " \
+ "failed on %s: key = %s ", \
+ path, key); \
+ } \
+ } \
+ } while (0)
+
+#define REMOVE_PGFID_XATTR(path, key, op_ret, this, label) \
+ do { \
+ op_ret = sys_lremovexattr(path, key); \
+ if (op_ret == -1) { \
+ op_errno = errno; \
+ gf_msg(this->name, GF_LOG_WARNING, op_errno, P_MSG_PGFID_OP, \
+ "removing xattr failed" \
+ "on %s: key = %s", \
+ path, key); \
+ goto label; \
+ } \
+ } while (0)
/* should be invoked holding a lock */
-#define LINK_MODIFY_PGFID_XATTR(path, key, value, flags, op_ret, this, label) do { \
- op_ret = sys_lgetxattr (path, key, &value, sizeof (value)); \
- if (op_ret == -1) { \
- op_errno = errno; \
- if (op_errno == ENOATTR || op_errno == ENODATA) { \
- value = 1; \
- } else { \
- gf_msg (this->name, GF_LOG_WARNING, errno, \
- P_MSG_PGFID_OP, "getting xattr " \
- "failed on %s: key = %s ", path, key); \
- goto label; \
- } \
- } else { \
- value = ntoh32 (value); \
- value++; \
- } \
- SET_PGFID_XATTR (path, key, value, flags, op_ret, this, label); \
- } while (0)
+#define LINK_MODIFY_PGFID_XATTR(path, key, value, flags, op_ret, this, label) \
+ do { \
+ op_ret = sys_lgetxattr(path, key, &value, sizeof(value)); \
+ if (op_ret == -1) { \
+ op_errno = errno; \
+ if (op_errno == ENOATTR || op_errno == ENODATA) { \
+ value = 1; \
+ } else { \
+ gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP, \
+ "getting xattr " \
+ "failed on %s: key = %s ", \
+ path, key); \
+ goto label; \
+ } \
+ } else { \
+ value = ntoh32(value); \
+ value++; \
+ } \
+ SET_PGFID_XATTR(path, key, value, flags, op_ret, this, label); \
+ } while (0)
/* should be invoked holding a lock */
-#define UNLINK_MODIFY_PGFID_XATTR(path, key, value, flags, op_ret, this, label) do { \
- op_ret = sys_lgetxattr (path, key, &value, sizeof (value)); \
- if (op_ret == -1) { \
- op_errno = errno; \
- gf_msg (this->name, GF_LOG_WARNING, errno, \
- P_MSG_PGFID_OP, "getting xattr failed on " \
- "%s: key = %s ", path, key); \
- goto label; \
- } else { \
- value = ntoh32 (value); \
- value--; \
- if (value > 0) { \
- SET_PGFID_XATTR (path, key, value, flags, op_ret, \
- this, label); \
- } else { \
- REMOVE_PGFID_XATTR (path, key, op_ret, this, label); \
- } \
- } \
+#define UNLINK_MODIFY_PGFID_XATTR(path, key, value, flags, op_ret, this, \
+ label) \
+ do { \
+ op_ret = sys_lgetxattr(path, key, &value, sizeof(value)); \
+ if (op_ret == -1) { \
+ op_errno = errno; \
+ gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP, \
+ "getting xattr failed on " \
+ "%s: key = %s ", \
+ path, key); \
+ goto label; \
+ } else { \
+ value = ntoh32(value); \
+ value--; \
+ if (value > 0) { \
+ SET_PGFID_XATTR(path, key, value, flags, op_ret, this, label); \
+ } else { \
+ REMOVE_PGFID_XATTR(path, key, op_ret, this, label); \
+ } \
+ } \
} while (0)
-#define MAKE_HANDLE_GFID_PATH(var, this, gfid, base) do { \
- int __len = 0; \
- __len = posix_handle_gfid_path (this, gfid, base, NULL, 0); \
- if (__len <= 0) \
- break; \
- var = alloca (__len); \
- __len = posix_handle_gfid_path (this, gfid, base, var, __len); \
- } while (0)
-
-
-#define MAKE_HANDLE_RELPATH(var, this, gfid, base) do { \
- int __len; \
- __len = posix_handle_relpath (this, gfid, base, NULL, 0); \
- if (__len <= 0) \
- break; \
- var = alloca (__len); \
- __len = posix_handle_relpath (this, gfid, base, var, __len); \
- } while (0)
-
-#define MAKE_HANDLE_ABSPATH(var, this, gfid) do { \
- struct posix_private * __priv = this->private; \
- int __len = HANDLE_ABSPATH_LEN(this); \
- var = alloca(__len); \
- snprintf(var, __len, "%s/" GF_HIDDEN_PATH "/%02x/%02x/%s", \
- __priv->base_path, gfid[0], gfid[1], uuid_utoa(gfid)); \
- } while (0)
-
-#define MAKE_ENTRY_HANDLE(entp, parp, this, loc, ent_p) do { \
- char *__parp; \
- \
- if (gf_uuid_is_null (loc->pargfid) || !loc->name) { \
- gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_ENTRY_HANDLE_CREATE,\
- "null pargfid/name for path %s", loc->path); \
- break; \
- } \
- \
- if (strstr (loc->name, "../")) { \
- gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_ENTRY_HANDLE_CREATE, \
- "'../' in name not allowed: (%s)", loc->name); \
- op_ret = -1; \
- break; \
- } \
- if (LOC_HAS_ABSPATH (loc)) { \
- MAKE_REAL_PATH (entp, this, loc->path); \
- __parp = strdupa (entp); \
- parp = dirname (__parp); \
- op_ret = posix_pstat (this, loc->inode, NULL, entp, ent_p, \
- _gf_false); \
- break; \
- } \
- errno = 0; \
- op_ret = posix_istat (this, loc->inode, loc->pargfid, \
- loc->name, ent_p); \
- if (errno != ELOOP) { \
- MAKE_HANDLE_PATH (parp, this, loc->pargfid, NULL); \
- MAKE_HANDLE_PATH (entp, this, loc->pargfid, loc->name); \
- if (!parp || !entp) { \
- gf_msg (this->name, GF_LOG_ERROR, errno, \
- P_MSG_ENTRY_HANDLE_CREATE, \
- "Failed to create entry handle " \
- "for path %s", loc->path); \
- } \
- break; \
- } \
- /* __ret == -1 && errno == ELOOP */ \
- /* expand ELOOP */ \
- } while (0)
+#define MAKE_HANDLE_GFID_PATH(var, this, gfid, base) \
+ do { \
+ int __len = 0; \
+ __len = posix_handle_gfid_path(this, gfid, base, NULL, 0); \
+ if (__len <= 0) \
+ break; \
+ var = alloca(__len); \
+ __len = posix_handle_gfid_path(this, gfid, base, var, __len); \
+ } while (0)
-int
-posix_handle_gfid_path (xlator_t *this, uuid_t gfid, const char *basename,
- char *buf, size_t len);
+#define MAKE_HANDLE_RELPATH(var, this, gfid, base) \
+ do { \
+ int __len; \
+ __len = posix_handle_relpath(this, gfid, base, NULL, 0); \
+ if (__len <= 0) \
+ break; \
+ var = alloca(__len); \
+ __len = posix_handle_relpath(this, gfid, base, var, __len); \
+ } while (0)
+
+#define MAKE_HANDLE_ABSPATH(var, this, gfid) \
+ do { \
+ struct posix_private *__priv = this->private; \
+ int __len = HANDLE_ABSPATH_LEN(this); \
+ var = alloca(__len); \
+ snprintf(var, __len, "%s/" GF_HIDDEN_PATH "/%02x/%02x/%s", \
+ __priv->base_path, gfid[0], gfid[1], uuid_utoa(gfid)); \
+ } while (0)
+
+#define MAKE_ENTRY_HANDLE(entp, parp, this, loc, ent_p) \
+ do { \
+ char *__parp; \
+ \
+ if (gf_uuid_is_null(loc->pargfid) || !loc->name) { \
+ gf_msg(this->name, GF_LOG_ERROR, 0, P_MSG_ENTRY_HANDLE_CREATE, \
+ "null pargfid/name for path %s", loc->path); \
+ break; \
+ } \
+ \
+ if (strstr(loc->name, "../")) { \
+ gf_msg(this->name, GF_LOG_ERROR, 0, P_MSG_ENTRY_HANDLE_CREATE, \
+ "'../' in name not allowed: (%s)", loc->name); \
+ op_ret = -1; \
+ break; \
+ } \
+ if (LOC_HAS_ABSPATH(loc)) { \
+ MAKE_REAL_PATH(entp, this, loc->path); \
+ __parp = strdupa(entp); \
+ parp = dirname(__parp); \
+ op_ret = posix_pstat(this, loc->inode, NULL, entp, ent_p, \
+ _gf_false); \
+ break; \
+ } \
+ errno = 0; \
+ op_ret = posix_istat(this, loc->inode, loc->pargfid, loc->name, \
+ ent_p); \
+ if (errno != ELOOP) { \
+ MAKE_HANDLE_PATH(parp, this, loc->pargfid, NULL); \
+ MAKE_HANDLE_PATH(entp, this, loc->pargfid, loc->name); \
+ if (!parp || !entp) { \
+ gf_msg(this->name, GF_LOG_ERROR, errno, \
+ P_MSG_ENTRY_HANDLE_CREATE, \
+ "Failed to create entry handle " \
+ "for path %s", \
+ loc->path); \
+ } \
+ break; \
+ } \
+ /* __ret == -1 && errno == ELOOP */ \
+ /* expand ELOOP */ \
+ } while (0)
int
-posix_handle_hard (xlator_t *this, const char *path, uuid_t gfid,
- struct stat *buf);
+posix_handle_gfid_path(xlator_t *this, uuid_t gfid, const char *basename,
+ char *buf, size_t len);
+int
+posix_handle_hard(xlator_t *this, const char *path, uuid_t gfid,
+ struct stat *buf);
int
-posix_handle_soft (xlator_t *this, const char *real_path, loc_t *loc,
- uuid_t gfid, struct stat *buf);
+posix_handle_soft(xlator_t *this, const char *real_path, loc_t *loc,
+ uuid_t gfid, struct stat *buf);
int
-posix_handle_unset (xlator_t *this, uuid_t gfid, const char *basename);
+posix_handle_unset(xlator_t *this, uuid_t gfid, const char *basename);
int
-posix_create_link_if_gfid_exists (xlator_t *this, uuid_t gfid,
- char *real_path, inode_table_t *itable);
+posix_create_link_if_gfid_exists(xlator_t *this, uuid_t gfid, char *real_path,
+ inode_table_t *itable);
int
-posix_check_internal_writes (xlator_t *this, fd_t *fd, int sysfd,
- dict_t *xdata);
+posix_check_internal_writes(xlator_t *this, fd_t *fd, int sysfd, dict_t *xdata);
void
-posix_disk_space_check (xlator_t *this);
+posix_disk_space_check(xlator_t *this);
#endif /* !_POSIX_HANDLE_H */
diff --git a/xlators/storage/posix/src/posix-inode-handle.h b/xlators/storage/posix/src/posix-inode-handle.h
index cb315424dd0..f225d94912b 100644
--- a/xlators/storage/posix/src/posix-inode-handle.h
+++ b/xlators/storage/posix/src/posix-inode-handle.h
@@ -27,91 +27,92 @@
#define SLEN(str) (sizeof(str) - 1)
#define LOC_HAS_ABSPATH(loc) (loc && (loc->path) && (loc->path[0] == '/'))
-#define LOC_IS_DIR(loc) (loc && (loc->inode) && \
- (loc->inode->ia_type == IA_IFDIR))
-#define MAKE_REAL_PATH(var, this, path) do { \
- size_t path_len = strlen(path); \
- size_t var_len = path_len + POSIX_BASE_PATH_LEN(this) + 1; \
- if (POSIX_PATH_MAX(this) != -1 && \
- var_len >= POSIX_PATH_MAX(this)) { \
- var = alloca (path_len + 1); \
- strcpy (var, (path[0] == '/') ? path + 1 : path); \
- } else { \
- var = alloca (var_len); \
- strcpy (var, POSIX_BASE_PATH(this)); \
- strcpy (&var[POSIX_BASE_PATH_LEN(this)], path); \
- } \
+#define LOC_IS_DIR(loc) \
+ (loc && (loc->inode) && (loc->inode->ia_type == IA_IFDIR))
+#define MAKE_REAL_PATH(var, this, path) \
+ do { \
+ size_t path_len = strlen(path); \
+ size_t var_len = path_len + POSIX_BASE_PATH_LEN(this) + 1; \
+ if (POSIX_PATH_MAX(this) != -1 && var_len >= POSIX_PATH_MAX(this)) { \
+ var = alloca(path_len + 1); \
+ strcpy(var, (path[0] == '/') ? path + 1 : path); \
+ } else { \
+ var = alloca(var_len); \
+ strcpy(var, POSIX_BASE_PATH(this)); \
+ strcpy(&var[POSIX_BASE_PATH_LEN(this)], path); \
+ } \
} while (0)
-#define MAKE_HANDLE_PATH(var, this, gfid, base) do { \
- int __len; \
- __len = posix_handle_path (this, gfid, base, NULL, 0); \
- if (__len <= 0) \
- break; \
- var = alloca (__len); \
- __len = posix_handle_path (this, gfid, base, var, __len); \
- if (__len <= 0) \
- var = NULL; \
- } while (0)
+#define MAKE_HANDLE_PATH(var, this, gfid, base) \
+ do { \
+ int __len; \
+ __len = posix_handle_path(this, gfid, base, NULL, 0); \
+ if (__len <= 0) \
+ break; \
+ var = alloca(__len); \
+ __len = posix_handle_path(this, gfid, base, var, __len); \
+ if (__len <= 0) \
+ var = NULL; \
+ } while (0)
/* TODO: it is not a good idea to change a variable which
is not passed to the macro.. Fix it later */
-#define MAKE_INODE_HANDLE(rpath, this, loc, iatt_p) do { \
- if (!this->private) { \
- op_ret = -1; \
- gf_msg ("make_inode_handle", GF_LOG_ERROR, 0, \
- P_MSG_INODE_HANDLE_CREATE, \
- "private is NULL, fini is already called"); \
- break; \
- } \
- if (gf_uuid_is_null (loc->gfid)) { \
- op_ret = -1; \
- gf_msg (this->name, GF_LOG_ERROR, 0, \
- P_MSG_INODE_HANDLE_CREATE, \
- "null gfid for path %s", (loc)->path); \
- break; \
- } \
- if (LOC_IS_DIR (loc) && LOC_HAS_ABSPATH (loc)) { \
- MAKE_REAL_PATH (rpath, this, (loc)->path); \
- op_ret = posix_pstat (this, (loc)->inode, (loc)->gfid, \
- rpath, iatt_p, _gf_false); \
- break; \
- } \
- errno = 0; \
- op_ret = posix_istat (this, loc->inode, loc->gfid, NULL, iatt_p); \
- if (errno != ELOOP) { \
- MAKE_HANDLE_PATH (rpath, this, (loc)->gfid, NULL); \
- if (!rpath) { \
- op_ret = -1; \
- gf_msg (this->name, GF_LOG_ERROR, errno, \
- P_MSG_INODE_HANDLE_CREATE, \
- "Failed to create inode handle " \
- "for path %s", (loc)->path); \
- } \
- break; \
- } \
- /* __ret == -1 && errno == ELOOP */ \
- } while (0)
+#define MAKE_INODE_HANDLE(rpath, this, loc, iatt_p) \
+ do { \
+ if (!this->private) { \
+ op_ret = -1; \
+ gf_msg("make_inode_handle", GF_LOG_ERROR, 0, \
+ P_MSG_INODE_HANDLE_CREATE, \
+ "private is NULL, fini is already called"); \
+ break; \
+ } \
+ if (gf_uuid_is_null(loc->gfid)) { \
+ op_ret = -1; \
+ gf_msg(this->name, GF_LOG_ERROR, 0, P_MSG_INODE_HANDLE_CREATE, \
+ "null gfid for path %s", (loc)->path); \
+ break; \
+ } \
+ if (LOC_IS_DIR(loc) && LOC_HAS_ABSPATH(loc)) { \
+ MAKE_REAL_PATH(rpath, this, (loc)->path); \
+ op_ret = posix_pstat(this, (loc)->inode, (loc)->gfid, rpath, \
+ iatt_p, _gf_false); \
+ break; \
+ } \
+ errno = 0; \
+ op_ret = posix_istat(this, loc->inode, loc->gfid, NULL, iatt_p); \
+ if (errno != ELOOP) { \
+ MAKE_HANDLE_PATH(rpath, this, (loc)->gfid, NULL); \
+ if (!rpath) { \
+ op_ret = -1; \
+ gf_msg(this->name, GF_LOG_ERROR, errno, \
+ P_MSG_INODE_HANDLE_CREATE, \
+ "Failed to create inode handle " \
+ "for path %s", \
+ (loc)->path); \
+ } \
+ break; \
+ } \
+ /* __ret == -1 && errno == ELOOP */ \
+ } while (0)
#define POSIX_ANCESTRY_PATH (1 << 0)
#define POSIX_ANCESTRY_DENTRY (1 << 1)
int
-posix_handle_path (xlator_t *this, uuid_t gfid, const char *basename, char *buf,
- size_t len);
+posix_handle_path(xlator_t *this, uuid_t gfid, const char *basename, char *buf,
+ size_t len);
int
-posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
- gf_dirent_t *head, int type, uuid_t gfid,
- const size_t handle_size,
- const char *priv_base_path,
- inode_table_t *table, inode_t **parent,
- dict_t *xdata, int32_t *op_errno);
+posix_make_ancestryfromgfid(xlator_t *this, char *path, int pathsize,
+ gf_dirent_t *head, int type, uuid_t gfid,
+ const size_t handle_size,
+ const char *priv_base_path, inode_table_t *table,
+ inode_t **parent, dict_t *xdata, int32_t *op_errno);
int
-posix_handle_init (xlator_t *this);
+posix_handle_init(xlator_t *this);
int
-posix_handle_trash_init (xlator_t *this);
+posix_handle_trash_init(xlator_t *this);
#endif /* !_POSIX_INODE_HANDLE_H */
diff --git a/xlators/storage/posix/src/posix-mem-types.h b/xlators/storage/posix/src/posix-mem-types.h
index 0180900ee8e..b9bd79ba3b8 100644
--- a/xlators/storage/posix/src/posix-mem-types.h
+++ b/xlators/storage/posix/src/posix-mem-types.h
@@ -13,17 +13,16 @@
#include "mem-types.h"
enum gf_posix_mem_types_ {
- gf_posix_mt_dir_entry_t = gf_common_mt_end + 1,
- gf_posix_mt_posix_fd,
- gf_posix_mt_char,
- gf_posix_mt_posix_private,
- gf_posix_mt_int32_t,
- gf_posix_mt_posix_dev_t,
- gf_posix_mt_trash_path,
- gf_posix_mt_paiocb,
- gf_posix_mt_inode_ctx_t,
- gf_posix_mt_mdata_attr,
- gf_posix_mt_end
+ gf_posix_mt_dir_entry_t = gf_common_mt_end + 1,
+ gf_posix_mt_posix_fd,
+ gf_posix_mt_char,
+ gf_posix_mt_posix_private,
+ gf_posix_mt_int32_t,
+ gf_posix_mt_posix_dev_t,
+ gf_posix_mt_trash_path,
+ gf_posix_mt_paiocb,
+ gf_posix_mt_inode_ctx_t,
+ gf_posix_mt_mdata_attr,
+ gf_posix_mt_end
};
#endif
-
diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h
index 38e6d3113d3..14167a5f829 100644
--- a/xlators/storage/posix/src/posix-messages.h
+++ b/xlators/storage/posix/src/posix-messages.h
@@ -23,125 +23,50 @@
* glfs-message-id.h.
*/
-GLFS_MSGID(POSIX,
- P_MSG_XATTR_FAILED,
- P_MSG_NULL_GFID,
- P_MSG_FCNTL_FAILED,
- P_MSG_READV_FAILED,
- P_MSG_FSTAT_FAILED,
- P_MSG_PFD_NULL,
- P_MSG_INVALID_ARGUMENT,
- P_MSG_IO_SUBMIT_FAILED,
- P_MSG_WRITEV_FAILED,
- P_MSG_IO_GETEVENTS_FAILED,
- P_MSG_UNKNOWN_OP,
- P_MSG_AIO_UNAVAILABLE,
- P_MSG_IO_SETUP_FAILED,
- P_MSG_ZEROFILL_FAILED,
- P_MSG_OPENDIR_FAILED,
- P_MSG_DIRFD_FAILED,
- P_MSG_FD_PATH_SETTING_FAILED,
- P_MSG_LSTAT_FAILED,
- P_MSG_READYLINK_FAILED,
- P_MSG_GFID_FAILED,
- P_MSG_CREATE_FAILED,
- P_MSG_MKNOD_FAILED,
- P_MSG_LCHOWN_FAILED,
- P_MSG_ACL_FAILED,
- P_MSG_MKDIR_NOT_PERMITTED,
- P_MSG_DIR_OF_SAME_ID,
- P_MSG_MKDIR_FAILED,
- P_MSG_CHOWN_FAILED,
- P_MSG_UNLINK_FAILED,
- P_MSG_KEY_STATUS_INFO,
- P_MSG_XATTR_STATUS,
- P_MSG_RMDIR_NOT_PERMITTED,
- P_MSG_RMDIR_FAILED,
- P_MSG_DIR_OPERATION_FAILED,
- P_MSG_SYMLINK_FAILED,
- P_MSG_DIR_FOUND,
- P_MSG_LINK_FAILED,
- P_MSG_TRUNCATE_FAILED,
- P_MSG_FILE_OP_FAILED,
- P_MSG_READ_FAILED,
- P_MSG_DICT_SET_FAILED,
- P_MSG_STATVFS_FAILED,
- P_MSG_DIR_NOT_NULL,
- P_MSG_FSYNC_FAILED,
- P_MSG_CLOSE_FAILED,
- P_MSG_GETTING_FILENAME_FAILED,
- P_MSG_INODE_PATH_GET_FAILED,
- P_MSG_GET_KEY_VALUE_FAILED,
- P_MSG_CHMOD_FAILED,
- P_MSG_FCHMOD_FAILED,
- P_MSG_FCHOWN_FAILED,
- P_MSG_UTIMES_FAILED,
- P_MSG_FUTIMES_FAILED,
- P_MSG_XATTR_NOT_REMOVED,
- P_MSG_PFD_GET_FAILED,
- P_MSG_ACCESS_FAILED,
- P_MSG_PREAD_FAILED,
- P_MSG_UUID_NULL,
- P_MSG_EXPORT_DIR_MISSING,
- P_MSG_SUBVOLUME_ERROR,
- P_MSG_VOLUME_DANGLING,
- P_MSG_INVALID_OPTION,
- P_MSG_INVALID_VOLUME_ID,
- P_MSG_VOLUME_ID_ABSENT,
- P_MSG_HOSTNAME_MISSING,
- P_MSG_SET_ULIMIT_FAILED,
- P_MSG_SET_FILE_MAX_FAILED,
- P_MSG_MAX_FILE_OPEN,
- P_MSG_OPEN_FAILED,
- P_MSG_LOOKUP_NOT_PERMITTED,
- P_MSG_RENAME_FAILED,
- P_MSG_WRITE_FAILED,
- P_MSG_FILE_FAILED,
- P_MSG_THREAD_FAILED,
- P_MSG_HEALTHCHECK_FAILED,
- P_MSG_GET_FDCTX_FAILED,
- P_MSG_HANDLEPATH_FAILED,
- P_MSG_IPC_NOT_HANDLE,
- P_MSG_SET_XDATA_FAIL,
- P_MSG_DURABILITY_REQ_NOT_SATISFIED,
- P_MSG_XATTR_NOTSUP,
- P_MSG_GFID_SET_FAILED,
- P_MSG_ACL_NOTSUP,
- P_MSG_BASEPATH_CHDIR_FAILED,
- P_MSG_INVALID_OPTION_VAL,
- P_MSG_INVALID_NODE_UUID,
- P_MSG_FSYNCER_THREAD_CREATE_FAILED,
- P_MSG_GF_DIRENT_CREATE_FAILED,
- P_MSG_VOLUME_ID_FETCH_FAILED,
- P_MSG_UNKNOWN_ARGUMENT,
- P_MSG_INODE_HANDLE_CREATE,
- P_MSG_ENTRY_HANDLE_CREATE,
- P_MSG_PGFID_OP,
- P_MSG_POSIX_AIO,
- P_MSG_HANDLE_CREATE_TRASH,
- P_MSG_HANDLE_CREATE,
- P_MSG_HANDLE_PATH_CREATE,
- P_MSG_SET_FILE_CONTENTS,
- P_MSG_XDATA_GETXATTR,
- P_MSG_STALE_HANDLE_REMOVE_FAILED,
- P_MSG_HANDLE_PATH_CREATE_FAILED,
- P_MSG_HANDLE_TRASH_CREATE,
- P_MSG_HANDLE_DELETE,
- P_MSG_READLINK_FAILED,
- P_MSG_BUFFER_OVERFLOW,
- P_MSG_SEEK_UNKOWN,
- P_MSG_SEEK_FAILED,
- P_MSG_INODE_RESOLVE_FAILED,
- P_MSG_PREOP_CHECK_FAILED,
- P_MSG_LEASE_DISABLED,
- P_MSG_ANCESTORY_FAILED,
- P_MSG_DISK_SPACE_CHECK_FAILED,
- P_MSG_FALLOCATE_FAILED,
- P_MSG_STOREMDATA_FAILED,
- P_MSG_FETCHMDATA_FAILED,
- P_MSG_GETMDATA_FAILED,
- P_MSG_SETMDATA_FAILED,
- P_MSG_FRESHFILE
-);
+GLFS_MSGID(POSIX, P_MSG_XATTR_FAILED, P_MSG_NULL_GFID, P_MSG_FCNTL_FAILED,
+ P_MSG_READV_FAILED, P_MSG_FSTAT_FAILED, P_MSG_PFD_NULL,
+ P_MSG_INVALID_ARGUMENT, P_MSG_IO_SUBMIT_FAILED, P_MSG_WRITEV_FAILED,
+ P_MSG_IO_GETEVENTS_FAILED, P_MSG_UNKNOWN_OP, P_MSG_AIO_UNAVAILABLE,
+ P_MSG_IO_SETUP_FAILED, P_MSG_ZEROFILL_FAILED, P_MSG_OPENDIR_FAILED,
+ P_MSG_DIRFD_FAILED, P_MSG_FD_PATH_SETTING_FAILED, P_MSG_LSTAT_FAILED,
+ P_MSG_READYLINK_FAILED, P_MSG_GFID_FAILED, P_MSG_CREATE_FAILED,
+ P_MSG_MKNOD_FAILED, P_MSG_LCHOWN_FAILED, P_MSG_ACL_FAILED,
+ P_MSG_MKDIR_NOT_PERMITTED, P_MSG_DIR_OF_SAME_ID, P_MSG_MKDIR_FAILED,
+ P_MSG_CHOWN_FAILED, P_MSG_UNLINK_FAILED, P_MSG_KEY_STATUS_INFO,
+ P_MSG_XATTR_STATUS, P_MSG_RMDIR_NOT_PERMITTED, P_MSG_RMDIR_FAILED,
+ P_MSG_DIR_OPERATION_FAILED, P_MSG_SYMLINK_FAILED, P_MSG_DIR_FOUND,
+ P_MSG_LINK_FAILED, P_MSG_TRUNCATE_FAILED, P_MSG_FILE_OP_FAILED,
+ P_MSG_READ_FAILED, P_MSG_DICT_SET_FAILED, P_MSG_STATVFS_FAILED,
+ P_MSG_DIR_NOT_NULL, P_MSG_FSYNC_FAILED, P_MSG_CLOSE_FAILED,
+ P_MSG_GETTING_FILENAME_FAILED, P_MSG_INODE_PATH_GET_FAILED,
+ P_MSG_GET_KEY_VALUE_FAILED, P_MSG_CHMOD_FAILED, P_MSG_FCHMOD_FAILED,
+ P_MSG_FCHOWN_FAILED, P_MSG_UTIMES_FAILED, P_MSG_FUTIMES_FAILED,
+ P_MSG_XATTR_NOT_REMOVED, P_MSG_PFD_GET_FAILED, P_MSG_ACCESS_FAILED,
+ P_MSG_PREAD_FAILED, P_MSG_UUID_NULL, P_MSG_EXPORT_DIR_MISSING,
+ P_MSG_SUBVOLUME_ERROR, P_MSG_VOLUME_DANGLING, P_MSG_INVALID_OPTION,
+ P_MSG_INVALID_VOLUME_ID, P_MSG_VOLUME_ID_ABSENT,
+ P_MSG_HOSTNAME_MISSING, P_MSG_SET_ULIMIT_FAILED,
+ P_MSG_SET_FILE_MAX_FAILED, P_MSG_MAX_FILE_OPEN, P_MSG_OPEN_FAILED,
+ P_MSG_LOOKUP_NOT_PERMITTED, P_MSG_RENAME_FAILED, P_MSG_WRITE_FAILED,
+ P_MSG_FILE_FAILED, P_MSG_THREAD_FAILED, P_MSG_HEALTHCHECK_FAILED,
+ P_MSG_GET_FDCTX_FAILED, P_MSG_HANDLEPATH_FAILED,
+ P_MSG_IPC_NOT_HANDLE, P_MSG_SET_XDATA_FAIL,
+ P_MSG_DURABILITY_REQ_NOT_SATISFIED, P_MSG_XATTR_NOTSUP,
+ P_MSG_GFID_SET_FAILED, P_MSG_ACL_NOTSUP, P_MSG_BASEPATH_CHDIR_FAILED,
+ P_MSG_INVALID_OPTION_VAL, P_MSG_INVALID_NODE_UUID,
+ P_MSG_FSYNCER_THREAD_CREATE_FAILED, P_MSG_GF_DIRENT_CREATE_FAILED,
+ P_MSG_VOLUME_ID_FETCH_FAILED, P_MSG_UNKNOWN_ARGUMENT,
+ P_MSG_INODE_HANDLE_CREATE, P_MSG_ENTRY_HANDLE_CREATE, P_MSG_PGFID_OP,
+ P_MSG_POSIX_AIO, P_MSG_HANDLE_CREATE_TRASH, P_MSG_HANDLE_CREATE,
+ P_MSG_HANDLE_PATH_CREATE, P_MSG_SET_FILE_CONTENTS,
+ P_MSG_XDATA_GETXATTR, P_MSG_STALE_HANDLE_REMOVE_FAILED,
+ P_MSG_HANDLE_PATH_CREATE_FAILED, P_MSG_HANDLE_TRASH_CREATE,
+ P_MSG_HANDLE_DELETE, P_MSG_READLINK_FAILED, P_MSG_BUFFER_OVERFLOW,
+ P_MSG_SEEK_UNKOWN, P_MSG_SEEK_FAILED, P_MSG_INODE_RESOLVE_FAILED,
+ P_MSG_PREOP_CHECK_FAILED, P_MSG_LEASE_DISABLED,
+ P_MSG_ANCESTORY_FAILED, P_MSG_DISK_SPACE_CHECK_FAILED,
+ P_MSG_FALLOCATE_FAILED, P_MSG_STOREMDATA_FAILED,
+ P_MSG_FETCHMDATA_FAILED, P_MSG_GETMDATA_FAILED,
+ P_MSG_SETMDATA_FAILED, P_MSG_FRESHFILE);
#endif /* !_GLUSTERD_MESSAGES_H_ */
diff --git a/xlators/storage/posix/src/posix-metadata-disk.h b/xlators/storage/posix/src/posix-metadata-disk.h
index b25ad04a633..8833fbb5428 100644
--- a/xlators/storage/posix/src/posix-metadata-disk.h
+++ b/xlators/storage/posix/src/posix-metadata-disk.h
@@ -12,20 +12,20 @@
#define _POSIX_METADATA_DISK_H
typedef struct gf_timespec_disk {
- uint64_t tv_sec;
- uint64_t tv_nsec;
+ uint64_t tv_sec;
+ uint64_t tv_nsec;
} gf_timespec_disk_t;
/* posix_mdata_t on disk structure */
-typedef struct __attribute__ ((__packed__)) posix_mdata_disk {
- /* version of structure, bumped up if any new member is added */
- uint8_t version;
- /* flags indicates valid fields in the structure */
- uint64_t flags;
- gf_timespec_disk_t ctime;
- gf_timespec_disk_t mtime;
- gf_timespec_disk_t atime;
+typedef struct __attribute__((__packed__)) posix_mdata_disk {
+ /* version of structure, bumped up if any new member is added */
+ uint8_t version;
+ /* flags indicates valid fields in the structure */
+ uint64_t flags;
+ gf_timespec_disk_t ctime;
+ gf_timespec_disk_t mtime;
+ gf_timespec_disk_t atime;
} posix_mdata_disk_t;
#endif /* _POSIX_METADATA_DISK_H */
diff --git a/xlators/storage/posix/src/posix-metadata.h b/xlators/storage/posix/src/posix-metadata.h
index fbd79f6a4b7..e1b549d55a1 100644
--- a/xlators/storage/posix/src/posix-metadata.h
+++ b/xlators/storage/posix/src/posix-metadata.h
@@ -15,38 +15,38 @@
/* In memory representation posix metadata xattr */
typedef struct {
- /* version of structure, bumped up if any new member is added */
- uint8_t version;
- /* flags indicates valid fields in the structure */
- uint64_t flags;
- struct timespec ctime;
- struct timespec mtime;
- struct timespec atime;
+ /* version of structure, bumped up if any new member is added */
+ uint8_t version;
+ /* flags indicates valid fields in the structure */
+ uint64_t flags;
+ struct timespec ctime;
+ struct timespec mtime;
+ struct timespec atime;
} posix_mdata_t;
typedef struct {
- unsigned short ctime : 1;
- unsigned short mtime : 1;
- unsigned short atime : 1;
+ unsigned short ctime : 1;
+ unsigned short mtime : 1;
+ unsigned short atime : 1;
} posix_mdata_flag_t;
/* With inode lock*/
int
-posix_get_mdata_xattr (xlator_t *this, const char *real_path, int _fd,
- inode_t *inode, struct iatt *stbuf);
+posix_get_mdata_xattr(xlator_t *this, const char *real_path, int _fd,
+ inode_t *inode, struct iatt *stbuf);
/* With out inode lock*/
int
-__posix_get_mdata_xattr (xlator_t *this, const char *real_path, int _fd,
- inode_t *inode, struct iatt *stbuf);
+__posix_get_mdata_xattr(xlator_t *this, const char *real_path, int _fd,
+ inode_t *inode, struct iatt *stbuf);
void
-posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd,
- inode_t *inode, struct iatt *stbuf, int valid);
+posix_update_utime_in_mdata(xlator_t *this, const char *real_path, int fd,
+ inode_t *inode, struct iatt *stbuf, int valid);
void
-posix_set_ctime (call_frame_t *frame, xlator_t *this, const char* real_path,
- int fd, inode_t *inode, struct iatt *stbuf);
+posix_set_ctime(call_frame_t *frame, xlator_t *this, const char *real_path,
+ int fd, inode_t *inode, struct iatt *stbuf);
void
-posix_set_parent_ctime (call_frame_t *frame, xlator_t *this,
- const char* real_path, int fd, inode_t *inode,
- struct iatt *stbuf);
+posix_set_parent_ctime(call_frame_t *frame, xlator_t *this,
+ const char *real_path, int fd, inode_t *inode,
+ struct iatt *stbuf);
#endif /* _POSIX_METADATA_H */
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 7f588495099..4c32509cf04 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -58,24 +58,25 @@
*/
#define TIER_LINKTO "trusted.tier.tier-dht.linkto"
-#define POSIX_GFID_HANDLE_SIZE(base_path_len) (base_path_len + SLEN("/") \
- + SLEN(GF_HIDDEN_PATH) + SLEN("/") \
- + SLEN("00/") \
- + SLEN("00/") + SLEN(UUID0_STR) + 1) /* '\0' */;
+#define POSIX_GFID_HANDLE_SIZE(base_path_len) \
+ (base_path_len + SLEN("/") + SLEN(GF_HIDDEN_PATH) + SLEN("/") + \
+ SLEN("00/") + SLEN("00/") + SLEN(UUID0_STR) + 1) /* '\0' */;
#define GF_UNLINK_TRUE 0x0000000000000001
#define GF_UNLINK_FALSE 0x0000000000000000
-#define DISK_SPACE_CHECK_AND_GOTO(frame, priv, xdata, op_ret, op_errno, out) do { \
- if (frame->root->pid >= 0 && priv->disk_space_full && \
- !dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { \
- op_ret = -1; \
- op_errno = ENOSPC; \
- gf_msg_debug ("posix", ENOSPC, \
- "disk space utilization reached limits" \
- " for path %s ", priv->base_path); \
- goto out; \
- } \
- } while (0)
+#define DISK_SPACE_CHECK_AND_GOTO(frame, priv, xdata, op_ret, op_errno, out) \
+ do { \
+ if (frame->root->pid >= 0 && priv->disk_space_full && \
+ !dict_get(xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { \
+ op_ret = -1; \
+ op_errno = ENOSPC; \
+ gf_msg_debug("posix", ENOSPC, \
+ "disk space utilization reached limits" \
+ " for path %s ", \
+ priv->base_path); \
+ goto out; \
+ } \
+ } while (0)
/* Setting microseconds or nanoseconds depending on what's supported:
The passed in `tv` can be
@@ -84,393 +85,398 @@
struct timeval
otherwise. */
#if HAVE_UTIMENSAT
-#define SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, nanosecs) \
- tv.tv_nsec = nanosecs
-#define PATH_SET_TIMESPEC_OR_TIMEVAL(path, tv) \
- (sys_utimensat (AT_FDCWD, path, tv, AT_SYMLINK_NOFOLLOW))
+#define SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, nanosecs) tv.tv_nsec = nanosecs
+#define PATH_SET_TIMESPEC_OR_TIMEVAL(path, tv) \
+ (sys_utimensat(AT_FDCWD, path, tv, AT_SYMLINK_NOFOLLOW))
#else
-#define SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, nanosecs) \
- tv.tv_usec = nanosecs / 1000
-#define PATH_SET_TIMESPEC_OR_TIMEVAL(path, tv) \
- (lutimes (path, tv))
+#define SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, nanosecs) \
+ tv.tv_usec = nanosecs / 1000
+#define PATH_SET_TIMESPEC_OR_TIMEVAL(path, tv) (lutimes(path, tv))
#endif
-#define GFID_NULL_CHECK_AND_GOTO(frame, this, loc, xattr_req, op_ret, \
- op_errno, out) \
- do { \
- uuid_t _uuid_req; \
- int _ret = 0; \
- /* TODO: Remove pid check once trash implements client side \
- * logic to assign gfid for entry creations inside .trashcan \
- */ \
- if (frame->root->pid == GF_SERVER_PID_TRASH) \
- break; \
- _ret = dict_get_gfuuid (xattr_req, "gfid-req", &_uuid_req); \
- if (_ret) { \
- gf_msg (this->name, GF_LOG_ERROR, EINVAL, \
- P_MSG_NULL_GFID, "failed to get the gfid from" \
- " dict for %s", loc->path); \
- op_ret = -1; \
- op_errno = EINVAL; \
- goto out; \
- } \
- if (gf_uuid_is_null (_uuid_req)) { \
- gf_msg (this->name, GF_LOG_ERROR, EINVAL, \
- P_MSG_NULL_GFID, "gfid is null for %s", \
- loc->path); \
- op_ret = -1; \
- op_errno = EINVAL; \
- goto out; \
- } \
- } while (0)
-
+#define GFID_NULL_CHECK_AND_GOTO(frame, this, loc, xattr_req, op_ret, \
+ op_errno, out) \
+ do { \
+ uuid_t _uuid_req; \
+ int _ret = 0; \
+ /* TODO: Remove pid check once trash implements client side \
+ * logic to assign gfid for entry creations inside .trashcan \
+ */ \
+ if (frame->root->pid == GF_SERVER_PID_TRASH) \
+ break; \
+ _ret = dict_get_gfuuid(xattr_req, "gfid-req", &_uuid_req); \
+ if (_ret) { \
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, P_MSG_NULL_GFID, \
+ "failed to get the gfid from" \
+ " dict for %s", \
+ loc->path); \
+ op_ret = -1; \
+ op_errno = EINVAL; \
+ goto out; \
+ } \
+ if (gf_uuid_is_null(_uuid_req)) { \
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, P_MSG_NULL_GFID, \
+ "gfid is null for %s", loc->path); \
+ op_ret = -1; \
+ op_errno = EINVAL; \
+ goto out; \
+ } \
+ } while (0)
/**
* posix_fd - internal structure common to file and directory fd's
*/
struct posix_fd {
- int fd; /* fd returned by the kernel */
- int32_t flags; /* flags for open/creat */
- DIR * dir; /* handle returned by the kernel */
- off_t dir_eof; /* offset at dir EOF */
- int odirect;
- struct list_head list; /* to add to the janitor list */
+ int fd; /* fd returned by the kernel */
+ int32_t flags; /* flags for open/creat */
+ DIR *dir; /* handle returned by the kernel */
+ off_t dir_eof; /* offset at dir EOF */
+ int odirect;
+ struct list_head list; /* to add to the janitor list */
};
-
struct posix_private {
- char *base_path;
- int32_t base_path_length;
- int32_t path_max;
-
- gf_lock_t lock;
-
- char *hostname;
- /* Statistics, provides activity of the server */
-
- struct timeval prev_fetch_time;
- struct timeval init_time;
-
- time_t last_landfill_check;
- int32_t janitor_sleep_duration;
- struct list_head janitor_fds;
- pthread_cond_t janitor_cond;
- pthread_mutex_t janitor_lock;
-
- int64_t read_value; /* Total read, from init */
- int64_t write_value; /* Total write, from init */
- int64_t nr_files;
-/*
- In some cases, two exported volumes may reside on the same
- partition on the server. Sending statvfs info for both
- the volumes will lead to erroneous df output at the client,
- since free space on the partition will be counted twice.
-
- In such cases, user can disable exporting statvfs info
- on one of the volumes by setting this option.
-*/
- gf_boolean_t export_statfs;
-
- gf_boolean_t o_direct; /* always open files in O_DIRECT mode */
-
-
-/*
- decide whether posix_unlink does open (file), unlink (file), close (fd)
- instead of just unlink (file). with the former approach there is no lockout
- of access to parent directory during removal of very large files for the
- entire duration of freeing of data blocks.
-*/
- gf_boolean_t background_unlink;
-
-/* janitor thread which cleans up /.trash (created by replicate) */
- pthread_t janitor;
- gf_boolean_t janitor_present;
- char * trash_path;
-/* lock for brick dir */
- DIR *mount_lock;
-
- struct stat handledir;
-
-/* uuid of glusterd that swapned the brick process */
- uuid_t glusterd_uuid;
-
- gf_boolean_t aio_configured;
- gf_boolean_t aio_init_done;
- gf_boolean_t aio_capable;
+ char *base_path;
+ int32_t base_path_length;
+ int32_t path_max;
+
+ gf_lock_t lock;
+
+ char *hostname;
+ /* Statistics, provides activity of the server */
+
+ struct timeval prev_fetch_time;
+ struct timeval init_time;
+
+ time_t last_landfill_check;
+ int32_t janitor_sleep_duration;
+ struct list_head janitor_fds;
+ pthread_cond_t janitor_cond;
+ pthread_mutex_t janitor_lock;
+
+ int64_t read_value; /* Total read, from init */
+ int64_t write_value; /* Total write, from init */
+ int64_t nr_files;
+ /*
+ In some cases, two exported volumes may reside on the same
+ partition on the server. Sending statvfs info for both
+ the volumes will lead to erroneous df output at the client,
+ since free space on the partition will be counted twice.
+
+ In such cases, user can disable exporting statvfs info
+ on one of the volumes by setting this option.
+ */
+ gf_boolean_t export_statfs;
+
+ gf_boolean_t o_direct; /* always open files in O_DIRECT mode */
+
+ /*
+ decide whether posix_unlink does open (file), unlink (file), close (fd)
+ instead of just unlink (file). with the former approach there is no
+ lockout of access to parent directory during removal of very large files
+ for the entire duration of freeing of data blocks.
+ */
+ gf_boolean_t background_unlink;
+
+ /* janitor thread which cleans up /.trash (created by replicate) */
+ pthread_t janitor;
+ gf_boolean_t janitor_present;
+ char *trash_path;
+ /* lock for brick dir */
+ DIR *mount_lock;
+
+ struct stat handledir;
+
+ /* uuid of glusterd that swapned the brick process */
+ uuid_t glusterd_uuid;
+
+ gf_boolean_t aio_configured;
+ gf_boolean_t aio_init_done;
+ gf_boolean_t aio_capable;
#ifdef HAVE_LIBAIO
- io_context_t ctxp;
- pthread_t aiothread;
+ io_context_t ctxp;
+ pthread_t aiothread;
#endif
- /* node-uuid in pathinfo xattr */
- gf_boolean_t node_uuid_pathinfo;
-
- pthread_t fsyncer;
- struct list_head fsyncs;
- pthread_mutex_t fsync_mutex;
- pthread_cond_t fsync_cond;
- int fsync_queue_count;
-
- enum {
- BATCH_NONE = 0,
- BATCH_SYNCFS,
- BATCH_SYNCFS_SINGLE_FSYNC,
- BATCH_REVERSE_FSYNC,
- BATCH_SYNCFS_REVERSE_FSYNC
- } batch_fsync_mode;
-
- uint32_t batch_fsync_delay_usec;
- gf_boolean_t update_pgfid_nlinks;
- gf_boolean_t gfid2path;
- char gfid2path_sep[8];
-
- /* seconds to sleep between health checks */
- uint32_t health_check_interval;
- /* seconds to sleep to wait for aio write finish for health checks */
- uint32_t health_check_timeout;
- pthread_t health_check;
- gf_boolean_t health_check_active;
-
- uint32_t disk_reserve;
- uint32_t disk_space_full;
- pthread_t disk_space_check;
- gf_boolean_t disk_space_check_active;
+ /* node-uuid in pathinfo xattr */
+ gf_boolean_t node_uuid_pathinfo;
+
+ pthread_t fsyncer;
+ struct list_head fsyncs;
+ pthread_mutex_t fsync_mutex;
+ pthread_cond_t fsync_cond;
+ int fsync_queue_count;
+
+ enum {
+ BATCH_NONE = 0,
+ BATCH_SYNCFS,
+ BATCH_SYNCFS_SINGLE_FSYNC,
+ BATCH_REVERSE_FSYNC,
+ BATCH_SYNCFS_REVERSE_FSYNC
+ } batch_fsync_mode;
+
+ uint32_t batch_fsync_delay_usec;
+ gf_boolean_t update_pgfid_nlinks;
+ gf_boolean_t gfid2path;
+ char gfid2path_sep[8];
+
+ /* seconds to sleep between health checks */
+ uint32_t health_check_interval;
+ /* seconds to sleep to wait for aio write finish for health checks */
+ uint32_t health_check_timeout;
+ pthread_t health_check;
+ gf_boolean_t health_check_active;
+
+ uint32_t disk_reserve;
+ uint32_t disk_space_full;
+ pthread_t disk_space_check;
+ gf_boolean_t disk_space_check_active;
#ifdef GF_DARWIN_HOST_OS
- enum {
- XATTR_NONE = 0,
- XATTR_STRIP,
- XATTR_APPEND,
- XATTR_BOTH,
- } xattr_user_namespace;
+ enum {
+ XATTR_NONE = 0,
+ XATTR_STRIP,
+ XATTR_APPEND,
+ XATTR_BOTH,
+ } xattr_user_namespace;
#endif
- /* Option to handle the cases of multiple bricks exported from
- same backend. Very much usable in brick-splitting feature. */
- int32_t shared_brick_count;
+ /* Option to handle the cases of multiple bricks exported from
+ same backend. Very much usable in brick-splitting feature. */
+ int32_t shared_brick_count;
- /* This option is used for either to call a landfill_purge or not */
- gf_boolean_t disable_landfill_purge;
+ /* This option is used for either to call a landfill_purge or not */
+ gf_boolean_t disable_landfill_purge;
- /*Option to set mode bit permission that will always be set on
- file/directory. */
- mode_t force_create_mode;
- mode_t force_directory_mode;
- mode_t create_mask;
- mode_t create_directory_mask;
- uint32_t max_hardlinks;
+ /*Option to set mode bit permission that will always be set on
+ file/directory. */
+ mode_t force_create_mode;
+ mode_t force_directory_mode;
+ mode_t create_mask;
+ mode_t create_directory_mask;
+ uint32_t max_hardlinks;
- gf_boolean_t fips_mode_rchecksum;
- gf_boolean_t ctime;
+ gf_boolean_t fips_mode_rchecksum;
+ gf_boolean_t ctime;
};
typedef struct {
- call_frame_t *frame;
- xlator_t *this;
- const char *real_path;
- dict_t *xattr;
- struct iatt *stbuf;
- loc_t *loc;
- inode_t *inode; /* for all do_xattrop() key handling */
- fd_t *fd;
- int fdnum;
- int flags;
- int32_t op_errno;
- char *list;
- size_t list_size;
+ call_frame_t *frame;
+ xlator_t *this;
+ const char *real_path;
+ dict_t *xattr;
+ struct iatt *stbuf;
+ loc_t *loc;
+ inode_t *inode; /* for all do_xattrop() key handling */
+ fd_t *fd;
+ int fdnum;
+ int flags;
+ int32_t op_errno;
+ char *list;
+ size_t list_size;
} posix_xattr_filler_t;
typedef struct {
- uint64_t unlink_flag;
- pthread_mutex_t xattrop_lock;
- pthread_mutex_t write_atomic_lock;
- pthread_mutex_t pgfid_lock;
+ uint64_t unlink_flag;
+ pthread_mutex_t xattrop_lock;
+ pthread_mutex_t write_atomic_lock;
+ pthread_mutex_t pgfid_lock;
} posix_inode_ctx_t;
-#define POSIX_BASE_PATH(this) (((struct posix_private *)this->private)->base_path)
+#define POSIX_BASE_PATH(this) \
+ (((struct posix_private *)this->private)->base_path)
-#define POSIX_BASE_PATH_LEN(this) (((struct posix_private *)this->private)->base_path_length)
+#define POSIX_BASE_PATH_LEN(this) \
+ (((struct posix_private *)this->private)->base_path_length)
#define POSIX_PATH_MAX(this) (((struct posix_private *)this->private)->path_max)
-#define POSIX_GET_FILE_UNLINK_PATH(base_path, gfid, unlink_path) \
- do { \
- int path_len = 0; \
- char gfid_str[64] = {0}; \
- uuid_utoa_r (gfid, gfid_str); \
- path_len = strlen (base_path) + 1 + \
- SLEN (GF_UNLINK_PATH) + 1 + \
- strlen (gfid_str) + 1; \
- unlink_path = alloca (path_len); \
- if (!unlink_path) { \
- gf_msg ("posix", GF_LOG_ERROR, ENOMEM, \
- P_MSG_UNLINK_FAILED, \
- "Failed to get unlink_path"); \
- break; \
- } \
- sprintf (unlink_path, "%s/%s/%s", \
- base_path, GF_UNLINK_PATH, gfid_str); \
- } while (0)
-
+#define POSIX_GET_FILE_UNLINK_PATH(base_path, gfid, unlink_path) \
+ do { \
+ int path_len = 0; \
+ char gfid_str[64] = {0}; \
+ uuid_utoa_r(gfid, gfid_str); \
+ path_len = strlen(base_path) + 1 + SLEN(GF_UNLINK_PATH) + 1 + \
+ strlen(gfid_str) + 1; \
+ unlink_path = alloca(path_len); \
+ if (!unlink_path) { \
+ gf_msg("posix", GF_LOG_ERROR, ENOMEM, P_MSG_UNLINK_FAILED, \
+ "Failed to get unlink_path"); \
+ break; \
+ } \
+ sprintf(unlink_path, "%s/%s/%s", base_path, GF_UNLINK_PATH, gfid_str); \
+ } while (0)
/* Helper functions */
-int posix_inode_ctx_set_unlink_flag (inode_t *inode, xlator_t *this,
- uint64_t ctx);
-
-int posix_inode_ctx_get_all (inode_t *inode, xlator_t *this,
- posix_inode_ctx_t **ctx);
-
-int __posix_inode_ctx_set_unlink_flag (inode_t *inode, xlator_t *this,
- uint64_t ctx);
-
-int __posix_inode_ctx_get_all (inode_t *inode, xlator_t *this,
- posix_inode_ctx_t **ctx);
-
-int posix_gfid_set (xlator_t *this, const char *path, loc_t *loc,
- dict_t *xattr_req, pid_t pid, int *op_errno);
-int posix_fdstat (xlator_t *this, inode_t *inode, int fd, struct iatt *stbuf_p);
-int posix_istat (xlator_t *this, inode_t *inode, uuid_t gfid,
- const char *basename, struct iatt *iatt);
-int posix_pstat (xlator_t *this, inode_t *inode, uuid_t gfid,
- const char *real_path, struct iatt *iatt,
- gf_boolean_t inode_locked);
-dict_t *posix_xattr_fill (xlator_t *this, const char *path, loc_t *loc,
- fd_t *fd, int fdnum, dict_t *xattr, struct iatt *buf);
-int posix_handle_pair (xlator_t *this, const char *real_path, char *key,
- data_t *value, int flags, struct iatt *stbuf);
-int posix_fhandle_pair (call_frame_t *frame, xlator_t *this, int fd, char *key,
- data_t *value, int flags, struct iatt *stbuf,
- fd_t *_fd);
-void posix_spawn_janitor_thread (xlator_t *this);
-int posix_acl_xattr_set (xlator_t *this, const char *path, dict_t *xattr_req);
-int posix_gfid_heal (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req);
-int posix_entry_create_xattr_set (xlator_t *this, const char *path,
- dict_t *dict);
-
-int posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd,
- int *op_errno);
-void posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf);
-
-gf_boolean_t posix_special_xattr (char **pattern, char *key);
+int
+posix_inode_ctx_set_unlink_flag(inode_t *inode, xlator_t *this, uint64_t ctx);
+
+int
+posix_inode_ctx_get_all(inode_t *inode, xlator_t *this,
+ posix_inode_ctx_t **ctx);
+
+int
+__posix_inode_ctx_set_unlink_flag(inode_t *inode, xlator_t *this, uint64_t ctx);
+int
+__posix_inode_ctx_get_all(inode_t *inode, xlator_t *this,
+ posix_inode_ctx_t **ctx);
+
+int
+posix_gfid_set(xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req,
+ pid_t pid, int *op_errno);
+int
+posix_fdstat(xlator_t *this, inode_t *inode, int fd, struct iatt *stbuf_p);
+int
+posix_istat(xlator_t *this, inode_t *inode, uuid_t gfid, const char *basename,
+ struct iatt *iatt);
+int
+posix_pstat(xlator_t *this, inode_t *inode, uuid_t gfid, const char *real_path,
+ struct iatt *iatt, gf_boolean_t inode_locked);
+dict_t *
+posix_xattr_fill(xlator_t *this, const char *path, loc_t *loc, fd_t *fd,
+ int fdnum, dict_t *xattr, struct iatt *buf);
+int
+posix_handle_pair(xlator_t *this, const char *real_path, char *key,
+ data_t *value, int flags, struct iatt *stbuf);
+int
+posix_fhandle_pair(call_frame_t *frame, xlator_t *this, int fd, char *key,
+ data_t *value, int flags, struct iatt *stbuf, fd_t *_fd);
void
-__posix_fd_set_odirect (fd_t *fd, struct posix_fd *pfd, int opflags,
- off_t offset, size_t size);
-void posix_spawn_health_check_thread (xlator_t *this);
+posix_spawn_janitor_thread(xlator_t *this);
+int
+posix_acl_xattr_set(xlator_t *this, const char *path, dict_t *xattr_req);
+int
+posix_gfid_heal(xlator_t *this, const char *path, loc_t *loc,
+ dict_t *xattr_req);
+int
+posix_entry_create_xattr_set(xlator_t *this, const char *path, dict_t *dict);
-void posix_spawn_disk_space_check_thread (xlator_t *this);
+int
+posix_fd_ctx_get(fd_t *fd, xlator_t *this, struct posix_fd **pfd,
+ int *op_errno);
+void
+posix_fill_ino_from_gfid(xlator_t *this, struct iatt *buf);
-void *posix_fsyncer (void *);
+gf_boolean_t
+posix_special_xattr(char **pattern, char *key);
+
+void
+__posix_fd_set_odirect(fd_t *fd, struct posix_fd *pfd, int opflags,
+ off_t offset, size_t size);
+void
+posix_spawn_health_check_thread(xlator_t *this);
+
+void
+posix_spawn_disk_space_check_thread(xlator_t *this);
+
+void *
+posix_fsyncer(void *);
int
-posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
- gf_dirent_t *head, char **path, int type, int32_t *op_errno,
- dict_t *xdata);
+posix_get_ancestry(xlator_t *this, inode_t *leaf_inode, gf_dirent_t *head,
+ char **path, int type, int32_t *op_errno, dict_t *xdata);
int
-posix_handle_mdata_xattr (call_frame_t *frame, const char *name, int *op_errno);
+posix_handle_mdata_xattr(call_frame_t *frame, const char *name, int *op_errno);
int
-posix_handle_georep_xattrs (call_frame_t *, const char *, int *, gf_boolean_t);
+posix_handle_georep_xattrs(call_frame_t *, const char *, int *, gf_boolean_t);
int32_t
-posix_resolve_dirgfid_to_path (const uuid_t dirgfid, const char *brick_path,
- const char *bname, char **path);
+posix_resolve_dirgfid_to_path(const uuid_t dirgfid, const char *brick_path,
+ const char *bname, char **path);
void
-posix_gfid_unset (xlator_t *this, dict_t *xdata);
+posix_gfid_unset(xlator_t *this, dict_t *xdata);
int
-posix_pacl_set (const char *path, const char *key, const char *acl_s);
+posix_pacl_set(const char *path, const char *key, const char *acl_s);
int
-posix_pacl_get (const char *path, const char *key, char **acl_s);
+posix_pacl_get(const char *path, const char *key, char **acl_s);
int32_t
-posix_get_objectsignature (char *, dict_t *);
+posix_get_objectsignature(char *, dict_t *);
int32_t
-posix_fdget_objectsignature (int, dict_t *);
+posix_fdget_objectsignature(int, dict_t *);
gf_boolean_t
-posix_is_bulk_removexattr (char *name, dict_t *dict);
+posix_is_bulk_removexattr(char *name, dict_t *dict);
int32_t
-posix_set_iatt_in_dict (dict_t *, struct iatt *, struct iatt *);
+posix_set_iatt_in_dict(dict_t *, struct iatt *, struct iatt *);
-mode_t
-posix_override_umask (mode_t , mode_t);
+mode_t posix_override_umask(mode_t, mode_t);
int32_t
-posix_priv (xlator_t *this);
+posix_priv(xlator_t *this);
int32_t
-posix_inode (xlator_t *this);
+posix_inode(xlator_t *this);
void
-posix_fini (xlator_t *this);
+posix_fini(xlator_t *this);
int
-posix_init (xlator_t *this);
+posix_init(xlator_t *this);
int
-posix_reconfigure (xlator_t *this, dict_t *options);
+posix_reconfigure(xlator_t *this, dict_t *options);
int32_t
-posix_notify (xlator_t *this, int32_t event, void *data, ...);
+posix_notify(xlator_t *this, int32_t event, void *data, ...);
/* posix-entry-ops.c FOP signatures */
int32_t
-posix_lookup (call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *xdata);
+posix_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
int
-posix_create (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int32_t flags, mode_t mode,
- mode_t umask, fd_t *fd, dict_t *xdata);
+posix_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
+ mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata);
int
-posix_symlink (call_frame_t *frame, xlator_t *this,
- const char *linkname, loc_t *loc, mode_t umask, dict_t *xdata);
+posix_symlink(call_frame_t *frame, xlator_t *this, const char *linkname,
+ loc_t *loc, mode_t umask, dict_t *xdata);
int
-posix_rename (call_frame_t *frame, xlator_t *this,
- loc_t *oldloc, loc_t *newloc, dict_t *xdata);
+posix_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata);
int
-posix_link (call_frame_t *frame, xlator_t *this,
- loc_t *oldloc, loc_t *newloc, dict_t *xdata);
+posix_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata);
int
-posix_mknod (call_frame_t *frame, xlator_t *this,
- loc_t *loc, mode_t mode, dev_t dev, mode_t umask, dict_t *xdata);
+posix_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ dev_t dev, mode_t umask, dict_t *xdata);
int
-posix_mkdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata);
+posix_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata);
int32_t
-posix_unlink (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int xflag, dict_t *xdata);
+posix_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
+ dict_t *xdata);
int
-posix_rmdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int flags, dict_t *xdata);
+posix_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
+ dict_t *xdata);
/* posix-inode-fs-ops.c FOP signatures */
int
-posix_forget (xlator_t *this, inode_t *inode);
+posix_forget(xlator_t *this, inode_t *inode);
int32_t
-posix_discover (call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *xdata);
+posix_discover(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
int32_t
-posix_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
+posix_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
int
-posix_setattr (call_frame_t *frame, xlator_t *this,
- loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata);
+posix_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct iatt *stbuf, int32_t valid, dict_t *xdata);
int
-posix_fsetattr (call_frame_t *frame, xlator_t *this,
- fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata);
+posix_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct iatt *stbuf, int32_t valid, dict_t *xdata);
int32_t
posix_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
@@ -482,181 +488,173 @@ posix_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
int32_t
posix_glfallocate(call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t keep_size, off_t offset, size_t len, dict_t *xdata);
+ int32_t keep_size, off_t offset, size_t len, dict_t *xdata);
int32_t
-posix_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata);
+posix_ipc(call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata);
int32_t
-posix_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- gf_seek_what_t what, dict_t *xdata);
+posix_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata);
int32_t
-posix_opendir (call_frame_t *frame, xlator_t *this,
- loc_t *loc, fd_t *fd, dict_t *xdata);
+posix_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
+ dict_t *xdata);
int32_t
-posix_releasedir (xlator_t *this,
- fd_t *fd);
+posix_releasedir(xlator_t *this, fd_t *fd);
int32_t
-posix_readlink (call_frame_t *frame, xlator_t *this,
- loc_t *loc, size_t size, dict_t *xdata);
+posix_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
+ dict_t *xdata);
int32_t
-posix_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
- dict_t *xdata);
+posix_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
+ dict_t *xdata);
int32_t
-posix_open (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata);
+posix_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
+ fd_t *fd, dict_t *xdata);
int
-posix_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata);
+posix_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata);
int32_t
-posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count, off_t offset,
- uint32_t flags, struct iobref *iobref, dict_t *xdata);
+posix_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct iovec *vector, int32_t count, off_t offset, uint32_t flags,
+ struct iobref *iobref, dict_t *xdata);
int32_t
-posix_statfs (call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *xdata);
+posix_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata);
int32_t
-posix_flush (call_frame_t *frame, xlator_t *this,
- fd_t *fd, dict_t *xdata);
+posix_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata);
int32_t
-posix_release (xlator_t *this, fd_t *fd);
+posix_release(xlator_t *this, fd_t *fd);
int32_t
-posix_fsync (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t datasync, dict_t *xdata);
+posix_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync,
+ dict_t *xdata);
int32_t
-posix_setxattr (call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *dict, int flags, dict_t *xdata);
+posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
+ int flags, dict_t *xdata);
int
-posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
- gf_dirent_t *head, char **path, int type,
- int32_t *op_errno, dict_t *xdata);
+posix_get_ancestry_non_directory(xlator_t *this, inode_t *leaf_inode,
+ gf_dirent_t *head, char **path, int type,
+ int32_t *op_errno, dict_t *xdata);
int
-posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
- gf_dirent_t *head, char **path, int type, int32_t *op_errno,
- dict_t *xdata);
+posix_get_ancestry(xlator_t *this, inode_t *leaf_inode, gf_dirent_t *head,
+ char **path, int type, int32_t *op_errno, dict_t *xdata);
int32_t
-posix_getxattr (call_frame_t *frame, xlator_t *this,
- loc_t *loc, const char *name, dict_t *xdata);
+posix_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ const char *name, dict_t *xdata);
int32_t
-posix_fgetxattr (call_frame_t *frame, xlator_t *this,
- fd_t *fd, const char *name, dict_t *xdata);
+posix_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
+ dict_t *xdata);
int32_t
-posix_fsetxattr (call_frame_t *frame, xlator_t *this,
- fd_t *fd, dict_t *dict, int flags, dict_t *xdata);
+posix_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
+ int flags, dict_t *xdata);
int32_t
-posix_removexattr (call_frame_t *frame, xlator_t *this,
- loc_t *loc, const char *name, dict_t *xdata);
+posix_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ const char *name, dict_t *xdata);
int32_t
-posix_fremovexattr (call_frame_t *frame, xlator_t *this,
- fd_t *fd, const char *name, dict_t *xdata);
+posix_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name, dict_t *xdata);
int32_t
-posix_fsyncdir (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int datasync, dict_t *xdata);
+posix_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
+ dict_t *xdata);
int
-posix_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
- gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata);
+posix_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata);
int
-posix_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
- gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata);
+posix_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata);
int
-posix_access (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int32_t mask, dict_t *xdata);
+posix_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
+ dict_t *xdata);
int32_t
-posix_ftruncate (call_frame_t *frame, xlator_t *this,
- fd_t *fd, off_t offset, dict_t *xdata);
+posix_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ dict_t *xdata);
int32_t
-posix_fstat (call_frame_t *frame, xlator_t *this,
- fd_t *fd, dict_t *xdata);
+posix_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata);
int32_t
-posix_lease (call_frame_t *frame, xlator_t *this,
- loc_t *loc, struct gf_lease *lease, dict_t *xdata);
+posix_lease(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata);
int32_t
-posix_lk (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata);
+posix_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata);
int32_t
-posix_inodelk (call_frame_t *frame, xlator_t *this,
- const char *volume, loc_t *loc, int32_t cmd,
- struct gf_flock *lock, dict_t *xdata);
+posix_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
+ loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata);
int32_t
-posix_finodelk (call_frame_t *frame, xlator_t *this,
- const char *volume, fd_t *fd, int32_t cmd,
- struct gf_flock *lock, dict_t *xdata);
+posix_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
+ fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata);
int32_t
-posix_entrylk (call_frame_t *frame, xlator_t *this,
- const char *volume, loc_t *loc, const char *basename,
- entrylk_cmd cmd, entrylk_type type, dict_t *xdata);
+posix_entrylk(call_frame_t *frame, xlator_t *this, const char *volume,
+ loc_t *loc, const char *basename, entrylk_cmd cmd,
+ entrylk_type type, dict_t *xdata);
int32_t
-posix_fentrylk (call_frame_t *frame, xlator_t *this,
- const char *volume, fd_t *fd, const char *basename,
- entrylk_cmd cmd, entrylk_type type, dict_t *xdata);
+posix_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume,
+ fd_t *fd, const char *basename, entrylk_cmd cmd,
+ entrylk_type type, dict_t *xdata);
int32_t
-posix_readdir (call_frame_t *frame, xlator_t *this,
- fd_t *fd, size_t size, off_t off, dict_t *xdata);
+posix_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t off, dict_t *xdata);
int32_t
-posix_readdirp (call_frame_t *frame, xlator_t *this,
- fd_t *fd, size_t size, off_t off, dict_t *dict);
+posix_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t off, dict_t *dict);
int32_t
-posix_rchecksum (call_frame_t *frame, xlator_t *this,
- fd_t *fd, off_t offset, int32_t len, dict_t *xdata);
+posix_rchecksum(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ int32_t len, dict_t *xdata);
int32_t
-posix_put (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode, mode_t umask, uint32_t flags,
- struct iovec *vector, int32_t count, off_t offset,
- struct iobref *iobref, dict_t *xattr, dict_t *xdata);
+posix_put(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
+ off_t offset, struct iobref *iobref, dict_t *xattr, dict_t *xdata);
int32_t
-posix_set_mode_in_dict (dict_t *in_dict, dict_t *out_dict,
- struct iatt *in_stbuf);
+posix_set_mode_in_dict(dict_t *in_dict, dict_t *out_dict,
+ struct iatt *in_stbuf);
gf_cs_obj_state
-posix_cs_check_status (xlator_t *this, const char *realpath, int *fd,
- struct iatt *buf);
+posix_cs_check_status(xlator_t *this, const char *realpath, int *fd,
+ struct iatt *buf);
int
-posix_cs_set_state (xlator_t *this, dict_t **rsp, gf_cs_obj_state state,
- char const *path, int *fd);
+posix_cs_set_state(xlator_t *this, dict_t **rsp, gf_cs_obj_state state,
+ char const *path, int *fd);
gf_cs_obj_state
-posix_cs_heal_state (xlator_t *this, const char *path, int *fd,
- struct iatt *stbuf);
+posix_cs_heal_state(xlator_t *this, const char *path, int *fd,
+ struct iatt *stbuf);
int
-posix_cs_maintenance (xlator_t *this, fd_t *fd, loc_t *loc, int *pfd,
- struct iatt *buf, const char *realpath, dict_t *xattr_req,
- dict_t **xattr_rsp, gf_boolean_t ignore_failure);
+posix_cs_maintenance(xlator_t *this, fd_t *fd, loc_t *loc, int *pfd,
+ struct iatt *buf, const char *realpath, dict_t *xattr_req,
+ dict_t **xattr_rsp, gf_boolean_t ignore_failure);
#endif /* _POSIX_H */