diff options
Diffstat (limited to 'xlators')
257 files changed, 16171 insertions, 17145 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.h b/xlators/cluster/afr/src/afr-dir-read.h index 09456d15949..773e925ec6c 100644 --- a/xlators/cluster/afr/src/afr-dir-read.h +++ b/xlators/cluster/afr/src/afr-dir-read.h @@ -11,26 +11,23 @@ #ifndef __DIR_READ_H__ #define __DIR_READ_H__ - int32_t -afr_opendir (call_frame_t *frame, xlator_t *this, - loc_t *loc, fd_t *fd, dict_t *xdata); +afr_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + dict_t *xdata); int32_t -afr_releasedir (xlator_t *this, fd_t *fd); +afr_releasedir(xlator_t *this, fd_t *fd); int32_t -afr_readdir (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, dict_t *xdata); - +afr_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset, dict_t *xdata); int32_t -afr_readdirp (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, dict_t *dict); +afr_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset, dict_t *dict); int32_t -afr_checksum (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, dict_t *xdata); - +afr_checksum(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + dict_t *xdata); #endif /* __DIR_READ_H__ */ diff --git a/xlators/cluster/afr/src/afr-dir-write.h b/xlators/cluster/afr/src/afr-dir-write.h index 02f0a3682d9..1d88c3b9b26 100644 --- a/xlators/cluster/afr/src/afr-dir-write.h +++ b/xlators/cluster/afr/src/afr-dir-write.h @@ -12,36 +12,35 @@ #define __DIR_WRITE_H__ int32_t -afr_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); +afr_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); int32_t -afr_mknod (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, dev_t dev, mode_t umask, dict_t *xdata); +afr_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + dev_t dev, mode_t umask, dict_t *xdata); int32_t -afr_mkdir (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata); +afr_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); int32_t -afr_unlink (call_frame_t *frame, xlator_t *this, - loc_t *loc, int xflag, dict_t *xdata); +afr_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, + dict_t *xdata); int32_t -afr_rmdir (call_frame_t *frame, xlator_t *this, - loc_t *loc, int flags, dict_t *xdata); +afr_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, + dict_t *xdata); int32_t -afr_link (call_frame_t *frame, xlator_t *this, - loc_t *oldloc, loc_t *newloc, dict_t *xdata); +afr_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); int32_t -afr_rename (call_frame_t *frame, xlator_t *this, - loc_t *oldloc, loc_t *newloc, dict_t *xdata); +afr_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); int -afr_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *oldloc, mode_t umask, dict_t *params); +afr_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath, + loc_t *oldloc, mode_t umask, dict_t *params); #endif /* __DIR_WRITE_H__ */ diff --git a/xlators/cluster/afr/src/afr-inode-read.h b/xlators/cluster/afr/src/afr-inode-read.h index d128134ef2a..1627ee2c426 100644 --- a/xlators/cluster/afr/src/afr-inode-read.h +++ b/xlators/cluster/afr/src/afr-inode-read.h @@ -12,34 +12,31 @@ #define __INODE_READ_H__ int32_t -afr_access (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t mask, dict_t *xdata); +afr_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, + dict_t *xdata); int32_t -afr_stat (call_frame_t *frame, xlator_t *this, - loc_t *loc, dict_t *xdata); +afr_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); int32_t -afr_fstat (call_frame_t *frame, xlator_t *this, - fd_t *fd, dict_t *xdata); +afr_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata); int32_t -afr_readlink (call_frame_t *frame, xlator_t *this, - loc_t *loc, size_t size, dict_t *xdata); +afr_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, + dict_t *xdata); int32_t -afr_readv (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata); +afr_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 -afr_getxattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *name, dict_t *xdata); +afr_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, + dict_t *xdata); int32_t -afr_fgetxattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *name, dict_t *xdata); - +afr_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, + dict_t *xdata); int -afr_handle_quota_size (call_frame_t *frame, xlator_t *this); +afr_handle_quota_size(call_frame_t *frame, xlator_t *this); #endif /* __INODE_READ_H__ */ diff --git a/xlators/cluster/afr/src/afr-inode-write.h b/xlators/cluster/afr/src/afr-inode-write.h index 1e8bb5c12b3..a787069b7a1 100644 --- a/xlators/cluster/afr/src/afr-inode-write.h +++ b/xlators/cluster/afr/src/afr-inode-write.h @@ -12,83 +12,83 @@ #define __INODE_WRITE_H__ int32_t -afr_chmod (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, dict_t *xdata); +afr_chmod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + dict_t *xdata); int32_t -afr_chown (call_frame_t *frame, xlator_t *this, - loc_t *loc, uid_t uid, gid_t gid, dict_t *xdata); +afr_chown(call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid, gid_t gid, + dict_t *xdata); int -afr_fchown (call_frame_t *frame, xlator_t *this, - fd_t *fd, uid_t uid, gid_t gid, dict_t *xdata); +afr_fchown(call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid, gid_t gid, + dict_t *xdata); int32_t -afr_fchmod (call_frame_t *frame, xlator_t *this, - fd_t *fd, mode_t mode, dict_t *xdata); +afr_fchmod(call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode, + dict_t *xdata); int32_t -afr_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); +afr_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 -afr_truncate (call_frame_t *frame, xlator_t *this, - loc_t *loc, off_t offset, dict_t *xdata); +afr_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, + dict_t *xdata); int32_t -afr_ftruncate (call_frame_t *frame, xlator_t *this, - fd_t *fd, off_t offset, dict_t *xdata); +afr_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + dict_t *xdata); int32_t -afr_utimens (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct timespec tv[2], dict_t *xdata); +afr_utimens(call_frame_t *frame, xlator_t *this, loc_t *loc, + struct timespec tv[2], dict_t *xdata); int -afr_setattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, struct iatt *buf, int32_t valid, dict_t *xdata); +afr_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *buf, + int32_t valid, dict_t *xdata); int -afr_fsetattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct iatt *buf, int32_t valid, dict_t *xdata); +afr_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *buf, + int32_t valid, dict_t *xdata); int32_t -afr_setxattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata); +afr_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, + int32_t flags, dict_t *xdata); int32_t -afr_fsetxattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata); +afr_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, + int32_t flags, dict_t *xdata); int32_t -afr_removexattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *name, dict_t *xdata); +afr_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, dict_t *xdata); int32_t -afr_fremovexattr (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *name, dict_t *xdata); +afr_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, + const char *name, dict_t *xdata); int -afr_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata); +afr_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + size_t len, dict_t *xdata); int -afr_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, - off_t offset, size_t len, dict_t *xdata); +afr_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata); int afr_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata); int32_t -afr_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); +afr_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); int32_t -afr_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); +afr_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); int -afr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, - dict_t *xdata); +afr_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, + dict_t *xdata); #endif /* __INODE_WRITE_H__ */ diff --git a/xlators/cluster/afr/src/afr-mem-types.h b/xlators/cluster/afr/src/afr-mem-types.h index 2e1117fc18c..d62f7876bcd 100644 --- a/xlators/cluster/afr/src/afr-mem-types.h +++ b/xlators/cluster/afr/src/afr-mem-types.h @@ -8,47 +8,45 @@ cases as published by the Free Software Foundation. */ - #ifndef __AFR_MEM_TYPES_H__ #define __AFR_MEM_TYPES_H__ #include "mem-types.h" enum gf_afr_mem_types_ { - gf_afr_mt_iovec = gf_common_mt_end + 1, - gf_afr_mt_afr_fd_ctx_t, - gf_afr_mt_afr_private_t, - gf_afr_mt_int32_t, - gf_afr_mt_char, - gf_afr_mt_xattr_key, - gf_afr_mt_dict_t, - gf_afr_mt_xlator_t, - gf_afr_mt_iatt, - gf_afr_mt_int, - gf_afr_mt_afr_node_character, - gf_afr_mt_sh_diff_loop_state, - gf_afr_mt_uint8_t, - gf_afr_mt_loc_t, - gf_afr_mt_entry_name, - gf_afr_mt_pump_priv, - gf_afr_mt_locked_fd, - gf_afr_mt_inode_ctx_t, - gf_afr_fd_paused_call_t, - gf_afr_mt_crawl_data_t, - gf_afr_mt_brick_pos_t, - gf_afr_mt_shd_bool_t, - gf_afr_mt_shd_timer_t, - gf_afr_mt_shd_event_t, - gf_afr_mt_time_t, - gf_afr_mt_pos_data_t, - gf_afr_mt_reply_t, - gf_afr_mt_subvol_healer_t, - gf_afr_mt_spbc_timeout_t, - gf_afr_mt_spb_status_t, - gf_afr_mt_empty_brick_t, - gf_afr_mt_child_latency_t, - gf_afr_mt_atomic_t, + gf_afr_mt_iovec = gf_common_mt_end + 1, + gf_afr_mt_afr_fd_ctx_t, + gf_afr_mt_afr_private_t, + gf_afr_mt_int32_t, + gf_afr_mt_char, + gf_afr_mt_xattr_key, + gf_afr_mt_dict_t, + gf_afr_mt_xlator_t, + gf_afr_mt_iatt, + gf_afr_mt_int, + gf_afr_mt_afr_node_character, + gf_afr_mt_sh_diff_loop_state, + gf_afr_mt_uint8_t, + gf_afr_mt_loc_t, + gf_afr_mt_entry_name, + gf_afr_mt_pump_priv, + gf_afr_mt_locked_fd, + gf_afr_mt_inode_ctx_t, + gf_afr_fd_paused_call_t, + gf_afr_mt_crawl_data_t, + gf_afr_mt_brick_pos_t, + gf_afr_mt_shd_bool_t, + gf_afr_mt_shd_timer_t, + gf_afr_mt_shd_event_t, + gf_afr_mt_time_t, + gf_afr_mt_pos_data_t, + gf_afr_mt_reply_t, + gf_afr_mt_subvol_healer_t, + gf_afr_mt_spbc_timeout_t, + gf_afr_mt_spb_status_t, + gf_afr_mt_empty_brick_t, + gf_afr_mt_child_latency_t, + gf_afr_mt_atomic_t, gf_afr_mt_end }; #endif - diff --git a/xlators/cluster/afr/src/afr-messages.h b/xlators/cluster/afr/src/afr-messages.h index 8aa94730158..696336889d3 100644 --- a/xlators/cluster/afr/src/afr-messages.h +++ b/xlators/cluster/afr/src/afr-messages.h @@ -23,51 +23,25 @@ * glfs-message-id.h. */ -GLFS_MSGID(AFR, - AFR_MSG_QUORUM_FAIL, - AFR_MSG_QUORUM_MET, - AFR_MSG_QUORUM_OVERRIDE, - AFR_MSG_INVALID_CHILD_UP, - AFR_MSG_SUBVOL_UP, - AFR_MSG_SUBVOLS_DOWN, - AFR_MSG_ENTRY_UNLOCK_FAIL, - AFR_MSG_SPLIT_BRAIN, - AFR_MSG_OPEN_FAIL, - AFR_MSG_UNLOCK_FAIL, - AFR_MSG_REPLACE_BRICK_STATUS, - AFR_MSG_GFID_NULL, - AFR_MSG_FD_CREATE_FAILED, - AFR_MSG_DICT_SET_FAILED, - AFR_MSG_EXPUNGING_FILE_OR_DIR, - AFR_MSG_MIGRATION_IN_PROGRESS, - AFR_MSG_CHILD_MISCONFIGURED, - AFR_MSG_VOL_MISCONFIGURED, - AFR_MSG_BLOCKING_LKS_FAILED, - AFR_MSG_INVALID_FD, - AFR_MSG_LOCK_INFO, - AFR_MSG_LOCK_XLATOR_NOT_LOADED, - AFR_MSG_FD_CTX_GET_FAILED, - AFR_MSG_INVALID_SUBVOL, - AFR_MSG_PUMP_XLATOR_ERROR, - AFR_MSG_SELF_HEAL_INFO, - AFR_MSG_READ_SUBVOL_ERROR, - AFR_MSG_DICT_GET_FAILED, - AFR_MSG_INFO_COMMON, - AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR, - AFR_MSG_LOCAL_CHILD, - AFR_MSG_INVALID_DATA, - AFR_MSG_INVALID_ARG, - AFR_MSG_INDEX_DIR_GET_FAILED, - AFR_MSG_FSYNC_FAILED, - AFR_MSG_FAVORITE_CHILD, - AFR_MSG_SELF_HEAL_FAILED, - AFR_MSG_SPLIT_BRAIN_STATUS, - AFR_MSG_ADD_BRICK_STATUS, - AFR_MSG_NO_CHANGELOG, - AFR_MSG_TIMER_CREATE_FAIL, - AFR_MSG_SBRAIN_FAV_CHILD_POLICY, - AFR_MSG_INODE_CTX_GET_FAILED, - AFR_MSG_THIN_ARB -); +GLFS_MSGID(AFR, AFR_MSG_QUORUM_FAIL, AFR_MSG_QUORUM_MET, + AFR_MSG_QUORUM_OVERRIDE, AFR_MSG_INVALID_CHILD_UP, AFR_MSG_SUBVOL_UP, + AFR_MSG_SUBVOLS_DOWN, AFR_MSG_ENTRY_UNLOCK_FAIL, AFR_MSG_SPLIT_BRAIN, + AFR_MSG_OPEN_FAIL, AFR_MSG_UNLOCK_FAIL, AFR_MSG_REPLACE_BRICK_STATUS, + AFR_MSG_GFID_NULL, AFR_MSG_FD_CREATE_FAILED, AFR_MSG_DICT_SET_FAILED, + AFR_MSG_EXPUNGING_FILE_OR_DIR, AFR_MSG_MIGRATION_IN_PROGRESS, + AFR_MSG_CHILD_MISCONFIGURED, AFR_MSG_VOL_MISCONFIGURED, + AFR_MSG_BLOCKING_LKS_FAILED, AFR_MSG_INVALID_FD, AFR_MSG_LOCK_INFO, + AFR_MSG_LOCK_XLATOR_NOT_LOADED, AFR_MSG_FD_CTX_GET_FAILED, + AFR_MSG_INVALID_SUBVOL, AFR_MSG_PUMP_XLATOR_ERROR, + AFR_MSG_SELF_HEAL_INFO, AFR_MSG_READ_SUBVOL_ERROR, + AFR_MSG_DICT_GET_FAILED, AFR_MSG_INFO_COMMON, + AFR_MSG_SPLIT_BRAIN_CHOICE_ERROR, AFR_MSG_LOCAL_CHILD, + AFR_MSG_INVALID_DATA, AFR_MSG_INVALID_ARG, + AFR_MSG_INDEX_DIR_GET_FAILED, AFR_MSG_FSYNC_FAILED, + AFR_MSG_FAVORITE_CHILD, AFR_MSG_SELF_HEAL_FAILED, + AFR_MSG_SPLIT_BRAIN_STATUS, AFR_MSG_ADD_BRICK_STATUS, + AFR_MSG_NO_CHANGELOG, AFR_MSG_TIMER_CREATE_FAIL, + AFR_MSG_SBRAIN_FAV_CHILD_POLICY, AFR_MSG_INODE_CTX_GET_FAILED, + AFR_MSG_THIN_ARB); #endif /* !_AFR_MESSAGES_H_ */ diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h index 9836e2fbc03..545e67f774d 100644 --- a/xlators/cluster/afr/src/afr-self-heal.h +++ b/xlators/cluster/afr/src/afr-self-heal.h @@ -8,7 +8,6 @@ cases as published by the Free Software Foundation. */ - #ifndef _AFR_SELFHEAL_H #define _AFR_SELFHEAL_H @@ -16,257 +15,257 @@ /* Perform fop on all UP subvolumes and wait for all callbacks to return */ -#define AFR_ONALL(frame, rfn, fop, args ...) do { \ - afr_local_t *__local = frame->local; \ - afr_private_t *__priv = frame->this->private; \ - int __i = 0, __count = 0; \ - unsigned char *__child_up = NULL; \ - \ - __child_up = alloca0 (__priv->child_count); \ - memcpy (__child_up, __priv->child_up, \ - sizeof (*__child_up) * __priv->child_count); \ - __count = AFR_COUNT (__child_up, __priv->child_count); \ - \ - __local->barrier.waitfor = __count; \ - afr_local_replies_wipe (__local, __priv); \ - \ - for (__i = 0; __i < __priv->child_count; __i++) { \ - if (!__child_up[__i]) \ - continue; \ - STACK_WIND_COOKIE (frame, rfn, (void *)(long) __i, \ - __priv->children[__i], \ - __priv->children[__i]->fops->fop, args); \ - } \ - syncbarrier_wait (&__local->barrier, __count); \ - } while (0) - +#define AFR_ONALL(frame, rfn, fop, args...) \ + do { \ + afr_local_t *__local = frame->local; \ + afr_private_t *__priv = frame->this->private; \ + int __i = 0, __count = 0; \ + unsigned char *__child_up = NULL; \ + \ + __child_up = alloca0(__priv->child_count); \ + memcpy(__child_up, __priv->child_up, \ + sizeof(*__child_up) * __priv->child_count); \ + __count = AFR_COUNT(__child_up, __priv->child_count); \ + \ + __local->barrier.waitfor = __count; \ + afr_local_replies_wipe(__local, __priv); \ + \ + for (__i = 0; __i < __priv->child_count; __i++) { \ + if (!__child_up[__i]) \ + continue; \ + STACK_WIND_COOKIE(frame, rfn, (void *)(long)__i, \ + __priv->children[__i], \ + __priv->children[__i]->fops->fop, args); \ + } \ + syncbarrier_wait(&__local->barrier, __count); \ + } while (0) /* Perform fop on all subvolumes represented by list[] array and wait for all callbacks to return */ -#define AFR_ONLIST(list, frame, rfn, fop, args ...) do { \ - afr_local_t *__local = frame->local; \ - afr_private_t *__priv = frame->this->private; \ - int __i = 0; \ - int __count = AFR_COUNT (list, __priv->child_count); \ - \ - __local->barrier.waitfor = __count; \ - afr_local_replies_wipe (__local, __priv); \ - \ - for (__i = 0; __i < __priv->child_count; __i++) { \ - if (!list[__i]) continue; \ - STACK_WIND_COOKIE (frame, rfn, (void *)(long) __i, \ - __priv->children[__i], \ - __priv->children[__i]->fops->fop, args); \ - } \ - syncbarrier_wait (&__local->barrier, __count); \ - } while (0) - - -#define AFR_SEQ(frame, rfn, fop, args ...) do { \ - afr_local_t *__local = frame->local; \ - afr_private_t *__priv = frame->this->private; \ - int __i = 0; \ - \ - afr_local_replies_wipe (__local, __priv); \ - \ - for (__i = 0; __i < __priv->child_count; __i++) { \ - if (!__priv->child_up[__i]) continue; \ - STACK_WIND_COOKIE (frame, rfn, (void *)(long) __i, \ - __priv->children[__i], \ - __priv->children[__i]->fops->fop, args); \ - syncbarrier_wait (&__local->barrier, 1); \ - } \ - } while (0) - - -#define ALLOC_MATRIX(n, type) ({type **__ptr = NULL; \ - int __i; \ - __ptr = alloca0 (n * sizeof(type *)); \ - for (__i = 0; __i < n; __i++) __ptr[__i] = alloca0 (n * sizeof(type)); \ - __ptr;}) - - -#define IA_EQUAL(f,s,field) (memcmp (&(f.ia_##field), &(s.ia_##field), sizeof (s.ia_##field)) == 0) - -#define SBRAIN_HEAL_NO_GO_MSG "Failed to obtain replies from all bricks of "\ - "the replica (are they up?). Cannot resolve split-brain." -int -afr_selfheal (xlator_t *this, uuid_t gfid); +#define AFR_ONLIST(list, frame, rfn, fop, args...) \ + do { \ + afr_local_t *__local = frame->local; \ + afr_private_t *__priv = frame->this->private; \ + int __i = 0; \ + int __count = AFR_COUNT(list, __priv->child_count); \ + \ + __local->barrier.waitfor = __count; \ + afr_local_replies_wipe(__local, __priv); \ + \ + for (__i = 0; __i < __priv->child_count; __i++) { \ + if (!list[__i]) \ + continue; \ + STACK_WIND_COOKIE(frame, rfn, (void *)(long)__i, \ + __priv->children[__i], \ + __priv->children[__i]->fops->fop, args); \ + } \ + syncbarrier_wait(&__local->barrier, __count); \ + } while (0) + +#define AFR_SEQ(frame, rfn, fop, args...) \ + do { \ + afr_local_t *__local = frame->local; \ + afr_private_t *__priv = frame->this->private; \ + int __i = 0; \ + \ + afr_local_replies_wipe(__local, __priv); \ + \ + for (__i = 0; __i < __priv->child_count; __i++) { \ + if (!__priv->child_up[__i]) \ + continue; \ + STACK_WIND_COOKIE(frame, rfn, (void *)(long)__i, \ + __priv->children[__i], \ + __priv->children[__i]->fops->fop, args); \ + syncbarrier_wait(&__local->barrier, 1); \ + } \ + } while (0) + +#define ALLOC_MATRIX(n, type) \ + ({ \ + type **__ptr = NULL; \ + int __i; \ + __ptr = alloca0(n * sizeof(type *)); \ + for (__i = 0; __i < n; __i++) \ + __ptr[__i] = alloca0(n * sizeof(type)); \ + __ptr; \ + }) + +#define IA_EQUAL(f, s, field) \ + (memcmp(&(f.ia_##field), &(s.ia_##field), sizeof(s.ia_##field)) == 0) + +#define SBRAIN_HEAL_NO_GO_MSG \ + "Failed to obtain replies from all bricks of " \ + "the replica (are they up?). Cannot resolve split-brain." +int +afr_selfheal(xlator_t *this, uuid_t gfid); gf_boolean_t -afr_throttled_selfheal (call_frame_t *frame, xlator_t *this); +afr_throttled_selfheal(call_frame_t *frame, xlator_t *this); int -afr_selfheal_name (xlator_t *this, uuid_t gfid, const char *name, - void *gfid_req, dict_t *xdata); +afr_selfheal_name(xlator_t *this, uuid_t gfid, const char *name, void *gfid_req, + dict_t *xdata); int -afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd); +afr_selfheal_data(call_frame_t *frame, xlator_t *this, fd_t *fd); int -afr_selfheal_metadata (call_frame_t *frame, xlator_t *this, inode_t *inode); +afr_selfheal_metadata(call_frame_t *frame, xlator_t *this, inode_t *inode); int -afr_selfheal_entry (call_frame_t *frame, xlator_t *this, inode_t *inode); +afr_selfheal_entry(call_frame_t *frame, xlator_t *this, inode_t *inode); int -afr_lookup_and_heal_gfid (xlator_t *this, inode_t *parent, const char *name, - inode_t *inode, struct afr_reply *replies, int source, - unsigned char *sources, void *gfid); +afr_lookup_and_heal_gfid(xlator_t *this, inode_t *parent, const char *name, + inode_t *inode, struct afr_reply *replies, int source, + unsigned char *sources, void *gfid); int -afr_selfheal_inodelk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, off_t off, size_t size, - unsigned char *locked_on); +afr_selfheal_inodelk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, off_t off, size_t size, + unsigned char *locked_on); int -afr_selfheal_tryinodelk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, off_t off, size_t size, - unsigned char *locked_on); +afr_selfheal_tryinodelk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, off_t off, size_t size, + unsigned char *locked_on); int -afr_selfheal_tie_breaker_inodelk (call_frame_t *frame, xlator_t *this, - inode_t *inode, char *dom, off_t off, - size_t size, unsigned char *locked_on); +afr_selfheal_tie_breaker_inodelk(call_frame_t *frame, xlator_t *this, + inode_t *inode, char *dom, off_t off, + size_t size, unsigned char *locked_on); int -afr_selfheal_uninodelk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, off_t off, size_t size, - const unsigned char *locked_on); +afr_selfheal_uninodelk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, off_t off, size_t size, + const unsigned char *locked_on); int -afr_selfheal_entrylk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, const char *name, unsigned char *locked_on); +afr_selfheal_entrylk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, const char *name, unsigned char *locked_on); int -afr_selfheal_tryentrylk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, const char *name, unsigned char *locked_on); +afr_selfheal_tryentrylk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, const char *name, unsigned char *locked_on); int -afr_selfheal_tie_breaker_entrylk (call_frame_t *frame, xlator_t *this, - inode_t *inode, char *dom, const char *name, - unsigned char *locked_on); +afr_selfheal_tie_breaker_entrylk(call_frame_t *frame, xlator_t *this, + inode_t *inode, char *dom, const char *name, + unsigned char *locked_on); int -afr_selfheal_unentrylk (call_frame_t *frame, xlator_t *this, inode_t *inode, - char *dom, const char *name, unsigned char *locked_on, - dict_t *xdata); +afr_selfheal_unentrylk(call_frame_t *frame, xlator_t *this, inode_t *inode, + char *dom, const char *name, unsigned char *locked_on, + dict_t *xdata); int -afr_selfheal_unlocked_discover (call_frame_t *frame, inode_t *inode, - uuid_t gfid, struct afr_reply *replies); +afr_selfheal_unlocked_discover(call_frame_t *frame, inode_t *inode, uuid_t gfid, + struct afr_reply *replies); int -afr_selfheal_unlocked_discover_on (call_frame_t *frame, inode_t *inode, +afr_selfheal_unlocked_discover_on(call_frame_t *frame, inode_t *inode, uuid_t gfid, struct afr_reply *replies, - unsigned char *discover_on); + unsigned char *discover_on); inode_t * -afr_selfheal_unlocked_lookup_on (call_frame_t *frame, inode_t *parent, - const char *name, struct afr_reply *replies, - unsigned char *lookup_on, dict_t *xattr); +afr_selfheal_unlocked_lookup_on(call_frame_t *frame, inode_t *parent, + const char *name, struct afr_reply *replies, + unsigned char *lookup_on, dict_t *xattr); int -afr_selfheal_find_direction (call_frame_t *frame, xlator_t *this, - struct afr_reply *replies, - afr_transaction_type type, - unsigned char *locked_on, unsigned char *sources, - unsigned char *sinks, uint64_t *witness, - gf_boolean_t *flag); +afr_selfheal_find_direction(call_frame_t *frame, xlator_t *this, + struct afr_reply *replies, + afr_transaction_type type, unsigned char *locked_on, + unsigned char *sources, unsigned char *sinks, + uint64_t *witness, gf_boolean_t *flag); int -afr_selfheal_fill_matrix (xlator_t *this, int **matrix, int subvol, int idx, - dict_t *xdata); +afr_selfheal_fill_matrix(xlator_t *this, int **matrix, int subvol, int idx, + dict_t *xdata); int -afr_selfheal_extract_xattr (xlator_t *this, struct afr_reply *replies, - afr_transaction_type type, int *dirty, int **matrix); +afr_selfheal_extract_xattr(xlator_t *this, struct afr_reply *replies, + afr_transaction_type type, int *dirty, int **matrix); int -afr_sh_generic_fop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *pre, - struct iatt *post, dict_t *xdata); +afr_sh_generic_fop_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct iatt *pre, + struct iatt *post, dict_t *xdata); int -afr_selfheal_restore_time (call_frame_t *frame, xlator_t *this, inode_t *inode, - int source, unsigned char *healed_sinks, - struct afr_reply *replies); +afr_selfheal_restore_time(call_frame_t *frame, xlator_t *this, inode_t *inode, + int source, unsigned char *healed_sinks, + struct afr_reply *replies); int -afr_selfheal_undo_pending (call_frame_t *frame, xlator_t *this, inode_t *inode, - unsigned char *sources, unsigned char *sinks, - unsigned char *healed_sinks, - unsigned char *undid_pending, - afr_transaction_type type, struct afr_reply *replies, - unsigned char *locked_on); +afr_selfheal_undo_pending(call_frame_t *frame, xlator_t *this, inode_t *inode, + unsigned char *sources, unsigned char *sinks, + unsigned char *healed_sinks, + unsigned char *undid_pending, + afr_transaction_type type, struct afr_reply *replies, + unsigned char *locked_on); int -afr_selfheal_recreate_entry (call_frame_t *frame, int dst, int source, - unsigned char *sources, - inode_t *dir, const char *name, inode_t *inode, - struct afr_reply *replies); +afr_selfheal_recreate_entry(call_frame_t *frame, int dst, int source, + unsigned char *sources, inode_t *dir, + const char *name, inode_t *inode, + struct afr_reply *replies); int -afr_selfheal_post_op (call_frame_t *frame, xlator_t *this, inode_t *inode, - int subvol, dict_t *xattr, dict_t *xdata); +afr_selfheal_post_op(call_frame_t *frame, xlator_t *this, inode_t *inode, + int subvol, dict_t *xattr, dict_t *xdata); call_frame_t * -afr_frame_create (xlator_t *this, int32_t *op_errno); +afr_frame_create(xlator_t *this, int32_t *op_errno); inode_t * -afr_inode_find (xlator_t *this, uuid_t gfid); +afr_inode_find(xlator_t *this, uuid_t gfid); int -afr_selfheal_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, - struct iatt *buf, dict_t *xdata, - struct iatt *parbuf); +afr_selfheal_discover_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, inode_t *inode, + struct iatt *buf, dict_t *xdata, struct iatt *parbuf); void -afr_reply_copy (struct afr_reply *dst, struct afr_reply *src); +afr_reply_copy(struct afr_reply *dst, struct afr_reply *src); void -afr_replies_copy (struct afr_reply *dst, struct afr_reply *src, int count); +afr_replies_copy(struct afr_reply *dst, struct afr_reply *src, int count); int -afr_selfheal_newentry_mark (call_frame_t *frame, xlator_t *this, inode_t *inode, - int source, struct afr_reply *replies, - unsigned char *sources, unsigned char *newentry); +afr_selfheal_newentry_mark(call_frame_t *frame, xlator_t *this, inode_t *inode, + int source, struct afr_reply *replies, + unsigned char *sources, unsigned char *newentry); unsigned int -afr_success_count (struct afr_reply *replies, unsigned int count); +afr_success_count(struct afr_reply *replies, unsigned int count); void -afr_log_selfheal (uuid_t gfid, xlator_t *this, int ret, char *type, - int source, unsigned char *sources, - unsigned char *healed_sinks); +afr_log_selfheal(uuid_t gfid, xlator_t *this, int ret, char *type, int source, + unsigned char *sources, unsigned char *healed_sinks); void -afr_mark_largest_file_as_source (xlator_t *this, unsigned char *sources, - struct afr_reply *replies); +afr_mark_largest_file_as_source(xlator_t *this, unsigned char *sources, + struct afr_reply *replies); void -afr_mark_active_sinks (xlator_t *this, unsigned char *sources, - unsigned char *locked_on, unsigned char *sinks); +afr_mark_active_sinks(xlator_t *this, unsigned char *sources, + unsigned char *locked_on, unsigned char *sinks); gf_boolean_t -afr_dict_contains_heal_op (call_frame_t *frame); +afr_dict_contains_heal_op(call_frame_t *frame); gf_boolean_t -afr_can_decide_split_brain_source_sinks (struct afr_reply *replies, - int child_count); +afr_can_decide_split_brain_source_sinks(struct afr_reply *replies, + int child_count); int -afr_mark_split_brain_source_sinks (call_frame_t *frame, xlator_t *this, - inode_t *inode, - unsigned char *sources, - unsigned char *sinks, - unsigned char *healed_sinks, - unsigned char *locked_on, - struct afr_reply *replies, - afr_transaction_type type); +afr_mark_split_brain_source_sinks( + call_frame_t *frame, xlator_t *this, inode_t *inode, unsigned char *sources, + unsigned char *sinks, unsigned char *healed_sinks, unsigned char *locked_on, + struct afr_reply *replies, afr_transaction_type type); int -afr_sh_get_fav_by_policy (xlator_t *this, struct afr_reply *replies, - inode_t *inode, char **policy_str); +afr_sh_get_fav_by_policy(xlator_t *this, struct afr_reply *replies, + inode_t *inode, char **policy_str); int -_afr_fav_child_reset_sink_xattrs (call_frame_t *frame, xlator_t *this, +_afr_fav_child_reset_sink_xattrs(call_frame_t *frame, xlator_t *this, inode_t *inode, int source, unsigned char *healed_sinks, unsigned char *undid_pending, @@ -275,86 +274,77 @@ _afr_fav_child_reset_sink_xattrs (call_frame_t *frame, xlator_t *this, struct afr_reply *replies); int -afr_get_child_index_from_name (xlator_t *this, char *name); +afr_get_child_index_from_name(xlator_t *this, char *name); gf_boolean_t -afr_does_witness_exist (xlator_t *this, uint64_t *witness); +afr_does_witness_exist(xlator_t *this, uint64_t *witness); int -__afr_selfheal_data_prepare (call_frame_t *frame, xlator_t *this, - inode_t *inode, unsigned char *locked_on, - unsigned char *sources, - unsigned char *sinks, unsigned char *healed_sinks, - unsigned char *undid_pending, - struct afr_reply *replies, gf_boolean_t *flag); +__afr_selfheal_data_prepare(call_frame_t *frame, xlator_t *this, inode_t *inode, + unsigned char *locked_on, unsigned char *sources, + unsigned char *sinks, unsigned char *healed_sinks, + unsigned char *undid_pending, + struct afr_reply *replies, gf_boolean_t *flag); int -__afr_selfheal_metadata_prepare (call_frame_t *frame, xlator_t *this, - inode_t *inode, unsigned char *locked_on, - unsigned char *sources, - unsigned char *sinks, - unsigned char *healed_sinks, - unsigned char *undid_pending, - struct afr_reply *replies, - gf_boolean_t *flag); +__afr_selfheal_metadata_prepare(call_frame_t *frame, xlator_t *this, + inode_t *inode, unsigned char *locked_on, + unsigned char *sources, unsigned char *sinks, + unsigned char *healed_sinks, + unsigned char *undid_pending, + struct afr_reply *replies, gf_boolean_t *flag); int -__afr_selfheal_entry_prepare (call_frame_t *frame, xlator_t *this, - inode_t *inode, unsigned char *locked_on, - unsigned char *sources, - unsigned char *sinks, - unsigned char *healed_sinks, - struct afr_reply *replies, int *source_p, - gf_boolean_t *flag); +__afr_selfheal_entry_prepare(call_frame_t *frame, xlator_t *this, + inode_t *inode, unsigned char *locked_on, + unsigned char *sources, unsigned char *sinks, + unsigned char *healed_sinks, + struct afr_reply *replies, int *source_p, + gf_boolean_t *flag); int -afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this, - uuid_t gfid, inode_t **link_inode, - gf_boolean_t *data_selfheal, - gf_boolean_t *metadata_selfheal, - gf_boolean_t *entry_selfheal); +afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid, + inode_t **link_inode, gf_boolean_t *data_selfheal, + gf_boolean_t *metadata_selfheal, + gf_boolean_t *entry_selfheal); int -afr_selfheal_do (call_frame_t *frame, xlator_t *this, uuid_t gfid); +afr_selfheal_do(call_frame_t *frame, xlator_t *this, uuid_t gfid); int -afr_selfheal_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata); +afr_selfheal_lock_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *xdata); int -afr_locked_fill (call_frame_t *frame, xlator_t *this, - unsigned char *locked_on); +afr_locked_fill(call_frame_t *frame, xlator_t *this, unsigned char *locked_on); int -afr_choose_source_by_policy (afr_private_t *priv, unsigned char *sources, - afr_transaction_type type); +afr_choose_source_by_policy(afr_private_t *priv, unsigned char *sources, + afr_transaction_type type); int -afr_selfheal_metadata_by_stbuf (xlator_t *this, struct iatt *stbuf); +afr_selfheal_metadata_by_stbuf(xlator_t *this, struct iatt *stbuf); int -afr_sh_fav_by_size (xlator_t *this, struct afr_reply *replies, - inode_t *inode); +afr_sh_fav_by_size(xlator_t *this, struct afr_reply *replies, inode_t *inode); int -afr_sh_fav_by_mtime (xlator_t *this, struct afr_reply *replies, - inode_t *inode); +afr_sh_fav_by_mtime(xlator_t *this, struct afr_reply *replies, inode_t *inode); int -afr_sh_fav_by_ctime (xlator_t *this, struct afr_reply *replies, - inode_t *inode); +afr_sh_fav_by_ctime(xlator_t *this, struct afr_reply *replies, inode_t *inode); int -afr_gfid_split_brain_source (xlator_t *this, struct afr_reply *replies, - inode_t *inode, uuid_t pargfid, const char *bname, - int src_idx, int child_idx, - unsigned char *locked_on, int *src, dict_t *xdata); +afr_gfid_split_brain_source(xlator_t *this, struct afr_reply *replies, + inode_t *inode, uuid_t pargfid, const char *bname, + int src_idx, int child_idx, + unsigned char *locked_on, int *src, dict_t *xdata); int -afr_mark_source_sinks_if_file_empty (xlator_t *this, unsigned char *sources, - unsigned char *sinks, - unsigned char *healed_sinks, - unsigned char *locked_on, - struct afr_reply *replies, - afr_transaction_type type); +afr_mark_source_sinks_if_file_empty(xlator_t *this, unsigned char *sources, + unsigned char *sinks, + unsigned char *healed_sinks, + unsigned char *locked_on, + struct afr_reply *replies, + afr_transaction_type type); gf_boolean_t -afr_is_file_empty_on_all_children (afr_private_t *priv, - struct afr_reply *replies); +afr_is_file_empty_on_all_children(afr_private_t *priv, + struct afr_reply *replies); #endif /* !_AFR_SELFHEAL_H */ diff --git a/xlators/cluster/afr/src/afr-self-heald.h b/xlators/cluster/afr/src/afr-self-heald.h index 4ac1d32f58a..7de7c431460 100644 --- a/xlators/cluster/afr/src/afr-self-heald.h +++ b/xlators/cluster/afr/src/afr-self-heald.h @@ -8,74 +8,71 @@ cases as published by the Free Software Foundation. */ - #ifndef _AFR_SELF_HEALD_H #define _AFR_SELF_HEALD_H #include <pthread.h> - typedef struct { - int child; - char *path; + int child; + char *path; } shd_event_t; typedef struct { - int child; - uint64_t healed_count; - uint64_t split_brain_count; - uint64_t heal_failed_count; - - /* If start_time is 0, it means crawler is not in progress - and stats are not valid */ - time_t start_time; - /* If start_time is NOT 0 and end_time is 0, it means - cralwer is in progress */ - time_t end_time; - char *crawl_type; + int child; + uint64_t healed_count; + uint64_t split_brain_count; + uint64_t heal_failed_count; + + /* If start_time is 0, it means crawler is not in progress + and stats are not valid */ + time_t start_time; + /* If start_time is NOT 0 and end_time is 0, it means + cralwer is in progress */ + time_t end_time; + char *crawl_type; } crawl_event_t; struct subvol_healer { - xlator_t *this; - int subvol; - gf_boolean_t local; - gf_boolean_t running; - gf_boolean_t rerun; - crawl_event_t crawl_event; - pthread_mutex_t mutex; - pthread_cond_t cond; - pthread_t thread; + xlator_t *this; + int subvol; + gf_boolean_t local; + gf_boolean_t running; + gf_boolean_t rerun; + crawl_event_t crawl_event; + pthread_mutex_t mutex; + pthread_cond_t cond; + pthread_t thread; }; typedef struct { - gf_boolean_t iamshd; - gf_boolean_t enabled; - int timeout; - struct subvol_healer *index_healers; - struct subvol_healer *full_healers; - - eh_t *split_brain; - eh_t **statistics; - uint32_t max_threads; - uint32_t wait_qlength; - uint32_t halo_max_latency_msec; + gf_boolean_t iamshd; + gf_boolean_t enabled; + int timeout; + struct subvol_healer *index_healers; + struct subvol_healer *full_healers; + + eh_t *split_brain; + eh_t **statistics; + uint32_t max_threads; + uint32_t wait_qlength; + uint32_t halo_max_latency_msec; } afr_self_heald_t; - int -afr_selfheal_childup (xlator_t *this, int subvol); +afr_selfheal_childup(xlator_t *this, int subvol); int -afr_selfheal_daemon_init (xlator_t *this); +afr_selfheal_daemon_init(xlator_t *this); int -afr_xl_op (xlator_t *this, dict_t *input, dict_t *output); +afr_xl_op(xlator_t *this, dict_t *input, dict_t *output); int -afr_shd_gfid_to_path (xlator_t *this, xlator_t *subvol, uuid_t gfid, - char **path_p); +afr_shd_gfid_to_path(xlator_t *this, xlator_t *subvol, uuid_t gfid, + char **path_p); int -afr_shd_index_purge (xlator_t *subvol, inode_t *inode, char *name, - ia_type_t type); +afr_shd_index_purge(xlator_t *subvol, inode_t *inode, char *name, + ia_type_t type); #endif /* !_AFR_SELF_HEALD_H */ diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h index fe0f45f2f93..fff8c65e976 100644 --- a/xlators/cluster/afr/src/afr-transaction.h +++ b/xlators/cluster/afr/src/afr-transaction.h @@ -14,51 +14,57 @@ #include "afr.h" void -afr_transaction_fop_failed (call_frame_t *frame, xlator_t *this, - int child_index); +afr_transaction_fop_failed(call_frame_t *frame, xlator_t *this, + int child_index); int32_t -afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type); +afr_transaction(call_frame_t *frame, xlator_t *this, afr_transaction_type type); int -afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int32_t **pending); +afr_set_pending_dict(afr_private_t *priv, dict_t *xattr, int32_t **pending); void -afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd); +afr_delayed_changelog_wake_up(xlator_t *this, fd_t *fd); void -__mark_all_success (call_frame_t *frame, xlator_t *this); +__mark_all_success(call_frame_t *frame, xlator_t *this); gf_boolean_t -afr_txn_nothing_failed (call_frame_t *frame, xlator_t *this); +afr_txn_nothing_failed(call_frame_t *frame, xlator_t *this); -int afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode, - afr_read_txn_wind_t readfn, afr_transaction_type type); +int +afr_read_txn(call_frame_t *frame, xlator_t *this, inode_t *inode, + afr_read_txn_wind_t readfn, afr_transaction_type type); -int afr_read_txn_continue (call_frame_t *frame, xlator_t *this, int subvol); +int +afr_read_txn_continue(call_frame_t *frame, xlator_t *this, int subvol); void -afr_pending_read_increment (afr_private_t *priv, int child_index); +afr_pending_read_increment(afr_private_t *priv, int child_index); void -afr_pending_read_decrement (afr_private_t *priv, int child_index); +afr_pending_read_decrement(afr_private_t *priv, int child_index); -call_frame_t *afr_transaction_detach_fop_frame (call_frame_t *frame); -gf_boolean_t afr_has_quorum (unsigned char *subvols, xlator_t *this); -gf_boolean_t afr_needs_changelog_update (afr_local_t *local); -void afr_zero_fill_stat (afr_local_t *local); +call_frame_t * +afr_transaction_detach_fop_frame(call_frame_t *frame); +gf_boolean_t +afr_has_quorum(unsigned char *subvols, xlator_t *this); +gf_boolean_t +afr_needs_changelog_update(afr_local_t *local); +void +afr_zero_fill_stat(afr_local_t *local); void -afr_pick_error_xdata (afr_local_t *local, afr_private_t *priv, - inode_t *inode1, unsigned char *readable1, - inode_t *inode2, unsigned char *readable2); +afr_pick_error_xdata(afr_local_t *local, afr_private_t *priv, inode_t *inode1, + unsigned char *readable1, inode_t *inode2, + unsigned char *readable2); int -afr_transaction_resume (call_frame_t *frame, xlator_t *this); +afr_transaction_resume(call_frame_t *frame, xlator_t *this); int -afr_lock (call_frame_t *frame, xlator_t *this); +afr_lock(call_frame_t *frame, xlator_t *this); void -afr_delayed_changelog_wake_up_cbk (void *data); +afr_delayed_changelog_wake_up_cbk(void *data); #endif /* __TRANSACTION_H__ */ diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index f7b636cb3d9..3395507ab90 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -8,7 +8,6 @@ cases as published by the Free Software Foundation. */ - #ifndef __AFR_H__ #define __AFR_H__ @@ -27,11 +26,11 @@ #define AFR_SH_READDIR_SIZE_KEY "self-heal-readdir-size" #define AFR_SH_DATA_DOMAIN_FMT "%s:self-heal" #define AFR_DIRTY_DEFAULT AFR_XATTR_PREFIX ".dirty" -#define AFR_DIRTY (((afr_private_t *) (THIS->private))->afr_dirty) +#define AFR_DIRTY (((afr_private_t *)(THIS->private))->afr_dirty) -#define AFR_LOCKEE_COUNT_MAX 3 -#define AFR_DOM_COUNT_MAX 3 -#define AFR_NUM_CHANGE_LOGS 3 /*data + metadata + entry*/ +#define AFR_LOCKEE_COUNT_MAX 3 +#define AFR_DOM_COUNT_MAX 3 +#define AFR_NUM_CHANGE_LOGS 3 /*data + metadata + entry*/ #define AFR_DEFAULT_SPB_CHOICE_TIMEOUT 300 /*in seconds*/ #define ARBITER_BRICK_INDEX 2 @@ -40,160 +39,185 @@ #define AFR_TA_DOM_MODIFY "afr.ta.dom-modify" #define AFR_HALO_MAX_LATENCY 99999 -typedef int (*afr_lock_cbk_t) (call_frame_t *frame, xlator_t *this); - -typedef int (*afr_read_txn_wind_t) (call_frame_t *frame, xlator_t *this, int subvol); - -typedef int (*afr_inode_refresh_cbk_t) (call_frame_t *frame, xlator_t *this, int err); - -typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this); - -#define AFR_COUNT(array,max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res;}) -#define AFR_INTERSECT(dst,src1,src2,max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i];}) -#define AFR_CMP(a1,a2,len) ({int __cmp = 0; int __i; for (__i = 0; __i < len; __i++) if (a1[__i] != a2[__i]) { __cmp = 1; break;} __cmp;}) -#define AFR_IS_ARBITER_BRICK(priv, index) ((priv->arbiter_count == 1) && (index == ARBITER_BRICK_INDEX)) +typedef int (*afr_lock_cbk_t)(call_frame_t *frame, xlator_t *this); + +typedef int (*afr_read_txn_wind_t)(call_frame_t *frame, xlator_t *this, + int subvol); + +typedef int (*afr_inode_refresh_cbk_t)(call_frame_t *frame, xlator_t *this, + int err); + +typedef int (*afr_changelog_resume_t)(call_frame_t *frame, xlator_t *this); + +#define AFR_COUNT(array, max) \ + ({ \ + int __i; \ + int __res = 0; \ + for (__i = 0; __i < max; __i++) \ + if (array[__i]) \ + __res++; \ + __res; \ + }) +#define AFR_INTERSECT(dst, src1, src2, max) \ + ({ \ + int __i; \ + for (__i = 0; __i < max; __i++) \ + dst[__i] = src1[__i] && src2[__i]; \ + }) +#define AFR_CMP(a1, a2, len) \ + ({ \ + int __cmp = 0; \ + int __i; \ + for (__i = 0; __i < len; __i++) \ + if (a1[__i] != a2[__i]) { \ + __cmp = 1; \ + break; \ + } \ + __cmp; \ + }) +#define AFR_IS_ARBITER_BRICK(priv, index) \ + ((priv->arbiter_count == 1) && (index == ARBITER_BRICK_INDEX)) #define AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN(ret, errnum) \ - do { \ - local->op_ret = ret; \ - local->op_errno = errnum; \ - if (local->op_errno == EIO) \ - gf_msg (this->name, GF_LOG_ERROR, local->op_errno, \ - AFR_MSG_SPLIT_BRAIN, "Failing %s on gfid %s: " \ - "split-brain observed.", \ - gf_fop_list[local->op], \ - uuid_utoa (local->inode->gfid)); \ - } while (0) + do { \ + local->op_ret = ret; \ + local->op_errno = errnum; \ + if (local->op_errno == EIO) \ + gf_msg(this->name, GF_LOG_ERROR, local->op_errno, \ + AFR_MSG_SPLIT_BRAIN, \ + "Failing %s on gfid %s: " \ + "split-brain observed.", \ + gf_fop_list[local->op], uuid_utoa(local->inode->gfid)); \ + } while (0) typedef enum { - AFR_FAV_CHILD_NONE, - AFR_FAV_CHILD_BY_SIZE, - AFR_FAV_CHILD_BY_CTIME, - AFR_FAV_CHILD_BY_MTIME, - AFR_FAV_CHILD_BY_MAJORITY, - AFR_FAV_CHILD_POLICY_MAX, + AFR_FAV_CHILD_NONE, + AFR_FAV_CHILD_BY_SIZE, + AFR_FAV_CHILD_BY_CTIME, + AFR_FAV_CHILD_BY_MTIME, + AFR_FAV_CHILD_BY_MAJORITY, + AFR_FAV_CHILD_POLICY_MAX, } afr_favorite_child_policy; typedef enum { - AFR_CHILD_UNKNOWN = -1, - AFR_CHILD_ZERO, - AFR_CHILD_ONE, + AFR_CHILD_UNKNOWN = -1, + AFR_CHILD_ZERO, + AFR_CHILD_ONE, } afr_child_index; struct afr_nfsd { - gf_boolean_t iamnfsd; - uint32_t halo_max_latency_msec; + gf_boolean_t iamnfsd; + uint32_t halo_max_latency_msec; }; typedef struct _afr_private { - gf_lock_t lock; /* to guard access to child_count, etc */ - unsigned int child_count; /* total number of children */ - unsigned int arbiter_count; /*subset of child_count. - Has to be 0 or 1.*/ - - xlator_t **children; - - inode_t *root_inode; - - /* For thin-arbiter. */ - unsigned int thin_arbiter_count; /* 0 or 1 at the moment.*/ - uuid_t ta_gfid; - int ta_bad_child_index; - off_t ta_notify_dom_lock_offset; - - unsigned char *child_up; - int64_t *child_latency; - unsigned char *local; - - char **pending_key; - - char *data_self_heal; /* on/off/open */ - char * data_self_heal_algorithm; /* name of algorithm */ - unsigned int data_self_heal_window_size; /* max number of pipelined - read/writes */ - - struct list_head heal_waiting; /*queue for files that need heal*/ - uint32_t heal_wait_qlen; /*configurable queue length for heal_waiting*/ - int32_t heal_waiters; /* No. of elements currently in wait queue.*/ - - struct list_head healing;/* queue for files that are undergoing - background heal*/ - uint32_t background_self_heal_count;/*configurable queue length for - healing queue*/ - int32_t healers;/* No. of elements currently undergoing background - heal*/ - - gf_boolean_t metadata_self_heal; /* on/off */ - gf_boolean_t entry_self_heal; /* on/off */ - - gf_boolean_t metadata_splitbrain_forced_heal; /* on/off */ - int read_child; /* read-subvolume */ - unsigned int hash_mode; /* for when read_child is not set */ - gf_atomic_t *pending_reads; /*No. of pending read cbks per child.*/ - int favorite_child; /* subvolume to be preferred in resolving - split-brain cases */ - - afr_favorite_child_policy fav_child_policy;/*Policy to use for automatic - resolution of split-brains.*/ - - unsigned int wait_count; /* # of servers to wait for success */ - - gf_timer_t *timer; /* launched when parent up is received */ - - gf_boolean_t optimistic_change_log; - gf_boolean_t eager_lock; - gf_boolean_t pre_op_compat; /* on/off */ - uint32_t post_op_delay_secs; - unsigned int quorum_count; - - char vol_uuid[UUID_SIZE + 1]; - int32_t *last_event; - - /* @event_generation: Keeps count of number of events received which can - potentially impact consistency decisions. The events are CHILD_UP - and CHILD_DOWN, when we have to recalculate the freshness/staleness - of copies to detect if changes had happened while the other server - was down. CHILD_DOWN and CHILD_UP can also be received on network - disconnect/reconnects and not necessarily server going down/up. - Recalculating freshness/staleness on network events is equally - important as we might have had a network split brain. - */ - uint32_t event_generation; - - gf_boolean_t choose_local; - gf_boolean_t did_discovery; - uint64_t sh_readdir_size; - gf_boolean_t ensure_durability; - char *sh_domain; - char *afr_dirty; - gf_boolean_t halo_enabled; - - uint32_t halo_max_latency_msec; - uint32_t halo_max_replicas; - uint32_t halo_min_replicas; - - afr_self_heald_t shd; - struct afr_nfsd nfsd; - - gf_boolean_t consistent_metadata; - uint64_t spb_choice_timeout; - gf_boolean_t need_heal; - - /* pump dependencies */ - void *pump_private; - gf_boolean_t use_afr_in_pump; - char *locking_scheme; - gf_boolean_t full_lock; - gf_boolean_t esh_granular; - gf_boolean_t consistent_io; + gf_lock_t lock; /* to guard access to child_count, etc */ + unsigned int child_count; /* total number of children */ + unsigned int arbiter_count; /*subset of child_count. + Has to be 0 or 1.*/ + + xlator_t **children; + + inode_t *root_inode; + + /* For thin-arbiter. */ + unsigned int thin_arbiter_count; /* 0 or 1 at the moment.*/ + uuid_t ta_gfid; + int ta_bad_child_index; + off_t ta_notify_dom_lock_offset; + + unsigned char *child_up; + int64_t *child_latency; + unsigned char *local; + + char **pending_key; + + char *data_self_heal; /* on/off/open */ + char *data_self_heal_algorithm; /* name of algorithm */ + unsigned int data_self_heal_window_size; /* max number of pipelined + read/writes */ + + struct list_head heal_waiting; /*queue for files that need heal*/ + uint32_t heal_wait_qlen; /*configurable queue length for heal_waiting*/ + int32_t heal_waiters; /* No. of elements currently in wait queue.*/ + + struct list_head healing; /* queue for files that are undergoing + background heal*/ + uint32_t background_self_heal_count; /*configurable queue length for + healing queue*/ + int32_t healers; /* No. of elements currently undergoing background + heal*/ + + gf_boolean_t metadata_self_heal; /* on/off */ + gf_boolean_t entry_self_heal; /* on/off */ + + gf_boolean_t metadata_splitbrain_forced_heal; /* on/off */ + int read_child; /* read-subvolume */ + unsigned int hash_mode; /* for when read_child is not set */ + gf_atomic_t *pending_reads; /*No. of pending read cbks per child.*/ + int favorite_child; /* subvolume to be preferred in resolving + split-brain cases */ + + afr_favorite_child_policy fav_child_policy; /*Policy to use for automatic + resolution of split-brains.*/ + + unsigned int wait_count; /* # of servers to wait for success */ + + gf_timer_t *timer; /* launched when parent up is received */ + + gf_boolean_t optimistic_change_log; + gf_boolean_t eager_lock; + gf_boolean_t pre_op_compat; /* on/off */ + uint32_t post_op_delay_secs; + unsigned int quorum_count; + + char vol_uuid[UUID_SIZE + 1]; + int32_t *last_event; + + /* @event_generation: Keeps count of number of events received which can + potentially impact consistency decisions. The events are CHILD_UP + and CHILD_DOWN, when we have to recalculate the freshness/staleness + of copies to detect if changes had happened while the other server + was down. CHILD_DOWN and CHILD_UP can also be received on network + disconnect/reconnects and not necessarily server going down/up. + Recalculating freshness/staleness on network events is equally + important as we might have had a network split brain. + */ + uint32_t event_generation; + + gf_boolean_t choose_local; + gf_boolean_t did_discovery; + uint64_t sh_readdir_size; + gf_boolean_t ensure_durability; + char *sh_domain; + char *afr_dirty; + gf_boolean_t halo_enabled; + + uint32_t halo_max_latency_msec; + uint32_t halo_max_replicas; + uint32_t halo_min_replicas; + + afr_self_heald_t shd; + struct afr_nfsd nfsd; + + gf_boolean_t consistent_metadata; + uint64_t spb_choice_timeout; + gf_boolean_t need_heal; + + /* pump dependencies */ + void *pump_private; + gf_boolean_t use_afr_in_pump; + char *locking_scheme; + gf_boolean_t full_lock; + gf_boolean_t esh_granular; + gf_boolean_t consistent_io; } afr_private_t; - typedef enum { - AFR_DATA_TRANSACTION, /* truncate, write, ... */ - AFR_METADATA_TRANSACTION, /* chmod, chown, ... */ - AFR_ENTRY_TRANSACTION, /* create, rmdir, ... */ - AFR_ENTRY_RENAME_TRANSACTION, /* rename */ + AFR_DATA_TRANSACTION, /* truncate, write, ... */ + AFR_METADATA_TRANSACTION, /* chmod, chown, ... */ + AFR_ENTRY_TRANSACTION, /* create, rmdir, ... */ + AFR_ENTRY_RENAME_TRANSACTION, /* rename */ } afr_transaction_type; /* @@ -204,914 +228,909 @@ typedef enum { */ static inline int -afr_index_for_transaction_type (afr_transaction_type type) +afr_index_for_transaction_type(afr_transaction_type type) { - switch (type) { - + switch (type) { case AFR_DATA_TRANSACTION: - return 0; + return 0; case AFR_METADATA_TRANSACTION: - return 1; + return 1; case AFR_ENTRY_TRANSACTION: case AFR_ENTRY_RENAME_TRANSACTION: - return 2; - } + return 2; + } - return -1; /* make gcc happy */ + return -1; /* make gcc happy */ } static inline int -afr_index_from_ia_type (ia_type_t type) +afr_index_from_ia_type(ia_type_t type) { - switch (type) { + switch (type) { case IA_IFDIR: - return afr_index_for_transaction_type (AFR_ENTRY_TRANSACTION); + return afr_index_for_transaction_type(AFR_ENTRY_TRANSACTION); case IA_IFREG: - return afr_index_for_transaction_type (AFR_DATA_TRANSACTION); - default: return -1; - } + return afr_index_for_transaction_type(AFR_DATA_TRANSACTION); + default: + return -1; + } } typedef struct { - loc_t loc; - char *basename; - unsigned char *locked_nodes; - int locked_count; + loc_t loc; + char *basename; + unsigned char *locked_nodes; + int locked_count; } afr_entry_lockee_t; int -afr_entry_lockee_cmp (const void *l1, const void *l2); +afr_entry_lockee_cmp(const void *l1, const void *l2); typedef struct { - loc_t *lk_loc; + loc_t *lk_loc; - int lockee_count; - afr_entry_lockee_t lockee[AFR_LOCKEE_COUNT_MAX]; + int lockee_count; + afr_entry_lockee_t lockee[AFR_LOCKEE_COUNT_MAX]; - struct gf_flock flock; - const char *lk_basename; - const char *lower_basename; - const char *higher_basename; - char lower_locked; - char higher_locked; + struct gf_flock flock; + const char *lk_basename; + const char *lower_basename; + const char *higher_basename; + char lower_locked; + char higher_locked; - unsigned char *locked_nodes; - unsigned char *lower_locked_nodes; + unsigned char *locked_nodes; + unsigned char *lower_locked_nodes; - int32_t lock_count; - int32_t entrylk_lock_count; + int32_t lock_count; + int32_t entrylk_lock_count; - int32_t lk_call_count; - int32_t lk_expected_count; - int32_t lk_attempted_count; + int32_t lk_call_count; + int32_t lk_expected_count; + int32_t lk_attempted_count; - int32_t lock_op_ret; - int32_t lock_op_errno; - afr_lock_cbk_t lock_cbk; - char *domain; /* Domain on which inode/entry lock/unlock in progress.*/ + int32_t lock_op_ret; + int32_t lock_op_errno; + afr_lock_cbk_t lock_cbk; + char *domain; /* Domain on which inode/entry lock/unlock in progress.*/ } afr_internal_lock_t; struct afr_reply { - int valid; - int32_t op_ret; - int32_t op_errno; - dict_t *xattr;/*For xattrop*/ - dict_t *xdata; - struct iatt poststat; - struct iatt postparent; - struct iatt prestat; - struct iatt preparent; - struct iatt preparent2; - struct iatt postparent2; - /* For rchecksum */ - uint8_t checksum[SHA256_DIGEST_LENGTH]; - gf_boolean_t buf_has_zeroes; - gf_boolean_t fips_mode_rchecksum; - /* For lookup */ - int8_t need_heal; + int valid; + int32_t op_ret; + int32_t op_errno; + dict_t *xattr; /*For xattrop*/ + dict_t *xdata; + struct iatt poststat; + struct iatt postparent; + struct iatt prestat; + struct iatt preparent; + struct iatt preparent2; + struct iatt postparent2; + /* For rchecksum */ + uint8_t checksum[SHA256_DIGEST_LENGTH]; + gf_boolean_t buf_has_zeroes; + gf_boolean_t fips_mode_rchecksum; + /* For lookup */ + int8_t need_heal; }; typedef enum { - AFR_FD_NOT_OPENED, - AFR_FD_OPENED, - AFR_FD_OPENING + AFR_FD_NOT_OPENED, + AFR_FD_OPENED, + AFR_FD_OPENING } afr_fd_open_status_t; typedef struct { - afr_fd_open_status_t *opened_on; /* which subvolumes the fd is open on */ - int flags; - - /* the subvolume on which the latest sequence of readdirs (starting - at offset 0) has begun. Till the next readdir request with 0 offset - arrives, we continue to read off this subvol. - */ - int readdir_subvol; + afr_fd_open_status_t *opened_on; /* which subvolumes the fd is open on */ + int flags; + + /* the subvolume on which the latest sequence of readdirs (starting + at offset 0) has begun. Till the next readdir request with 0 offset + arrives, we continue to read off this subvol. + */ + int readdir_subvol; } afr_fd_ctx_t; typedef enum { - AFR_FOP_LOCK_PARALLEL, - AFR_FOP_LOCK_SERIAL, - AFR_FOP_LOCK_QUORUM_FAILED, + AFR_FOP_LOCK_PARALLEL, + AFR_FOP_LOCK_SERIAL, + AFR_FOP_LOCK_QUORUM_FAILED, } afr_fop_lock_state_t; typedef struct _afr_inode_lock_t { - unsigned int event_generation; - gf_boolean_t release; - gf_boolean_t acquired; - gf_timer_t *delay_timer; - struct list_head owners; /*Transactions that are performing fop*/ - struct list_head post_op;/*Transactions that are done with the fop - *So can not conflict with the fops*/ - struct list_head waiting;/*Transaction that are waiting for - *conflicting transactions to complete*/ - struct list_head frozen;/*Transactions that need to go as part of - * next batch of eager-lock*/ + unsigned int event_generation; + gf_boolean_t release; + gf_boolean_t acquired; + gf_timer_t *delay_timer; + struct list_head owners; /*Transactions that are performing fop*/ + struct list_head post_op; /*Transactions that are done with the fop + *So can not conflict with the fops*/ + struct list_head waiting; /*Transaction that are waiting for + *conflicting transactions to complete*/ + struct list_head frozen; /*Transactions that need to go as part of + * next batch of eager-lock*/ } afr_lock_t; typedef struct _afr_inode_ctx { - uint64_t read_subvol; - uint64_t write_subvol; - int lock_count; - int spb_choice; - gf_timer_t *timer; - gf_boolean_t need_refresh; - unsigned int *pre_op_done[AFR_NUM_CHANGE_LOGS]; - int inherited[AFR_NUM_CHANGE_LOGS]; - int on_disk[AFR_NUM_CHANGE_LOGS]; - - /* set if any write on this fd was a non stable write - (i.e, without O_SYNC or O_DSYNC) - */ - gf_boolean_t witnessed_unstable_write; - - /* @open_fd_count: - Number of open FDs queried from the server, as queried through - xdata in FOPs. Currently, used to decide if eager-locking must be - temporarily disabled. - */ - uint32_t open_fd_count; - /*Only 2 types of transactions support eager-locks now. DATA/METADATA*/ - afr_lock_t lock[2]; + uint64_t read_subvol; + uint64_t write_subvol; + int lock_count; + int spb_choice; + gf_timer_t *timer; + gf_boolean_t need_refresh; + unsigned int *pre_op_done[AFR_NUM_CHANGE_LOGS]; + int inherited[AFR_NUM_CHANGE_LOGS]; + int on_disk[AFR_NUM_CHANGE_LOGS]; + + /* set if any write on this fd was a non stable write + (i.e, without O_SYNC or O_DSYNC) + */ + gf_boolean_t witnessed_unstable_write; + + /* @open_fd_count: + Number of open FDs queried from the server, as queried through + xdata in FOPs. Currently, used to decide if eager-locking must be + temporarily disabled. + */ + uint32_t open_fd_count; + /*Only 2 types of transactions support eager-locks now. DATA/METADATA*/ + afr_lock_t lock[2]; } afr_inode_ctx_t; - typedef struct _afr_local { - glusterfs_fop_t op; - unsigned int call_count; + glusterfs_fop_t op; + unsigned int call_count; - /* @event_generation: copy of priv->event_generation taken at the - time of starting the transaction. The copy is made so that we - have a stable value through the various phases of the transaction. - */ - unsigned int event_generation; + /* @event_generation: copy of priv->event_generation taken at the + time of starting the transaction. The copy is made so that we + have a stable value through the various phases of the transaction. + */ + unsigned int event_generation; - uint32_t open_fd_count; - gf_boolean_t update_open_fd_count; + uint32_t open_fd_count; + gf_boolean_t update_open_fd_count; - gf_lkowner_t saved_lk_owner; + gf_lkowner_t saved_lk_owner; - int32_t op_ret; - int32_t op_errno; + int32_t op_ret; + int32_t op_errno; - int32_t **pending; + int32_t **pending; - int dirty[AFR_NUM_CHANGE_LOGS]; + int dirty[AFR_NUM_CHANGE_LOGS]; - loc_t loc; - loc_t newloc; + loc_t loc; + loc_t newloc; - fd_t *fd; - afr_fd_ctx_t *fd_ctx; + fd_t *fd; + afr_fd_ctx_t *fd_ctx; - /* @child_up: copy of priv->child_up taken at the time of transaction - start. The copy is taken so that we have a stable child_up array - through the phases of the transaction as priv->child_up[i] can keep - changing through time. - */ - unsigned char *child_up; + /* @child_up: copy of priv->child_up taken at the time of transaction + start. The copy is taken so that we have a stable child_up array + through the phases of the transaction as priv->child_up[i] can keep + changing through time. + */ + unsigned char *child_up; - /* @read_attempted: - array of flags representing subvolumes where read operations of - the read transaction have already been attempted. The array is - first pre-filled with down subvolumes, and as reads are performed - on other subvolumes, those are set as well. This way if the read - operation fails we do not retry on that subvolume again. - */ - unsigned char *read_attempted; + /* @read_attempted: + array of flags representing subvolumes where read operations of + the read transaction have already been attempted. The array is + first pre-filled with down subvolumes, and as reads are performed + on other subvolumes, those are set as well. This way if the read + operation fails we do not retry on that subvolume again. + */ + unsigned char *read_attempted; - /* @readfn: + /* @readfn: - pointer to function which will perform the read operation on a given - subvolume. Used in read transactions. - */ + pointer to function which will perform the read operation on a given + subvolume. Used in read transactions. + */ - afr_read_txn_wind_t readfn; + afr_read_txn_wind_t readfn; - /* @refreshed: + /* @refreshed: - the inode was "refreshed" (i.e, pending xattrs from all subvols - freshly inspected and inode ctx updated accordingly) as part of - this transaction already. - */ - gf_boolean_t refreshed; + the inode was "refreshed" (i.e, pending xattrs from all subvols + freshly inspected and inode ctx updated accordingly) as part of + this transaction already. + */ + gf_boolean_t refreshed; - /* @inode: + /* @inode: - the inode on which the read txn is performed on. ref'ed and copied - from either fd->inode or loc.inode - */ + the inode on which the read txn is performed on. ref'ed and copied + from either fd->inode or loc.inode + */ - inode_t *inode; + inode_t *inode; - /* @parent[2]: + /* @parent[2]: - parent inode[s] on which directory transactions are performed. - */ + parent inode[s] on which directory transactions are performed. + */ - inode_t *parent; - inode_t *parent2; + inode_t *parent; + inode_t *parent2; - /* @readable: + /* @readable: - array of flags representing servers from which a read can be - performed. This is the output of afr_inode_refresh() - */ - unsigned char *readable; - unsigned char *readable2; /*For rename transaction*/ + array of flags representing servers from which a read can be + performed. This is the output of afr_inode_refresh() + */ + unsigned char *readable; + unsigned char *readable2; /*For rename transaction*/ - int read_subvol; /* Current read subvolume */ + int read_subvol; /* Current read subvolume */ - afr_inode_refresh_cbk_t refreshfn; + afr_inode_refresh_cbk_t refreshfn; - /* @refreshinode: + /* @refreshinode: - Inode currently getting refreshed. - */ - inode_t *refreshinode; + Inode currently getting refreshed. + */ + inode_t *refreshinode; - /*To handle setattr/setxattr on yet to be linked inode from dht*/ - uuid_t refreshgfid; + /*To handle setattr/setxattr on yet to be linked inode from dht*/ + uuid_t refreshgfid; - /* - @pre_op_compat: + /* + @pre_op_compat: - compatibility mode of pre-op. send a separate pre-op and - op operations as part of transaction, rather than combining - */ + compatibility mode of pre-op. send a separate pre-op and + op operations as part of transaction, rather than combining + */ - gf_boolean_t pre_op_compat; + gf_boolean_t pre_op_compat; - dict_t *xattr_req; + dict_t *xattr_req; - afr_internal_lock_t internal_lock; + afr_internal_lock_t internal_lock; - dict_t *dict; + dict_t *dict; - int optimistic_change_log; + int optimistic_change_log; - /* Is the current writev() going to perform a stable write? - i.e, is fd->flags or @flags writev param have O_SYNC or - O_DSYNC? - */ - gf_boolean_t stable_write; + /* Is the current writev() going to perform a stable write? + i.e, is fd->flags or @flags writev param have O_SYNC or + O_DSYNC? + */ + gf_boolean_t stable_write; - /* This write appended to the file. Nnot necessarily O_APPEND, - just means the offset of write was at the end of file. - */ - gf_boolean_t append_write; + /* This write appended to the file. Nnot necessarily O_APPEND, + just means the offset of write was at the end of file. + */ + gf_boolean_t append_write; - /* - This struct contains the arguments for the "continuation" - (scheme-like) of fops - */ + /* + This struct contains the arguments for the "continuation" + (scheme-like) of fops + */ + struct { struct { - struct { - gf_boolean_t needs_fresh_lookup; - uuid_t gfid_req; - } lookup; - - struct { - unsigned char buf_set; - struct statvfs buf; - } statfs; - - struct { - int32_t flags; - fd_t *fd; - } open; - - struct { - int32_t cmd; - struct gf_flock user_flock; - struct gf_flock ret_flock; - unsigned char *locked_nodes; - } lk; - - /* inode read */ - - struct { - int32_t mask; - int last_index; /* index of the child we tried previously */ - } access; - - struct { - int last_index; - } stat; - - struct { - int last_index; - } fstat; - - struct { - size_t size; - int last_index; - } readlink; - - struct { - char *name; - int last_index; - long xattr_len; - } getxattr; - - struct { - size_t size; - off_t offset; - int last_index; - uint32_t flags; - } readv; - - /* dir read */ - - struct { - int success_count; - int32_t op_ret; - int32_t op_errno; - - uint32_t *checksum; - } opendir; - - struct { - int32_t op_ret; - int32_t op_errno; - size_t size; - off_t offset; - dict_t *dict; - gf_boolean_t failed; - int last_index; - } readdir; - /* inode write */ - - struct { - struct iatt prebuf; - struct iatt postbuf; - } inode_wfop; //common structure for all inode-write-fops - - struct { - int32_t op_ret; - - struct iovec *vector; - struct iobref *iobref; - int32_t count; - off_t offset; - uint32_t flags; - } writev; - - struct { - off_t offset; - } truncate; - - struct { - off_t offset; - } ftruncate; - - struct { - struct iatt in_buf; - int32_t valid; - } setattr; - - struct { - struct iatt in_buf; - int32_t valid; - } fsetattr; - - struct { - dict_t *dict; - int32_t flags; - } setxattr; - - struct { - dict_t *dict; - int32_t flags; - } fsetxattr; - - struct { - char *name; - } removexattr; - - struct { - dict_t *xattr; - gf_xattrop_flags_t optype; - } xattrop; - - /* dir write */ - - struct { - inode_t *inode; - struct iatt buf; - struct iatt preparent; - struct iatt postparent; - struct iatt prenewparent; - struct iatt postnewparent; - } dir_fop; //common structure for all dir fops - - struct { - fd_t *fd; - dict_t *params; - int32_t flags; - mode_t mode; - } create; - - struct { - dev_t dev; - mode_t mode; - dict_t *params; - } mknod; - - struct { - int32_t mode; - dict_t *params; - } mkdir; - - struct { - int flags; - } rmdir; - - struct { - dict_t *params; - char *linkpath; - } symlink; - - struct { - int32_t mode; - off_t offset; - size_t len; - } fallocate; - - struct { - off_t offset; - size_t len; - } discard; - - struct { - off_t offset; - off_t len; - struct iatt prebuf; - struct iatt postbuf; - } zerofill; - - struct { - char *volume; - int32_t cmd; - int32_t in_cmd; - struct gf_flock in_flock; - struct gf_flock flock; - void *xdata; - } inodelk; - - struct { - char *volume; - char *basename; - entrylk_cmd in_cmd; - entrylk_cmd cmd; - entrylk_type type; - void *xdata; - } entrylk; - - struct { - off_t offset; - gf_seek_what_t what; - } seek; - - struct { - int32_t datasync; - } fsync; - - struct { - struct gf_lease user_lease; - struct gf_lease ret_lease; - unsigned char *locked_nodes; - } lease; - - - } cont; + gf_boolean_t needs_fresh_lookup; + uuid_t gfid_req; + } lookup; struct { - off_t start, len; + unsigned char buf_set; + struct statvfs buf; + } statfs; - gf_boolean_t eager_lock_on; - gf_boolean_t do_eager_unlock; + struct { + int32_t flags; + fd_t *fd; + } open; - char *basename; - char *new_basename; + struct { + int32_t cmd; + struct gf_flock user_flock; + struct gf_flock ret_flock; + unsigned char *locked_nodes; + } lk; - loc_t parent_loc; - loc_t new_parent_loc; + /* inode read */ - afr_transaction_type type; + struct { + int32_t mask; + int last_index; /* index of the child we tried previously */ + } access; - /* stub to resume on destruction - of the transaction frame */ - call_stub_t *resume_stub; + struct { + int last_index; + } stat; - struct list_head owner_list; - struct list_head wait_list; + struct { + int last_index; + } fstat; - unsigned char *pre_op; + struct { + size_t size; + int last_index; + } readlink; - /* Changelog xattr dict for [f]xattrop*/ - dict_t **changelog_xdata; - unsigned char *pre_op_sources; + struct { + char *name; + int last_index; + long xattr_len; + } getxattr; - /* @failed_subvols: subvolumes on which a pre-op or a - FOP failed. */ - unsigned char *failed_subvols; + struct { + size_t size; + off_t offset; + int last_index; + uint32_t flags; + } readv; - /* @dirtied: flag which indicates whether we set dirty flag - in the OP. Typically true when we are performing operation - on more than one subvol and optimistic changelog is disabled + /* dir read */ - A 'true' value set in @dirtied flag means an 'undirtying' - has to be done in POST-OP phase. - */ - gf_boolean_t dirtied; + struct { + int success_count; + int32_t op_ret; + int32_t op_errno; - /* @inherited: flag which indicates that the dirty flags - of the previous transaction were inherited - */ - gf_boolean_t inherited; + uint32_t *checksum; + } opendir; - /* - @no_uninherit: flag which indicates that a pre_op_uninherit() - must _not_ be attempted (and returned as failure) always. This - flag is set when a hard pre-op is performed, but not accounted - for it in fd_ctx->on_disk[]. Such transactions are "isolated" - from the pre-op piggybacking entirely and therefore uninherit - must not be attempted. - */ - gf_boolean_t no_uninherit; + struct { + int32_t op_ret; + int32_t op_errno; + size_t size; + off_t offset; + dict_t *dict; + gf_boolean_t failed; + int last_index; + } readdir; + /* inode write */ - /* @uninherit_done: - @uninherit_value: + struct { + struct iatt prebuf; + struct iatt postbuf; + } inode_wfop; // common structure for all inode-write-fops - The above pair variables make pre_op_uninherit() idempotent. - Both are FALSE initially. The first call to pre_op_uninherit - sets @uninherit_done to TRUE and the return value to - @uninherit_value. Further calls will check for @uninherit_done - to be TRUE and if so will simply return @uninherit_value. - */ - gf_boolean_t uninherit_done; - gf_boolean_t uninherit_value; + struct { + int32_t op_ret; - gf_boolean_t in_flight_sb; /* Indicator for occurrence of - split-brain while in the middle of - a txn. */ - int32_t in_flight_sb_errno; /* This is where the cause of the - failure on the last good copy of - the file is stored. - */ + struct iovec *vector; + struct iobref *iobref; + int32_t count; + off_t offset; + uint32_t flags; + } writev; - /* @changelog_resume: function to be called after changlogging - (either pre-op or post-op) is done - */ - afr_changelog_resume_t changelog_resume; + struct { + off_t offset; + } truncate; - call_frame_t *main_frame; /*Fop frame*/ - call_frame_t *frame; /*Transaction frame*/ + struct { + off_t offset; + } ftruncate; - int (*wind) (call_frame_t *frame, xlator_t *this, int subvol); + struct { + struct iatt in_buf; + int32_t valid; + } setattr; - int (*unwind) (call_frame_t *frame, xlator_t *this); + struct { + struct iatt in_buf; + int32_t valid; + } fsetattr; - /* post-op hook */ - } transaction; + struct { + dict_t *dict; + int32_t flags; + } setxattr; - syncbarrier_t barrier; + struct { + dict_t *dict; + int32_t flags; + } fsetxattr; - /* extra data for fops */ - dict_t *xdata_req; - dict_t *xdata_rsp; + struct { + char *name; + } removexattr; - dict_t *xattr_rsp; /*for [f]xattrop*/ + struct { + dict_t *xattr; + gf_xattrop_flags_t optype; + } xattrop; - mode_t umask; - int xflag; - gf_boolean_t do_discovery; - struct afr_reply *replies; + /* dir write */ - /* For client side background heals. */ - struct list_head healer; - call_frame_t *heal_frame; + struct { + inode_t *inode; + struct iatt buf; + struct iatt preparent; + struct iatt postparent; + struct iatt prenewparent; + struct iatt postnewparent; + } dir_fop; // common structure for all dir fops - gf_boolean_t need_full_crawl; - afr_fop_lock_state_t fop_lock_state; + struct { + fd_t *fd; + dict_t *params; + int32_t flags; + mode_t mode; + } create; - gf_boolean_t is_read_txn; - afr_inode_ctx_t *inode_ctx; -} afr_local_t; + struct { + dev_t dev; + mode_t mode; + dict_t *params; + } mknod; + + struct { + int32_t mode; + dict_t *params; + } mkdir; + + struct { + int flags; + } rmdir; + + struct { + dict_t *params; + char *linkpath; + } symlink; + + struct { + int32_t mode; + off_t offset; + size_t len; + } fallocate; + + struct { + off_t offset; + size_t len; + } discard; + struct { + off_t offset; + off_t len; + struct iatt prebuf; + struct iatt postbuf; + } zerofill; + + struct { + char *volume; + int32_t cmd; + int32_t in_cmd; + struct gf_flock in_flock; + struct gf_flock flock; + void *xdata; + } inodelk; + + struct { + char *volume; + char *basename; + entrylk_cmd in_cmd; + entrylk_cmd cmd; + entrylk_type type; + void *xdata; + } entrylk; + + struct { + off_t offset; + gf_seek_what_t what; + } seek; + + struct { + int32_t datasync; + } fsync; + + struct { + struct gf_lease user_lease; + struct gf_lease ret_lease; + unsigned char *locked_nodes; + } lease; + + } cont; + + struct { + off_t start, len; + + gf_boolean_t eager_lock_on; + gf_boolean_t do_eager_unlock; + + char *basename; + char *new_basename; + + loc_t parent_loc; + loc_t new_parent_loc; + + afr_transaction_type type; + + /* stub to resume on destruction + of the transaction frame */ + call_stub_t *resume_stub; + + struct list_head owner_list; + struct list_head wait_list; + + unsigned char *pre_op; + + /* Changelog xattr dict for [f]xattrop*/ + dict_t **changelog_xdata; + unsigned char *pre_op_sources; + + /* @failed_subvols: subvolumes on which a pre-op or a + FOP failed. */ + unsigned char *failed_subvols; + + /* @dirtied: flag which indicates whether we set dirty flag + in the OP. Typically true when we are performing operation + on more than one subvol and optimistic changelog is disabled + + A 'true' value set in @dirtied flag means an 'undirtying' + has to be done in POST-OP phase. + */ + gf_boolean_t dirtied; + + /* @inherited: flag which indicates that the dirty flags + of the previous transaction were inherited + */ + gf_boolean_t inherited; + + /* + @no_uninherit: flag which indicates that a pre_op_uninherit() + must _not_ be attempted (and returned as failure) always. This + flag is set when a hard pre-op is performed, but not accounted + for it in fd_ctx->on_disk[]. Such transactions are "isolated" + from the pre-op piggybacking entirely and therefore uninherit + must not be attempted. + */ + gf_boolean_t no_uninherit; + + /* @uninherit_done: + @uninherit_value: + + The above pair variables make pre_op_uninherit() idempotent. + Both are FALSE initially. The first call to pre_op_uninherit + sets @uninherit_done to TRUE and the return value to + @uninherit_value. Further calls will check for @uninherit_done + to be TRUE and if so will simply return @uninherit_value. + */ + gf_boolean_t uninherit_done; + gf_boolean_t uninherit_value; + + gf_boolean_t in_flight_sb; /* Indicator for occurrence of + split-brain while in the middle of + a txn. */ + int32_t in_flight_sb_errno; /* This is where the cause of the + failure on the last good copy of + the file is stored. + */ + + /* @changelog_resume: function to be called after changlogging + (either pre-op or post-op) is done + */ + afr_changelog_resume_t changelog_resume; + + call_frame_t *main_frame; /*Fop frame*/ + call_frame_t *frame; /*Transaction frame*/ + + int (*wind)(call_frame_t *frame, xlator_t *this, int subvol); + + int (*unwind)(call_frame_t *frame, xlator_t *this); + + /* post-op hook */ + } transaction; + + syncbarrier_t barrier; + + /* extra data for fops */ + dict_t *xdata_req; + dict_t *xdata_rsp; + + dict_t *xattr_rsp; /*for [f]xattrop*/ + + mode_t umask; + int xflag; + gf_boolean_t do_discovery; + struct afr_reply *replies; + + /* For client side background heals. */ + struct list_head healer; + call_frame_t *heal_frame; + + gf_boolean_t need_full_crawl; + afr_fop_lock_state_t fop_lock_state; + + gf_boolean_t is_read_txn; + afr_inode_ctx_t *inode_ctx; +} afr_local_t; typedef struct afr_spbc_timeout { - call_frame_t *frame; - gf_boolean_t d_spb; - gf_boolean_t m_spb; - loc_t *loc; - int spb_child_index; + call_frame_t *frame; + gf_boolean_t d_spb; + gf_boolean_t m_spb; + loc_t *loc; + int spb_child_index; } afr_spbc_timeout_t; typedef struct afr_spb_status { - call_frame_t *frame; - loc_t *loc; + call_frame_t *frame; + loc_t *loc; } afr_spb_status_t; typedef struct afr_empty_brick_args { - call_frame_t *frame; - loc_t loc; - int empty_index; - char *op_type; + call_frame_t *frame; + loc_t loc; + int empty_index; + char *op_type; } afr_empty_brick_args_t; typedef struct afr_read_subvol_args { - ia_type_t ia_type; - uuid_t gfid; + ia_type_t ia_type; + uuid_t gfid; } afr_read_subvol_args_t; typedef struct afr_granular_esh_args { - fd_t *heal_fd; - xlator_t *xl; - call_frame_t *frame; - gf_boolean_t mismatch; /* flag to represent occurrence of type/gfid - mismatch */ + fd_t *heal_fd; + xlator_t *xl; + call_frame_t *frame; + gf_boolean_t mismatch; /* flag to represent occurrence of type/gfid + mismatch */ } afr_granular_esh_args_t; int -afr_inode_get_readable (call_frame_t *frame, inode_t *inode, xlator_t *this, - unsigned char *readable, int *event_p, int type); +afr_inode_get_readable(call_frame_t *frame, inode_t *inode, xlator_t *this, + unsigned char *readable, int *event_p, int type); int -afr_inode_read_subvol_get (inode_t *inode, xlator_t *this, - unsigned char *data_subvols, - unsigned char *metadata_subvols, - int *event_generation); +afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, + unsigned char *data_subvols, + unsigned char *metadata_subvols, + int *event_generation); int -__afr_inode_read_subvol_get (inode_t *inode, xlator_t *this, - unsigned char *data_subvols, - unsigned char *metadata_subvols, - int *event_generation); +__afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, + unsigned char *data_subvols, + unsigned char *metadata_subvols, + int *event_generation); int -__afr_inode_read_subvol_set (inode_t *inode, xlator_t *this, - unsigned char *data_subvols, - unsigned char *metadata_subvol, - int event_generation); +__afr_inode_read_subvol_set(inode_t *inode, xlator_t *this, + unsigned char *data_subvols, + unsigned char *metadata_subvol, + int event_generation); int -afr_inode_read_subvol_set (inode_t *inode, xlator_t *this, - unsigned char *data_subvols, - unsigned char *metadata_subvols, - int event_generation); +afr_inode_read_subvol_set(inode_t *inode, xlator_t *this, + unsigned char *data_subvols, + unsigned char *metadata_subvols, + int event_generation); int -afr_inode_event_gen_reset (inode_t *inode, xlator_t *this); +afr_inode_event_gen_reset(inode_t *inode, xlator_t *this); int -afr_read_subvol_select_by_policy (inode_t *inode, xlator_t *this, - unsigned char *readable, - afr_read_subvol_args_t *args); +afr_read_subvol_select_by_policy(inode_t *inode, xlator_t *this, + unsigned char *readable, + afr_read_subvol_args_t *args); int -afr_inode_read_subvol_type_get (inode_t *inode, xlator_t *this, - unsigned char *readable, int *event_p, - int type); +afr_inode_read_subvol_type_get(inode_t *inode, xlator_t *this, + unsigned char *readable, int *event_p, int type); int -afr_read_subvol_get (inode_t *inode, xlator_t *this, int *subvol_p, - unsigned char *readables, - int *event_p, afr_transaction_type type, - afr_read_subvol_args_t *args); +afr_read_subvol_get(inode_t *inode, xlator_t *this, int *subvol_p, + unsigned char *readables, int *event_p, + afr_transaction_type type, afr_read_subvol_args_t *args); -#define afr_data_subvol_get(i, t, s, r, e, a) \ - afr_read_subvol_get(i, t, s, r, e, AFR_DATA_TRANSACTION, a) +#define afr_data_subvol_get(i, t, s, r, e, a) \ + afr_read_subvol_get(i, t, s, r, e, AFR_DATA_TRANSACTION, a) -#define afr_metadata_subvol_get(i, t, s, r, e, a) \ - afr_read_subvol_get(i, t, s, r, e, AFR_METADATA_TRANSACTION, a) +#define afr_metadata_subvol_get(i, t, s, r, e, a) \ + afr_read_subvol_get(i, t, s, r, e, AFR_METADATA_TRANSACTION, a) int -afr_inode_refresh (call_frame_t *frame, xlator_t *this, inode_t *inode, - uuid_t gfid, afr_inode_refresh_cbk_t cbk); +afr_inode_refresh(call_frame_t *frame, xlator_t *this, inode_t *inode, + uuid_t gfid, afr_inode_refresh_cbk_t cbk); int32_t -afr_notify (xlator_t *this, int32_t event, void *data, void *data2); +afr_notify(xlator_t *this, int32_t event, void *data, void *data2); int -xattr_is_equal (dict_t *this, char *key1, data_t *value1, void *data); +xattr_is_equal(dict_t *this, char *key1, data_t *value1, void *data); int -afr_init_entry_lockee (afr_entry_lockee_t *lockee, afr_local_t *local, - loc_t *loc, char *basename, int child_count); +afr_init_entry_lockee(afr_entry_lockee_t *lockee, afr_local_t *local, + loc_t *loc, char *basename, int child_count); void -afr_entry_lockee_cleanup (afr_internal_lock_t *int_lock); +afr_entry_lockee_cleanup(afr_internal_lock_t *int_lock); int -afr_attempt_lock_recovery (xlator_t *this, int32_t child_index); +afr_attempt_lock_recovery(xlator_t *this, int32_t child_index); int -afr_mark_locked_nodes (xlator_t *this, fd_t *fd, - unsigned char *locked_nodes); +afr_mark_locked_nodes(xlator_t *this, fd_t *fd, unsigned char *locked_nodes); void -afr_set_lk_owner (call_frame_t *frame, xlator_t *this, void *lk_owner); +afr_set_lk_owner(call_frame_t *frame, xlator_t *this, void *lk_owner); int -afr_set_lock_number (call_frame_t *frame, xlator_t *this); +afr_set_lock_number(call_frame_t *frame, xlator_t *this); int32_t -afr_unlock (call_frame_t *frame, xlator_t *this); +afr_unlock(call_frame_t *frame, xlator_t *this); int -afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this); +afr_nonblocking_entrylk(call_frame_t *frame, xlator_t *this); int -afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this); +afr_nonblocking_inodelk(call_frame_t *frame, xlator_t *this); int -afr_blocking_lock (call_frame_t *frame, xlator_t *this); +afr_blocking_lock(call_frame_t *frame, xlator_t *this); int -afr_internal_lock_finish (call_frame_t *frame, xlator_t *this); +afr_internal_lock_finish(call_frame_t *frame, xlator_t *this); int -__afr_fd_ctx_set (xlator_t *this, fd_t *fd); +__afr_fd_ctx_set(xlator_t *this, fd_t *fd); afr_fd_ctx_t * -afr_fd_ctx_get (fd_t *fd, xlator_t *this); +afr_fd_ctx_get(fd_t *fd, xlator_t *this); int -afr_build_parent_loc (loc_t *parent, loc_t *child, int32_t *op_errno); +afr_build_parent_loc(loc_t *parent, loc_t *child, int32_t *op_errno); int -afr_locked_nodes_count (unsigned char *locked_nodes, int child_count); +afr_locked_nodes_count(unsigned char *locked_nodes, int child_count); int -afr_replies_interpret (call_frame_t *frame, xlator_t *this, inode_t *inode, - gf_boolean_t *start_heal); +afr_replies_interpret(call_frame_t *frame, xlator_t *this, inode_t *inode, + gf_boolean_t *start_heal); void -afr_local_replies_wipe (afr_local_t *local, afr_private_t *priv); +afr_local_replies_wipe(afr_local_t *local, afr_private_t *priv); void -afr_local_cleanup (afr_local_t *local, xlator_t *this); +afr_local_cleanup(afr_local_t *local, xlator_t *this); int -afr_frame_return (call_frame_t *frame); +afr_frame_return(call_frame_t *frame); int -afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd, dict_t *xdata); +afr_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, dict_t *xdata); void -afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this); +afr_local_transaction_cleanup(afr_local_t *local, xlator_t *this); int -afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd); - -#define AFR_STACK_UNWIND(fop, frame, op_ret, op_errno, params ...)\ - do { \ - afr_local_t *__local = NULL; \ - xlator_t *__this = NULL; \ - int32_t __op_ret = 0; \ - int32_t __op_errno = 0; \ - \ - __op_ret = op_ret; \ - __op_errno = op_errno; \ - if (frame) { \ - __local = frame->local; \ - __this = frame->this; \ - afr_handle_inconsistent_fop (frame, &__op_ret,\ - &__op_errno);\ - if (__local && __local->is_read_txn) \ - afr_pending_read_decrement (__this->private, __local->read_subvol); \ - frame->local = NULL; \ - } \ - \ - STACK_UNWIND_STRICT (fop, frame, __op_ret, \ - __op_errno, params); \ - if (__local) { \ - afr_local_cleanup (__local, __this); \ - mem_put (__local); \ - } \ - } while (0) - -#define AFR_STACK_DESTROY(frame) \ - do { \ - afr_local_t *__local = NULL; \ - xlator_t *__this = NULL; \ - __local = frame->local; \ - __this = frame->this; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - if (__local) { \ - afr_local_cleanup (__local, __this); \ - mem_put (__local); \ - } \ - } while (0); - -#define AFR_FRAME_INIT(frame, op_errno) \ - ({frame->local = mem_get0 (THIS->local_pool); \ - if (afr_local_init (frame->local, THIS->private, &op_errno)) { \ - afr_local_cleanup (frame->local, THIS); \ - mem_put (frame->local); \ - frame->local = NULL; }; \ - frame->local; }) - -#define AFR_STACK_RESET(frame) \ - do { \ - afr_local_t *__local = NULL; \ - xlator_t *__this = NULL; \ - __local = frame->local; \ - __this = frame->this; \ - frame->local = NULL; \ - int __opr; \ - STACK_RESET (frame->root); \ - if (__local) { \ - afr_local_cleanup (__local, __this); \ - mem_put (__local); \ - } \ - AFR_FRAME_INIT (frame, __opr); \ - } while (0) +afr_cleanup_fd_ctx(xlator_t *this, fd_t *fd); + +#define AFR_STACK_UNWIND(fop, frame, op_ret, op_errno, params...) \ + do { \ + afr_local_t *__local = NULL; \ + xlator_t *__this = NULL; \ + int32_t __op_ret = 0; \ + int32_t __op_errno = 0; \ + \ + __op_ret = op_ret; \ + __op_errno = op_errno; \ + if (frame) { \ + __local = frame->local; \ + __this = frame->this; \ + afr_handle_inconsistent_fop(frame, &__op_ret, &__op_errno); \ + if (__local && __local->is_read_txn) \ + afr_pending_read_decrement(__this->private, \ + __local->read_subvol); \ + frame->local = NULL; \ + } \ + \ + STACK_UNWIND_STRICT(fop, frame, __op_ret, __op_errno, params); \ + if (__local) { \ + afr_local_cleanup(__local, __this); \ + mem_put(__local); \ + } \ + } while (0) + +#define AFR_STACK_DESTROY(frame) \ + do { \ + afr_local_t *__local = NULL; \ + xlator_t *__this = NULL; \ + __local = frame->local; \ + __this = frame->this; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + if (__local) { \ + afr_local_cleanup(__local, __this); \ + mem_put(__local); \ + } \ + } while (0); + +#define AFR_FRAME_INIT(frame, op_errno) \ + ({ \ + frame->local = mem_get0(THIS->local_pool); \ + if (afr_local_init(frame->local, THIS->private, &op_errno)) { \ + afr_local_cleanup(frame->local, THIS); \ + mem_put(frame->local); \ + frame->local = NULL; \ + }; \ + frame->local; \ + }) + +#define AFR_STACK_RESET(frame) \ + do { \ + afr_local_t *__local = NULL; \ + xlator_t *__this = NULL; \ + __local = frame->local; \ + __this = frame->this; \ + frame->local = NULL; \ + int __opr; \ + STACK_RESET(frame->root); \ + if (__local) { \ + afr_local_cleanup(__local, __this); \ + mem_put(__local); \ + } \ + AFR_FRAME_INIT(frame, __opr); \ + } while (0) /* allocate and return a string that is the basename of argument */ static inline char * -AFR_BASENAME (const char *str) +AFR_BASENAME(const char *str) { - char *__tmp_str = NULL; - char *__basename_str = NULL; - __tmp_str = gf_strdup (str); - __basename_str = gf_strdup (basename (__tmp_str)); - GF_FREE (__tmp_str); - return __basename_str; + char *__tmp_str = NULL; + char *__basename_str = NULL; + __tmp_str = gf_strdup(str); + __basename_str = gf_strdup(basename(__tmp_str)); + GF_FREE(__tmp_str); + return __basename_str; } call_frame_t * -afr_copy_frame (call_frame_t *base); +afr_copy_frame(call_frame_t *base); int -afr_transaction_local_init (afr_local_t *local, xlator_t *this); +afr_transaction_local_init(afr_local_t *local, xlator_t *this); int32_t -afr_marker_getxattr (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *name,afr_local_t *local, afr_private_t *priv ); +afr_marker_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, afr_local_t *local, afr_private_t *priv); int -afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno); +afr_local_init(afr_local_t *local, afr_private_t *priv, int32_t *op_errno); int -afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count); +afr_internal_lock_init(afr_internal_lock_t *lk, size_t child_count); int -afr_higher_errno (int32_t old_errno, int32_t new_errno); +afr_higher_errno(int32_t old_errno, int32_t new_errno); int -afr_final_errno (afr_local_t *local, afr_private_t *priv); +afr_final_errno(afr_local_t *local, afr_private_t *priv); int -afr_xattr_req_prepare (xlator_t *this, dict_t *xattr_req); +afr_xattr_req_prepare(xlator_t *this, dict_t *xattr_req); void -afr_fix_open (fd_t *fd, xlator_t *this); +afr_fix_open(fd_t *fd, xlator_t *this); afr_fd_ctx_t * -afr_fd_ctx_get (fd_t *fd, xlator_t *this); +afr_fd_ctx_get(fd_t *fd, xlator_t *this); void -afr_set_low_priority (call_frame_t *frame); +afr_set_low_priority(call_frame_t *frame); int -afr_child_fd_ctx_set (xlator_t *this, fd_t *fd, int32_t child, - int flags); +afr_child_fd_ctx_set(xlator_t *this, fd_t *fd, int32_t child, int flags); void -afr_matrix_cleanup (int32_t **pending, unsigned int m); +afr_matrix_cleanup(int32_t **pending, unsigned int m); -int32_t** -afr_matrix_create (unsigned int m, unsigned int n); +int32_t ** +afr_matrix_create(unsigned int m, unsigned int n); -int** -afr_mark_pending_changelog (afr_private_t *priv, unsigned char *pending, - dict_t *xattr, ia_type_t iat); +int ** +afr_mark_pending_changelog(afr_private_t *priv, unsigned char *pending, + dict_t *xattr, ia_type_t iat); void -afr_filter_xattrs (dict_t *xattr); +afr_filter_xattrs(dict_t *xattr); /* * Special value indicating we should use the "auto" quorum method instead of @@ -1120,139 +1139,139 @@ afr_filter_xattrs (dict_t *xattr); #define AFR_QUORUM_AUTO INT_MAX int -afr_fd_report_unstable_write (xlator_t *this, afr_local_t *local); +afr_fd_report_unstable_write(xlator_t *this, afr_local_t *local); gf_boolean_t -afr_fd_has_witnessed_unstable_write (xlator_t *this, inode_t *inode); +afr_fd_has_witnessed_unstable_write(xlator_t *this, inode_t *inode); void -afr_reply_wipe (struct afr_reply *reply); +afr_reply_wipe(struct afr_reply *reply); void -afr_replies_wipe (struct afr_reply *replies, int count); +afr_replies_wipe(struct afr_reply *replies, int count); gf_boolean_t -afr_xattrs_are_equal (dict_t *dict1, dict_t *dict2); +afr_xattrs_are_equal(dict_t *dict1, dict_t *dict2); gf_boolean_t -afr_is_xattr_ignorable (char *key); +afr_is_xattr_ignorable(char *key); int -afr_get_heal_info (call_frame_t *frame, xlator_t *this, loc_t *loc); +afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc); int afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc); int -afr_get_split_brain_status (void *opaque); +afr_get_split_brain_status(void *opaque); int -afr_get_split_brain_status_cbk (int ret, call_frame_t *frame, void *opaque); +afr_get_split_brain_status_cbk(int ret, call_frame_t *frame, void *opaque); int -afr_inode_split_brain_choice_set (inode_t *inode, xlator_t *this, - int spb_choice); +afr_inode_split_brain_choice_set(inode_t *inode, xlator_t *this, + int spb_choice); int -afr_inode_split_brain_choice_get (inode_t *inode, xlator_t *this, - int *spb_choice); +afr_inode_split_brain_choice_get(inode_t *inode, xlator_t *this, + int *spb_choice); int -afr_get_child_index_from_name (xlator_t *this, char *name); +afr_get_child_index_from_name(xlator_t *this, char *name); int -afr_is_split_brain (call_frame_t *frame, xlator_t *this, inode_t *inode, - uuid_t gfid, gf_boolean_t *d_spb, gf_boolean_t *m_spb); +afr_is_split_brain(call_frame_t *frame, xlator_t *this, inode_t *inode, + uuid_t gfid, gf_boolean_t *d_spb, gf_boolean_t *m_spb); int -afr_spb_choice_timeout_cancel (xlator_t *this, inode_t *inode); +afr_spb_choice_timeout_cancel(xlator_t *this, inode_t *inode); int -afr_set_split_brain_choice (int ret, call_frame_t *frame, void *opaque); +afr_set_split_brain_choice(int ret, call_frame_t *frame, void *opaque); gf_boolean_t -afr_get_need_heal (xlator_t *this); +afr_get_need_heal(xlator_t *this); void -afr_set_need_heal (xlator_t *this, afr_local_t *local); +afr_set_need_heal(xlator_t *this, afr_local_t *local); int -afr_selfheal_data_open (xlator_t *this, inode_t *inode, fd_t **fd); +afr_selfheal_data_open(xlator_t *this, inode_t *inode, fd_t **fd); int -afr_get_msg_id (char *op_type); +afr_get_msg_id(char *op_type); int -afr_set_in_flight_sb_status (xlator_t *this, call_frame_t *frame, - inode_t *inode); +afr_set_in_flight_sb_status(xlator_t *this, call_frame_t *frame, + inode_t *inode); int32_t -afr_quorum_errno (afr_private_t *priv); +afr_quorum_errno(afr_private_t *priv); gf_boolean_t -afr_is_consistent_io_possible (afr_local_t *local, afr_private_t *priv, - int32_t *op_errno); +afr_is_consistent_io_possible(afr_local_t *local, afr_private_t *priv, + int32_t *op_errno); void -afr_handle_inconsistent_fop (call_frame_t *frame, int32_t *op_ret, - int32_t *op_errno); +afr_handle_inconsistent_fop(call_frame_t *frame, int32_t *op_ret, + int32_t *op_errno); void -afr_inode_write_fill (call_frame_t *frame, xlator_t *this, int child_index, +afr_inode_write_fill(call_frame_t *frame, xlator_t *this, int child_index, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata); void -afr_process_post_writev (call_frame_t *frame, xlator_t *this); +afr_process_post_writev(call_frame_t *frame, xlator_t *this); void -afr_writev_unwind (call_frame_t *frame, xlator_t *this); +afr_writev_unwind(call_frame_t *frame, xlator_t *this); void -afr_writev_copy_outvars (call_frame_t *src_frame, call_frame_t *dst_frame); +afr_writev_copy_outvars(call_frame_t *src_frame, call_frame_t *dst_frame); void -afr_update_uninodelk (afr_local_t *local, afr_internal_lock_t *int_lock, - int32_t child_index); +afr_update_uninodelk(afr_local_t *local, afr_internal_lock_t *int_lock, + int32_t child_index); int afr_is_inodelk_transaction(afr_transaction_type type); afr_fd_ctx_t * -__afr_fd_ctx_get (fd_t *fd, xlator_t *this); +__afr_fd_ctx_get(fd_t *fd, xlator_t *this); gf_boolean_t -afr_is_inode_refresh_reqd (inode_t *inode, xlator_t *this, - int event_gen1, int event_gen2); +afr_is_inode_refresh_reqd(inode_t *inode, xlator_t *this, int event_gen1, + int event_gen2); int -afr_serialize_xattrs_with_delimiter (call_frame_t *frame, xlator_t *this, - char *buf, const char *default_str, - int32_t *serz_len, char delimiter); +afr_serialize_xattrs_with_delimiter(call_frame_t *frame, xlator_t *this, + char *buf, const char *default_str, + int32_t *serz_len, char delimiter); gf_boolean_t -afr_is_symmetric_error (call_frame_t *frame, xlator_t *this); +afr_is_symmetric_error(call_frame_t *frame, xlator_t *this); int -__afr_inode_ctx_get (xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx); +__afr_inode_ctx_get(xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx); uint64_t -afr_write_subvol_get (call_frame_t *frame, xlator_t *this); +afr_write_subvol_get(call_frame_t *frame, xlator_t *this); int -afr_write_subvol_set (call_frame_t *frame, xlator_t *this); +afr_write_subvol_set(call_frame_t *frame, xlator_t *this); int -afr_write_subvol_reset (call_frame_t *frame, xlator_t *this); +afr_write_subvol_reset(call_frame_t *frame, xlator_t *this); int -afr_set_inode_local (xlator_t *this, afr_local_t *local, inode_t *inode); +afr_set_inode_local(xlator_t *this, afr_local_t *local, inode_t *inode); int -afr_fill_ta_loc (xlator_t *this, loc_t *loc); +afr_fill_ta_loc(xlator_t *this, loc_t *loc); int -afr_ta_post_op_lock (xlator_t *this, loc_t *loc); +afr_ta_post_op_lock(xlator_t *this, loc_t *loc); int -afr_ta_post_op_unlock (xlator_t *this, loc_t *loc); +afr_ta_post_op_unlock(xlator_t *this, loc_t *loc); gf_boolean_t -afr_is_pending_set (xlator_t *this, dict_t *xdata, int type); +afr_is_pending_set(xlator_t *this, dict_t *xdata, int type); -call_frame_t* -afr_ta_frame_create (xlator_t *this); +call_frame_t * +afr_ta_frame_create(xlator_t *this); #endif /* __AFR_H__ */ diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 86b3eb3cbd2..bd30fd84b88 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -25,141 +25,136 @@ #ifndef _DHT_H #define _DHT_H -#define GF_XATTR_FIX_LAYOUT_KEY "distribute.fix.layout" -#define GF_XATTR_TIER_LAYOUT_FIXED_KEY "trusted.tier.fix.layout.complete" -#define GF_XATTR_FILE_MIGRATE_KEY "trusted.distribute.migrate-data" -#define DHT_MDS_STR "mds" -#define GF_DHT_LOOKUP_UNHASHED_OFF 0 -#define GF_DHT_LOOKUP_UNHASHED_ON 1 -#define GF_DHT_LOOKUP_UNHASHED_AUTO 2 -#define DHT_PATHINFO_HEADER "DISTRIBUTE:" -#define DHT_FILE_MIGRATE_DOMAIN "dht.file.migrate" +#define GF_XATTR_FIX_LAYOUT_KEY "distribute.fix.layout" +#define GF_XATTR_TIER_LAYOUT_FIXED_KEY "trusted.tier.fix.layout.complete" +#define GF_XATTR_FILE_MIGRATE_KEY "trusted.distribute.migrate-data" +#define DHT_MDS_STR "mds" +#define GF_DHT_LOOKUP_UNHASHED_OFF 0 +#define GF_DHT_LOOKUP_UNHASHED_ON 1 +#define GF_DHT_LOOKUP_UNHASHED_AUTO 2 +#define DHT_PATHINFO_HEADER "DISTRIBUTE:" +#define DHT_FILE_MIGRATE_DOMAIN "dht.file.migrate" /* Layout synchronization */ -#define DHT_LAYOUT_HEAL_DOMAIN "dht.layout.heal" +#define DHT_LAYOUT_HEAL_DOMAIN "dht.layout.heal" /* Namespace synchronization */ -#define DHT_ENTRY_SYNC_DOMAIN "dht.entry.sync" -#define TIERING_MIGRATION_KEY "tiering.migration" -#define DHT_LAYOUT_HASH_INVALID 1 -#define MAX_REBAL_THREADS sysconf(_SC_NPROCESSORS_ONLN) - -#define DHT_DIR_STAT_BLOCKS 8 -#define DHT_DIR_STAT_SIZE 4096 +#define DHT_ENTRY_SYNC_DOMAIN "dht.entry.sync" +#define TIERING_MIGRATION_KEY "tiering.migration" +#define DHT_LAYOUT_HASH_INVALID 1 +#define MAX_REBAL_THREADS sysconf(_SC_NPROCESSORS_ONLN) +#define DHT_DIR_STAT_BLOCKS 8 +#define DHT_DIR_STAT_SIZE 4096 /* Virtual xattrs for debugging */ -#define DHT_DBG_HASHED_SUBVOL_PATTERN "dht.file.hashed-subvol.*" -#define DHT_DBG_HASHED_SUBVOL_KEY "dht.file.hashed-subvol." - +#define DHT_DBG_HASHED_SUBVOL_PATTERN "dht.file.hashed-subvol.*" +#define DHT_DBG_HASHED_SUBVOL_KEY "dht.file.hashed-subvol." /* Array to hold custom xattr keys -*/ + */ extern char *xattrs_to_heal[]; /* Rebalance nodeuuid flags */ -#define REBAL_NODEUUID_MINE 0x01 +#define REBAL_NODEUUID_MINE 0x01 +typedef int (*dht_selfheal_dir_cbk_t)(call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, dict_t *xdata); +typedef int (*dht_defrag_cbk_fn_t)(xlator_t *this, xlator_t *dst_node, + call_frame_t *frame, int ret); -typedef int (*dht_selfheal_dir_cbk_t) (call_frame_t *frame, void *cookie, - xlator_t *this, - int32_t op_ret, int32_t op_errno, - dict_t *xdata); -typedef int (*dht_defrag_cbk_fn_t) (xlator_t *this, xlator_t *dst_node, - call_frame_t *frame, int ret); - -typedef int (*dht_refresh_layout_unlock) (call_frame_t *frame, xlator_t *this, +typedef int (*dht_refresh_layout_unlock)(call_frame_t *frame, xlator_t *this, int op_ret, int invoke_cbk); -typedef int (*dht_refresh_layout_done_handle) (call_frame_t *frame); +typedef int (*dht_refresh_layout_done_handle)(call_frame_t *frame); struct dht_layout { - int spread_cnt; /* layout spread count per directory, - is controlled by 'setxattr()' with - special key */ - int cnt; - int preset; - /* - * The last *configuration* state for which this directory was known - * to be in balance. The corresponding vol_commit_hash changes - * whenever bricks are added or removed. This value changes when a - * (full) rebalance is complete. If they match, it's safe to assume - * that every file is where it should be and there's no need to do - * lookups for files elsewhere. If they don't, then we have to do a - * global lookup to be sure. - */ - uint32_t commit_hash; - /* - * The *runtime* state of the volume, changes when connections to - * bricks are made or lost. - */ - int gen; - int type; - gf_atomic_t ref; /* use with dht_conf_t->layout_lock */ - uint32_t search_unhashed; - struct { - int err; /* 0 = normal - -1 = dir exists and no xattr - >0 = dir lookup failed with errno - */ - uint32_t start; - uint32_t stop; - uint32_t commit_hash; - xlator_t *xlator; - } list[]; + int spread_cnt; /* layout spread count per directory, + is controlled by 'setxattr()' with + special key */ + int cnt; + int preset; + /* + * The last *configuration* state for which this directory was known + * to be in balance. The corresponding vol_commit_hash changes + * whenever bricks are added or removed. This value changes when a + * (full) rebalance is complete. If they match, it's safe to assume + * that every file is where it should be and there's no need to do + * lookups for files elsewhere. If they don't, then we have to do a + * global lookup to be sure. + */ + uint32_t commit_hash; + /* + * The *runtime* state of the volume, changes when connections to + * bricks are made or lost. + */ + int gen; + int type; + gf_atomic_t ref; /* use with dht_conf_t->layout_lock */ + uint32_t search_unhashed; + struct { + int err; /* 0 = normal + -1 = dir exists and no xattr + >0 = dir lookup failed with errno + */ + uint32_t start; + uint32_t stop; + uint32_t commit_hash; + xlator_t *xlator; + } list[]; }; -typedef struct dht_layout dht_layout_t; +typedef struct dht_layout dht_layout_t; struct dht_stat_time { - uint32_t atime; - uint32_t atime_nsec; - uint32_t ctime; - uint32_t ctime_nsec; - uint32_t mtime; - uint32_t mtime_nsec; + uint32_t atime; + uint32_t atime_nsec; + uint32_t ctime; + uint32_t ctime_nsec; + uint32_t mtime; + uint32_t mtime_nsec; }; typedef struct dht_stat_time dht_stat_time_t; struct dht_inode_ctx { - dht_layout_t *layout; - dht_stat_time_t time; - xlator_t *lock_subvol; - xlator_t *mds_subvol; /* This is only used for directories */ + dht_layout_t *layout; + dht_stat_time_t time; + xlator_t *lock_subvol; + xlator_t *mds_subvol; /* This is only used for directories */ }; typedef struct dht_inode_ctx dht_inode_ctx_t; - typedef enum { - DHT_HASH_TYPE_DM, - DHT_HASH_TYPE_DM_USER, + DHT_HASH_TYPE_DM, + DHT_HASH_TYPE_DM_USER, } dht_hashfn_type_t; typedef enum { - DHT_INODELK, - DHT_ENTRYLK, + DHT_INODELK, + DHT_ENTRYLK, } dht_lock_type_t; /* rebalance related */ struct dht_rebalance_ { - xlator_t *from_subvol; - xlator_t *target_node; - off_t offset; - size_t size; - int32_t flags; - int count; - struct iobref *iobref; - struct iovec *vector; - struct iatt stbuf; - struct iatt prebuf; - struct iatt postbuf; - dht_defrag_cbk_fn_t target_op_fn; - dict_t *xdata; - dict_t *xattr; - dict_t *dict; - int32_t set; - struct gf_flock flock; - int lock_cmd; + xlator_t *from_subvol; + xlator_t *target_node; + off_t offset; + size_t size; + int32_t flags; + int count; + struct iobref *iobref; + struct iovec *vector; + struct iatt stbuf; + struct iatt prebuf; + struct iatt postbuf; + dht_defrag_cbk_fn_t target_op_fn; + dict_t *xdata; + dict_t *xattr; + dict_t *dict; + int32_t set; + struct gf_flock flock; + int lock_cmd; }; /** @@ -167,63 +162,62 @@ struct dht_rebalance_ { * events **/ typedef enum { - qdstatfs_action_OFF = 0, - qdstatfs_action_REPLACE, - qdstatfs_action_NEGLECT, - qdstatfs_action_COMPARE, + qdstatfs_action_OFF = 0, + qdstatfs_action_REPLACE, + qdstatfs_action_NEGLECT, + qdstatfs_action_COMPARE, } qdstatfs_action_t; typedef enum { - REACTION_INVALID, - FAIL_ON_ANY_ERROR, - IGNORE_ENOENT_ESTALE, - IGNORE_ENOENT_ESTALE_EIO, + REACTION_INVALID, + FAIL_ON_ANY_ERROR, + IGNORE_ENOENT_ESTALE, + IGNORE_ENOENT_ESTALE_EIO, } dht_reaction_type_t; struct dht_skip_linkto_unlink { - - gf_boolean_t handle_valid_link; - int opend_fd_count; - xlator_t *hash_links_to; - uuid_t cached_gfid; - uuid_t hashed_gfid; + gf_boolean_t handle_valid_link; + int opend_fd_count; + xlator_t *hash_links_to; + uuid_t cached_gfid; + uuid_t hashed_gfid; }; typedef struct { - xlator_t *xl; - loc_t loc; /* contains/points to inode to lock on. */ - short type; /* read/write lock. */ - char *domain; /* Only locks within a single domain - * contend with each other - */ - char *basename; /* Required for entrylk */ - gf_lkowner_t lk_owner; - gf_boolean_t locked; - dht_reaction_type_t do_on_failure; + xlator_t *xl; + loc_t loc; /* contains/points to inode to lock on. */ + short type; /* read/write lock. */ + char *domain; /* Only locks within a single domain + * contend with each other + */ + char *basename; /* Required for entrylk */ + gf_lkowner_t lk_owner; + gf_boolean_t locked; + dht_reaction_type_t do_on_failure; } dht_lock_t; /* The lock structure represents inodelk. */ typedef struct { - fop_inodelk_cbk_t inodelk_cbk; - dht_lock_t **locks; - int lk_count; - dht_reaction_type_t reaction; - - /* whether locking failed on _any_ of the "locks" above */ - int op_ret; - int op_errno; + fop_inodelk_cbk_t inodelk_cbk; + dht_lock_t **locks; + int lk_count; + dht_reaction_type_t reaction; + + /* whether locking failed on _any_ of the "locks" above */ + int op_ret; + int op_errno; } dht_ilock_wrap_t; /* The lock structure represents entrylk. */ typedef struct { - fop_entrylk_cbk_t entrylk_cbk; - dht_lock_t **locks; - int lk_count; - dht_reaction_type_t reaction; - - /* whether locking failed on _any_ of the "locks" above */ - int op_ret; - int op_errno; + fop_entrylk_cbk_t entrylk_cbk; + dht_lock_t **locks; + int lk_count; + dht_reaction_type_t reaction; + + /* whether locking failed on _any_ of the "locks" above */ + int op_ret; + int op_errno; } dht_elock_wrap_t; /* The first member of dht_dir_transaction_t should be of type dht_ilock_wrap_t. @@ -232,1263 +226,1280 @@ typedef struct { * lock[0].ns.parent_layout (like in dht_local_wipe). */ typedef union { - union { - dht_ilock_wrap_t my_layout; - dht_ilock_wrap_t parent_layout; - } layout; - struct dht_namespace { - dht_ilock_wrap_t parent_layout; - dht_elock_wrap_t directory_ns; - fop_entrylk_cbk_t ns_cbk; - } ns; + union { + dht_ilock_wrap_t my_layout; + dht_ilock_wrap_t parent_layout; + } layout; + struct dht_namespace { + dht_ilock_wrap_t parent_layout; + dht_elock_wrap_t directory_ns; + fop_entrylk_cbk_t ns_cbk; + } ns; } dht_dir_transaction_t; -typedef -int (*dht_selfheal_layout_t)(call_frame_t *frame, loc_t *loc, - dht_layout_t *layout); +typedef int (*dht_selfheal_layout_t)(call_frame_t *frame, loc_t *loc, + dht_layout_t *layout); -typedef -gf_boolean_t (*dht_need_heal_t)(call_frame_t *frame, dht_layout_t **inmem, - dht_layout_t **ondisk); +typedef gf_boolean_t (*dht_need_heal_t)(call_frame_t *frame, + dht_layout_t **inmem, + dht_layout_t **ondisk); typedef struct { - uint64_t blocks_used; - uint64_t pblocks_used; - uint64_t files_used; - uint64_t pfiles_used; - uint64_t unhashed_blocks_used; - uint64_t unhashed_pblocks_used; - uint64_t unhashed_files_used; - uint64_t unhashed_pfiles_used; - uint64_t unhashed_fsid; - uint64_t hashed_fsid; + uint64_t blocks_used; + uint64_t pblocks_used; + uint64_t files_used; + uint64_t pfiles_used; + uint64_t unhashed_blocks_used; + uint64_t unhashed_pblocks_used; + uint64_t unhashed_files_used; + uint64_t unhashed_pfiles_used; + uint64_t unhashed_fsid; + uint64_t hashed_fsid; } tier_statvfs_t; struct dht_local { - int call_cnt; - loc_t loc; - loc_t loc2; - int op_ret; - int op_errno; - int layout_mismatch; - /* Use stbuf as the postbuf, when we require both - * pre and post attrs */ - struct iatt stbuf; - struct iatt mds_stbuf; - struct iatt prebuf; - struct iatt preoldparent; - struct iatt postoldparent; - struct iatt preparent; - struct iatt postparent; - struct statvfs statvfs; - tier_statvfs_t tier_statvfs; - fd_t *fd; - inode_t *inode; - dict_t *params; - dict_t *xattr; - dict_t *mds_xattr; - dict_t *xdata; /* dict used to save xdata response by xattr fop */ - dict_t *xattr_req; - dht_layout_t *layout; - size_t size; - ino_t ia_ino; - xlator_t *src_hashed, *src_cached; - xlator_t *dst_hashed, *dst_cached; - xlator_t *cached_subvol; - xlator_t *hashed_subvol; - xlator_t *mds_subvol; /* This is use for dir only */ - char need_selfheal; - char need_xattr_heal; - char need_attrheal; - int file_count; - int dir_count; - call_frame_t *main_frame; - int fop_succeeded; - struct { - fop_mknod_cbk_t linkfile_cbk; - struct iatt stbuf; - loc_t loc; - inode_t *inode; - dict_t *xattr; - xlator_t *srcvol; - } linkfile; - struct { - uint32_t hole_cnt; - uint32_t overlaps_cnt; - uint32_t down; - uint32_t misc; - uint32_t missing_cnt; - dht_selfheal_dir_cbk_t dir_cbk; - dht_selfheal_layout_t healer; - dht_need_heal_t should_heal; - gf_boolean_t force_mkdir; - dht_layout_t *layout, *refreshed_layout; - } selfheal; - - dht_refresh_layout_unlock refresh_layout_unlock; - dht_refresh_layout_done_handle refresh_layout_done; - - uint32_t uid; - uint32_t gid; - - /* needed by nufa */ - int32_t flags; - mode_t mode; - dev_t rdev; - mode_t umask; - - /* need for file-info */ - char *xattr_val; - char *key; - - /* which xattr request? */ - char xsel[256]; - int32_t alloc_len; - - /* gfid related */ - uuid_t gfid; - - /* flag used to make sure we need to return estale in - {lookup,revalidate}_cbk */ - char return_estale; - char need_lookup_everywhere; - - glusterfs_fop_t fop; - - gf_boolean_t linked; - xlator_t *link_subvol; - - struct dht_rebalance_ rebalance; - xlator_t *first_up_subvol; - - gf_boolean_t quota_deem_statfs; - - gf_boolean_t added_link; - gf_boolean_t is_linkfile; - - struct dht_skip_linkto_unlink skip_unlink; - - dht_dir_transaction_t lock[2], *current; - - /* inodelks during filerename for backward compatibility */ - dht_lock_t **rename_inodelk_backward_compatible; - int rename_inodelk_bc_count; - - short lock_type; - - call_stub_t *stub; - int32_t parent_disk_layout[4]; - - /* rename rollback */ - int *ret_cache ; - - /* fd open check */ - gf_boolean_t fd_checked; - /* This is use only for directory operation */ - int32_t valid; - gf_boolean_t heal_layout; - int32_t mds_heal_fresh_lookup; - loc_t loc2_copy; - gf_boolean_t locked; - gf_boolean_t dont_create_linkto; + int call_cnt; + loc_t loc; + loc_t loc2; + int op_ret; + int op_errno; + int layout_mismatch; + /* Use stbuf as the postbuf, when we require both + * pre and post attrs */ + struct iatt stbuf; + struct iatt mds_stbuf; + struct iatt prebuf; + struct iatt preoldparent; + struct iatt postoldparent; + struct iatt preparent; + struct iatt postparent; + struct statvfs statvfs; + tier_statvfs_t tier_statvfs; + fd_t *fd; + inode_t *inode; + dict_t *params; + dict_t *xattr; + dict_t *mds_xattr; + dict_t *xdata; /* dict used to save xdata response by xattr fop */ + dict_t *xattr_req; + dht_layout_t *layout; + size_t size; + ino_t ia_ino; + xlator_t *src_hashed, *src_cached; + xlator_t *dst_hashed, *dst_cached; + xlator_t *cached_subvol; + xlator_t *hashed_subvol; + xlator_t *mds_subvol; /* This is use for dir only */ + char need_selfheal; + char need_xattr_heal; + char need_attrheal; + int file_count; + int dir_count; + call_frame_t *main_frame; + int fop_succeeded; + struct { + fop_mknod_cbk_t linkfile_cbk; + struct iatt stbuf; + loc_t loc; + inode_t *inode; + dict_t *xattr; + xlator_t *srcvol; + } linkfile; + struct { + uint32_t hole_cnt; + uint32_t overlaps_cnt; + uint32_t down; + uint32_t misc; + uint32_t missing_cnt; + dht_selfheal_dir_cbk_t dir_cbk; + dht_selfheal_layout_t healer; + dht_need_heal_t should_heal; + gf_boolean_t force_mkdir; + dht_layout_t *layout, *refreshed_layout; + } selfheal; + + dht_refresh_layout_unlock refresh_layout_unlock; + dht_refresh_layout_done_handle refresh_layout_done; + + uint32_t uid; + uint32_t gid; + + /* needed by nufa */ + int32_t flags; + mode_t mode; + dev_t rdev; + mode_t umask; + + /* need for file-info */ + char *xattr_val; + char *key; + + /* which xattr request? */ + char xsel[256]; + int32_t alloc_len; + + /* gfid related */ + uuid_t gfid; + + /* flag used to make sure we need to return estale in + {lookup,revalidate}_cbk */ + char return_estale; + char need_lookup_everywhere; + + glusterfs_fop_t fop; + + gf_boolean_t linked; + xlator_t *link_subvol; + + struct dht_rebalance_ rebalance; + xlator_t *first_up_subvol; + + gf_boolean_t quota_deem_statfs; + + gf_boolean_t added_link; + gf_boolean_t is_linkfile; + + struct dht_skip_linkto_unlink skip_unlink; + + dht_dir_transaction_t lock[2], *current; + + /* inodelks during filerename for backward compatibility */ + dht_lock_t **rename_inodelk_backward_compatible; + int rename_inodelk_bc_count; + + short lock_type; + + call_stub_t *stub; + int32_t parent_disk_layout[4]; + + /* rename rollback */ + int *ret_cache; + + /* fd open check */ + gf_boolean_t fd_checked; + /* This is use only for directory operation */ + int32_t valid; + gf_boolean_t heal_layout; + int32_t mds_heal_fresh_lookup; + loc_t loc2_copy; + gf_boolean_t locked; + gf_boolean_t dont_create_linkto; }; typedef struct dht_local dht_local_t; /* du - disk-usage */ struct dht_du { - double avail_percent; - double avail_inodes; - uint64_t avail_space; - uint32_t log; - uint32_t chunks; - uint32_t total_blocks; - uint32_t avail_blocks; - uint32_t frsize; /*fragment size*/ + double avail_percent; + double avail_inodes; + uint64_t avail_space; + uint32_t log; + uint32_t chunks; + uint32_t total_blocks; + uint32_t avail_blocks; + uint32_t frsize; /*fragment size*/ }; typedef struct dht_du dht_du_t; enum gf_defrag_type { - GF_DEFRAG_CMD_NONE = 0, - GF_DEFRAG_CMD_START = 1, - GF_DEFRAG_CMD_STOP = 1 + 1, - GF_DEFRAG_CMD_STATUS = 1 + 2, - GF_DEFRAG_CMD_START_LAYOUT_FIX = 1 + 3, - GF_DEFRAG_CMD_START_FORCE = 1 + 4, - GF_DEFRAG_CMD_START_TIER = 1 + 5, - GF_DEFRAG_CMD_STATUS_TIER = 1 + 6, - GF_DEFRAG_CMD_START_DETACH_TIER = 1 + 7, - GF_DEFRAG_CMD_STOP_DETACH_TIER = 1 + 8, - GF_DEFRAG_CMD_PAUSE_TIER = 1 + 9, - GF_DEFRAG_CMD_RESUME_TIER = 1 + 10, - GF_DEFRAG_CMD_DETACH_STATUS = 1 + 11, - GF_DEFRAG_CMD_STOP_TIER = 1 + 12, - GF_DEFRAG_CMD_DETACH_START = 1 + 13, - GF_DEFRAG_CMD_DETACH_COMMIT = 1 + 14, - GF_DEFRAG_CMD_DETACH_COMMIT_FORCE = 1 + 15, - GF_DEFRAG_CMD_DETACH_STOP = 1 + 16, - /* new labels are used so it will help - * while removing old labels by easily differentiating. - * A few labels are added so that the count remains same - * between this enum and the ones on the xdr file. - * different values for the same enum cause errors and - * confusion. - */ + GF_DEFRAG_CMD_NONE = 0, + GF_DEFRAG_CMD_START = 1, + GF_DEFRAG_CMD_STOP = 1 + 1, + GF_DEFRAG_CMD_STATUS = 1 + 2, + GF_DEFRAG_CMD_START_LAYOUT_FIX = 1 + 3, + GF_DEFRAG_CMD_START_FORCE = 1 + 4, + GF_DEFRAG_CMD_START_TIER = 1 + 5, + GF_DEFRAG_CMD_STATUS_TIER = 1 + 6, + GF_DEFRAG_CMD_START_DETACH_TIER = 1 + 7, + GF_DEFRAG_CMD_STOP_DETACH_TIER = 1 + 8, + GF_DEFRAG_CMD_PAUSE_TIER = 1 + 9, + GF_DEFRAG_CMD_RESUME_TIER = 1 + 10, + GF_DEFRAG_CMD_DETACH_STATUS = 1 + 11, + GF_DEFRAG_CMD_STOP_TIER = 1 + 12, + GF_DEFRAG_CMD_DETACH_START = 1 + 13, + GF_DEFRAG_CMD_DETACH_COMMIT = 1 + 14, + GF_DEFRAG_CMD_DETACH_COMMIT_FORCE = 1 + 15, + GF_DEFRAG_CMD_DETACH_STOP = 1 + 16, + /* new labels are used so it will help + * while removing old labels by easily differentiating. + * A few labels are added so that the count remains same + * between this enum and the ones on the xdr file. + * different values for the same enum cause errors and + * confusion. + */ }; typedef enum gf_defrag_type gf_defrag_type; enum gf_defrag_status_t { - GF_DEFRAG_STATUS_NOT_STARTED, - GF_DEFRAG_STATUS_STARTED, - GF_DEFRAG_STATUS_STOPPED, - GF_DEFRAG_STATUS_COMPLETE, - GF_DEFRAG_STATUS_FAILED, - GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED, - GF_DEFRAG_STATUS_LAYOUT_FIX_STOPPED, - GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE, - GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED, + GF_DEFRAG_STATUS_NOT_STARTED, + GF_DEFRAG_STATUS_STARTED, + GF_DEFRAG_STATUS_STOPPED, + GF_DEFRAG_STATUS_COMPLETE, + GF_DEFRAG_STATUS_FAILED, + GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED, + GF_DEFRAG_STATUS_LAYOUT_FIX_STOPPED, + GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE, + GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED, }; typedef enum gf_defrag_status_t gf_defrag_status_t; typedef struct gf_defrag_pattern_list gf_defrag_pattern_list_t; struct gf_defrag_pattern_list { - char path_pattern[256]; - uint64_t size; - gf_defrag_pattern_list_t *next; + char path_pattern[256]; + uint64_t size; + gf_defrag_pattern_list_t *next; }; struct dht_container { - union { - struct list_head list; - struct { - struct _gf_dirent_t *next; - struct _gf_dirent_t *prev; - }; + union { + struct list_head list; + struct { + struct _gf_dirent_t *next; + struct _gf_dirent_t *prev; }; - gf_dirent_t *df_entry; - xlator_t *this; - loc_t *parent_loc; - dict_t *migrate_data; - int local_subvol_index; + }; + gf_dirent_t *df_entry; + xlator_t *this; + loc_t *parent_loc; + dict_t *migrate_data; + int local_subvol_index; }; typedef enum tier_mode_ { - TIER_MODE_NONE = 0, - TIER_MODE_TEST, - TIER_MODE_WM + TIER_MODE_NONE = 0, + TIER_MODE_TEST, + TIER_MODE_WM } tier_mode_t; typedef enum tier_pause_state_ { - TIER_RUNNING = 0, - TIER_REQUEST_PAUSE, - TIER_PAUSED + TIER_RUNNING = 0, + TIER_REQUEST_PAUSE, + TIER_PAUSED } tier_pause_state_t; /* This Structure is only used in tiering fixlayout */ typedef struct gf_tier_fix_layout_arg { - xlator_t *this; - dict_t *fix_layout; - pthread_t thread_id; + xlator_t *this; + dict_t *fix_layout; + pthread_t thread_id; } gf_tier_fix_layout_arg_t; typedef struct gf_tier_conf { - int is_tier; - int watermark_hi; - int watermark_low; - int watermark_last; - unsigned long block_size; - fsblkcnt_t blocks_total; - fsblkcnt_t blocks_used; - int percent_full; - uint64_t max_migrate_bytes; - int max_migrate_files; - int query_limit; - tier_mode_t mode; - /* These flags are only used for tier-compact */ - gf_boolean_t compact_active; - /* These 3 flags are set to true when the client changes the */ - /* compaction mode on the command line. */ - /* When they are set, the daemon will trigger compaction as */ - /* soon as possible to activate or deactivate compaction. */ - /* If in the middle of a compaction, then the switches take */ - /* effect on the next compaction, not the current one. */ - /* If the user switches it off, we want to avoid needless */ - /* compactions. */ - /* If the user switches it on, they want to compact as soon */ - /* as possible. */ - gf_boolean_t compact_mode_switched; - gf_boolean_t compact_mode_switched_hot; - gf_boolean_t compact_mode_switched_cold; - int tier_max_promote_size; - int tier_promote_frequency; - int tier_demote_frequency; - int tier_compact_hot_frequency; - int tier_compact_cold_frequency; - uint64_t st_last_promoted_size; - uint64_t st_last_demoted_size; - tier_pause_state_t pause_state; - struct synctask *pause_synctask; - gf_timer_t *pause_timer; - pthread_mutex_t pause_mutex; - int promote_in_progress; - int demote_in_progress; - /* This Structure is only used in tiering fixlayout */ - gf_tier_fix_layout_arg_t tier_fix_layout_arg; - /* Indicates the index of the first queryfile picked - * in the last cycle of promote or demote */ - int32_t last_promote_qfile_index; - int32_t last_demote_qfile_index; - char volname[GD_VOLUME_NAME_MAX + 1]; + int is_tier; + int watermark_hi; + int watermark_low; + int watermark_last; + unsigned long block_size; + fsblkcnt_t blocks_total; + fsblkcnt_t blocks_used; + int percent_full; + uint64_t max_migrate_bytes; + int max_migrate_files; + int query_limit; + tier_mode_t mode; + /* These flags are only used for tier-compact */ + gf_boolean_t compact_active; + /* These 3 flags are set to true when the client changes the */ + /* compaction mode on the command line. */ + /* When they are set, the daemon will trigger compaction as */ + /* soon as possible to activate or deactivate compaction. */ + /* If in the middle of a compaction, then the switches take */ + /* effect on the next compaction, not the current one. */ + /* If the user switches it off, we want to avoid needless */ + /* compactions. */ + /* If the user switches it on, they want to compact as soon */ + /* as possible. */ + gf_boolean_t compact_mode_switched; + gf_boolean_t compact_mode_switched_hot; + gf_boolean_t compact_mode_switched_cold; + int tier_max_promote_size; + int tier_promote_frequency; + int tier_demote_frequency; + int tier_compact_hot_frequency; + int tier_compact_cold_frequency; + uint64_t st_last_promoted_size; + uint64_t st_last_demoted_size; + tier_pause_state_t pause_state; + struct synctask *pause_synctask; + gf_timer_t *pause_timer; + pthread_mutex_t pause_mutex; + int promote_in_progress; + int demote_in_progress; + /* This Structure is only used in tiering fixlayout */ + gf_tier_fix_layout_arg_t tier_fix_layout_arg; + /* Indicates the index of the first queryfile picked + * in the last cycle of promote or demote */ + int32_t last_promote_qfile_index; + int32_t last_demote_qfile_index; + char volname[GD_VOLUME_NAME_MAX + 1]; } gf_tier_conf_t; typedef struct nodeuuid_info { - char info; /* Set to 1 is this is my node's uuid*/ - uuid_t uuid; /* Store the nodeuuid as well for debugging*/ + char info; /* Set to 1 is this is my node's uuid*/ + uuid_t uuid; /* Store the nodeuuid as well for debugging*/ } nodeuuid_info_t; typedef struct subvol_nodeuuids_info { - nodeuuid_info_t *elements; - int count; + nodeuuid_info_t *elements; + int count; } subvol_nodeuuids_info_t; - struct gf_defrag_info_ { - uint64_t total_files; - uint64_t total_data; - uint64_t num_files_lookedup; - uint64_t total_failures; - uint64_t skipped; - uint64_t num_dirs_processed; - uint64_t size_processed; - gf_lock_t lock; - int cmd; - pthread_t th; - gf_defrag_status_t defrag_status; - struct rpc_clnt *rpc; - uint32_t connected; - uint32_t is_exiting; - pid_t pid; - inode_t *root_inode; - uuid_t node_uuid; - struct timeval start_time; - gf_boolean_t stats; - uint32_t new_commit_hash; - gf_defrag_pattern_list_t *defrag_pattern; - gf_tier_conf_t tier_conf; - - /*Data Tiering params for scanner*/ - uint64_t total_files_promoted; - uint64_t total_files_demoted; - int write_freq_threshold; - int read_freq_threshold; - - pthread_cond_t parallel_migration_cond; - pthread_mutex_t dfq_mutex; - pthread_cond_t rebalance_crawler_alarm; - int32_t q_entry_count; - int32_t global_error; - struct dht_container *queue; - int32_t crawl_done; - int32_t abort; - int32_t wakeup_crawler; - - /*Throttle params*/ - /*stands for reconfigured thread count*/ - int32_t recon_thread_count; - /*stands for current running thread count*/ - int32_t current_thread_count; - pthread_cond_t df_wakeup_thread; - - /* lock migration flag */ - gf_boolean_t lock_migration_enabled; - - /* backpointer to make it easier to write functions for rebalance */ - xlator_t *this; - - pthread_cond_t fc_wakeup_cond; - pthread_mutex_t fc_mutex; + uint64_t total_files; + uint64_t total_data; + uint64_t num_files_lookedup; + uint64_t total_failures; + uint64_t skipped; + uint64_t num_dirs_processed; + uint64_t size_processed; + gf_lock_t lock; + int cmd; + pthread_t th; + gf_defrag_status_t defrag_status; + struct rpc_clnt *rpc; + uint32_t connected; + uint32_t is_exiting; + pid_t pid; + inode_t *root_inode; + uuid_t node_uuid; + struct timeval start_time; + gf_boolean_t stats; + uint32_t new_commit_hash; + gf_defrag_pattern_list_t *defrag_pattern; + gf_tier_conf_t tier_conf; + + /*Data Tiering params for scanner*/ + uint64_t total_files_promoted; + uint64_t total_files_demoted; + int write_freq_threshold; + int read_freq_threshold; + + pthread_cond_t parallel_migration_cond; + pthread_mutex_t dfq_mutex; + pthread_cond_t rebalance_crawler_alarm; + int32_t q_entry_count; + int32_t global_error; + struct dht_container *queue; + int32_t crawl_done; + int32_t abort; + int32_t wakeup_crawler; + + /*Throttle params*/ + /*stands for reconfigured thread count*/ + int32_t recon_thread_count; + /*stands for current running thread count*/ + int32_t current_thread_count; + pthread_cond_t df_wakeup_thread; + + /* lock migration flag */ + gf_boolean_t lock_migration_enabled; + + /* backpointer to make it easier to write functions for rebalance */ + xlator_t *this; + + pthread_cond_t fc_wakeup_cond; + pthread_mutex_t fc_mutex; }; typedef struct gf_defrag_info_ gf_defrag_info_t; struct dht_methods_s { - int32_t (*migration_get_dst_subvol)(xlator_t *this, - dht_local_t *local); - int32_t (*migration_other)(xlator_t *this, - gf_defrag_info_t *defrag); - int32_t (*migration_needed)(xlator_t *this); - xlator_t* (*layout_search)(xlator_t *this, - dht_layout_t *layout, - const char *name); + int32_t (*migration_get_dst_subvol)(xlator_t *this, dht_local_t *local); + int32_t (*migration_other)(xlator_t *this, gf_defrag_info_t *defrag); + int32_t (*migration_needed)(xlator_t *this); + xlator_t *(*layout_search)(xlator_t *this, dht_layout_t *layout, + const char *name); }; typedef struct dht_methods_s dht_methods_t; struct dht_conf { - gf_lock_t subvolume_lock; - int subvolume_cnt; - xlator_t **subvolumes; - char *subvolume_status; - int *last_event; - dht_layout_t **file_layouts; - dht_layout_t **dir_layouts; - unsigned int search_unhashed; - gf_boolean_t lookup_optimize; - int gen; - dht_du_t *du_stats; - double min_free_disk; - double min_free_inodes; - char disk_unit; - int32_t refresh_interval; - gf_boolean_t unhashed_sticky_bit; - struct timeval last_stat_fetch; - gf_lock_t layout_lock; - dict_t *leaf_to_subvol; - void *private; /* Can be used by wrapper xlators over - dht */ - gf_boolean_t use_readdirp; - char vol_uuid[UUID_SIZE + 1]; - gf_boolean_t assert_no_child_down; - time_t *subvol_up_time; - - /* This is the count used as the distribute layout for a directory */ - /* Will be a global flag to control the layout spread count */ - uint32_t dir_spread_cnt; - - /* to keep track of nodes which are decommissioned */ - xlator_t **decommissioned_bricks; - int decommission_in_progress; - int decommission_subvols_cnt; - - /* defrag related */ - gf_defrag_info_t *defrag; - - /* Request to filter directory entries in readdir request */ - - gf_boolean_t readdir_optimize; - - /* Support regex-based name reinterpretation. */ - regex_t rsync_regex; - gf_boolean_t rsync_regex_valid; - regex_t extra_regex; - gf_boolean_t extra_regex_valid; - - /* Support variable xattr names. */ - char *xattr_name; - char *mds_xattr_key; - char *link_xattr_name; - char *commithash_xattr_name; - char *wild_xattr_name; - - /* Support size-weighted rebalancing (heterogeneous bricks). */ - gf_boolean_t do_weighting; - gf_boolean_t randomize_by_gfid; - int dthrottle; - - dht_methods_t methods; - - struct mem_pool *lock_pool; - - /*local subvol storage for rebalance*/ - xlator_t **local_subvols; - subvol_nodeuuids_info_t *local_nodeuuids; - int32_t local_subvols_cnt; - - /* - * "Commit hash" for this volume topology. Changed whenever bricks - * are added or removed. - */ - uint32_t vol_commit_hash; - gf_boolean_t vch_forced; - - /* lock migration */ - - gf_boolean_t lock_migration_enabled; - gf_lock_t lock; - - /* Hard link handle requirement for migration triggered from client*/ - synclock_t link_lock; - - gf_boolean_t use_fallocate; - - gf_boolean_t force_migration; + gf_lock_t subvolume_lock; + int subvolume_cnt; + xlator_t **subvolumes; + char *subvolume_status; + int *last_event; + dht_layout_t **file_layouts; + dht_layout_t **dir_layouts; + unsigned int search_unhashed; + gf_boolean_t lookup_optimize; + int gen; + dht_du_t *du_stats; + double min_free_disk; + double min_free_inodes; + char disk_unit; + int32_t refresh_interval; + gf_boolean_t unhashed_sticky_bit; + struct timeval last_stat_fetch; + gf_lock_t layout_lock; + dict_t *leaf_to_subvol; + void *private; /* Can be used by wrapper xlators over + dht */ + gf_boolean_t use_readdirp; + char vol_uuid[UUID_SIZE + 1]; + gf_boolean_t assert_no_child_down; + time_t *subvol_up_time; + + /* This is the count used as the distribute layout for a directory */ + /* Will be a global flag to control the layout spread count */ + uint32_t dir_spread_cnt; + + /* to keep track of nodes which are decommissioned */ + xlator_t **decommissioned_bricks; + int decommission_in_progress; + int decommission_subvols_cnt; + + /* defrag related */ + gf_defrag_info_t *defrag; + + /* Request to filter directory entries in readdir request */ + + gf_boolean_t readdir_optimize; + + /* Support regex-based name reinterpretation. */ + regex_t rsync_regex; + gf_boolean_t rsync_regex_valid; + regex_t extra_regex; + gf_boolean_t extra_regex_valid; + + /* Support variable xattr names. */ + char *xattr_name; + char *mds_xattr_key; + char *link_xattr_name; + char *commithash_xattr_name; + char *wild_xattr_name; + + /* Support size-weighted rebalancing (heterogeneous bricks). */ + gf_boolean_t do_weighting; + gf_boolean_t randomize_by_gfid; + int dthrottle; + + dht_methods_t methods; + + struct mem_pool *lock_pool; + + /*local subvol storage for rebalance*/ + xlator_t **local_subvols; + subvol_nodeuuids_info_t *local_nodeuuids; + int32_t local_subvols_cnt; + + /* + * "Commit hash" for this volume topology. Changed whenever bricks + * are added or removed. + */ + uint32_t vol_commit_hash; + gf_boolean_t vch_forced; + + /* lock migration */ + + gf_boolean_t lock_migration_enabled; + gf_lock_t lock; + + /* Hard link handle requirement for migration triggered from client*/ + synclock_t link_lock; + + gf_boolean_t use_fallocate; + + gf_boolean_t force_migration; }; typedef struct dht_conf dht_conf_t; struct dht_dfoffset_ctx { - xlator_t *this; - off_t offset; - int32_t readdir_done; + xlator_t *this; + off_t offset; + int32_t readdir_done; }; typedef struct dht_dfoffset_ctx dht_dfoffset_ctx_t; struct dht_disk_layout { - uint32_t cnt; - uint32_t type; - struct { - uint32_t start; - uint32_t stop; - } list[1]; + uint32_t cnt; + uint32_t type; + struct { + uint32_t start; + uint32_t stop; + } list[1]; }; typedef struct dht_disk_layout dht_disk_layout_t; typedef enum { - GF_DHT_MIGRATE_DATA, - GF_DHT_MIGRATE_DATA_EVEN_IF_LINK_EXISTS, - GF_DHT_MIGRATE_HARDLINK, - GF_DHT_MIGRATE_HARDLINK_IN_PROGRESS + GF_DHT_MIGRATE_DATA, + GF_DHT_MIGRATE_DATA_EVEN_IF_LINK_EXISTS, + GF_DHT_MIGRATE_HARDLINK, + GF_DHT_MIGRATE_HARDLINK_IN_PROGRESS } gf_dht_migrate_data_type_t; typedef enum { - GF_DHT_EQUAL_DISTRIBUTION, - GF_DHT_WEIGHTED_DISTRIBUTION + GF_DHT_EQUAL_DISTRIBUTION, + GF_DHT_WEIGHTED_DISTRIBUTION } dht_distribution_type_t; struct dir_dfmeta { - gf_dirent_t *equeue; - dht_dfoffset_ctx_t *offset_var; - struct list_head **head; - struct list_head **iterator; - int *fetch_entries; + gf_dirent_t *equeue; + dht_dfoffset_ctx_t *offset_var; + struct list_head **head; + struct list_head **iterator; + int *fetch_entries; }; typedef struct dht_migrate_info { - xlator_t *src_subvol; - xlator_t *dst_subvol; - GF_REF_DECL; + xlator_t *src_subvol; + xlator_t *dst_subvol; + GF_REF_DECL; } dht_migrate_info_t; - - typedef struct dht_fd_ctx { - uint64_t opened_on_dst; - GF_REF_DECL; + uint64_t opened_on_dst; + GF_REF_DECL; } dht_fd_ctx_t; - #define ENTRY_MISSING(op_ret, op_errno) (op_ret == -1 && op_errno == ENOENT) -#define is_revalidate(loc) (dht_inode_ctx_layout_get ((loc)->inode, this, NULL) == 0) +#define is_revalidate(loc) \ + (dht_inode_ctx_layout_get((loc)->inode, this, NULL) == 0) #define is_last_call(cnt) (cnt == 0) #define DHT_MIGRATION_IN_PROGRESS 1 -#define DHT_MIGRATION_COMPLETED 2 +#define DHT_MIGRATION_COMPLETED 2 -#define check_is_linkfile(i,s,x,n) (IS_DHT_LINKFILE_MODE (s) && dict_get (x, n)) +#define check_is_linkfile(i, s, x, n) \ + (IS_DHT_LINKFILE_MODE(s) && dict_get(x, n)) -#define IS_DHT_MIGRATION_PHASE2(buf) ( \ - IA_ISREG ((buf)->ia_type) && \ - ((st_mode_from_ia ((buf)->ia_prot, (buf)->ia_type) & \ - ~S_IFMT) == DHT_LINKFILE_MODE)) +#define IS_DHT_MIGRATION_PHASE2(buf) \ + (IA_ISREG((buf)->ia_type) && \ + ((st_mode_from_ia((buf)->ia_prot, (buf)->ia_type) & ~S_IFMT) == \ + DHT_LINKFILE_MODE)) -#define IS_DHT_MIGRATION_PHASE1(buf) ( \ - IA_ISREG ((buf)->ia_type) && \ - ((buf)->ia_prot.sticky == 1) && \ - ((buf)->ia_prot.sgid == 1)) +#define IS_DHT_MIGRATION_PHASE1(buf) \ + (IA_ISREG((buf)->ia_type) && ((buf)->ia_prot.sticky == 1) && \ + ((buf)->ia_prot.sgid == 1)) -#define DHT_STRIP_PHASE1_FLAGS(buf) do { \ - if ((buf) && IS_DHT_MIGRATION_PHASE1(buf)) { \ - (buf)->ia_prot.sticky = 0; \ - (buf)->ia_prot.sgid = 0; \ - } \ - } while (0) +#define DHT_STRIP_PHASE1_FLAGS(buf) \ + do { \ + if ((buf) && IS_DHT_MIGRATION_PHASE1(buf)) { \ + (buf)->ia_prot.sticky = 0; \ + (buf)->ia_prot.sgid = 0; \ + } \ + } while (0) #define dht_inode_missing(op_errno) (op_errno == ENOENT || op_errno == ESTALE) -#define check_is_dir(i,s,x) (IA_ISDIR(s->ia_type)) +#define check_is_dir(i, s, x) (IA_ISDIR(s->ia_type)) #define layout_is_sane(layout) ((layout) && (layout->cnt > 0)) -#define we_are_not_migrating(x) ((x) == 1) - -#define DHT_STACK_UNWIND(fop, frame, params ...) do { \ - dht_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - if (frame) { \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - dht_local_wipe (__xl, __local); \ - } while (0) - -#define DHT_STACK_DESTROY(frame) do { \ - dht_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - dht_local_wipe (__xl, __local); \ - } while (0) - -#define DHT_UPDATE_TIME(ctx_sec, ctx_nsec, new_sec, new_nsec, inode, post) do {\ - LOCK (&inode->lock); \ - { \ - if (ctx_sec == new_sec) \ - new_nsec = max (new_nsec, ctx_nsec); \ - else if (ctx_sec > new_sec) { \ - new_sec = ctx_sec; \ - new_nsec = ctx_nsec; \ - } \ - if (post) { \ - ctx_sec = new_sec; \ - ctx_nsec = new_nsec; \ - } \ - } \ - UNLOCK (&inode->lock); \ - } while (0) - -#define is_greater_time(a, an, b, bn) (((a) < (b)) || (((a) == (b)) && ((an) < (bn)))) - -#define DHT_MARK_FOP_INTERNAL(xattr) do { \ - int tmp = -1; \ - if (!xattr) { \ - xattr = dict_new (); \ - if (!xattr) \ - break; \ - } \ - tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \ - if (tmp) { \ - gf_msg (this->name, GF_LOG_ERROR, 0, \ - DHT_MSG_DICT_SET_FAILED, \ - "Failed to set dictionary value: key = %s," \ - " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \ - local->loc.path); \ - } \ - } while (0) - -dht_layout_t *dht_layout_new (xlator_t *this, int cnt); -dht_layout_t *dht_layout_get (xlator_t *this, inode_t *inode); -dht_layout_t *dht_layout_for_subvol (xlator_t *this, xlator_t *subvol); -xlator_t *dht_layout_search (xlator_t *this, dht_layout_t *layout, - const char *name); +#define we_are_not_migrating(x) ((x) == 1) + +#define DHT_STACK_UNWIND(fop, frame, params...) \ + do { \ + dht_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + if (frame) { \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + dht_local_wipe(__xl, __local); \ + } while (0) + +#define DHT_STACK_DESTROY(frame) \ + do { \ + dht_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + dht_local_wipe(__xl, __local); \ + } while (0) + +#define DHT_UPDATE_TIME(ctx_sec, ctx_nsec, new_sec, new_nsec, inode, post) \ + do { \ + LOCK(&inode->lock); \ + { \ + if (ctx_sec == new_sec) \ + new_nsec = max(new_nsec, ctx_nsec); \ + else if (ctx_sec > new_sec) { \ + new_sec = ctx_sec; \ + new_nsec = ctx_nsec; \ + } \ + if (post) { \ + ctx_sec = new_sec; \ + ctx_nsec = new_nsec; \ + } \ + } \ + UNLOCK(&inode->lock); \ + } while (0) + +#define is_greater_time(a, an, b, bn) \ + (((a) < (b)) || (((a) == (b)) && ((an) < (bn)))) + +#define DHT_MARK_FOP_INTERNAL(xattr) \ + do { \ + int tmp = -1; \ + if (!xattr) { \ + xattr = dict_new(); \ + if (!xattr) \ + break; \ + } \ + tmp = dict_set_str(xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \ + if (tmp) { \ + gf_msg(this->name, GF_LOG_ERROR, 0, DHT_MSG_DICT_SET_FAILED, \ + "Failed to set dictionary value: key = %s," \ + " path = %s", \ + GLUSTERFS_INTERNAL_FOP_KEY, local->loc.path); \ + } \ + } while (0) + +dht_layout_t * +dht_layout_new(xlator_t *this, int cnt); +dht_layout_t * +dht_layout_get(xlator_t *this, inode_t *inode); +dht_layout_t * +dht_layout_for_subvol(xlator_t *this, xlator_t *subvol); +xlator_t * +dht_layout_search(xlator_t *this, dht_layout_t *layout, const char *name); int32_t -dht_migration_get_dst_subvol(xlator_t *this, dht_local_t *local); +dht_migration_get_dst_subvol(xlator_t *this, dht_local_t *local); int32_t dht_migration_needed(xlator_t *this); -int dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout); -int dht_layout_anomalies (xlator_t *this, loc_t *loc, dht_layout_t *layout, - uint32_t *holes_p, uint32_t *overlaps_p, - uint32_t *missing_p, uint32_t *down_p, - uint32_t *misc_p, uint32_t *no_space_p); -int dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, - xlator_t *subvol, loc_t *loc, dict_t *xattr); +int +dht_layout_normalize(xlator_t *this, loc_t *loc, dht_layout_t *layout); +int +dht_layout_anomalies(xlator_t *this, loc_t *loc, dht_layout_t *layout, + uint32_t *holes_p, uint32_t *overlaps_p, + uint32_t *missing_p, uint32_t *down_p, uint32_t *misc_p, + uint32_t *no_space_p); +int +dht_layout_dir_mismatch(xlator_t *this, dht_layout_t *layout, xlator_t *subvol, + loc_t *loc, dict_t *xattr); -xlator_t *dht_linkfile_subvol (xlator_t *this, inode_t *inode, - struct iatt *buf, dict_t *xattr); -int dht_linkfile_unlink (call_frame_t *frame, xlator_t *this, - xlator_t *subvol, loc_t *loc); +xlator_t * +dht_linkfile_subvol(xlator_t *this, inode_t *inode, struct iatt *buf, + dict_t *xattr); +int +dht_linkfile_unlink(call_frame_t *frame, xlator_t *this, xlator_t *subvol, + loc_t *loc); -int dht_layouts_init (xlator_t *this, dht_conf_t *conf); -int dht_layout_merge (xlator_t *this, dht_layout_t *layout, xlator_t *subvol, - int op_ret, int op_errno, dict_t *xattr); +int +dht_layouts_init(xlator_t *this, dht_conf_t *conf); +int +dht_layout_merge(xlator_t *this, dht_layout_t *layout, xlator_t *subvol, + int op_ret, int op_errno, dict_t *xattr); -int dht_disk_layout_extract (xlator_t *this, dht_layout_t *layout, - int pos, int32_t **disk_layout_p); -int dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout, - int pos, void *disk_layout_raw, int disk_layout_len); int -dht_disk_layout_extract_for_subvol (xlator_t *this, dht_layout_t *layout, - xlator_t *subvol, int32_t **disk_layout_p); +dht_disk_layout_extract(xlator_t *this, dht_layout_t *layout, int pos, + int32_t **disk_layout_p); +int +dht_disk_layout_merge(xlator_t *this, dht_layout_t *layout, int pos, + void *disk_layout_raw, int disk_layout_len); +int +dht_disk_layout_extract_for_subvol(xlator_t *this, dht_layout_t *layout, + xlator_t *subvol, int32_t **disk_layout_p); -int dht_frame_return (call_frame_t *frame); +int +dht_frame_return(call_frame_t *frame); -int dht_deitransform (xlator_t *this, uint64_t y, xlator_t **subvol); +int +dht_deitransform(xlator_t *this, uint64_t y, xlator_t **subvol); -void dht_local_wipe (xlator_t *this, dht_local_t *local); -dht_local_t *dht_local_init (call_frame_t *frame, loc_t *loc, fd_t *fd, - glusterfs_fop_t fop); -int dht_iatt_merge (xlator_t *this, struct iatt *to, struct iatt *from); +void +dht_local_wipe(xlator_t *this, dht_local_t *local); +dht_local_t * +dht_local_init(call_frame_t *frame, loc_t *loc, fd_t *fd, glusterfs_fop_t fop); +int +dht_iatt_merge(xlator_t *this, struct iatt *to, struct iatt *from); -xlator_t *dht_subvol_get_hashed (xlator_t *this, loc_t *loc); -xlator_t *dht_subvol_get_cached (xlator_t *this, inode_t *inode); -xlator_t *dht_subvol_next (xlator_t *this, xlator_t *prev); -xlator_t *dht_subvol_next_available (xlator_t *this, xlator_t *prev); -int dht_subvol_cnt (xlator_t *this, xlator_t *subvol); +xlator_t * +dht_subvol_get_hashed(xlator_t *this, loc_t *loc); +xlator_t * +dht_subvol_get_cached(xlator_t *this, inode_t *inode); +xlator_t * +dht_subvol_next(xlator_t *this, xlator_t *prev); +xlator_t * +dht_subvol_next_available(xlator_t *this, xlator_t *prev); +int +dht_subvol_cnt(xlator_t *this, xlator_t *subvol); -int dht_hash_compute (xlator_t *this, int type, const char *name, uint32_t *hash_p); +int +dht_hash_compute(xlator_t *this, int type, const char *name, uint32_t *hash_p); -int dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, - xlator_t *this, xlator_t *tovol, - xlator_t *fromvol, loc_t *loc); -int dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc); -int dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc); int -dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, - loc_t *loc, dht_layout_t *layout); +dht_linkfile_create(call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, + xlator_t *this, xlator_t *tovol, xlator_t *fromvol, + loc_t *loc); +int +dht_lookup_directory(call_frame_t *frame, xlator_t *this, loc_t *loc); +int +dht_lookup_everywhere(call_frame_t *frame, xlator_t *this, loc_t *loc); +int +dht_selfheal_directory(call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, + loc_t *loc, dht_layout_t *layout); int -dht_selfheal_directory_for_nameless_lookup (call_frame_t *frame, - dht_selfheal_dir_cbk_t cbk, - loc_t *loc, dht_layout_t *layout); +dht_selfheal_directory_for_nameless_lookup(call_frame_t *frame, + dht_selfheal_dir_cbk_t cbk, + loc_t *loc, dht_layout_t *layout); int -dht_selfheal_new_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, - dht_layout_t *layout); +dht_selfheal_new_directory(call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, + dht_layout_t *layout); int -dht_selfheal_restore (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, - loc_t *loc, dht_layout_t *layout); +dht_selfheal_restore(call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, + loc_t *loc, dht_layout_t *layout); int -dht_layout_sort_volname (dht_layout_t *layout); +dht_layout_sort_volname(dht_layout_t *layout); -int dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc); +int +dht_get_du_info(call_frame_t *frame, xlator_t *this, loc_t *loc); -gf_boolean_t dht_is_subvol_filled (xlator_t *this, xlator_t *subvol); -xlator_t *dht_free_disk_available_subvol (xlator_t *this, xlator_t *subvol, - dht_local_t *layout); -int dht_get_du_info_for_subvol (xlator_t *this, int subvol_idx); +gf_boolean_t +dht_is_subvol_filled(xlator_t *this, xlator_t *subvol); +xlator_t * +dht_free_disk_available_subvol(xlator_t *this, xlator_t *subvol, + dht_local_t *layout); +int +dht_get_du_info_for_subvol(xlator_t *this, int subvol_idx); -int dht_layout_preset (xlator_t *this, xlator_t *subvol, inode_t *inode); -int dht_layout_index_for_subvol (dht_layout_t *layout, xlator_t *subvol); -int dht_layout_set (xlator_t *this, inode_t *inode, dht_layout_t *layout);; -void dht_layout_unref (xlator_t *this, dht_layout_t *layout); -dht_layout_t *dht_layout_ref (xlator_t *this, dht_layout_t *layout); -xlator_t *dht_first_up_subvol (xlator_t *this); -xlator_t *dht_last_up_subvol (xlator_t *this); +int +dht_layout_preset(xlator_t *this, xlator_t *subvol, inode_t *inode); +int +dht_layout_index_for_subvol(dht_layout_t *layout, xlator_t *subvol); +int +dht_layout_set(xlator_t *this, inode_t *inode, dht_layout_t *layout); +; +void +dht_layout_unref(xlator_t *this, dht_layout_t *layout); +dht_layout_t * +dht_layout_ref(xlator_t *this, dht_layout_t *layout); +xlator_t * +dht_first_up_subvol(xlator_t *this); +xlator_t * +dht_last_up_subvol(xlator_t *this); -int dht_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name); +int +dht_build_child_loc(xlator_t *this, loc_t *child, loc_t *parent, char *name); -int dht_filter_loc_subvol_key (xlator_t *this, loc_t *loc, loc_t *new_loc, - xlator_t **subvol); +int +dht_filter_loc_subvol_key(xlator_t *this, loc_t *loc, loc_t *new_loc, + xlator_t **subvol); -int dht_rename_cleanup (call_frame_t *frame); -int dht_rename_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t *xdata); +int +dht_rename_cleanup(call_frame_t *frame); +int +dht_rename_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); -int dht_update_commit_hash_for_layout (call_frame_t *frame); -int dht_fix_directory_layout (call_frame_t *frame, - dht_selfheal_dir_cbk_t dir_cbk, - dht_layout_t *layout); +int +dht_update_commit_hash_for_layout(call_frame_t *frame); +int +dht_fix_directory_layout(call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk, + dht_layout_t *layout); -int dht_init_subvolumes (xlator_t *this, dht_conf_t *conf); +int +dht_init_subvolumes(xlator_t *this, dht_conf_t *conf); /* migration/rebalance */ -int dht_start_rebalance_task (xlator_t *this, call_frame_t *frame); +int +dht_start_rebalance_task(xlator_t *this, call_frame_t *frame); -int dht_rebalance_in_progress_check (xlator_t *this, call_frame_t *frame); -int dht_rebalance_complete_check (xlator_t *this, call_frame_t *frame); +int +dht_rebalance_in_progress_check(xlator_t *this, call_frame_t *frame); +int +dht_rebalance_complete_check(xlator_t *this, call_frame_t *frame); int -dht_init_local_subvolumes (xlator_t *this, dht_conf_t *conf); +dht_init_local_subvolumes(xlator_t *this, dht_conf_t *conf); /* FOPS */ -int32_t dht_lookup (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - dict_t *xattr_req); - -int32_t dht_stat (call_frame_t *frame, - xlator_t *this, - loc_t *loc, dict_t *xdata); - -int32_t dht_fstat (call_frame_t *frame, - xlator_t *this, - fd_t *fd, dict_t *xdata); - -int32_t dht_truncate (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - off_t offset, dict_t *xdata); - -int32_t dht_ftruncate (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - off_t offset, dict_t *xdata); - -int32_t dht_access (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - int32_t mask, dict_t *xdata); - -int32_t dht_readlink (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - size_t size, dict_t *xdata); - -int32_t dht_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, - mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata); - -int32_t dht_mkdir (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata); - -int32_t dht_unlink (call_frame_t *frame, - xlator_t *this, - loc_t *loc, int xflag, dict_t *xdata); - -int32_t dht_rmdir (call_frame_t *frame, xlator_t *this, - loc_t *loc, int flags, dict_t *xdata); - -int32_t dht_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *loc, mode_t umask, - dict_t *xdata); - -int32_t dht_rename (call_frame_t *frame, - xlator_t *this, - loc_t *oldloc, - loc_t *newloc, dict_t *xdata); - -int32_t dht_link (call_frame_t *frame, - xlator_t *this, - loc_t *oldloc, - loc_t *newloc, dict_t *xdata); - -int32_t dht_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 *params); - -int32_t dht_open (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - int32_t flags, fd_t *fd, dict_t *xdata); - -int32_t dht_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 dht_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 dht_flush (call_frame_t *frame, - xlator_t *this, - fd_t *fd, dict_t *xdata); - -int32_t dht_fsync (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t datasync, dict_t *xdata); - -int32_t dht_opendir (call_frame_t *frame, - xlator_t *this, - loc_t *loc, fd_t *fd, dict_t *xdata); - -int32_t dht_fsyncdir (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t datasync, dict_t *xdata); - -int32_t dht_statfs (call_frame_t *frame, - xlator_t *this, - loc_t *loc, dict_t *xdata); - -int32_t dht_setxattr (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - dict_t *dict, - int32_t flags, dict_t *xdata); - -int32_t dht_getxattr (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - const char *name, dict_t *xdata); - -int32_t dht_fsetxattr (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - dict_t *dict, - int32_t flags, dict_t *xdata); - -int32_t dht_fgetxattr (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - const char *name, dict_t *xdata); - -int32_t dht_removexattr (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - const char *name, dict_t *xdata); -int32_t dht_fremovexattr (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - const char *name, dict_t *xdata); - -int32_t dht_lk (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t cmd, - struct gf_flock *flock, dict_t *xdata); - -int32_t dht_lease (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - struct gf_lease *lease, dict_t *xdata); - -int32_t dht_inodelk (call_frame_t *frame, xlator_t *this, - const char *volume, loc_t *loc, int32_t cmd, - struct gf_flock *flock, dict_t *xdata); - -int32_t dht_finodelk (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, int32_t cmd, - struct gf_flock *flock, dict_t *xdata); - -int32_t dht_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 dht_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 dht_readdir (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, off_t off, dict_t *xdata); - -int32_t dht_readdirp (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, off_t off, dict_t *dict); - -int32_t dht_xattrop (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - gf_xattrop_flags_t flags, - dict_t *dict, dict_t *xdata); - -int32_t dht_fxattrop (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - gf_xattrop_flags_t flags, - dict_t *dict, dict_t *xdata); - -int32_t dht_forget (xlator_t *this, inode_t *inode); -int32_t dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid, dict_t *xdata); -int32_t dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iatt *stbuf, int32_t valid, dict_t *xdata); -int32_t dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t mode, off_t offset, size_t len, dict_t *xdata); -int32_t dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, dict_t *xdata); -int32_t dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, off_t len, dict_t *xdata); -int32_t dht_ipc (call_frame_t *frame, xlator_t *this, int32_t op, - dict_t *xdata); +int32_t +dht_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req); + +int32_t +dht_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); + +int32_t +dht_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata); + +int32_t +dht_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, + dict_t *xdata); + +int32_t +dht_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + dict_t *xdata); + +int32_t +dht_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, + dict_t *xdata); + +int32_t +dht_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, + dict_t *xdata); + +int32_t +dht_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata); + +int32_t +dht_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); + +int32_t +dht_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, + dict_t *xdata); + +int32_t +dht_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, + dict_t *xdata); + +int32_t +dht_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath, + loc_t *loc, mode_t umask, dict_t *xdata); + +int32_t +dht_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); + +int32_t +dht_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); + +int32_t +dht_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 *params); + +int32_t +dht_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, dict_t *xdata); + +int32_t +dht_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 +dht_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 +dht_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata); + +int32_t +dht_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, + dict_t *xdata); + +int32_t +dht_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + dict_t *xdata); + +int32_t +dht_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, + dict_t *xdata); + +int32_t +dht_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); + +int32_t +dht_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, + int32_t flags, dict_t *xdata); + +int32_t +dht_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, + dict_t *xdata); + +int32_t +dht_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, + int32_t flags, dict_t *xdata); + +int32_t +dht_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, + dict_t *xdata); + +int32_t +dht_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, dict_t *xdata); +int32_t +dht_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, + const char *name, dict_t *xdata); + +int32_t +dht_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, + struct gf_flock *flock, dict_t *xdata); + +int32_t +dht_lease(call_frame_t *frame, xlator_t *this, loc_t *loc, + struct gf_lease *lease, dict_t *xdata); + +int32_t +dht_inodelk(call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, + int32_t cmd, struct gf_flock *flock, dict_t *xdata); + +int32_t +dht_finodelk(call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, + int32_t cmd, struct gf_flock *flock, dict_t *xdata); + +int32_t +dht_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 +dht_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 +dht_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t off, dict_t *xdata); + +int32_t +dht_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t off, dict_t *dict); + +int32_t +dht_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc, + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); + +int32_t +dht_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd, + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); + +int32_t +dht_forget(xlator_t *this, inode_t *inode); +int32_t +dht_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, + int32_t valid, dict_t *xdata); +int32_t +dht_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, + int32_t valid, dict_t *xdata); +int32_t +dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata); +int32_t +dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + size_t len, dict_t *xdata); +int32_t +dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + off_t len, dict_t *xdata); +int32_t +dht_ipc(call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata); int dht_set_subvol_range(xlator_t *this); -int32_t dht_init (xlator_t *this); -void dht_fini (xlator_t *this); -int dht_reconfigure (xlator_t *this, dict_t *options); -int32_t dht_notify (xlator_t *this, int32_t event, void *data, ...); +int32_t +dht_init(xlator_t *this); +void +dht_fini(xlator_t *this); +int +dht_reconfigure(xlator_t *this, dict_t *options); +int32_t +dht_notify(xlator_t *this, int32_t event, void *data, ...); /* definitions for nufa/switch */ -int dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, - struct iatt *stbuf, dict_t *xattr, - struct iatt *postparent); -int dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, +int +dht_revalidate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, inode_t *inode, struct iatt *stbuf, + dict_t *xattr, struct iatt *postparent); +int +dht_lookup_dir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, inode_t *inode, struct iatt *stbuf, + dict_t *xattr, struct iatt *postparent); +int +dht_lookup_linkfile_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct iatt *stbuf, dict_t *xattr, struct iatt *postparent); -int dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct iatt *stbuf, dict_t *xattr, - struct iatt *postparent); -int dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct iatt *stbuf, dict_t *xattr, - struct iatt *postparent); -int dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - fd_t *fd, inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t *xdata); -int dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); - -int -gf_defrag_status_get (dht_conf_t *conf, dict_t *dict); +int +dht_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, inode_t *inode, struct iatt *stbuf, dict_t *xattr, + struct iatt *postparent); +int +dht_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, fd_t *fd, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, dict_t *xdata); +int +dht_newfile_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, dict_t *xdata); + +int +gf_defrag_status_get(dht_conf_t *conf, dict_t *dict); void -gf_defrag_set_pause_state (gf_tier_conf_t *tier_conf, tier_pause_state_t state); +gf_defrag_set_pause_state(gf_tier_conf_t *tier_conf, tier_pause_state_t state); tier_pause_state_t -gf_defrag_get_pause_state (gf_tier_conf_t *tier_conf); +gf_defrag_get_pause_state(gf_tier_conf_t *tier_conf); int -gf_defrag_pause_tier (xlator_t *this, gf_defrag_info_t *defrag); +gf_defrag_pause_tier(xlator_t *this, gf_defrag_info_t *defrag); tier_pause_state_t -gf_defrag_check_pause_tier (gf_tier_conf_t *defrag); +gf_defrag_check_pause_tier(gf_tier_conf_t *defrag); int -gf_defrag_resume_tier (xlator_t *this, gf_defrag_info_t *defrag); +gf_defrag_resume_tier(xlator_t *this, gf_defrag_info_t *defrag); int -gf_defrag_start_detach_tier (gf_defrag_info_t *defrag); +gf_defrag_start_detach_tier(gf_defrag_info_t *defrag); int -gf_defrag_stop (dht_conf_t *conf, gf_defrag_status_t status, - dict_t *output); +gf_defrag_stop(dht_conf_t *conf, gf_defrag_status_t status, dict_t *output); -void* -gf_defrag_start (void *this); +void * +gf_defrag_start(void *this); int32_t -gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, int *fop_errno); +gf_defrag_handle_hardlink(xlator_t *this, loc_t *loc, int *fop_errno); int -dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, +dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, int flag, int *fop_errno); int -dht_inode_ctx_layout_get (inode_t *inode, xlator_t *this, - dht_layout_t **layout_int); +dht_inode_ctx_layout_get(inode_t *inode, xlator_t *this, + dht_layout_t **layout_int); int -dht_inode_ctx_layout_set (inode_t *inode, xlator_t *this, - dht_layout_t* layout_int); +dht_inode_ctx_layout_set(inode_t *inode, xlator_t *this, + dht_layout_t *layout_int); int -dht_inode_ctx_time_update (inode_t *inode, xlator_t *this, struct iatt *stat, - int32_t update_ctx); -void dht_inode_ctx_time_set (inode_t *inode, xlator_t *this, struct iatt *stat); +dht_inode_ctx_time_update(inode_t *inode, xlator_t *this, struct iatt *stat, + int32_t update_ctx); +void +dht_inode_ctx_time_set(inode_t *inode, xlator_t *this, struct iatt *stat); -int dht_inode_ctx_get (inode_t *inode, xlator_t *this, dht_inode_ctx_t **ctx); -int dht_inode_ctx_set (inode_t *inode, xlator_t *this, dht_inode_ctx_t *ctx); int -dht_dir_attr_heal (void *data); +dht_inode_ctx_get(inode_t *inode, xlator_t *this, dht_inode_ctx_t **ctx); int -dht_dir_attr_heal_done (int ret, call_frame_t *sync_frame, void *data); +dht_inode_ctx_set(inode_t *inode, xlator_t *this, dht_inode_ctx_t *ctx); int -dht_dir_has_layout (dict_t *xattr, char *name); +dht_dir_attr_heal(void *data); +int +dht_dir_attr_heal_done(int ret, call_frame_t *sync_frame, void *data); +int +dht_dir_has_layout(dict_t *xattr, char *name); gf_boolean_t -dht_is_subvol_in_layout (dht_layout_t *layout, xlator_t *xlator); +dht_is_subvol_in_layout(dht_layout_t *layout, xlator_t *xlator); xlator_t * -dht_subvol_with_free_space_inodes (xlator_t *this, xlator_t *subvol, xlator_t *ignore, - dht_layout_t *layout, uint64_t filesize); +dht_subvol_with_free_space_inodes(xlator_t *this, xlator_t *subvol, + xlator_t *ignore, dht_layout_t *layout, + uint64_t filesize); xlator_t * -dht_subvol_maxspace_nonzeroinode (xlator_t *this, xlator_t *subvol, - dht_layout_t *layout); +dht_subvol_maxspace_nonzeroinode(xlator_t *this, xlator_t *subvol, + dht_layout_t *layout); int -dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this); +dht_linkfile_attr_heal(call_frame_t *frame, xlator_t *this); void -dht_layout_dump (dht_layout_t *layout, const char *prefix); +dht_layout_dump(dht_layout_t *layout, const char *prefix); int32_t -dht_priv_dump (xlator_t *this); +dht_priv_dump(xlator_t *this); int32_t -dht_inodectx_dump (xlator_t *this, inode_t *inode); +dht_inodectx_dump(xlator_t *this, inode_t *inode); int -dht_inode_ctx_get_mig_info (xlator_t *this, inode_t *inode, - xlator_t **src_subvol, xlator_t **dst_subvol); +dht_inode_ctx_get_mig_info(xlator_t *this, inode_t *inode, + xlator_t **src_subvol, xlator_t **dst_subvol); gf_boolean_t -dht_mig_info_is_invalid (xlator_t *current, xlator_t *src_subvol, - xlator_t *dst_subvol); +dht_mig_info_is_invalid(xlator_t *current, xlator_t *src_subvol, + xlator_t *dst_subvol); int -dht_subvol_status (dht_conf_t *conf, xlator_t *subvol); +dht_subvol_status(dht_conf_t *conf, xlator_t *subvol); void -dht_log_new_layout_for_dir_selfheal (xlator_t *this, loc_t *loc, - dht_layout_t *layout); +dht_log_new_layout_for_dir_selfheal(xlator_t *this, loc_t *loc, + dht_layout_t *layout); int -dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this); +dht_lookup_everywhere_done(call_frame_t *frame, xlator_t *this); int -dht_fill_dict_to_avoid_unlink_of_migrating_file (dict_t *dict); +dht_fill_dict_to_avoid_unlink_of_migrating_file(dict_t *dict); int -dht_layout_sort (dht_layout_t *layout); +dht_layout_sort(dht_layout_t *layout); int -dht_heal_full_path (void *data); +dht_heal_full_path(void *data); int -dht_heal_full_path_done (int op_ret, call_frame_t *frame, void *data); +dht_heal_full_path_done(int op_ret, call_frame_t *frame, void *data); int -dht_layout_missing_dirs (dht_layout_t *layout); +dht_layout_missing_dirs(dht_layout_t *layout); int -dht_refresh_layout (call_frame_t *frame); +dht_refresh_layout(call_frame_t *frame); gf_boolean_t -dht_is_tier_xlator (xlator_t *this); +dht_is_tier_xlator(xlator_t *this); int -dht_build_parent_loc (xlator_t *this, loc_t *parent, loc_t *child, - int32_t *op_errno); +dht_build_parent_loc(xlator_t *this, loc_t *parent, loc_t *child, + int32_t *op_errno); int32_t -dht_set_local_rebalance (xlator_t *this, dht_local_t *local, - struct iatt *stbuf, - struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_set_local_rebalance(xlator_t *this, dht_local_t *local, struct iatt *stbuf, + struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); void -dht_build_root_loc (inode_t *inode, loc_t *loc); +dht_build_root_loc(inode_t *inode, loc_t *loc); gf_boolean_t -dht_fd_open_on_dst (xlator_t *this, fd_t *fd, xlator_t *dst); +dht_fd_open_on_dst(xlator_t *this, fd_t *fd, xlator_t *dst); int32_t -dht_fd_ctx_destroy (xlator_t *this, fd_t *fd); +dht_fd_ctx_destroy(xlator_t *this, fd_t *fd); int32_t -dht_release (xlator_t *this, fd_t *fd); - +dht_release(xlator_t *this, fd_t *fd); int32_t -dht_set_fixed_dir_stat (struct iatt *stat); +dht_set_fixed_dir_stat(struct iatt *stat); -xlator_t* -dht_get_lock_subvolume (xlator_t *this, struct gf_flock *lock, - dht_local_t *local); +xlator_t * +dht_get_lock_subvolume(xlator_t *this, struct gf_flock *lock, + dht_local_t *local); int -dht_lk_inode_unref (call_frame_t *frame, int32_t op_ret); +dht_lk_inode_unref(call_frame_t *frame, int32_t op_ret); void -dht_normalize_stats (struct statvfs *buf, unsigned long bsize, - unsigned long frsize); +dht_normalize_stats(struct statvfs *buf, unsigned long bsize, + unsigned long frsize); int add_opt(char **optsp, const char *opt); int -dht_aggregate_split_brain_xattr (dict_t *dst, char *key, data_t *value); +dht_aggregate_split_brain_xattr(dict_t *dst, char *key, data_t *value); int -dht_remove_stale_linkto (void *data); +dht_remove_stale_linkto(void *data); int -dht_remove_stale_linkto_cbk (int ret, call_frame_t *sync_frame, void *data); +dht_remove_stale_linkto_cbk(int ret, call_frame_t *sync_frame, void *data); int -dht_fd_ctx_set (xlator_t *this, fd_t *fd, xlator_t *subvol); +dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *subvol); int -dht_check_and_open_fd_on_subvol (xlator_t *this, call_frame_t *frame); +dht_check_and_open_fd_on_subvol(xlator_t *this, call_frame_t *frame); /* FD fop callbacks */ int -dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata); +dht_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, dict_t *xdata); int -dht_file_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_file_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata); int -dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +dht_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, - int op_errno, struct iatt *prebuf, struct iatt *postbuf, - dict_t *xdata); - +dht_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); int -dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - struct iovec *vector, int count, struct iatt *stbuf, - struct iobref *iobref, dict_t *xdata); +dht_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iovec *vector, int count, struct iatt *stbuf, + struct iobref *iobref, dict_t *xdata); int -dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *stbuf, dict_t *xdata); +dht_file_attr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *stbuf, dict_t *xdata); int -dht_file_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata); +dht_file_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *xdata); int -dht_file_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *xdata); +dht_file_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *xdata); /* All custom xattr heal functions */ int -dht_dir_heal_xattrs (void *data); +dht_dir_heal_xattrs(void *data); int -dht_dir_heal_xattrs_done (int ret, call_frame_t *sync_frame, void *data); +dht_dir_heal_xattrs_done(int ret, call_frame_t *sync_frame, void *data); void -dht_aggregate_xattr (dict_t *dst, dict_t *src); +dht_aggregate_xattr(dict_t *dst, dict_t *src); int32_t dht_dict_set_array(dict_t *dict, char *key, int32_t value[], int32_t size); int -dht_set_user_xattr (dict_t *dict, char *k, data_t *v, void *data); +dht_set_user_xattr(dict_t *dict, char *k, data_t *v, void *data); void -dht_dir_set_heal_xattr (xlator_t *this, dht_local_t *local, dict_t *dst, - dict_t *src, int *uret, int *uflag); +dht_dir_set_heal_xattr(xlator_t *this, dht_local_t *local, dict_t *dst, + dict_t *src, int *uret, int *uflag); int -dht_dir_xattr_heal (xlator_t *this, dht_local_t *local); +dht_dir_xattr_heal(xlator_t *this, dht_local_t *local); int32_t -dht_dict_get_array (dict_t *dict, char *key, int32_t value[], int32_t size, int *errst); +dht_dict_get_array(dict_t *dict, char *key, int32_t value[], int32_t size, + int *errst); xlator_t * -dht_inode_get_hashed_subvol (inode_t *inode, xlator_t *this, loc_t *loc); +dht_inode_get_hashed_subvol(inode_t *inode, xlator_t *this, loc_t *loc); int -dht_common_mark_mdsxattr (call_frame_t *frame, int *errst, int flag); +dht_common_mark_mdsxattr(call_frame_t *frame, int *errst, int flag); int -dht_common_mark_mdsxattr_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int op_ret, int op_errno, - dict_t *xdata); +dht_common_mark_mdsxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *xdata); int -dht_inode_ctx_mdsvol_set (inode_t *inode, xlator_t *this, - xlator_t *mds_subvol); +dht_inode_ctx_mdsvol_set(inode_t *inode, xlator_t *this, xlator_t *mds_subvol); int -dht_inode_ctx_mdsvol_get (inode_t *inode, xlator_t *this, - xlator_t **mdsvol); +dht_inode_ctx_mdsvol_get(inode_t *inode, xlator_t *this, xlator_t **mdsvol); int -dht_selfheal_dir_setattr (call_frame_t *frame, loc_t *loc, struct iatt *stbuf, - int32_t valid, dht_layout_t *layout); +dht_selfheal_dir_setattr(call_frame_t *frame, loc_t *loc, struct iatt *stbuf, + int32_t valid, dht_layout_t *layout); /* Abstract out the DHT-IATT-IN-DICT */ +int +dht_request_iatt_in_xdata(xlator_t *this, dict_t *xattr_req); -int dht_request_iatt_in_xdata (xlator_t *this, dict_t *xattr_req); - -int dht_read_iatt_from_xdata (xlator_t *this, dict_t *xdata, - struct iatt *stbuf); +int +dht_read_iatt_from_xdata(xlator_t *this, dict_t *xdata, struct iatt *stbuf); int -is_permission_different (ia_prot_t *prot1, ia_prot_t *prot2); -#endif/* _DHT_H */ +is_permission_different(ia_prot_t *prot1, ia_prot_t *prot2); +#endif /* _DHT_H */ diff --git a/xlators/cluster/dht/src/dht-lock.h b/xlators/cluster/dht/src/dht-lock.h index f36bf3fd685..802970adb3b 100644 --- a/xlators/cluster/dht/src/dht-lock.h +++ b/xlators/cluster/dht/src/dht-lock.h @@ -15,32 +15,32 @@ #include "dht-common.h" void -dht_lock_array_free (dht_lock_t **lk_array, int count); +dht_lock_array_free(dht_lock_t **lk_array, int count); int32_t -dht_lock_count (dht_lock_t **lk_array, int lk_count); +dht_lock_count(dht_lock_t **lk_array, int lk_count); dht_lock_t * -dht_lock_new (xlator_t *this, xlator_t *xl, loc_t *loc, short type, - const char *domain, const char *basename, - dht_reaction_type_t do_on_failure); +dht_lock_new(xlator_t *this, xlator_t *xl, loc_t *loc, short type, + const char *domain, const char *basename, + dht_reaction_type_t do_on_failure); int32_t -dht_unlock_entrylk_wrapper (call_frame_t *, dht_elock_wrap_t *); +dht_unlock_entrylk_wrapper(call_frame_t *, dht_elock_wrap_t *); void -dht_blocking_entrylk_rec (call_frame_t *frame, int i); +dht_blocking_entrylk_rec(call_frame_t *frame, int i); int -dht_blocking_entrylk (call_frame_t *frame, dht_lock_t **lk_array, - int lk_count, fop_inodelk_cbk_t entrylk_cbk); +dht_blocking_entrylk(call_frame_t *frame, dht_lock_t **lk_array, int lk_count, + fop_inodelk_cbk_t entrylk_cbk); int32_t -dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count, - fop_inodelk_cbk_t inodelk_cbk); +dht_unlock_inodelk(call_frame_t *frame, dht_lock_t **lk_array, int lk_count, + fop_inodelk_cbk_t inodelk_cbk); int32_t -dht_unlock_inodelk_wrapper (call_frame_t *, dht_ilock_wrap_t *); +dht_unlock_inodelk_wrapper(call_frame_t *, dht_ilock_wrap_t *); /* Acquire non-blocking inodelk on a list of xlators. * @@ -57,11 +57,11 @@ dht_unlock_inodelk_wrapper (call_frame_t *, dht_ilock_wrap_t *); */ int -dht_nonblocking_inodelk (call_frame_t *frame, dht_lock_t **lk_array, - int lk_count, fop_inodelk_cbk_t inodelk_cbk); +dht_nonblocking_inodelk(call_frame_t *frame, dht_lock_t **lk_array, + int lk_count, fop_inodelk_cbk_t inodelk_cbk); void -dht_blocking_inodelk_rec (call_frame_t *frame, int i); +dht_blocking_inodelk_rec(call_frame_t *frame, int i); /* same as dht_nonblocking_inodelk, but issues sequential blocking locks on * @lk_array directly. locks are issued on some order which remains same @@ -69,25 +69,24 @@ dht_blocking_inodelk_rec (call_frame_t *frame, int i); */ int -dht_blocking_inodelk (call_frame_t *frame, dht_lock_t **lk_array, - int lk_count, fop_inodelk_cbk_t inodelk_cbk); +dht_blocking_inodelk(call_frame_t *frame, dht_lock_t **lk_array, int lk_count, + fop_inodelk_cbk_t inodelk_cbk); int32_t -dht_blocking_entrylk_after_inodelk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, - int32_t op_errno, dict_t *xdata); +dht_blocking_entrylk_after_inodelk(call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, dict_t *xdata); int32_t -dht_blocking_entrylk_after_inodelk_rename (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, - int32_t op_errno, dict_t *xdata); +dht_blocking_entrylk_after_inodelk_rename(call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, dict_t *xdata); void -dht_unlock_namespace (call_frame_t *, dht_dir_transaction_t *); +dht_unlock_namespace(call_frame_t *, dht_dir_transaction_t *); int -dht_protect_namespace (call_frame_t *frame, loc_t *loc, xlator_t *subvol, - struct dht_namespace *ns, - fop_entrylk_cbk_t ns_cbk); +dht_protect_namespace(call_frame_t *frame, loc_t *loc, xlator_t *subvol, + struct dht_namespace *ns, fop_entrylk_cbk_t ns_cbk); -#endif /* _DHT_LOCK_H */ +#endif /* _DHT_LOCK_H */ diff --git a/xlators/cluster/dht/src/dht-mem-types.h b/xlators/cluster/dht/src/dht-mem-types.h index 19cccef537b..5b728f86c95 100644 --- a/xlators/cluster/dht/src/dht-mem-types.h +++ b/xlators/cluster/dht/src/dht-mem-types.h @@ -8,38 +8,37 @@ cases as published by the Free Software Foundation. */ - #ifndef __DHT_MEM_TYPES_H__ #define __DHT_MEM_TYPES_H__ #include "mem-types.h" enum gf_dht_mem_types_ { - gf_dht_mt_dht_du_t = gf_common_mt_end + 1, - gf_dht_mt_dht_conf_t, - gf_dht_mt_char, - gf_dht_mt_int32_t, - gf_dht_mt_xlator_t, - gf_dht_mt_dht_layout_t, - gf_switch_mt_dht_conf_t, - gf_switch_mt_dht_du_t, - gf_switch_mt_switch_sched_array, - gf_switch_mt_switch_struct, - gf_dht_mt_subvol_time, - gf_dht_mt_loc_t, - gf_defrag_info_mt, - gf_dht_mt_inode_ctx_t, - gf_dht_mt_ctx_stat_time_t, - gf_dht_mt_dirent_t, - gf_dht_mt_container_t, - gf_dht_mt_octx_t, - gf_dht_mt_miginfo_t, - gf_tier_mt_bricklist_t, - gf_tier_mt_ipc_ctr_params_t, - gf_dht_mt_fd_ctx_t, - gf_tier_mt_qfile_array_t, - gf_dht_ret_cache_t, - gf_dht_nodeuuids_t, - gf_dht_mt_end + gf_dht_mt_dht_du_t = gf_common_mt_end + 1, + gf_dht_mt_dht_conf_t, + gf_dht_mt_char, + gf_dht_mt_int32_t, + gf_dht_mt_xlator_t, + gf_dht_mt_dht_layout_t, + gf_switch_mt_dht_conf_t, + gf_switch_mt_dht_du_t, + gf_switch_mt_switch_sched_array, + gf_switch_mt_switch_struct, + gf_dht_mt_subvol_time, + gf_dht_mt_loc_t, + gf_defrag_info_mt, + gf_dht_mt_inode_ctx_t, + gf_dht_mt_ctx_stat_time_t, + gf_dht_mt_dirent_t, + gf_dht_mt_container_t, + gf_dht_mt_octx_t, + gf_dht_mt_miginfo_t, + gf_tier_mt_bricklist_t, + gf_tier_mt_ipc_ctr_params_t, + gf_dht_mt_fd_ctx_t, + gf_tier_mt_qfile_array_t, + gf_dht_ret_cache_t, + gf_dht_nodeuuids_t, + gf_dht_mt_end }; #endif diff --git a/xlators/cluster/dht/src/dht-messages.h b/xlators/cluster/dht/src/dht-messages.h index bdea5a092b7..005ab57b505 100644 --- a/xlators/cluster/dht/src/dht-messages.h +++ b/xlators/cluster/dht/src/dht-messages.h @@ -22,136 +22,63 @@ * glfs-message-id.h. */ -GLFS_MSGID(DHT, - DHT_MSG_CACHED_SUBVOL_GET_FAILED, - DHT_MSG_CREATE_LINK_FAILED, - DHT_MSG_DICT_SET_FAILED, - DHT_MSG_DIR_ATTR_HEAL_FAILED, - DHT_MSG_DIR_SELFHEAL_FAILED, - DHT_MSG_DIR_SELFHEAL_XATTR_FAILED, - DHT_MSG_FILE_ON_MULT_SUBVOL, - DHT_MSG_FILE_TYPE_MISMATCH, - DHT_MSG_GFID_MISMATCH, - DHT_MSG_GFID_NULL, - DHT_MSG_HASHED_SUBVOL_GET_FAILED, - DHT_MSG_INIT_FAILED, - DHT_MSG_INVALID_CONFIGURATION, - DHT_MSG_INVALID_DISK_LAYOUT, - DHT_MSG_INVALID_OPTION, - DHT_MSG_LAYOUT_FIX_FAILED, - DHT_MSG_LAYOUT_MERGE_FAILED, - DHT_MSG_LAYOUT_MISMATCH, - DHT_MSG_LAYOUT_NULL, - DHT_MSG_MIGRATE_DATA_COMPLETE, - DHT_MSG_MIGRATE_DATA_FAILED, - DHT_MSG_MIGRATE_FILE_COMPLETE, - DHT_MSG_MIGRATE_FILE_FAILED, - DHT_MSG_NO_MEMORY, - DHT_MSG_OPENDIR_FAILED, - DHT_MSG_REBALANCE_FAILED, - DHT_MSG_REBALANCE_START_FAILED, - DHT_MSG_REBALANCE_STATUS, - DHT_MSG_REBALANCE_STOPPED, - DHT_MSG_RENAME_FAILED, - DHT_MSG_SETATTR_FAILED, - DHT_MSG_SUBVOL_INSUFF_INODES, - DHT_MSG_SUBVOL_INSUFF_SPACE, - DHT_MSG_UNLINK_FAILED, - DHT_MSG_LAYOUT_SET_FAILED, - DHT_MSG_LOG_FIXED_LAYOUT, - DHT_MSG_LOG_TIER_ERROR, - DHT_MSG_LOG_TIER_STATUS, - DHT_MSG_GET_XATTR_FAILED, - DHT_MSG_FILE_LOOKUP_FAILED, - DHT_MSG_OPEN_FD_FAILED, - DHT_MSG_SET_INODE_CTX_FAILED, - DHT_MSG_UNLOCKING_FAILED, - DHT_MSG_DISK_LAYOUT_NULL, - DHT_MSG_SUBVOL_INFO, - DHT_MSG_CHUNK_SIZE_INFO, - DHT_MSG_LAYOUT_FORM_FAILED, - DHT_MSG_SUBVOL_ERROR, - DHT_MSG_LAYOUT_SORT_FAILED, - DHT_MSG_REGEX_INFO, - DHT_MSG_FOPEN_FAILED, - DHT_MSG_SET_HOSTNAME_FAILED, - DHT_MSG_BRICK_ERROR, - DHT_MSG_SYNCOP_FAILED, - DHT_MSG_MIGRATE_INFO, - DHT_MSG_SOCKET_ERROR, - DHT_MSG_CREATE_FD_FAILED, - DHT_MSG_READDIR_ERROR, - DHT_MSG_CHILD_LOC_BUILD_FAILED, - DHT_MSG_SET_SWITCH_PATTERN_ERROR, - DHT_MSG_COMPUTE_HASH_FAILED, - DHT_MSG_FIND_LAYOUT_ANOMALIES_ERROR, - DHT_MSG_ANOMALIES_INFO, - DHT_MSG_LAYOUT_INFO, - DHT_MSG_INODE_LK_ERROR, - DHT_MSG_RENAME_INFO, - DHT_MSG_DATA_NULL, - DHT_MSG_AGGREGATE_QUOTA_XATTR_FAILED, - DHT_MSG_UNLINK_LOOKUP_INFO, - DHT_MSG_LINK_FILE_LOOKUP_INFO, - DHT_MSG_OPERATION_NOT_SUP, - DHT_MSG_NOT_LINK_FILE_ERROR, - DHT_MSG_CHILD_DOWN, - DHT_MSG_UUID_PARSE_ERROR, - DHT_MSG_GET_DISK_INFO_ERROR, - DHT_MSG_INVALID_VALUE, - DHT_MSG_SWITCH_PATTERN_INFO, - DHT_MSG_SUBVOL_OP_FAILED, - DHT_MSG_LAYOUT_PRESET_FAILED, - DHT_MSG_INVALID_LINKFILE, - DHT_MSG_FIX_LAYOUT_INFO, - DHT_MSG_GET_HOSTNAME_FAILED, - DHT_MSG_WRITE_FAILED, - DHT_MSG_MIGRATE_HARDLINK_FILE_FAILED, - DHT_MSG_FSYNC_FAILED, - DHT_MSG_SUBVOL_DECOMMISSION_INFO, - DHT_MSG_BRICK_QUERY_FAILED, - DHT_MSG_SUBVOL_NO_LAYOUT_INFO, - DHT_MSG_OPEN_FD_ON_DST_FAILED, - DHT_MSG_SUBVOL_NOT_FOUND, - DHT_MSG_FILE_LOOKUP_ON_DST_FAILED, - DHT_MSG_DISK_LAYOUT_MISSING, - DHT_MSG_DICT_GET_FAILED, - DHT_MSG_REVALIDATE_CBK_INFO, - DHT_MSG_UPGRADE_BRICKS, - DHT_MSG_LK_ARRAY_INFO, - DHT_MSG_RENAME_NOT_LOCAL, - DHT_MSG_RECONFIGURE_INFO, - DHT_MSG_INIT_LOCAL_SUBVOL_FAILED, - DHT_MSG_SYS_CALL_GET_TIME_FAILED, - DHT_MSG_NO_DISK_USAGE_STATUS, - DHT_MSG_SUBVOL_DOWN_ERROR, - DHT_MSG_REBAL_THROTTLE_INFO, - DHT_MSG_COMMIT_HASH_INFO, - DHT_MSG_REBAL_STRUCT_SET, - DHT_MSG_HAS_MIGINFO, - DHT_MSG_LOG_IPC_TIER_ERROR, - DHT_MSG_TIER_PAUSED, - DHT_MSG_TIER_RESUME, - DHT_MSG_SETTLE_HASH_FAILED, - DHT_MSG_DEFRAG_PROCESS_DIR_FAILED, - DHT_MSG_FD_CTX_SET_FAILED, - DHT_MSG_STALE_LOOKUP, - DHT_MSG_PARENT_LAYOUT_CHANGED, - DHT_MSG_LOCK_MIGRATION_FAILED, - DHT_MSG_LOCK_INODE_UNREF_FAILED, - DHT_MSG_ASPRINTF_FAILED, - DHT_MSG_DIR_LOOKUP_FAILED, - DHT_MSG_INODELK_FAILED, - DHT_MSG_LOCK_FRAME_FAILED, - DHT_MSG_LOCAL_LOCK_INIT_FAILED, - DHT_MSG_ENTRYLK_ERROR, - DHT_MSG_INODELK_ERROR, - DHT_MSG_LOC_FAILED, - DHT_MSG_UNKNOWN_FOP, - DHT_MSG_MIGRATE_FILE_SKIPPED, - DHT_MSG_DIR_XATTR_HEAL_FAILED, - DHT_MSG_HASHED_SUBVOL_DOWN, - DHT_MSG_NON_HASHED_SUBVOL_DOWN -); +GLFS_MSGID( + DHT, DHT_MSG_CACHED_SUBVOL_GET_FAILED, DHT_MSG_CREATE_LINK_FAILED, + DHT_MSG_DICT_SET_FAILED, DHT_MSG_DIR_ATTR_HEAL_FAILED, + DHT_MSG_DIR_SELFHEAL_FAILED, DHT_MSG_DIR_SELFHEAL_XATTR_FAILED, + DHT_MSG_FILE_ON_MULT_SUBVOL, DHT_MSG_FILE_TYPE_MISMATCH, + DHT_MSG_GFID_MISMATCH, DHT_MSG_GFID_NULL, DHT_MSG_HASHED_SUBVOL_GET_FAILED, + DHT_MSG_INIT_FAILED, DHT_MSG_INVALID_CONFIGURATION, + DHT_MSG_INVALID_DISK_LAYOUT, DHT_MSG_INVALID_OPTION, + DHT_MSG_LAYOUT_FIX_FAILED, DHT_MSG_LAYOUT_MERGE_FAILED, + DHT_MSG_LAYOUT_MISMATCH, DHT_MSG_LAYOUT_NULL, DHT_MSG_MIGRATE_DATA_COMPLETE, + DHT_MSG_MIGRATE_DATA_FAILED, DHT_MSG_MIGRATE_FILE_COMPLETE, + DHT_MSG_MIGRATE_FILE_FAILED, DHT_MSG_NO_MEMORY, DHT_MSG_OPENDIR_FAILED, + DHT_MSG_REBALANCE_FAILED, DHT_MSG_REBALANCE_START_FAILED, + DHT_MSG_REBALANCE_STATUS, DHT_MSG_REBALANCE_STOPPED, DHT_MSG_RENAME_FAILED, + DHT_MSG_SETATTR_FAILED, DHT_MSG_SUBVOL_INSUFF_INODES, + DHT_MSG_SUBVOL_INSUFF_SPACE, DHT_MSG_UNLINK_FAILED, + DHT_MSG_LAYOUT_SET_FAILED, DHT_MSG_LOG_FIXED_LAYOUT, DHT_MSG_LOG_TIER_ERROR, + DHT_MSG_LOG_TIER_STATUS, DHT_MSG_GET_XATTR_FAILED, + DHT_MSG_FILE_LOOKUP_FAILED, DHT_MSG_OPEN_FD_FAILED, + DHT_MSG_SET_INODE_CTX_FAILED, DHT_MSG_UNLOCKING_FAILED, + DHT_MSG_DISK_LAYOUT_NULL, DHT_MSG_SUBVOL_INFO, DHT_MSG_CHUNK_SIZE_INFO, + DHT_MSG_LAYOUT_FORM_FAILED, DHT_MSG_SUBVOL_ERROR, + DHT_MSG_LAYOUT_SORT_FAILED, DHT_MSG_REGEX_INFO, DHT_MSG_FOPEN_FAILED, + DHT_MSG_SET_HOSTNAME_FAILED, DHT_MSG_BRICK_ERROR, DHT_MSG_SYNCOP_FAILED, + DHT_MSG_MIGRATE_INFO, DHT_MSG_SOCKET_ERROR, DHT_MSG_CREATE_FD_FAILED, + DHT_MSG_READDIR_ERROR, DHT_MSG_CHILD_LOC_BUILD_FAILED, + DHT_MSG_SET_SWITCH_PATTERN_ERROR, DHT_MSG_COMPUTE_HASH_FAILED, + DHT_MSG_FIND_LAYOUT_ANOMALIES_ERROR, DHT_MSG_ANOMALIES_INFO, + DHT_MSG_LAYOUT_INFO, DHT_MSG_INODE_LK_ERROR, DHT_MSG_RENAME_INFO, + DHT_MSG_DATA_NULL, DHT_MSG_AGGREGATE_QUOTA_XATTR_FAILED, + DHT_MSG_UNLINK_LOOKUP_INFO, DHT_MSG_LINK_FILE_LOOKUP_INFO, + DHT_MSG_OPERATION_NOT_SUP, DHT_MSG_NOT_LINK_FILE_ERROR, DHT_MSG_CHILD_DOWN, + DHT_MSG_UUID_PARSE_ERROR, DHT_MSG_GET_DISK_INFO_ERROR, + DHT_MSG_INVALID_VALUE, DHT_MSG_SWITCH_PATTERN_INFO, + DHT_MSG_SUBVOL_OP_FAILED, DHT_MSG_LAYOUT_PRESET_FAILED, + DHT_MSG_INVALID_LINKFILE, DHT_MSG_FIX_LAYOUT_INFO, + DHT_MSG_GET_HOSTNAME_FAILED, DHT_MSG_WRITE_FAILED, + DHT_MSG_MIGRATE_HARDLINK_FILE_FAILED, DHT_MSG_FSYNC_FAILED, + DHT_MSG_SUBVOL_DECOMMISSION_INFO, DHT_MSG_BRICK_QUERY_FAILED, + DHT_MSG_SUBVOL_NO_LAYOUT_INFO, DHT_MSG_OPEN_FD_ON_DST_FAILED, + DHT_MSG_SUBVOL_NOT_FOUND, DHT_MSG_FILE_LOOKUP_ON_DST_FAILED, + DHT_MSG_DISK_LAYOUT_MISSING, DHT_MSG_DICT_GET_FAILED, + DHT_MSG_REVALIDATE_CBK_INFO, DHT_MSG_UPGRADE_BRICKS, DHT_MSG_LK_ARRAY_INFO, + DHT_MSG_RENAME_NOT_LOCAL, DHT_MSG_RECONFIGURE_INFO, + DHT_MSG_INIT_LOCAL_SUBVOL_FAILED, DHT_MSG_SYS_CALL_GET_TIME_FAILED, + DHT_MSG_NO_DISK_USAGE_STATUS, DHT_MSG_SUBVOL_DOWN_ERROR, + DHT_MSG_REBAL_THROTTLE_INFO, DHT_MSG_COMMIT_HASH_INFO, + DHT_MSG_REBAL_STRUCT_SET, DHT_MSG_HAS_MIGINFO, DHT_MSG_LOG_IPC_TIER_ERROR, + DHT_MSG_TIER_PAUSED, DHT_MSG_TIER_RESUME, DHT_MSG_SETTLE_HASH_FAILED, + DHT_MSG_DEFRAG_PROCESS_DIR_FAILED, DHT_MSG_FD_CTX_SET_FAILED, + DHT_MSG_STALE_LOOKUP, DHT_MSG_PARENT_LAYOUT_CHANGED, + DHT_MSG_LOCK_MIGRATION_FAILED, DHT_MSG_LOCK_INODE_UNREF_FAILED, + DHT_MSG_ASPRINTF_FAILED, DHT_MSG_DIR_LOOKUP_FAILED, DHT_MSG_INODELK_FAILED, + DHT_MSG_LOCK_FRAME_FAILED, DHT_MSG_LOCAL_LOCK_INIT_FAILED, + DHT_MSG_ENTRYLK_ERROR, DHT_MSG_INODELK_ERROR, DHT_MSG_LOC_FAILED, + DHT_MSG_UNKNOWN_FOP, DHT_MSG_MIGRATE_FILE_SKIPPED, + DHT_MSG_DIR_XATTR_HEAL_FAILED, DHT_MSG_HASHED_SUBVOL_DOWN, + DHT_MSG_NON_HASHED_SUBVOL_DOWN); #endif /* _DHT_MESSAGES_H_ */ diff --git a/xlators/cluster/dht/src/tier-common.h b/xlators/cluster/dht/src/tier-common.h index 26e01d7f141..b1ebaa8004d 100644 --- a/xlators/cluster/dht/src/tier-common.h +++ b/xlators/cluster/dht/src/tier-common.h @@ -12,57 +12,44 @@ #define _TIER_COMMON_H_ /* Function definitions */ int -tier_create_unlink_stale_linkto_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int op_ret, int op_errno, - struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +tier_create_unlink_stale_linkto_cbk(call_frame_t *frame, void *cookie, + xlator_t *this, int op_ret, int op_errno, + struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); int -tier_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - fd_t *fd, inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t *xdata); +tier_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, fd_t *fd, inode_t *inode, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, dict_t *xdata); int -tier_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, - struct iatt *postparent, - dict_t *xdata); +tier_create_linkfile_create_cbk(call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); int -tier_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 *params); +tier_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 *params); int32_t -tier_unlink (call_frame_t *frame, xlator_t *this, - loc_t *loc, int xflag, dict_t *xdata); +tier_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, + dict_t *xdata); int32_t -tier_readdirp (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, off_t off, dict_t *dict); +tier_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t off, dict_t *dict); int -tier_readdir (call_frame_t *frame, - xlator_t *this, fd_t *fd, size_t size, - off_t yoff, dict_t *xdata); - - +tier_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t yoff, dict_t *xdata); int -tier_link (call_frame_t *frame, xlator_t *this, - loc_t *oldloc, loc_t *newloc, dict_t *xdata); - +tier_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); int -tier_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); - +tier_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); #endif - diff --git a/xlators/cluster/dht/src/tier.h b/xlators/cluster/dht/src/tier.h index ce08fb5a669..f0ffdfcd769 100644 --- a/xlators/cluster/dht/src/tier.h +++ b/xlators/cluster/dht/src/tier.h @@ -11,7 +11,6 @@ #ifndef _TIER_H_ #define _TIER_H_ - /******************************************************************************/ /* This is from dht-rebalancer.c as we don't have dht-rebalancer.h */ #include "dht-common.h" @@ -33,80 +32,79 @@ #define PROMOTION_QFILE "promotequeryfile" #define DEMOTION_QFILE "demotequeryfile" -#define TIER_HASHED_SUBVOL conf->subvolumes[0] -#define TIER_UNHASHED_SUBVOL conf->subvolumes[1] +#define TIER_HASHED_SUBVOL conf->subvolumes[0] +#define TIER_UNHASHED_SUBVOL conf->subvolumes[1] -#define GET_QFILE_PATH(is_promotion)\ - (is_promotion) ? promotion_qfile : demotion_qfile +#define GET_QFILE_PATH(is_promotion) \ + (is_promotion) ? promotion_qfile : demotion_qfile typedef struct tier_qfile_array { - int *fd_array; - ssize_t array_size; - ssize_t next_index; - /* Indicate the number of exhuasted FDs*/ - ssize_t exhausted_count; + int *fd_array; + ssize_t array_size; + ssize_t next_index; + /* Indicate the number of exhuasted FDs*/ + ssize_t exhausted_count; } tier_qfile_array_t; - typedef struct _query_cbk_args { - xlator_t *this; - gf_defrag_info_t *defrag; - /* This is write */ - int query_fd; - int is_promotion; - int is_compaction; - /* This is for read */ - tier_qfile_array_t *qfile_array; + xlator_t *this; + gf_defrag_info_t *defrag; + /* This is write */ + int query_fd; + int is_promotion; + int is_compaction; + /* This is for read */ + tier_qfile_array_t *qfile_array; } query_cbk_args_t; int gf_run_tier(xlator_t *this, gf_defrag_info_t *defrag); typedef struct gfdb_brick_info { - gfdb_time_t *time_stamp; - gf_boolean_t _gfdb_promote; - query_cbk_args_t *_query_cbk_args; + gfdb_time_t *time_stamp; + gf_boolean_t _gfdb_promote; + query_cbk_args_t *_query_cbk_args; } gfdb_brick_info_t; typedef struct brick_list { - xlator_t *xlator; - char *brick_db_path; - char brick_name[NAME_MAX]; - char qfile_path[PATH_MAX]; - struct list_head list; + xlator_t *xlator; + char *brick_db_path; + char brick_name[NAME_MAX]; + char qfile_path[PATH_MAX]; + struct list_head list; } tier_brick_list_t; typedef struct _dm_thread_args { - xlator_t *this; - gf_defrag_info_t *defrag; - struct list_head *brick_list; - int freq_time; - int return_value; - int is_promotion; - int is_compaction; - gf_boolean_t is_hot_tier; + xlator_t *this; + gf_defrag_info_t *defrag; + struct list_head *brick_list; + int freq_time; + int return_value; + int is_promotion; + int is_compaction; + gf_boolean_t is_hot_tier; } migration_args_t; typedef enum tier_watermark_op_ { - TIER_WM_NONE = 0, - TIER_WM_LOW, - TIER_WM_HI, - TIER_WM_MID + TIER_WM_NONE = 0, + TIER_WM_LOW, + TIER_WM_HI, + TIER_WM_MID } tier_watermark_op_t; -#define DEFAULT_PROMOTE_FREQ_SEC 120 -#define DEFAULT_DEMOTE_FREQ_SEC 120 -#define DEFAULT_HOT_COMPACT_FREQ_SEC 604800 -#define DEFAULT_COLD_COMPACT_FREQ_SEC 604800 -#define DEFAULT_DEMOTE_DEGRADED 1 -#define DEFAULT_WRITE_FREQ_SEC 0 -#define DEFAULT_READ_FREQ_SEC 0 -#define DEFAULT_WM_LOW 75 -#define DEFAULT_WM_HI 90 -#define DEFAULT_TIER_MODE TIER_MODE_TEST -#define DEFAULT_COMP_MODE _gf_true -#define DEFAULT_TIER_MAX_MIGRATE_MB 1000 +#define DEFAULT_PROMOTE_FREQ_SEC 120 +#define DEFAULT_DEMOTE_FREQ_SEC 120 +#define DEFAULT_HOT_COMPACT_FREQ_SEC 604800 +#define DEFAULT_COLD_COMPACT_FREQ_SEC 604800 +#define DEFAULT_DEMOTE_DEGRADED 1 +#define DEFAULT_WRITE_FREQ_SEC 0 +#define DEFAULT_READ_FREQ_SEC 0 +#define DEFAULT_WM_LOW 75 +#define DEFAULT_WM_HI 90 +#define DEFAULT_TIER_MODE TIER_MODE_TEST +#define DEFAULT_COMP_MODE _gf_true +#define DEFAULT_TIER_MAX_MIGRATE_MB 1000 #define DEFAULT_TIER_MAX_MIGRATE_FILES 5000 -#define DEFAULT_TIER_QUERY_LIMIT 100 +#define DEFAULT_TIER_QUERY_LIMIT 100 #endif diff --git a/xlators/cluster/ec/src/ec-code-c.h b/xlators/cluster/ec/src/ec-code-c.h index 92e8070e514..42b5a064eb8 100644 --- a/xlators/cluster/ec/src/ec-code-c.h +++ b/xlators/cluster/ec/src/ec-code-c.h @@ -13,12 +13,15 @@ #include "ec-types.h" -void ec_code_c_prepare(ec_gf_t *gf, uint32_t *values, uint32_t count); +void +ec_code_c_prepare(ec_gf_t *gf, uint32_t *values, uint32_t count); -void ec_code_c_linear(void *dst, void *src, uint64_t offset, uint32_t *values, - uint32_t count); +void +ec_code_c_linear(void *dst, void *src, uint64_t offset, uint32_t *values, + uint32_t count); -void ec_code_c_interleaved(void *dst, void **src, uint64_t offset, - uint32_t *values, uint32_t count); +void +ec_code_c_interleaved(void *dst, void **src, uint64_t offset, uint32_t *values, + uint32_t count); #endif /* __EC_CODE_C_H__ */ diff --git a/xlators/cluster/ec/src/ec-code-intel.h b/xlators/cluster/ec/src/ec-code-intel.h index 903d023f962..3fa4a174765 100644 --- a/xlators/cluster/ec/src/ec-code-intel.h +++ b/xlators/cluster/ec/src/ec-code-intel.h @@ -76,109 +76,116 @@ enum _ec_code_vex_opcode { struct _ec_code_intel_buffer { uint32_t bytes; union { - uint8_t data[4]; + uint8_t data[4]; uint32_t value; }; }; struct _ec_code_intel_sib { gf_boolean_t present; - uint32_t base; - uint32_t index; - uint32_t scale; + uint32_t base; + uint32_t index; + uint32_t scale; }; struct _ec_code_intel_modrm { gf_boolean_t present; - uint32_t mod; - uint32_t rm; - uint32_t reg; + uint32_t mod; + uint32_t rm; + uint32_t reg; }; struct _ec_code_intel_rex { gf_boolean_t present; - uint32_t w; - uint32_t r; - uint32_t x; - uint32_t b; + uint32_t w; + uint32_t r; + uint32_t x; + uint32_t b; }; struct _ec_code_intel { - gf_boolean_t invalid; + gf_boolean_t invalid; ec_code_intel_buffer_t prefix; ec_code_intel_buffer_t opcode; ec_code_intel_buffer_t offset; ec_code_intel_buffer_t immediate; ec_code_intel_buffer_t vex; - ec_code_intel_rex_t rex; - ec_code_intel_modrm_t modrm; - ec_code_intel_sib_t sib; - uint32_t reg; + ec_code_intel_rex_t rex; + ec_code_intel_modrm_t modrm; + ec_code_intel_sib_t sib; + uint32_t reg; }; -void ec_code_intel_op_push_r(ec_code_builder_t *builder, - ec_code_intel_reg_t reg); -void ec_code_intel_op_pop_r(ec_code_builder_t *builder, - ec_code_intel_reg_t reg); -void ec_code_intel_op_ret(ec_code_builder_t *builder, uint32_t size); - -void ec_code_intel_op_mov_r2r(ec_code_builder_t *builder, - ec_code_intel_reg_t src, - ec_code_intel_reg_t dst); -void ec_code_intel_op_mov_r2m(ec_code_builder_t *builder, - ec_code_intel_reg_t src, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset); -void ec_code_intel_op_mov_m2r(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, ec_code_intel_reg_t dst); -void ec_code_intel_op_xor_r2r(ec_code_builder_t *builder, - ec_code_intel_reg_t src, - ec_code_intel_reg_t dst); -void ec_code_intel_op_xor_m2r(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, ec_code_intel_reg_t dst); -void ec_code_intel_op_add_i2r(ec_code_builder_t *builder, int32_t value, - ec_code_intel_reg_t reg); -void ec_code_intel_op_test_i2r(ec_code_builder_t *builder, uint32_t value, - ec_code_intel_reg_t reg); -void ec_code_intel_op_jne(ec_code_builder_t *builder, uint32_t address); - -void ec_code_intel_op_mov_sse2sse(ec_code_builder_t *builder, uint32_t src, - uint32_t dst); -void ec_code_intel_op_mov_sse2m(ec_code_builder_t *builder, uint32_t src, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset); -void ec_code_intel_op_mov_m2sse(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, uint32_t dst); -void ec_code_intel_op_xor_sse2sse(ec_code_builder_t *builder, uint32_t src, - uint32_t dst); -void ec_code_intel_op_xor_m2sse(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, uint32_t dst); - -void ec_code_intel_op_mov_avx2avx(ec_code_builder_t *builder, uint32_t src, - uint32_t dst); -void ec_code_intel_op_mov_avx2m(ec_code_builder_t *builder, uint32_t src, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset); -void ec_code_intel_op_mov_m2avx(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, uint32_t dst); -void ec_code_intel_op_xor_avx2avx(ec_code_builder_t *builder, uint32_t src, - uint32_t dst); -void ec_code_intel_op_xor_m2avx(ec_code_builder_t *builder, - ec_code_intel_reg_t base, - ec_code_intel_reg_t index, uint32_t scale, - int32_t offset, uint32_t dst); +void +ec_code_intel_op_push_r(ec_code_builder_t *builder, ec_code_intel_reg_t reg); +void +ec_code_intel_op_pop_r(ec_code_builder_t *builder, ec_code_intel_reg_t reg); +void +ec_code_intel_op_ret(ec_code_builder_t *builder, uint32_t size); + +void +ec_code_intel_op_mov_r2r(ec_code_builder_t *builder, ec_code_intel_reg_t src, + ec_code_intel_reg_t dst); +void +ec_code_intel_op_mov_r2m(ec_code_builder_t *builder, ec_code_intel_reg_t src, + ec_code_intel_reg_t base, ec_code_intel_reg_t index, + uint32_t scale, int32_t offset); +void +ec_code_intel_op_mov_m2r(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, ec_code_intel_reg_t dst); +void +ec_code_intel_op_xor_r2r(ec_code_builder_t *builder, ec_code_intel_reg_t src, + ec_code_intel_reg_t dst); +void +ec_code_intel_op_xor_m2r(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, ec_code_intel_reg_t dst); +void +ec_code_intel_op_add_i2r(ec_code_builder_t *builder, int32_t value, + ec_code_intel_reg_t reg); +void +ec_code_intel_op_test_i2r(ec_code_builder_t *builder, uint32_t value, + ec_code_intel_reg_t reg); +void +ec_code_intel_op_jne(ec_code_builder_t *builder, uint32_t address); + +void +ec_code_intel_op_mov_sse2sse(ec_code_builder_t *builder, uint32_t src, + uint32_t dst); +void +ec_code_intel_op_mov_sse2m(ec_code_builder_t *builder, uint32_t src, + ec_code_intel_reg_t base, ec_code_intel_reg_t index, + uint32_t scale, int32_t offset); +void +ec_code_intel_op_mov_m2sse(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, uint32_t dst); +void +ec_code_intel_op_xor_sse2sse(ec_code_builder_t *builder, uint32_t src, + uint32_t dst); +void +ec_code_intel_op_xor_m2sse(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, uint32_t dst); + +void +ec_code_intel_op_mov_avx2avx(ec_code_builder_t *builder, uint32_t src, + uint32_t dst); +void +ec_code_intel_op_mov_avx2m(ec_code_builder_t *builder, uint32_t src, + ec_code_intel_reg_t base, ec_code_intel_reg_t index, + uint32_t scale, int32_t offset); +void +ec_code_intel_op_mov_m2avx(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, uint32_t dst); +void +ec_code_intel_op_xor_avx2avx(ec_code_builder_t *builder, uint32_t src, + uint32_t dst); +void +ec_code_intel_op_xor_m2avx(ec_code_builder_t *builder, ec_code_intel_reg_t base, + ec_code_intel_reg_t index, uint32_t scale, + int32_t offset, uint32_t dst); #endif /* __EC_CODE_INTEL_H__ */ diff --git a/xlators/cluster/ec/src/ec-combine.h b/xlators/cluster/ec/src/ec-combine.h index 19a42ded706..1010cc3be26 100644 --- a/xlators/cluster/ec/src/ec-combine.h +++ b/xlators/cluster/ec/src/ec-combine.h @@ -11,28 +11,34 @@ #ifndef __EC_COMBINE_H__ #define __EC_COMBINE_H__ -#define EC_COMBINE_DICT 0 +#define EC_COMBINE_DICT 0 #define EC_COMBINE_XDATA 1 -typedef int32_t (* ec_combine_f)(ec_fop_data_t * fop, ec_cbk_data_t * dst, - ec_cbk_data_t * src); +typedef int32_t (*ec_combine_f)(ec_fop_data_t *fop, ec_cbk_data_t *dst, + ec_cbk_data_t *src); -void ec_iatt_rebuild(ec_t * ec, struct iatt * iatt, int32_t count, - int32_t answers); +void +ec_iatt_rebuild(ec_t *ec, struct iatt *iatt, int32_t count, int32_t answers); -int32_t ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src, - int32_t count); -int32_t ec_dict_compare(dict_t * dict1, dict_t * dict2); -int32_t ec_vector_compare(struct iovec * dst_vector, int32_t dst_count, - struct iovec * src_vector, int32_t src_count); -int32_t ec_flock_compare(struct gf_flock * dst, struct gf_flock * src); -void ec_statvfs_combine(struct statvfs * dst, struct statvfs * src); +int32_t +ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src, + int32_t count); +int32_t +ec_dict_compare(dict_t *dict1, dict_t *dict2); +int32_t +ec_vector_compare(struct iovec *dst_vector, int32_t dst_count, + struct iovec *src_vector, int32_t src_count); +int32_t +ec_flock_compare(struct gf_flock *dst, struct gf_flock *src); +void +ec_statvfs_combine(struct statvfs *dst, struct statvfs *src); -int32_t ec_dict_combine(ec_cbk_data_t * cbk, int32_t which); +int32_t +ec_dict_combine(ec_cbk_data_t *cbk, int32_t which); -void ec_combine(ec_cbk_data_t * cbk, ec_combine_f combine); +void +ec_combine(ec_cbk_data_t *cbk, ec_combine_f combine); int32_t -ec_combine_write (ec_fop_data_t *fop, ec_cbk_data_t *dst, - ec_cbk_data_t *src); +ec_combine_write(ec_fop_data_t *fop, ec_cbk_data_t *dst, ec_cbk_data_t *src); #endif /* __EC_COMBINE_H__ */ diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h index a92752952ad..bea0c045a47 100644 --- a/xlators/cluster/ec/src/ec-common.h +++ b/xlators/cluster/ec/src/ec-common.h @@ -15,29 +15,26 @@ #include "ec-data.h" -typedef enum { - EC_DATA_TXN, - EC_METADATA_TXN -} ec_txn_t; +typedef enum { EC_DATA_TXN, EC_METADATA_TXN } ec_txn_t; -#define EC_FOP_HEAL -1 -#define EC_FOP_FHEAL -2 +#define EC_FOP_HEAL -1 +#define EC_FOP_FHEAL -2 #define EC_CONFIG_VERSION 0 #define EC_CONFIG_ALGORITHM 0 -#define EC_FLAG_LOCK_SHARED 0x0001 +#define EC_FLAG_LOCK_SHARED 0x0001 enum _ec_xattrop_flags { - EC_FLAG_XATTROP, - EC_FLAG_DATA_DIRTY, - EC_FLAG_METADATA_DIRTY, + EC_FLAG_XATTROP, + EC_FLAG_DATA_DIRTY, + EC_FLAG_METADATA_DIRTY, - /* Add any new flag here, before EC_FLAG_MAX. The maximum number of - * flags that can be defined is 16. */ + /* Add any new flag here, before EC_FLAG_MAX. The maximum number of + * flags that can be defined is 16. */ - EC_FLAG_MAX + EC_FLAG_MAX }; /* We keep two sets of flags. One to determine what's really providing the @@ -57,57 +54,63 @@ enum _ec_xattrop_flags { #define EC_SELFHEAL_BIT 62 -#define EC_MINIMUM_ONE -1 -#define EC_MINIMUM_MIN -2 -#define EC_MINIMUM_ALL -3 - -#define EC_UPDATE_DATA 1 -#define EC_UPDATE_META 2 -#define EC_QUERY_INFO 4 -#define EC_INODE_SIZE 8 - -#define EC_STATE_START 0 -#define EC_STATE_END 0 -#define EC_STATE_INIT 1 -#define EC_STATE_LOCK 2 -#define EC_STATE_DISPATCH 3 -#define EC_STATE_PREPARE_ANSWER 4 -#define EC_STATE_REPORT 5 -#define EC_STATE_LOCK_REUSE 6 -#define EC_STATE_UNLOCK 7 - -#define EC_STATE_DELAYED_START 100 - -#define EC_STATE_HEAL_ENTRY_LOOKUP 200 -#define EC_STATE_HEAL_ENTRY_PREPARE 201 -#define EC_STATE_HEAL_PRE_INODELK_LOCK 202 -#define EC_STATE_HEAL_PRE_INODE_LOOKUP 203 -#define EC_STATE_HEAL_XATTRIBUTES_REMOVE 204 -#define EC_STATE_HEAL_XATTRIBUTES_SET 205 -#define EC_STATE_HEAL_ATTRIBUTES 206 -#define EC_STATE_HEAL_OPEN 207 -#define EC_STATE_HEAL_REOPEN_FD 208 -#define EC_STATE_HEAL_UNLOCK 209 -#define EC_STATE_HEAL_UNLOCK_ENTRY 210 -#define EC_STATE_HEAL_DATA_LOCK 211 -#define EC_STATE_HEAL_DATA_COPY 212 -#define EC_STATE_HEAL_DATA_UNLOCK 213 -#define EC_STATE_HEAL_POST_INODELK_LOCK 214 -#define EC_STATE_HEAL_POST_INODE_LOOKUP 215 -#define EC_STATE_HEAL_SETATTR 216 -#define EC_STATE_HEAL_POST_INODELK_UNLOCK 217 -#define EC_STATE_HEAL_DISPATCH 218 - -gf_boolean_t ec_dispatch_one_retry (ec_fop_data_t *fop, ec_cbk_data_t **cbk); -void ec_dispatch_next(ec_fop_data_t * fop, uint32_t idx); - -void ec_complete(ec_fop_data_t *fop); - -void ec_update_good(ec_fop_data_t *fop, uintptr_t good); - -void ec_fop_set_error(ec_fop_data_t *fop, int32_t error); - -void __ec_fop_set_error(ec_fop_data_t *fop, int32_t error); +#define EC_MINIMUM_ONE -1 +#define EC_MINIMUM_MIN -2 +#define EC_MINIMUM_ALL -3 + +#define EC_UPDATE_DATA 1 +#define EC_UPDATE_META 2 +#define EC_QUERY_INFO 4 +#define EC_INODE_SIZE 8 + +#define EC_STATE_START 0 +#define EC_STATE_END 0 +#define EC_STATE_INIT 1 +#define EC_STATE_LOCK 2 +#define EC_STATE_DISPATCH 3 +#define EC_STATE_PREPARE_ANSWER 4 +#define EC_STATE_REPORT 5 +#define EC_STATE_LOCK_REUSE 6 +#define EC_STATE_UNLOCK 7 + +#define EC_STATE_DELAYED_START 100 + +#define EC_STATE_HEAL_ENTRY_LOOKUP 200 +#define EC_STATE_HEAL_ENTRY_PREPARE 201 +#define EC_STATE_HEAL_PRE_INODELK_LOCK 202 +#define EC_STATE_HEAL_PRE_INODE_LOOKUP 203 +#define EC_STATE_HEAL_XATTRIBUTES_REMOVE 204 +#define EC_STATE_HEAL_XATTRIBUTES_SET 205 +#define EC_STATE_HEAL_ATTRIBUTES 206 +#define EC_STATE_HEAL_OPEN 207 +#define EC_STATE_HEAL_REOPEN_FD 208 +#define EC_STATE_HEAL_UNLOCK 209 +#define EC_STATE_HEAL_UNLOCK_ENTRY 210 +#define EC_STATE_HEAL_DATA_LOCK 211 +#define EC_STATE_HEAL_DATA_COPY 212 +#define EC_STATE_HEAL_DATA_UNLOCK 213 +#define EC_STATE_HEAL_POST_INODELK_LOCK 214 +#define EC_STATE_HEAL_POST_INODE_LOOKUP 215 +#define EC_STATE_HEAL_SETATTR 216 +#define EC_STATE_HEAL_POST_INODELK_UNLOCK 217 +#define EC_STATE_HEAL_DISPATCH 218 + +gf_boolean_t +ec_dispatch_one_retry(ec_fop_data_t *fop, ec_cbk_data_t **cbk); +void +ec_dispatch_next(ec_fop_data_t *fop, uint32_t idx); + +void +ec_complete(ec_fop_data_t *fop); + +void +ec_update_good(ec_fop_data_t *fop, uintptr_t good); + +void +ec_fop_set_error(ec_fop_data_t *fop, int32_t error); + +void +__ec_fop_set_error(ec_fop_data_t *fop, int32_t error); ec_cbk_data_t * ec_fop_prepare_answer(ec_fop_data_t *fop, gf_boolean_t ro); @@ -115,55 +118,73 @@ ec_fop_prepare_answer(ec_fop_data_t *fop, gf_boolean_t ro); gf_boolean_t ec_cbk_set_error(ec_cbk_data_t *cbk, int32_t error, gf_boolean_t ro); -void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags, - off_t fl_start, size_t fl_size); -void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, - uint32_t flags); -void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags, - off_t fl_start, size_t fl_size); -void ec_lock(ec_fop_data_t * fop); -void ec_lock_reuse(ec_fop_data_t *fop); -void ec_unlock(ec_fop_data_t * fop); -void ec_lock_release(ec_t *ec, inode_t *inode); - -gf_boolean_t ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode, - uint64_t *size); -gf_boolean_t __ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode, - uint64_t *size); -gf_boolean_t ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode, - uint64_t size); -gf_boolean_t __ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode, - uint64_t size); -void ec_clear_inode_info(ec_fop_data_t *fop, inode_t *inode); - -void ec_flush_size_version(ec_fop_data_t * fop); - -void ec_dispatch_all(ec_fop_data_t * fop); -void ec_dispatch_inc(ec_fop_data_t * fop); -void ec_dispatch_min(ec_fop_data_t * fop); -void ec_dispatch_one(ec_fop_data_t * fop); - -void ec_sleep(ec_fop_data_t *fop); -void ec_resume(ec_fop_data_t * fop, int32_t error); -void ec_resume_parent(ec_fop_data_t * fop, int32_t error); - -void ec_manager(ec_fop_data_t * fop, int32_t error); -gf_boolean_t ec_is_recoverable_error (int32_t op_errno); -void ec_handle_healers_done (ec_fop_data_t *fop); +void +ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags, + off_t fl_start, size_t fl_size); +void +ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, + uint32_t flags); +void +ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags, off_t fl_start, + size_t fl_size); +void +ec_lock(ec_fop_data_t *fop); +void +ec_lock_reuse(ec_fop_data_t *fop); +void +ec_unlock(ec_fop_data_t *fop); +void +ec_lock_release(ec_t *ec, inode_t *inode); + +gf_boolean_t +ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode, uint64_t *size); +gf_boolean_t +__ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode, uint64_t *size); +gf_boolean_t +ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode, uint64_t size); +gf_boolean_t +__ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode, uint64_t size); +void +ec_clear_inode_info(ec_fop_data_t *fop, inode_t *inode); + +void +ec_flush_size_version(ec_fop_data_t *fop); + +void +ec_dispatch_all(ec_fop_data_t *fop); +void +ec_dispatch_inc(ec_fop_data_t *fop); +void +ec_dispatch_min(ec_fop_data_t *fop); +void +ec_dispatch_one(ec_fop_data_t *fop); + +void +ec_sleep(ec_fop_data_t *fop); +void +ec_resume(ec_fop_data_t *fop, int32_t error); +void +ec_resume_parent(ec_fop_data_t *fop, int32_t error); + +void +ec_manager(ec_fop_data_t *fop, int32_t error); +gf_boolean_t +ec_is_recoverable_error(int32_t op_errno); +void +ec_handle_healers_done(ec_fop_data_t *fop); int32_t -ec_heal_inspect (call_frame_t *frame, ec_t *ec, - inode_t *inode, unsigned char *locked_on, - gf_boolean_t self_locked, gf_boolean_t thorough, - ec_heal_need_t *need_heal); +ec_heal_inspect(call_frame_t *frame, ec_t *ec, inode_t *inode, + unsigned char *locked_on, gf_boolean_t self_locked, + gf_boolean_t thorough, ec_heal_need_t *need_heal); int32_t -ec_get_heal_info (xlator_t *this, loc_t *loc, dict_t **dict); +ec_get_heal_info(xlator_t *this, loc_t *loc, dict_t **dict); -int32_t ec_lock_unlocked(call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno, - dict_t *xdata); +int32_t +ec_lock_unlocked(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata); void -ec_update_fd_status (fd_t *fd, xlator_t *xl, - int child_index, int32_t ret_status); +ec_update_fd_status(fd_t *fd, xlator_t *xl, int child_index, + int32_t ret_status); #endif /* __EC_COMMON_H__ */ diff --git a/xlators/cluster/ec/src/ec-data.h b/xlators/cluster/ec/src/ec-data.h index 965bc1e25ef..112536d554c 100644 --- a/xlators/cluster/ec/src/ec-data.h +++ b/xlators/cluster/ec/src/ec-data.h @@ -13,20 +13,23 @@ #include "ec-types.h" -ec_cbk_data_t * ec_cbk_data_allocate(call_frame_t * frame, xlator_t * this, - ec_fop_data_t * fop, int32_t id, - int32_t idx, int32_t op_ret, - int32_t op_errno); -ec_fop_data_t * ec_fop_data_allocate(call_frame_t * frame, xlator_t * this, - int32_t id, uint32_t flags, - uintptr_t target, int32_t minimum, - ec_wind_f wind, ec_handler_f handler, - ec_cbk_t cbks, void * data); -void ec_fop_data_acquire(ec_fop_data_t * fop); -void ec_fop_data_release(ec_fop_data_t * fop); +ec_cbk_data_t * +ec_cbk_data_allocate(call_frame_t *frame, xlator_t *this, ec_fop_data_t *fop, + int32_t id, int32_t idx, int32_t op_ret, int32_t op_errno); +ec_fop_data_t * +ec_fop_data_allocate(call_frame_t *frame, xlator_t *this, int32_t id, + uint32_t flags, uintptr_t target, int32_t minimum, + ec_wind_f wind, ec_handler_f handler, ec_cbk_t cbks, + void *data); +void +ec_fop_data_acquire(ec_fop_data_t *fop); +void +ec_fop_data_release(ec_fop_data_t *fop); -void ec_fop_cleanup(ec_fop_data_t *fop); +void +ec_fop_cleanup(ec_fop_data_t *fop); -void ec_pending_fops_completed(ec_t *ec); +void +ec_pending_fops_completed(ec_t *ec); #endif /* __EC_DATA_H__ */ diff --git a/xlators/cluster/ec/src/ec-fops.h b/xlators/cluster/ec/src/ec-fops.h index 4a926cf4802..2858d829c73 100644 --- a/xlators/cluster/ec/src/ec-fops.h +++ b/xlators/cluster/ec/src/ec-fops.h @@ -16,199 +16,235 @@ #include "ec-types.h" #include "ec-common.h" -void ec_access(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_access_cbk_t func, void *data, loc_t * loc, - int32_t mask, dict_t * xdata); - -void ec_create(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_create_cbk_t func, void *data, loc_t * loc, - int32_t flags, mode_t mode, mode_t umask, fd_t * fd, - dict_t * xdata); - -void ec_entrylk(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_entrylk_cbk_t func, void *data, - const char * volume, loc_t * loc, const char * basename, - entrylk_cmd cmd, entrylk_type type, dict_t * xdata); - -void ec_fentrylk(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fentrylk_cbk_t func, void *data, - const char * volume, fd_t * fd, const char * basename, - entrylk_cmd cmd, entrylk_type type, dict_t * xdata); - -void ec_flush(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_flush_cbk_t func, void *data, fd_t * fd, - dict_t * xdata); - -void ec_fsync(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fsync_cbk_t func, void *data, fd_t * fd, - int32_t datasync, dict_t * xdata); - -void ec_fsyncdir(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fsyncdir_cbk_t func, void *data, - fd_t * fd, int32_t datasync, dict_t * xdata); - -void ec_getxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_getxattr_cbk_t func, void *data, - loc_t * loc, const char * name, dict_t * xdata); - -void ec_fgetxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fgetxattr_cbk_t func, void *data, - fd_t * fd, const char * name, dict_t * xdata); - -void ec_heal(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_heal_cbk_t func, void *data, loc_t * loc, - int32_t partial, dict_t *xdata); - -void ec_fheal(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fheal_cbk_t func, void *data, fd_t * fd, - int32_t partial, dict_t *xdata); - -void ec_inodelk (call_frame_t *frame, xlator_t *this, gf_lkowner_t *owner, - uintptr_t target, int32_t minimum, fop_inodelk_cbk_t func, - void *data, const char *volume, loc_t *loc, int32_t cmd, - struct gf_flock * flock, dict_t * xdata); - -void ec_finodelk(call_frame_t *frame, xlator_t *this, gf_lkowner_t *owner, - uintptr_t target, int32_t minimum, fop_finodelk_cbk_t func, - void *data, const char *volume, fd_t *fd, int32_t cmd, - struct gf_flock *flock, dict_t *xdata); - -void ec_link(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_link_cbk_t func, void *data, loc_t * oldloc, - loc_t * newloc, dict_t * xdata); - -void ec_lk(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_lk_cbk_t func, void *data, fd_t * fd, - int32_t cmd, struct gf_flock * flock, dict_t * xdata); - -void ec_lookup(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_lookup_cbk_t func, void *data, loc_t * loc, - dict_t * xdata); - -void ec_mkdir(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_mkdir_cbk_t func, void *data, loc_t * loc, - mode_t mode, mode_t umask, dict_t * xdata); - -void ec_mknod(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_mknod_cbk_t func, void *data, loc_t * loc, - mode_t mode, dev_t rdev, mode_t umask, dict_t * xdata); - -void ec_open(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_open_cbk_t func, void *data, loc_t * loc, - int32_t flags, fd_t * fd, dict_t * xdata); - -void ec_opendir(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_opendir_cbk_t func, void *data, - loc_t * loc, fd_t * fd, dict_t * xdata); - -void ec_readdir(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_readdir_cbk_t func, void *data, fd_t * fd, - size_t size, off_t offset, dict_t * xdata); - -void ec_readdirp(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_readdirp_cbk_t func, void *data, - fd_t * fd, size_t size, off_t offset, dict_t * xdata); - -void ec_readlink(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_readlink_cbk_t func, void *data, - loc_t * loc, size_t size, dict_t * xdata); - -void ec_readv(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_readv_cbk_t func, void *data, fd_t * fd, - size_t size, off_t offset, uint32_t flags, dict_t * xdata); - -void ec_removexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_removexattr_cbk_t func, void *data, - loc_t * loc, const char * name, dict_t * xdata); - -void ec_fremovexattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fremovexattr_cbk_t func, void *data, - fd_t * fd, const char * name, dict_t * xdata); - -void ec_rename(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_rename_cbk_t func, void *data, - loc_t * oldloc, loc_t * newloc, dict_t * xdata); - -void ec_rmdir(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_rmdir_cbk_t func, void *data, loc_t * loc, - int xflags, dict_t * xdata); - -void ec_setattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_setattr_cbk_t func, void *data, - loc_t * loc, struct iatt * stbuf, int32_t valid, - dict_t * xdata); - -void ec_fsetattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fsetattr_cbk_t func, void *data, - fd_t * fd, struct iatt * stbuf, int32_t valid, - dict_t * xdata); - -void ec_setxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_setxattr_cbk_t func, void *data, - loc_t * loc, dict_t * dict, int32_t flags, dict_t * xdata); - -void ec_fsetxattr(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fsetxattr_cbk_t func, void *data, - fd_t * fd, dict_t * dict, int32_t flags, dict_t * xdata); - -void ec_stat(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_stat_cbk_t func, void *data, loc_t * loc, - dict_t * xdata); - -void ec_fstat(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fstat_cbk_t func, void *data, fd_t * fd, - dict_t * xdata); - -void ec_statfs(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_statfs_cbk_t func, void *data, loc_t * loc, - dict_t * xdata); - -void ec_symlink(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_symlink_cbk_t func, void *data, - const char * linkname, loc_t * loc, mode_t umask, - dict_t * xdata); - -void ec_fallocate(call_frame_t *frame, xlator_t *this, uintptr_t target, - int32_t minimum, fop_fallocate_cbk_t func, void *data, fd_t *fd, - int32_t mode, off_t offset, size_t len, dict_t *xdata); - -void ec_discard(call_frame_t *frame, xlator_t *this, uintptr_t target, - int32_t minimum, fop_discard_cbk_t func, void *data, fd_t *fd, - off_t offset, size_t len, dict_t *xdata); - -void ec_truncate(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_truncate_cbk_t func, void *data, - loc_t * loc, off_t offset, dict_t * xdata); - -void ec_ftruncate(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_ftruncate_cbk_t func, void *data, - fd_t * fd, off_t offset, dict_t * xdata); - -void ec_unlink(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_unlink_cbk_t func, void *data, loc_t * loc, - int xflags, dict_t * xdata); - -void ec_writev(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_writev_cbk_t func, void *data, fd_t * fd, - struct iovec * vector, int32_t count, off_t offset, - uint32_t flags, struct iobref * iobref, dict_t * xdata); - -void ec_xattrop(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_xattrop_cbk_t func, void *data, - loc_t * loc, gf_xattrop_flags_t optype, dict_t * xattr, - dict_t * xdata); - -void ec_fxattrop(call_frame_t * frame, xlator_t * this, uintptr_t target, - int32_t minimum, fop_fxattrop_cbk_t func, void *data, - fd_t * fd, gf_xattrop_flags_t optype, dict_t * xattr, - dict_t * xdata); - -void ec_seek(call_frame_t *frame, xlator_t *this, uintptr_t target, - int32_t minimum, fop_seek_cbk_t func, void *data, fd_t *fd, - off_t offset, gf_seek_what_t what, dict_t *xdata); - -void ec_ipc(call_frame_t *frame, xlator_t *this, uintptr_t target, - int32_t minimum, fop_ipc_cbk_t func, void *data, int32_t op, - dict_t *xdata); +void +ec_access(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_access_cbk_t func, void *data, loc_t *loc, + int32_t mask, dict_t *xdata); + +void +ec_create(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_create_cbk_t func, void *data, loc_t *loc, + int32_t flags, mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata); + +void +ec_entrylk(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_entrylk_cbk_t func, void *data, + const char *volume, loc_t *loc, const char *basename, + entrylk_cmd cmd, entrylk_type type, dict_t *xdata); + +void +ec_fentrylk(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fentrylk_cbk_t func, void *data, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, + entrylk_type type, dict_t *xdata); + +void +ec_flush(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_flush_cbk_t func, void *data, fd_t *fd, dict_t *xdata); + +void +ec_fsync(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_fsync_cbk_t func, void *data, fd_t *fd, int32_t datasync, + dict_t *xdata); + +void +ec_fsyncdir(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fsyncdir_cbk_t func, void *data, fd_t *fd, + int32_t datasync, dict_t *xdata); + +void +ec_getxattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_getxattr_cbk_t func, void *data, loc_t *loc, + const char *name, dict_t *xdata); + +void +ec_fgetxattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fgetxattr_cbk_t func, void *data, fd_t *fd, + const char *name, dict_t *xdata); + +void +ec_heal(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_heal_cbk_t func, void *data, loc_t *loc, int32_t partial, + dict_t *xdata); + +void +ec_fheal(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_fheal_cbk_t func, void *data, fd_t *fd, int32_t partial, + dict_t *xdata); + +void +ec_inodelk(call_frame_t *frame, xlator_t *this, gf_lkowner_t *owner, + uintptr_t target, int32_t minimum, fop_inodelk_cbk_t func, + void *data, const char *volume, loc_t *loc, int32_t cmd, + struct gf_flock *flock, dict_t *xdata); + +void +ec_finodelk(call_frame_t *frame, xlator_t *this, gf_lkowner_t *owner, + uintptr_t target, int32_t minimum, fop_finodelk_cbk_t func, + void *data, const char *volume, fd_t *fd, int32_t cmd, + struct gf_flock *flock, dict_t *xdata); + +void +ec_link(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_link_cbk_t func, void *data, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); + +void +ec_lk(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_lk_cbk_t func, void *data, fd_t *fd, int32_t cmd, + struct gf_flock *flock, dict_t *xdata); + +void +ec_lookup(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_lookup_cbk_t func, void *data, loc_t *loc, + dict_t *xdata); + +void +ec_mkdir(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_mkdir_cbk_t func, void *data, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); + +void +ec_mknod(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_mknod_cbk_t func, void *data, loc_t *loc, mode_t mode, dev_t rdev, + mode_t umask, dict_t *xdata); + +void +ec_open(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_open_cbk_t func, void *data, loc_t *loc, int32_t flags, fd_t *fd, + dict_t *xdata); + +void +ec_opendir(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_opendir_cbk_t func, void *data, loc_t *loc, + fd_t *fd, dict_t *xdata); + +void +ec_readdir(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_readdir_cbk_t func, void *data, fd_t *fd, + size_t size, off_t offset, dict_t *xdata); + +void +ec_readdirp(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_readdirp_cbk_t func, void *data, fd_t *fd, + size_t size, off_t offset, dict_t *xdata); + +void +ec_readlink(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_readlink_cbk_t func, void *data, loc_t *loc, + size_t size, dict_t *xdata); + +void +ec_readv(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_readv_cbk_t func, void *data, fd_t *fd, size_t size, off_t offset, + uint32_t flags, dict_t *xdata); + +void +ec_removexattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_removexattr_cbk_t func, void *data, + loc_t *loc, const char *name, dict_t *xdata); + +void +ec_fremovexattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fremovexattr_cbk_t func, void *data, + fd_t *fd, const char *name, dict_t *xdata); + +void +ec_rename(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_rename_cbk_t func, void *data, loc_t *oldloc, + loc_t *newloc, dict_t *xdata); + +void +ec_rmdir(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_rmdir_cbk_t func, void *data, loc_t *loc, int xflags, + dict_t *xdata); + +void +ec_setattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_setattr_cbk_t func, void *data, loc_t *loc, + struct iatt *stbuf, int32_t valid, dict_t *xdata); + +void +ec_fsetattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fsetattr_cbk_t func, void *data, fd_t *fd, + struct iatt *stbuf, int32_t valid, dict_t *xdata); + +void +ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_setxattr_cbk_t func, void *data, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata); + +void +ec_fsetxattr(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fsetxattr_cbk_t func, void *data, fd_t *fd, + dict_t *dict, int32_t flags, dict_t *xdata); + +void +ec_stat(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_stat_cbk_t func, void *data, loc_t *loc, dict_t *xdata); + +void +ec_fstat(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_fstat_cbk_t func, void *data, fd_t *fd, dict_t *xdata); + +void +ec_statfs(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_statfs_cbk_t func, void *data, loc_t *loc, + dict_t *xdata); + +void +ec_symlink(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_symlink_cbk_t func, void *data, + const char *linkname, loc_t *loc, mode_t umask, dict_t *xdata); + +void +ec_fallocate(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fallocate_cbk_t func, void *data, fd_t *fd, + int32_t mode, off_t offset, size_t len, dict_t *xdata); + +void +ec_discard(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_discard_cbk_t func, void *data, fd_t *fd, + off_t offset, size_t len, dict_t *xdata); + +void +ec_truncate(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_truncate_cbk_t func, void *data, loc_t *loc, + off_t offset, dict_t *xdata); + +void +ec_ftruncate(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_ftruncate_cbk_t func, void *data, fd_t *fd, + off_t offset, dict_t *xdata); + +void +ec_unlink(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_unlink_cbk_t func, void *data, loc_t *loc, + int xflags, dict_t *xdata); + +void +ec_writev(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_writev_cbk_t func, void *data, fd_t *fd, + struct iovec *vector, int32_t count, off_t offset, uint32_t flags, + struct iobref *iobref, dict_t *xdata); + +void +ec_xattrop(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_xattrop_cbk_t func, void *data, loc_t *loc, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); + +void +ec_fxattrop(call_frame_t *frame, xlator_t *this, uintptr_t target, + int32_t minimum, fop_fxattrop_cbk_t func, void *data, fd_t *fd, + gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata); + +void +ec_seek(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_seek_cbk_t func, void *data, fd_t *fd, off_t offset, + gf_seek_what_t what, dict_t *xdata); + +void +ec_ipc(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, + fop_ipc_cbk_t func, void *data, int32_t op, dict_t *xdata); #endif /* __EC_FOPS_H__ */ diff --git a/xlators/cluster/ec/src/ec-galois.h b/xlators/cluster/ec/src/ec-galois.h index 02e6b6c1bc2..ed55d53e419 100644 --- a/xlators/cluster/ec/src/ec-galois.h +++ b/xlators/cluster/ec/src/ec-galois.h @@ -15,12 +15,18 @@ #include "ec-types.h" -ec_gf_t *ec_gf_prepare(uint32_t bits, uint32_t mod); -void ec_gf_destroy(ec_gf_t *gf); +ec_gf_t * +ec_gf_prepare(uint32_t bits, uint32_t mod); +void +ec_gf_destroy(ec_gf_t *gf); -uint32_t ec_gf_add(ec_gf_t *gf, uint32_t a, uint32_t b); -uint32_t ec_gf_mul(ec_gf_t *gf, uint32_t a, uint32_t b); -uint32_t ec_gf_div(ec_gf_t *gf, uint32_t a, uint32_t b); -uint32_t ec_gf_exp(ec_gf_t *gf, uint32_t a, uint32_t b); +uint32_t +ec_gf_add(ec_gf_t *gf, uint32_t a, uint32_t b); +uint32_t +ec_gf_mul(ec_gf_t *gf, uint32_t a, uint32_t b); +uint32_t +ec_gf_div(ec_gf_t *gf, uint32_t a, uint32_t b); +uint32_t +ec_gf_exp(ec_gf_t *gf, uint32_t a, uint32_t b); #endif /* __EC_GALOIS_H__ */ diff --git a/xlators/cluster/ec/src/ec-heald.h b/xlators/cluster/ec/src/ec-heald.h index 2a8488124c4..4d141d767e5 100644 --- a/xlators/cluster/ec/src/ec-heald.h +++ b/xlators/cluster/ec/src/ec-heald.h @@ -16,10 +16,10 @@ #include "ec-types.h" int -ec_xl_op (xlator_t *this, dict_t *input, dict_t *output); +ec_xl_op(xlator_t *this, dict_t *input, dict_t *output); int -ec_selfheal_daemon_init (xlator_t *this); +ec_selfheal_daemon_init(xlator_t *this); void ec_shd_index_healer_wake(ec_t *ec); diff --git a/xlators/cluster/ec/src/ec-helpers.h b/xlators/cluster/ec/src/ec-helpers.h index b548f802361..015db514e05 100644 --- a/xlators/cluster/ec/src/ec-helpers.h +++ b/xlators/cluster/ec/src/ec-helpers.h @@ -17,60 +17,77 @@ #define EC_IS_ERR(_x) (((uintptr_t)(_x) & ~0xfffULL) == ~0xfffULL) #define EC_GET_ERR(_x) ((int32_t)(intptr_t)(_x)) -#define EC_ALIGN_CHECK(_ptr, _align) \ - ((((uintptr_t)(_ptr)) & ((_align) - 1)) == 0) - -const char * ec_bin(char * str, size_t size, uint64_t value, int32_t digits); -const char * ec_fop_name(int32_t id); -void ec_trace(const char * event, ec_fop_data_t * fop, const char * fmt, ...); -int32_t ec_bits_consume(uint64_t * n); -size_t ec_iov_copy_to(void * dst, struct iovec * vector, int32_t count, - off_t offset, size_t size); -int32_t ec_buffer_alloc(xlator_t *xl, size_t size, struct iobref **piobref, - void **ptr); -int32_t ec_dict_set_array(dict_t *dict, char *key, - uint64_t *value, int32_t size); -int32_t ec_dict_get_array (dict_t *dict, char *key, uint64_t value[], - int32_t size); - -int32_t ec_dict_del_array(dict_t *dict, char *key, - uint64_t *value, int32_t size); -int32_t ec_dict_set_number(dict_t * dict, char * key, uint64_t value); -int32_t ec_dict_del_number(dict_t * dict, char * key, uint64_t * value); -int32_t ec_dict_set_config(dict_t * dict, char * key, ec_config_t * config); -int32_t ec_dict_del_config(dict_t * dict, char * key, ec_config_t * config); - -int32_t ec_loc_parent(xlator_t *xl, loc_t *loc, loc_t *parent); -int32_t ec_loc_update(xlator_t *xl, loc_t *loc, inode_t *inode, - struct iatt *iatt); - -int32_t ec_loc_from_fd(xlator_t * xl, loc_t * loc, fd_t * fd); -int32_t ec_loc_from_loc(xlator_t * xl, loc_t * dst, loc_t * src); - -void ec_owner_set(call_frame_t * frame, void * owner); -void ec_owner_copy(call_frame_t * frame, gf_lkowner_t * owner); - -ec_inode_t * __ec_inode_get(inode_t * inode, xlator_t * xl); -ec_inode_t * ec_inode_get(inode_t * inode, xlator_t * xl); -ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl); -ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl); +#define EC_ALIGN_CHECK(_ptr, _align) ((((uintptr_t)(_ptr)) & ((_align)-1)) == 0) + +const char * +ec_bin(char *str, size_t size, uint64_t value, int32_t digits); +const char * +ec_fop_name(int32_t id); +void +ec_trace(const char *event, ec_fop_data_t *fop, const char *fmt, ...); +int32_t +ec_bits_consume(uint64_t *n); +size_t +ec_iov_copy_to(void *dst, struct iovec *vector, int32_t count, off_t offset, + size_t size); +int32_t +ec_buffer_alloc(xlator_t *xl, size_t size, struct iobref **piobref, void **ptr); +int32_t +ec_dict_set_array(dict_t *dict, char *key, uint64_t *value, int32_t size); +int32_t +ec_dict_get_array(dict_t *dict, char *key, uint64_t value[], int32_t size); + +int32_t +ec_dict_del_array(dict_t *dict, char *key, uint64_t *value, int32_t size); +int32_t +ec_dict_set_number(dict_t *dict, char *key, uint64_t value); +int32_t +ec_dict_del_number(dict_t *dict, char *key, uint64_t *value); +int32_t +ec_dict_set_config(dict_t *dict, char *key, ec_config_t *config); +int32_t +ec_dict_del_config(dict_t *dict, char *key, ec_config_t *config); + +int32_t +ec_loc_parent(xlator_t *xl, loc_t *loc, loc_t *parent); +int32_t +ec_loc_update(xlator_t *xl, loc_t *loc, inode_t *inode, struct iatt *iatt); + +int32_t +ec_loc_from_fd(xlator_t *xl, loc_t *loc, fd_t *fd); +int32_t +ec_loc_from_loc(xlator_t *xl, loc_t *dst, loc_t *src); + +void +ec_owner_set(call_frame_t *frame, void *owner); +void +ec_owner_copy(call_frame_t *frame, gf_lkowner_t *owner); + +ec_inode_t * +__ec_inode_get(inode_t *inode, xlator_t *xl); +ec_inode_t * +ec_inode_get(inode_t *inode, xlator_t *xl); +ec_fd_t * +__ec_fd_get(fd_t *fd, xlator_t *xl); +ec_fd_t * +ec_fd_get(fd_t *fd, xlator_t *xl); static inline uint32_t ec_adjust_size_down(ec_t *ec, uint64_t *value, gf_boolean_t scale) { - uint64_t head, tmp; + uint64_t head, tmp; - tmp = *value; - head = tmp % ec->stripe_size; - tmp -= head; + tmp = *value; + head = tmp % ec->stripe_size; + tmp -= head; - if (scale) { - tmp /= ec->fragments; - } + if (scale) { + tmp /= ec->fragments; + } - *value = tmp; + *value = tmp; - return (uint32_t)head; + return (uint32_t)head; } /* This function can cause an overflow if the passed value is too near to the @@ -79,35 +96,35 @@ ec_adjust_size_down(ec_t *ec, uint64_t *value, gf_boolean_t scale) static inline int32_t ec_adjust_size_up(ec_t *ec, uint64_t *value, gf_boolean_t scale) { - uint64_t tmp; - int32_t tail; - - tmp = *value; - /* We first adjust the value down. This never causes overflow. */ - tail = ec_adjust_size_down(ec, &tmp, scale); - - /* If the value was already aligned, tail will be 0 and nothing else - * needs to be done. */ - if (tail != 0) { - /* Otherwise, we need to compute the real tail and adjust the - * returned value to the next stripe. */ - tail = ec->stripe_size - tail; - if (scale) { - tmp += ec->fragment_size; - } else { - tmp += ec->stripe_size; - /* If no scaling is requested there's a possibility of - * overflow. */ - if (tmp < ec->stripe_size) { - tmp = UINT64_MAX; - tail = -tail; - } - } + uint64_t tmp; + int32_t tail; + + tmp = *value; + /* We first adjust the value down. This never causes overflow. */ + tail = ec_adjust_size_down(ec, &tmp, scale); + + /* If the value was already aligned, tail will be 0 and nothing else + * needs to be done. */ + if (tail != 0) { + /* Otherwise, we need to compute the real tail and adjust the + * returned value to the next stripe. */ + tail = ec->stripe_size - tail; + if (scale) { + tmp += ec->fragment_size; + } else { + tmp += ec->stripe_size; + /* If no scaling is requested there's a possibility of + * overflow. */ + if (tmp < ec->stripe_size) { + tmp = UINT64_MAX; + tail = -tail; + } } + } - *value = tmp; + *value = tmp; - return tail; + return tail; } /* This function is equivalent to ec_adjust_size_down() but with a potentially @@ -115,19 +132,19 @@ ec_adjust_size_up(ec_t *ec, uint64_t *value, gf_boolean_t scale) static inline uint32_t ec_adjust_offset_down(ec_t *ec, off_t *value, gf_boolean_t scale) { - off_t head, tmp; + off_t head, tmp; - tmp = *value; - head = tmp % ec->stripe_size; - tmp -= head; + tmp = *value; + head = tmp % ec->stripe_size; + tmp -= head; - if (scale) { - tmp /= ec->fragments; - } + if (scale) { + tmp /= ec->fragments; + } - *value = tmp; + *value = tmp; - return (uint32_t)head; + return (uint32_t)head; } /* This function is equivalent to ec_adjust_size_up() but with a potentially @@ -135,48 +152,49 @@ ec_adjust_offset_down(ec_t *ec, off_t *value, gf_boolean_t scale) static inline int32_t ec_adjust_offset_up(ec_t *ec, off_t *value, gf_boolean_t scale) { - uint64_t tail, tmp; - - /* An offset is a signed type that can only have positive values, so - * we take advantage of this to avoid overflows. We simply convert it - * to an unsigned integer and operate normally. This won't cause an - * overflow. Overflow is only checked when converting back to an - * off_t. */ - tmp = *value; - tail = ec->stripe_size; - tail -= (tmp + tail - 1) % tail + 1; - tmp += tail; - if (scale) { - /* If we are scaling, we'll never get an overflow. */ - tmp /= ec->fragments; - } else { - /* Check if there has been an overflow. */ - if ((off_t)tmp < 0) { - tmp = GF_OFF_MAX; - tail = -tail; - } + uint64_t tail, tmp; + + /* An offset is a signed type that can only have positive values, so + * we take advantage of this to avoid overflows. We simply convert it + * to an unsigned integer and operate normally. This won't cause an + * overflow. Overflow is only checked when converting back to an + * off_t. */ + tmp = *value; + tail = ec->stripe_size; + tail -= (tmp + tail - 1) % tail + 1; + tmp += tail; + if (scale) { + /* If we are scaling, we'll never get an overflow. */ + tmp /= ec->fragments; + } else { + /* Check if there has been an overflow. */ + if ((off_t)tmp < 0) { + tmp = GF_OFF_MAX; + tail = -tail; } + } - *value = (off_t)tmp; + *value = (off_t)tmp; - return (int32_t)tail; + return (int32_t)tail; } -static inline int32_t ec_is_power_of_2(uint32_t value) +static inline int32_t +ec_is_power_of_2(uint32_t value) { return (value != 0) && ((value & (value - 1)) == 0); } gf_boolean_t -ec_is_internal_xattr (dict_t *dict, char *key, data_t *value, void *data); +ec_is_internal_xattr(dict_t *dict, char *key, data_t *value, void *data); void -ec_filter_internal_xattrs (dict_t *xattr); +ec_filter_internal_xattrs(dict_t *xattr); gf_boolean_t -ec_is_data_fop (glusterfs_fop_t fop); +ec_is_data_fop(glusterfs_fop_t fop); int32_t -ec_launch_replace_heal (ec_t *ec); +ec_launch_replace_heal(ec_t *ec); #endif /* __EC_HELPERS_H__ */ diff --git a/xlators/cluster/ec/src/ec-mem-types.h b/xlators/cluster/ec/src/ec-mem-types.h index 8109a422d9d..fc33d09ea33 100644 --- a/xlators/cluster/ec/src/ec-mem-types.h +++ b/xlators/cluster/ec/src/ec-mem-types.h @@ -13,8 +13,7 @@ #include "mem-types.h" -enum gf_ec_mem_types_ -{ +enum gf_ec_mem_types_ { ec_mt_ec_t = gf_common_mt_end + 1, ec_mt_xlator_t, ec_mt_ec_inode_t, diff --git a/xlators/cluster/ec/src/ec-messages.h b/xlators/cluster/ec/src/ec-messages.h index f5138ad8e57..5f673d69aa4 100644 --- a/xlators/cluster/ec/src/ec-messages.h +++ b/xlators/cluster/ec/src/ec-messages.h @@ -23,83 +23,38 @@ * glfs-message-id.h. */ -GLFS_MSGID(EC, - EC_MSG_INVALID_CONFIG, - EC_MSG_HEAL_FAIL, - EC_MSG_DICT_COMBINE_FAIL, - EC_MSG_STIME_COMBINE_FAIL, - EC_MSG_INVALID_DICT_NUMS, - EC_MSG_IATT_COMBINE_FAIL, - EC_MSG_INVALID_FORMAT, - EC_MSG_DICT_GET_FAILED, - EC_MSG_UNHANDLED_STATE, - EC_MSG_FILE_DESC_REF_FAIL, - EC_MSG_LOC_COPY_FAIL, - EC_MSG_BUF_REF_FAIL, - EC_MSG_DICT_REF_FAIL, - EC_MSG_LK_UNLOCK_FAILED, - EC_MSG_UNLOCK_FAILED, - EC_MSG_LOC_PARENT_INODE_MISSING, - EC_MSG_INVALID_LOC_NAME, - EC_MSG_NO_MEMORY, - EC_MSG_GFID_MISMATCH, - EC_MSG_UNSUPPORTED_VERSION, - EC_MSG_FD_CREATE_FAIL, - EC_MSG_READDIRP_REQ_PREP_FAIL, - EC_MSG_LOOKUP_REQ_PREP_FAIL, - EC_MSG_INODE_REF_FAIL, - EC_MSG_LOOKUP_READAHEAD_FAIL, - EC_MSG_FRAME_MISMATCH, - EC_MSG_XLATOR_MISMATCH, - EC_MSG_VECTOR_MISMATCH, - EC_MSG_IATT_MISMATCH, - EC_MSG_FD_MISMATCH, - EC_MSG_DICT_MISMATCH, - EC_MSG_INDEX_DIR_GET_FAIL, - EC_MSG_PREOP_LOCK_FAILED, - EC_MSG_CHILDS_INSUFFICIENT, - EC_MSG_OP_EXEC_UNAVAIL, - EC_MSG_UNLOCK_DELAY_FAILED, - EC_MSG_SIZE_VERS_UPDATE_FAIL, - EC_MSG_INVALID_REQUEST, - EC_MSG_INVALID_LOCK_TYPE, - EC_MSG_SIZE_VERS_GET_FAIL, - EC_MSG_FILE_SIZE_GET_FAIL, - EC_MSG_FOP_MISMATCH, - EC_MSG_SUBVOL_ID_DICT_SET_FAIL, - EC_MSG_SUBVOL_BUILD_FAIL, - EC_MSG_XLATOR_INIT_FAIL, - EC_MSG_NO_PARENTS, - EC_MSG_TIMER_CREATE_FAIL, - EC_MSG_TOO_MANY_SUBVOLS, - EC_MSG_DATA_UNAVAILABLE, - EC_MSG_INODE_REMOVE_FAIL, - EC_MSG_INVALID_REDUNDANCY, - EC_MSG_XLATOR_PARSE_OPT_FAIL, - EC_MSG_OP_FAIL_ON_SUBVOLS, - EC_MSG_INVALID_INODE, - EC_MSG_LOCK_MISMATCH, - EC_MSG_XDATA_MISMATCH, - EC_MSG_HEALING_INFO, - EC_MSG_HEAL_SUCCESS, - EC_MSG_FULL_SWEEP_START, - EC_MSG_FULL_SWEEP_STOP, - EC_MSG_INVALID_FOP, - EC_MSG_EC_UP, - EC_MSG_EC_DOWN, - EC_MSG_SIZE_XATTR_GET_FAIL, - EC_MSG_VER_XATTR_GET_FAIL, - EC_MSG_CONFIG_XATTR_GET_FAIL, - EC_MSG_CONFIG_XATTR_INVALID, - EC_MSG_EXTENSION, - EC_MSG_EXTENSION_NONE, - EC_MSG_EXTENSION_UNKNOWN, - EC_MSG_EXTENSION_UNSUPPORTED, - EC_MSG_EXTENSION_FAILED, - EC_MSG_NO_GF, - EC_MSG_MATRIX_FAILED, - EC_MSG_DYN_CREATE_FAILED, - EC_MSG_DYN_CODEGEN_FAILED -); +GLFS_MSGID(EC, EC_MSG_INVALID_CONFIG, EC_MSG_HEAL_FAIL, + EC_MSG_DICT_COMBINE_FAIL, EC_MSG_STIME_COMBINE_FAIL, + EC_MSG_INVALID_DICT_NUMS, EC_MSG_IATT_COMBINE_FAIL, + EC_MSG_INVALID_FORMAT, EC_MSG_DICT_GET_FAILED, + EC_MSG_UNHANDLED_STATE, EC_MSG_FILE_DESC_REF_FAIL, + EC_MSG_LOC_COPY_FAIL, EC_MSG_BUF_REF_FAIL, EC_MSG_DICT_REF_FAIL, + EC_MSG_LK_UNLOCK_FAILED, EC_MSG_UNLOCK_FAILED, + EC_MSG_LOC_PARENT_INODE_MISSING, EC_MSG_INVALID_LOC_NAME, + EC_MSG_NO_MEMORY, EC_MSG_GFID_MISMATCH, EC_MSG_UNSUPPORTED_VERSION, + EC_MSG_FD_CREATE_FAIL, EC_MSG_READDIRP_REQ_PREP_FAIL, + EC_MSG_LOOKUP_REQ_PREP_FAIL, EC_MSG_INODE_REF_FAIL, + EC_MSG_LOOKUP_READAHEAD_FAIL, EC_MSG_FRAME_MISMATCH, + EC_MSG_XLATOR_MISMATCH, EC_MSG_VECTOR_MISMATCH, EC_MSG_IATT_MISMATCH, + EC_MSG_FD_MISMATCH, EC_MSG_DICT_MISMATCH, EC_MSG_INDEX_DIR_GET_FAIL, + EC_MSG_PREOP_LOCK_FAILED, EC_MSG_CHILDS_INSUFFICIENT, + EC_MSG_OP_EXEC_UNAVAIL, EC_MSG_UNLOCK_DELAY_FAILED, + EC_MSG_SIZE_VERS_UPDATE_FAIL, EC_MSG_INVALID_REQUEST, + EC_MSG_INVALID_LOCK_TYPE, EC_MSG_SIZE_VERS_GET_FAIL, + EC_MSG_FILE_SIZE_GET_FAIL, EC_MSG_FOP_MISMATCH, + EC_MSG_SUBVOL_ID_DICT_SET_FAIL, EC_MSG_SUBVOL_BUILD_FAIL, + EC_MSG_XLATOR_INIT_FAIL, EC_MSG_NO_PARENTS, EC_MSG_TIMER_CREATE_FAIL, + EC_MSG_TOO_MANY_SUBVOLS, EC_MSG_DATA_UNAVAILABLE, + EC_MSG_INODE_REMOVE_FAIL, EC_MSG_INVALID_REDUNDANCY, + EC_MSG_XLATOR_PARSE_OPT_FAIL, EC_MSG_OP_FAIL_ON_SUBVOLS, + EC_MSG_INVALID_INODE, EC_MSG_LOCK_MISMATCH, EC_MSG_XDATA_MISMATCH, + EC_MSG_HEALING_INFO, EC_MSG_HEAL_SUCCESS, EC_MSG_FULL_SWEEP_START, + EC_MSG_FULL_SWEEP_STOP, EC_MSG_INVALID_FOP, EC_MSG_EC_UP, + EC_MSG_EC_DOWN, EC_MSG_SIZE_XATTR_GET_FAIL, + EC_MSG_VER_XATTR_GET_FAIL, EC_MSG_CONFIG_XATTR_GET_FAIL, + EC_MSG_CONFIG_XATTR_INVALID, EC_MSG_EXTENSION, EC_MSG_EXTENSION_NONE, + EC_MSG_EXTENSION_UNKNOWN, EC_MSG_EXTENSION_UNSUPPORTED, + EC_MSG_EXTENSION_FAILED, EC_MSG_NO_GF, EC_MSG_MATRIX_FAILED, + EC_MSG_DYN_CREATE_FAILED, EC_MSG_DYN_CODEGEN_FAILED); #endif /* !_EC_MESSAGES_H_ */ diff --git a/xlators/cluster/ec/src/ec-method.h b/xlators/cluster/ec/src/ec-method.h index 9ba5069ff0e..3d6393bed06 100644 --- a/xlators/cluster/ec/src/ec-method.h +++ b/xlators/cluster/ec/src/ec-method.h @@ -24,7 +24,7 @@ /* Determines the maximum size of the matrix used to encode/decode data */ #define EC_METHOD_MAX_FRAGMENTS 16 /* Determines the maximum number of usable elements in the Galois Field */ -#define EC_METHOD_MAX_NODES (EC_GF_SIZE - 1) +#define EC_METHOD_MAX_NODES (EC_GF_SIZE - 1) #define EC_METHOD_WORD_SIZE 64 @@ -34,7 +34,8 @@ int32_t ec_method_init(xlator_t *xl, ec_matrix_list_t *list, uint32_t columns, uint32_t rows, uint32_t max, const char *gen); -void ec_method_fini(ec_matrix_list_t *list); +void +ec_method_fini(ec_matrix_list_t *list); int32_t ec_method_update(xlator_t *xl, ec_matrix_list_t *list, const char *gen); diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h index 3a0267bf176..80d9c0d4014 100644 --- a/xlators/cluster/ec/src/ec-types.h +++ b/xlators/cluster/ec/src/ec-types.h @@ -128,75 +128,59 @@ typedef void (*ec_wind_f)(ec_t *, ec_fop_data_t *, int32_t); typedef int32_t (*ec_handler_f)(ec_fop_data_t *, int32_t); typedef void (*ec_resume_f)(ec_fop_data_t *, int32_t); -enum _ec_read_policy { - EC_ROUND_ROBIN, - EC_GFID_HASH, - EC_READ_POLICY_MAX -}; +enum _ec_read_policy { EC_ROUND_ROBIN, EC_GFID_HASH, EC_READ_POLICY_MAX }; -enum _ec_heal_need { - EC_HEAL_NONEED, - EC_HEAL_MAYBE, - EC_HEAL_MUST -}; +enum _ec_heal_need { EC_HEAL_NONEED, EC_HEAL_MAYBE, EC_HEAL_MUST }; -enum _ec_stripe_part { - EC_STRIPE_HEAD, - EC_STRIPE_TAIL -}; +enum _ec_stripe_part { EC_STRIPE_HEAD, EC_STRIPE_TAIL }; /* Enumartions to indicate FD status. */ -typedef enum { - EC_FD_NOT_OPENED, - EC_FD_OPENED, - EC_FD_OPENING -} ec_fd_status_t; +typedef enum { EC_FD_NOT_OPENED, EC_FD_OPENED, EC_FD_OPENING } ec_fd_status_t; struct _ec_config { uint32_t version; - uint8_t algorithm; - uint8_t gf_word_size; - uint8_t bricks; - uint8_t redundancy; + uint8_t algorithm; + uint8_t gf_word_size; + uint8_t bricks; + uint8_t redundancy; uint32_t chunk_size; }; struct _ec_fd { - loc_t loc; + loc_t loc; uintptr_t open; - int32_t flags; + int32_t flags; ec_fd_status_t fd_status[0]; }; struct _ec_stripe { - struct list_head lru; /* LRU list member */ - uint64_t frag_offset; /* Fragment offset of this stripe */ - char data[]; /* Contents of the stripe */ + struct list_head lru; /* LRU list member */ + uint64_t frag_offset; /* Fragment offset of this stripe */ + char data[]; /* Contents of the stripe */ }; struct _ec_stripe_list { - struct list_head lru; - uint32_t count; - uint32_t max; + struct list_head lru; + uint32_t count; + uint32_t max; }; struct _ec_inode { - ec_lock_t *inode_lock; - gf_boolean_t have_info; - gf_boolean_t have_config; - gf_boolean_t have_version; - gf_boolean_t have_size; - ec_config_t config; - uint64_t pre_version[2]; - uint64_t post_version[2]; - uint64_t pre_size; - uint64_t post_size; - uint64_t dirty[2]; - struct list_head heal; - ec_stripe_list_t stripe_cache; + ec_lock_t *inode_lock; + gf_boolean_t have_info; + gf_boolean_t have_config; + gf_boolean_t have_version; + gf_boolean_t have_size; + ec_config_t config; + uint64_t pre_version[2]; + uint64_t post_version[2]; + uint64_t pre_size; + uint64_t post_size; + uint64_t dirty[2]; + struct list_head heal; + ec_stripe_list_t stripe_cache; }; - typedef int32_t (*fop_heal_cbk_t)(call_frame_t *, void *, xlator_t *, int32_t, int32_t, uintptr_t, uintptr_t, uintptr_t, dict_t *); @@ -205,105 +189,105 @@ typedef int32_t (*fop_fheal_cbk_t)(call_frame_t *, void *, xlator_t *, int32_t, dict_t *); union _ec_cbk { - fop_access_cbk_t access; - fop_create_cbk_t create; - fop_discard_cbk_t discard; - fop_entrylk_cbk_t entrylk; - fop_fentrylk_cbk_t fentrylk; - fop_fallocate_cbk_t fallocate; - fop_flush_cbk_t flush; - fop_fsync_cbk_t fsync; - fop_fsyncdir_cbk_t fsyncdir; - fop_getxattr_cbk_t getxattr; - fop_fgetxattr_cbk_t fgetxattr; - fop_heal_cbk_t heal; - fop_fheal_cbk_t fheal; - fop_inodelk_cbk_t inodelk; - fop_finodelk_cbk_t finodelk; - fop_link_cbk_t link; - fop_lk_cbk_t lk; - fop_lookup_cbk_t lookup; - fop_mkdir_cbk_t mkdir; - fop_mknod_cbk_t mknod; - fop_open_cbk_t open; - fop_opendir_cbk_t opendir; - fop_readdir_cbk_t readdir; - fop_readdirp_cbk_t readdirp; - fop_readlink_cbk_t readlink; - fop_readv_cbk_t readv; - fop_removexattr_cbk_t removexattr; + fop_access_cbk_t access; + fop_create_cbk_t create; + fop_discard_cbk_t discard; + fop_entrylk_cbk_t entrylk; + fop_fentrylk_cbk_t fentrylk; + fop_fallocate_cbk_t fallocate; + fop_flush_cbk_t flush; + fop_fsync_cbk_t fsync; + fop_fsyncdir_cbk_t fsyncdir; + fop_getxattr_cbk_t getxattr; + fop_fgetxattr_cbk_t fgetxattr; + fop_heal_cbk_t heal; + fop_fheal_cbk_t fheal; + fop_inodelk_cbk_t inodelk; + fop_finodelk_cbk_t finodelk; + fop_link_cbk_t link; + fop_lk_cbk_t lk; + fop_lookup_cbk_t lookup; + fop_mkdir_cbk_t mkdir; + fop_mknod_cbk_t mknod; + fop_open_cbk_t open; + fop_opendir_cbk_t opendir; + fop_readdir_cbk_t readdir; + fop_readdirp_cbk_t readdirp; + fop_readlink_cbk_t readlink; + fop_readv_cbk_t readv; + fop_removexattr_cbk_t removexattr; fop_fremovexattr_cbk_t fremovexattr; - fop_rename_cbk_t rename; - fop_rmdir_cbk_t rmdir; - fop_setattr_cbk_t setattr; - fop_fsetattr_cbk_t fsetattr; - fop_setxattr_cbk_t setxattr; - fop_fsetxattr_cbk_t fsetxattr; - fop_stat_cbk_t stat; - fop_fstat_cbk_t fstat; - fop_statfs_cbk_t statfs; - fop_symlink_cbk_t symlink; - fop_truncate_cbk_t truncate; - fop_ftruncate_cbk_t ftruncate; - fop_unlink_cbk_t unlink; - fop_writev_cbk_t writev; - fop_xattrop_cbk_t xattrop; - fop_fxattrop_cbk_t fxattrop; - fop_zerofill_cbk_t zerofill; - fop_seek_cbk_t seek; - fop_ipc_cbk_t ipc; + fop_rename_cbk_t rename; + fop_rmdir_cbk_t rmdir; + fop_setattr_cbk_t setattr; + fop_fsetattr_cbk_t fsetattr; + fop_setxattr_cbk_t setxattr; + fop_fsetxattr_cbk_t fsetxattr; + fop_stat_cbk_t stat; + fop_fstat_cbk_t fstat; + fop_statfs_cbk_t statfs; + fop_symlink_cbk_t symlink; + fop_truncate_cbk_t truncate; + fop_ftruncate_cbk_t ftruncate; + fop_unlink_cbk_t unlink; + fop_writev_cbk_t writev; + fop_xattrop_cbk_t xattrop; + fop_fxattrop_cbk_t fxattrop; + fop_zerofill_cbk_t zerofill; + fop_seek_cbk_t seek; + fop_ipc_cbk_t ipc; }; struct _ec_lock { - ec_inode_t *ctx; - gf_timer_t *timer; + ec_inode_t *ctx; + gf_timer_t *timer; /* List of owners of this lock. All fops added to this list are running * concurrently. */ - struct list_head owners; + struct list_head owners; /* List of fops waiting to be an owner of the lock. Fops are added to this * list when the current owner has an incompatible access (conflicting lock) * or the lock is not acquired yet. */ - struct list_head waiting; + struct list_head waiting; /* List of fops that will wait until the next unlock/lock cycle. This * happens when the currently acquired lock is decided to be released as * soon as possible. In this case, all frozen fops will be continued only * after the lock is reacquired. */ - struct list_head frozen; - - uintptr_t mask; - uintptr_t good_mask; - uintptr_t healing; - uint32_t refs_owners; /* Refs for fops owning the lock */ - uint32_t refs_pending; /* Refs assigned to fops being prepared */ - uint32_t waiting_flags; /*Track xattrop/dirty marking*/ - gf_boolean_t acquired; - gf_boolean_t unlock_now; - gf_boolean_t release; - gf_boolean_t query; - fd_t *fd; - loc_t loc; + struct list_head frozen; + + uintptr_t mask; + uintptr_t good_mask; + uintptr_t healing; + uint32_t refs_owners; /* Refs for fops owning the lock */ + uint32_t refs_pending; /* Refs assigned to fops being prepared */ + uint32_t waiting_flags; /*Track xattrop/dirty marking*/ + gf_boolean_t acquired; + gf_boolean_t unlock_now; + gf_boolean_t release; + gf_boolean_t query; + fd_t *fd; + loc_t loc; union { - entrylk_type type; - struct gf_flock flock; + entrylk_type type; + struct gf_flock flock; }; }; struct _ec_lock_link { - ec_lock_t *lock; - ec_fop_data_t *fop; - struct list_head owner_list; - struct list_head wait_list; - gf_boolean_t update[2]; - gf_boolean_t dirty[2]; - gf_boolean_t optimistic_changelog; - loc_t *base; - uint64_t size; - uint32_t waiting_flags; - off_t fl_start; - off_t fl_end; + ec_lock_t *lock; + ec_fop_data_t *fop; + struct list_head owner_list; + struct list_head wait_list; + gf_boolean_t update[2]; + gf_boolean_t dirty[2]; + gf_boolean_t optimistic_changelog; + loc_t *base; + uint64_t size; + uint32_t waiting_flags; + off_t fl_start; + off_t fl_end; }; /* This structure keeps a range of fragment offsets affected by a fop. Since @@ -320,113 +304,113 @@ struct _ec_fragment_range { /* EC xlator data structure to collect all the data required to perform * the file operation.*/ struct _ec_fop_data { - int32_t id; /* ID of the file operation */ - int32_t refs; - int32_t state; - int32_t minimum; /* Minimum number of successful - operation required to conclude a - fop as successful */ - int32_t expected; - int32_t winds; - int32_t jobs; - int32_t error; - ec_fop_data_t *parent; - xlator_t *xl; /* points to EC xlator */ - call_frame_t *req_frame; /* frame of the calling xlator */ - call_frame_t *frame; /* frame used by this fop */ - struct list_head cbk_list; /* sorted list of groups of answers */ - struct list_head answer_list; /* list of answers */ - struct list_head pending_list; /* member of ec_t.pending_fops */ - ec_cbk_data_t *answer; /* accepted answer */ - int32_t lock_count; - int32_t locked; - ec_lock_link_t locks[2]; - int32_t first_lock; - gf_lock_t lock; - - uint32_t flags; - uint32_t first; - uintptr_t mask; - uintptr_t healing; /*Dispatch is done but call is successful only - if fop->minimum number of subvolumes succeed - which are not healing*/ - uintptr_t remaining; - uintptr_t received; /* Mask of responses */ - uintptr_t good; - - uid_t uid; - gid_t gid; - - ec_wind_f wind; /* Function to wind to */ - ec_handler_f handler; /* FOP manager function */ - ec_resume_f resume; - ec_cbk_t cbks; /* Callback function for this FOP */ - void *data; - ec_heal_t *heal; - struct list_head healer; - - uint64_t user_size; - uint32_t head; - - int32_t use_fd; /* Indicates whether this FOP uses FD or - not */ - - dict_t *xdata; - dict_t *dict; - int32_t int32; - uint32_t uint32; - uint64_t size; - off_t offset; - mode_t mode[2]; - entrylk_cmd entrylk_cmd; - entrylk_type entrylk_type; + int32_t id; /* ID of the file operation */ + int32_t refs; + int32_t state; + int32_t minimum; /* Minimum number of successful + operation required to conclude a + fop as successful */ + int32_t expected; + int32_t winds; + int32_t jobs; + int32_t error; + ec_fop_data_t *parent; + xlator_t *xl; /* points to EC xlator */ + call_frame_t *req_frame; /* frame of the calling xlator */ + call_frame_t *frame; /* frame used by this fop */ + struct list_head cbk_list; /* sorted list of groups of answers */ + struct list_head answer_list; /* list of answers */ + struct list_head pending_list; /* member of ec_t.pending_fops */ + ec_cbk_data_t *answer; /* accepted answer */ + int32_t lock_count; + int32_t locked; + ec_lock_link_t locks[2]; + int32_t first_lock; + gf_lock_t lock; + + uint32_t flags; + uint32_t first; + uintptr_t mask; + uintptr_t healing; /*Dispatch is done but call is successful only + if fop->minimum number of subvolumes succeed + which are not healing*/ + uintptr_t remaining; + uintptr_t received; /* Mask of responses */ + uintptr_t good; + + uid_t uid; + gid_t gid; + + ec_wind_f wind; /* Function to wind to */ + ec_handler_f handler; /* FOP manager function */ + ec_resume_f resume; + ec_cbk_t cbks; /* Callback function for this FOP */ + void *data; + ec_heal_t *heal; + struct list_head healer; + + uint64_t user_size; + uint32_t head; + + int32_t use_fd; /* Indicates whether this FOP uses FD or + not */ + + dict_t *xdata; + dict_t *dict; + int32_t int32; + uint32_t uint32; + uint64_t size; + off_t offset; + mode_t mode[2]; + entrylk_cmd entrylk_cmd; + entrylk_type entrylk_type; gf_xattrop_flags_t xattrop_flags; - dev_t dev; - inode_t *inode; - fd_t *fd; /* FD of the file on which FOP is - being carried upon */ - struct iatt iatt; - char *str[2]; - loc_t loc[2]; /* Holds the location details for - the file */ - struct gf_flock flock; - struct iovec *vector; - struct iobref *buffers; - gf_seek_what_t seek; - ec_fragment_range_t frag_range; /* This will hold the range of stripes - affected by the fop. */ - char *errstr; /*String of fop name, path and gfid + dev_t dev; + inode_t *inode; + fd_t *fd; /* FD of the file on which FOP is + being carried upon */ + struct iatt iatt; + char *str[2]; + loc_t loc[2]; /* Holds the location details for + the file */ + struct gf_flock flock; + struct iovec *vector; + struct iobref *buffers; + gf_seek_what_t seek; + ec_fragment_range_t frag_range; /* This will hold the range of stripes + affected by the fop. */ + char *errstr; /*String of fop name, path and gfid to be used in gf_msg. */ }; struct _ec_cbk_data { - struct list_head list; /* item in the sorted list of groups */ - struct list_head answer_list; /* item in the list of answers */ - ec_fop_data_t *fop; - ec_cbk_data_t *next; /* next answer in the same group */ - uint32_t idx; - int32_t op_ret; - int32_t op_errno; - int32_t count; - uintptr_t mask; - - dict_t *xdata; - dict_t *dict; - int32_t int32; - uintptr_t uintptr[3]; - uint64_t size; - uint64_t version[2]; - inode_t *inode; - fd_t *fd; - struct statvfs statvfs; - struct iatt iatt[5]; - struct gf_flock flock; - struct iovec *vector; - struct iobref *buffers; - char *str; - gf_dirent_t entries; - off_t offset; - gf_seek_what_t what; + struct list_head list; /* item in the sorted list of groups */ + struct list_head answer_list; /* item in the list of answers */ + ec_fop_data_t *fop; + ec_cbk_data_t *next; /* next answer in the same group */ + uint32_t idx; + int32_t op_ret; + int32_t op_errno; + int32_t count; + uintptr_t mask; + + dict_t *xdata; + dict_t *dict; + int32_t int32; + uintptr_t uintptr[3]; + uint64_t size; + uint64_t version[2]; + inode_t *inode; + fd_t *fd; + struct statvfs statvfs; + struct iatt iatt[5]; + struct gf_flock flock; + struct iovec *vector; + struct iobref *buffers; + char *str; + gf_dirent_t entries; + off_t offset; + gf_seek_what_t what; }; enum _ec_gf_opcode { @@ -441,26 +425,26 @@ enum _ec_gf_opcode { struct _ec_gf_op { ec_gf_opcode_t op; - uint32_t arg1; - uint32_t arg2; - uint32_t arg3; + uint32_t arg1; + uint32_t arg2; + uint32_t arg3; }; struct _ec_gf_mul { - uint32_t regs; - uint32_t map[EC_GF_MAX_REGS]; + uint32_t regs; + uint32_t map[EC_GF_MAX_REGS]; ec_gf_op_t *ops; }; struct _ec_gf { - uint32_t bits; - uint32_t size; - uint32_t mod; - uint32_t min_ops; - uint32_t max_ops; - uint32_t avg_ops; - uint32_t *log; - uint32_t *pow; + uint32_t bits; + uint32_t size; + uint32_t mod; + uint32_t min_ops; + uint32_t max_ops; + uint32_t avg_ops; + uint32_t *log; + uint32_t *pow; ec_gf_mul_t **table; }; @@ -483,207 +467,206 @@ struct _ec_code_gen { }; struct _ec_code { - gf_lock_t lock; - struct list_head spaces; - ec_gf_t *gf; - ec_code_gen_t *gen; + gf_lock_t lock; + struct list_head spaces; + ec_gf_t *gf; + ec_code_gen_t *gen; }; struct _ec_code_arg { - uint32_t value; + uint32_t value; }; struct _ec_code_op { - ec_gf_opcode_t op; - ec_code_arg_t arg1; - ec_code_arg_t arg2; - ec_code_arg_t arg3; + ec_gf_opcode_t op; + ec_code_arg_t arg1; + ec_code_arg_t arg2; + ec_code_arg_t arg3; }; struct _ec_code_builder { - ec_code_t *code; - uint64_t address; - uint8_t *data; - uint32_t size; - int32_t error; - uint32_t regs; - uint32_t bits; - uint32_t width; - uint32_t count; - uint32_t base; - uint32_t map[EC_GF_MAX_REGS]; - gf_boolean_t linear; - uint64_t loop; - ec_code_op_t ops[0]; + ec_code_t *code; + uint64_t address; + uint8_t *data; + uint32_t size; + int32_t error; + uint32_t regs; + uint32_t bits; + uint32_t width; + uint32_t count; + uint32_t base; + uint32_t map[EC_GF_MAX_REGS]; + gf_boolean_t linear; + uint64_t loop; + ec_code_op_t ops[0]; }; struct _ec_code_chunk { - struct list_head list; - size_t size; - ec_code_space_t *space; + struct list_head list; + size_t size; + ec_code_space_t *space; }; struct _ec_code_space { - struct list_head list; - struct list_head chunks; - ec_code_t *code; - void *exec; - size_t size; + struct list_head list; + struct list_head chunks; + ec_code_t *code; + void *exec; + size_t size; }; - union _ec_code_func { - ec_code_func_linear_t linear; + ec_code_func_linear_t linear; ec_code_func_interleaved_t interleaved; }; struct _ec_matrix_row { - ec_code_func_t func; - uint32_t *values; + ec_code_func_t func; + uint32_t *values; }; struct _ec_matrix { struct list_head lru; - uint32_t refs; - uint32_t columns; - uint32_t rows; - uintptr_t mask; - ec_code_t *code; - uint32_t *values; - ec_matrix_row_t row_data[0]; + uint32_t refs; + uint32_t columns; + uint32_t rows; + uintptr_t mask; + ec_code_t *code; + uint32_t *values; + ec_matrix_row_t row_data[0]; }; struct _ec_matrix_list { - struct list_head lru; - gf_lock_t lock; - uint32_t columns; - uint32_t rows; - uint32_t max; - uint32_t count; - uint32_t stripe; - struct mem_pool *pool; - ec_gf_t *gf; - ec_code_t *code; - ec_matrix_t *encode; - ec_matrix_t **objects; + struct list_head lru; + gf_lock_t lock; + uint32_t columns; + uint32_t rows; + uint32_t max; + uint32_t count; + uint32_t stripe; + struct mem_pool *pool; + ec_gf_t *gf; + ec_code_t *code; + ec_matrix_t *encode; + ec_matrix_t **objects; }; struct _ec_heal { - struct list_head list; - gf_lock_t lock; - xlator_t *xl; - ec_fop_data_t *fop; - void *data; - ec_fop_data_t *lookup; - loc_t loc; - struct iatt iatt; - char *symlink; - fd_t *fd; - int32_t partial; - int32_t done; - int32_t error; - gf_boolean_t nameheal; - uintptr_t available; - uintptr_t good; - uintptr_t bad; - uintptr_t open; - uintptr_t fixed; - uint64_t offset; - uint64_t size; - uint64_t total_size; - uint64_t version[2]; - uint64_t raw_size; + struct list_head list; + gf_lock_t lock; + xlator_t *xl; + ec_fop_data_t *fop; + void *data; + ec_fop_data_t *lookup; + loc_t loc; + struct iatt iatt; + char *symlink; + fd_t *fd; + int32_t partial; + int32_t done; + int32_t error; + gf_boolean_t nameheal; + uintptr_t available; + uintptr_t good; + uintptr_t bad; + uintptr_t open; + uintptr_t fixed; + uint64_t offset; + uint64_t size; + uint64_t total_size; + uint64_t version[2]; + uint64_t raw_size; }; struct subvol_healer { - xlator_t *this; - int subvol; - gf_boolean_t running; - gf_boolean_t rerun; - pthread_mutex_t mutex; - pthread_cond_t cond; - pthread_t thread; + xlator_t *this; + int subvol; + gf_boolean_t running; + gf_boolean_t rerun; + pthread_mutex_t mutex; + pthread_cond_t cond; + pthread_t thread; }; struct _ec_self_heald { - gf_boolean_t iamshd; - gf_boolean_t enabled; - int timeout; - uint32_t max_threads; - uint32_t wait_qlength; - struct subvol_healer *index_healers; - struct subvol_healer *full_healers; + gf_boolean_t iamshd; + gf_boolean_t enabled; + int timeout; + uint32_t max_threads; + uint32_t wait_qlength; + struct subvol_healer *index_healers; + struct subvol_healer *full_healers; }; struct _ec_statistics { - struct { - gf_atomic_t hits; /* Cache hits. */ - gf_atomic_t misses; /* Cache misses. */ - gf_atomic_t updates; /* Number of times an existing stripe has - been updated with new content. */ - gf_atomic_t invals; /* Number of times an existing stripe has - been invalidated because of truncates - or discards. */ - gf_atomic_t evicts; /* Number of times that an existing entry - has been evicted to make room for newer - entries. */ - gf_atomic_t allocs; /* Number of memory allocations made to - store stripes. */ - gf_atomic_t errors; /* Number of errors that have caused extra - requests. (Basically memory allocation - errors). */ - } stripe_cache; + struct { + gf_atomic_t hits; /* Cache hits. */ + gf_atomic_t misses; /* Cache misses. */ + gf_atomic_t updates; /* Number of times an existing stripe has + been updated with new content. */ + gf_atomic_t invals; /* Number of times an existing stripe has + been invalidated because of truncates + or discards. */ + gf_atomic_t evicts; /* Number of times that an existing entry + has been evicted to make room for newer + entries. */ + gf_atomic_t allocs; /* Number of memory allocations made to + store stripes. */ + gf_atomic_t errors; /* Number of errors that have caused extra + requests. (Basically memory allocation + errors). */ + } stripe_cache; }; struct _ec { - xlator_t *xl; - int32_t healers; - int32_t heal_waiters; - int32_t nodes; /* Total number of bricks(n) */ - int32_t bits_for_nodes; - int32_t fragments; /* Data bricks(k) */ - int32_t redundancy; /* Redundant bricks(m) */ - uint32_t fragment_size; /* Size of fragment/chunk on a - brick. */ - uint32_t stripe_size; /* (fragment_size * fragments) - maximum size of user data - stored in one stripe. */ - int32_t up; /* Represents whether EC volume is - up or not. */ - uint32_t idx; - uint32_t xl_up_count; /* Number of UP bricks. */ - uintptr_t xl_up; /* Bit flag representing UP - bricks */ - uint32_t xl_notify_count; /* Number of notifications. */ - uintptr_t xl_notify; /* Bit flag representing - notification for bricks. */ - uintptr_t node_mask; - xlator_t **xl_list; - gf_lock_t lock; - gf_timer_t *timer; - gf_boolean_t shutdown; - gf_boolean_t eager_lock; - gf_boolean_t other_eager_lock; - gf_boolean_t optimistic_changelog; - gf_boolean_t parallel_writes; - uint32_t stripe_cache; - uint32_t background_heals; - uint32_t heal_wait_qlen; - uint32_t self_heal_window_size; /* max size of read/writes */ - uint32_t eager_lock_timeout; - uint32_t other_eager_lock_timeout; - struct list_head pending_fops; - struct list_head heal_waiting; - struct list_head healing; - struct mem_pool *fop_pool; - struct mem_pool *cbk_pool; - struct mem_pool *lock_pool; - ec_self_heald_t shd; - char vol_uuid[UUID_SIZE + 1]; - dict_t *leaf_to_subvolid; - ec_read_policy_t read_policy; - ec_matrix_list_t matrix; - ec_statistics_t stats; + xlator_t *xl; + int32_t healers; + int32_t heal_waiters; + int32_t nodes; /* Total number of bricks(n) */ + int32_t bits_for_nodes; + int32_t fragments; /* Data bricks(k) */ + int32_t redundancy; /* Redundant bricks(m) */ + uint32_t fragment_size; /* Size of fragment/chunk on a + brick. */ + uint32_t stripe_size; /* (fragment_size * fragments) + maximum size of user data + stored in one stripe. */ + int32_t up; /* Represents whether EC volume is + up or not. */ + uint32_t idx; + uint32_t xl_up_count; /* Number of UP bricks. */ + uintptr_t xl_up; /* Bit flag representing UP + bricks */ + uint32_t xl_notify_count; /* Number of notifications. */ + uintptr_t xl_notify; /* Bit flag representing + notification for bricks. */ + uintptr_t node_mask; + xlator_t **xl_list; + gf_lock_t lock; + gf_timer_t *timer; + gf_boolean_t shutdown; + gf_boolean_t eager_lock; + gf_boolean_t other_eager_lock; + gf_boolean_t optimistic_changelog; + gf_boolean_t parallel_writes; + uint32_t stripe_cache; + uint32_t background_heals; + uint32_t heal_wait_qlen; + uint32_t self_heal_window_size; /* max size of read/writes */ + uint32_t eager_lock_timeout; + uint32_t other_eager_lock_timeout; + struct list_head pending_fops; + struct list_head heal_waiting; + struct list_head healing; + struct mem_pool *fop_pool; + struct mem_pool *cbk_pool; + struct mem_pool *lock_pool; + ec_self_heald_t shd; + char vol_uuid[UUID_SIZE + 1]; + dict_t *leaf_to_subvolid; + ec_read_policy_t read_policy; + ec_matrix_list_t matrix; + ec_statistics_t stats; }; #endif /* __EC_TYPES_H__ */ diff --git a/xlators/cluster/ec/src/ec.h b/xlators/cluster/ec/src/ec.h index e2ec9cf04f5..1b210d9adc1 100644 --- a/xlators/cluster/ec/src/ec.h +++ b/xlators/cluster/ec/src/ec.h @@ -13,15 +13,15 @@ #include "ec-method.h" -#define EC_XATTR_PREFIX "trusted.ec." -#define EC_XATTR_CONFIG EC_XATTR_PREFIX"config" -#define EC_XATTR_SIZE EC_XATTR_PREFIX"size" -#define EC_XATTR_VERSION EC_XATTR_PREFIX"version" -#define EC_XATTR_HEAL EC_XATTR_PREFIX"heal" -#define EC_XATTR_DIRTY EC_XATTR_PREFIX"dirty" -#define EC_STRIPE_CACHE_MAX_SIZE 10 +#define EC_XATTR_PREFIX "trusted.ec." +#define EC_XATTR_CONFIG EC_XATTR_PREFIX "config" +#define EC_XATTR_SIZE EC_XATTR_PREFIX "size" +#define EC_XATTR_VERSION EC_XATTR_PREFIX "version" +#define EC_XATTR_HEAL EC_XATTR_PREFIX "heal" +#define EC_XATTR_DIRTY EC_XATTR_PREFIX "dirty" +#define EC_STRIPE_CACHE_MAX_SIZE 10 #define EC_VERSION_SIZE 2 -#define EC_SHD_INODE_LRU_LIMIT 10 +#define EC_SHD_INODE_LRU_LIMIT 10 #define EC_MAX_FRAGMENTS EC_METHOD_MAX_FRAGMENTS /* The maximum number of nodes is derived from the maximum allowed fragments diff --git a/xlators/cluster/stripe/src/stripe-mem-types.h b/xlators/cluster/stripe/src/stripe-mem-types.h index e9ac9cf4648..dcbef31212b 100644 --- a/xlators/cluster/stripe/src/stripe-mem-types.h +++ b/xlators/cluster/stripe/src/stripe-mem-types.h @@ -8,24 +8,22 @@ cases as published by the Free Software Foundation. */ - #ifndef __STRIPE_MEM_TYPES_H__ #define __STRIPE_MEM_TYPES_H__ #include "mem-types.h" enum gf_stripe_mem_types_ { - gf_stripe_mt_iovec = gf_common_mt_end + 1, - gf_stripe_mt_stripe_replies, - gf_stripe_mt_stripe_fd_ctx_t, - gf_stripe_mt_char, - gf_stripe_mt_int8_t, - gf_stripe_mt_int32_t, - gf_stripe_mt_xlator_t, - gf_stripe_mt_stripe_private_t, - gf_stripe_mt_stripe_options, - gf_stripe_mt_xattr_sort_t, - gf_stripe_mt_end + gf_stripe_mt_iovec = gf_common_mt_end + 1, + gf_stripe_mt_stripe_replies, + gf_stripe_mt_stripe_fd_ctx_t, + gf_stripe_mt_char, + gf_stripe_mt_int8_t, + gf_stripe_mt_int32_t, + gf_stripe_mt_xlator_t, + gf_stripe_mt_stripe_private_t, + gf_stripe_mt_stripe_options, + gf_stripe_mt_xattr_sort_t, + gf_stripe_mt_end }; #endif - diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h index 1e2fcb4e659..103c96491ff 100644 --- a/xlators/cluster/stripe/src/stripe.h +++ b/xlators/cluster/stripe/src/stripe.h @@ -8,7 +8,6 @@ cases as published by the Free Software Foundation. */ - #ifndef _STRIPE_H_ #define _STRIPE_H_ @@ -24,53 +23,55 @@ #include <signal.h> #define STRIPE_PATHINFO_HEADER "STRIPE:" -#define STRIPE_MIN_BLOCK_SIZE (16*GF_UNIT_KB) - -#define STRIPE_STACK_UNWIND(fop, frame, params ...) do { \ - stripe_local_t *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - stripe_local_wipe(__local); \ - mem_put (__local); \ - } \ - } while (0) - -#define STRIPE_STACK_DESTROY(frame) do { \ - stripe_local_t *__local = NULL; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - if (__local) { \ - stripe_local_wipe (__local); \ - mem_put (__local); \ - } \ - } while (0) - -#define STRIPE_VALIDATE_FCTX(fctx, label) do { \ - int idx = 0; \ - if (!fctx) { \ - op_errno = EINVAL; \ - goto label; \ - } \ - for (idx = 0; idx < fctx->stripe_count; idx++) { \ - if (!fctx->xl_array[idx]) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "fctx->xl_array[%d] is NULL", \ - idx); \ - op_errno = ESTALE; \ - goto label; \ - } \ - } \ - } while (0) +#define STRIPE_MIN_BLOCK_SIZE (16 * GF_UNIT_KB) + +#define STRIPE_STACK_UNWIND(fop, frame, params...) \ + do { \ + stripe_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + stripe_local_wipe(__local); \ + mem_put(__local); \ + } \ + } while (0) + +#define STRIPE_STACK_DESTROY(frame) \ + do { \ + stripe_local_t *__local = NULL; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + if (__local) { \ + stripe_local_wipe(__local); \ + mem_put(__local); \ + } \ + } while (0) + +#define STRIPE_VALIDATE_FCTX(fctx, label) \ + do { \ + int idx = 0; \ + if (!fctx) { \ + op_errno = EINVAL; \ + goto label; \ + } \ + for (idx = 0; idx < fctx->stripe_count; idx++) { \ + if (!fctx->xl_array[idx]) { \ + gf_log(this->name, GF_LOG_ERROR, "fctx->xl_array[%d] is NULL", \ + idx); \ + op_errno = ESTALE; \ + goto label; \ + } \ + } \ + } while (0) typedef struct stripe_xattr_sort { - int pos; - int xattr_len; - char *xattr_value; + int pos; + int xattr_len; + char *xattr_value; } stripe_xattr_sort_t; /** @@ -78,204 +79,213 @@ typedef struct stripe_xattr_sort { * information, which is used for striping on a file. */ struct stripe_options { - struct stripe_options *next; - char path_pattern[256]; - uint64_t block_size; + struct stripe_options *next; + char path_pattern[256]; + uint64_t block_size; }; /** * Private structure for stripe translator */ struct stripe_private { - struct stripe_options *pattern; - xlator_t **xl_array; - uint64_t block_size; - gf_lock_t lock; - uint8_t nodes_down; - int8_t first_child_down; - int *last_event; - int8_t child_count; - gf_boolean_t xattr_supported; /* default yes */ - gf_boolean_t coalesce; - char vol_uuid[UUID_SIZE + 1]; + struct stripe_options *pattern; + xlator_t **xl_array; + uint64_t block_size; + gf_lock_t lock; + uint8_t nodes_down; + int8_t first_child_down; + int *last_event; + int8_t child_count; + gf_boolean_t xattr_supported; /* default yes */ + gf_boolean_t coalesce; + char vol_uuid[UUID_SIZE + 1]; }; /** * Used to keep info about the replies received from readv/writev calls */ struct stripe_replies { - struct iovec *vector; - int32_t count; //count of vector - int32_t op_ret; //op_ret of readv - int32_t op_errno; - int32_t requested_size; - struct iatt stbuf; /* 'stbuf' is also a part of reply */ + struct iovec *vector; + int32_t count; // count of vector + int32_t op_ret; // op_ret of readv + int32_t op_errno; + int32_t requested_size; + struct iatt stbuf; /* 'stbuf' is also a part of reply */ }; typedef struct _stripe_fd_ctx { - off_t stripe_size; - int stripe_count; - int stripe_coalesce; - int static_array; - xlator_t **xl_array; + off_t stripe_size; + int stripe_count; + int stripe_coalesce; + int static_array; + xlator_t **xl_array; } stripe_fd_ctx_t; - /** * Local structure to be passed with all the frames in case of STACK_WIND */ struct stripe_local; /* this itself is used inside the structure; */ struct stripe_local { - struct stripe_local *next; - call_frame_t *orig_frame; - - stripe_fd_ctx_t *fctx; - - /* Used by _cbk functions */ - struct iatt stbuf; - struct iatt pre_buf; - struct iatt post_buf; - struct iatt preparent; - struct iatt postparent; - - off_t stbuf_size; - off_t prebuf_size; - off_t postbuf_size; - off_t preparent_size; - off_t postparent_size; - - blkcnt_t stbuf_blocks; - blkcnt_t prebuf_blocks; - blkcnt_t postbuf_blocks; - blkcnt_t preparent_blocks; - blkcnt_t postparent_blocks; - - struct stripe_replies *replies; - struct statvfs statvfs_buf; - dir_entry_t *entry; - - int8_t revalidate; - int8_t failed; - int8_t unwind; - - size_t readv_size; - int32_t entry_count; - int32_t node_index; - int32_t call_count; - int32_t wind_count; /* used instead of child_cound - in case of read and write */ - int32_t op_ret; - int32_t op_errno; - int32_t count; - int32_t flags; - char *name; - inode_t *inode; - - loc_t loc; - loc_t loc2; - - mode_t mode; - dev_t rdev; - /* For File I/O fops */ - dict_t *xdata; - - stripe_xattr_sort_t *xattr_list; - int32_t xattr_total_len; - int32_t nallocs; - char xsel[256]; - - /* General usage */ - off_t offset; - off_t stripe_size; - - int xattr_self_heal_needed; - int entry_self_heal_needed; - - int8_t *list; - struct gf_flock lock; - fd_t *fd; - void *value; - struct iobref *iobref; - gf_dirent_t entries; - gf_dirent_t *dirent; - dict_t *xattr; - uuid_t ia_gfid; - - int xflag; - mode_t umask; + struct stripe_local *next; + call_frame_t *orig_frame; + + stripe_fd_ctx_t *fctx; + + /* Used by _cbk functions */ + struct iatt stbuf; + struct iatt pre_buf; + struct iatt post_buf; + struct iatt preparent; + struct iatt postparent; + + off_t stbuf_size; + off_t prebuf_size; + off_t postbuf_size; + off_t preparent_size; + off_t postparent_size; + + blkcnt_t stbuf_blocks; + blkcnt_t prebuf_blocks; + blkcnt_t postbuf_blocks; + blkcnt_t preparent_blocks; + blkcnt_t postparent_blocks; + + struct stripe_replies *replies; + struct statvfs statvfs_buf; + dir_entry_t *entry; + + int8_t revalidate; + int8_t failed; + int8_t unwind; + + size_t readv_size; + int32_t entry_count; + int32_t node_index; + int32_t call_count; + int32_t wind_count; /* used instead of child_cound + in case of read and write */ + int32_t op_ret; + int32_t op_errno; + int32_t count; + int32_t flags; + char *name; + inode_t *inode; + + loc_t loc; + loc_t loc2; + + mode_t mode; + dev_t rdev; + /* For File I/O fops */ + dict_t *xdata; + + stripe_xattr_sort_t *xattr_list; + int32_t xattr_total_len; + int32_t nallocs; + char xsel[256]; + + /* General usage */ + off_t offset; + off_t stripe_size; + + int xattr_self_heal_needed; + int entry_self_heal_needed; + + int8_t *list; + struct gf_flock lock; + fd_t *fd; + void *value; + struct iobref *iobref; + gf_dirent_t entries; + gf_dirent_t *dirent; + dict_t *xattr; + uuid_t ia_gfid; + + int xflag; + mode_t umask; }; -typedef struct stripe_local stripe_local_t; +typedef struct stripe_local stripe_local_t; typedef struct stripe_private stripe_private_t; /* * Determine the stripe index of a particular frame based on the translator. */ -static inline int32_t stripe_get_frame_index(stripe_fd_ctx_t *fctx, - call_frame_t *prev) +static inline int32_t +stripe_get_frame_index(stripe_fd_ctx_t *fctx, call_frame_t *prev) { - int32_t i, idx = -1; + int32_t i, idx = -1; - for (i = 0; i < fctx->stripe_count; i++) { - if (fctx->xl_array[i] == prev->this) { - idx = i; - break; - } - } + for (i = 0; i < fctx->stripe_count; i++) { + if (fctx->xl_array[i] == prev->this) { + idx = i; + break; + } + } - return idx; + return idx; } -static inline void stripe_copy_xl_array(xlator_t **dst, xlator_t **src, - int count) +static inline void +stripe_copy_xl_array(xlator_t **dst, xlator_t **src, int count) { - int i; + int i; - for (i = 0; i < count; i++) - dst[i] = src[i]; + for (i = 0; i < count; i++) + dst[i] = src[i]; } -void stripe_local_wipe (stripe_local_t *local); -int32_t stripe_ctx_handle (xlator_t *this, call_frame_t *prev, - stripe_local_t *local, dict_t *dict); -void stripe_aggregate_xattr (dict_t *dst, dict_t *src); -int32_t stripe_xattr_request_build (xlator_t *this, dict_t *dict, - uint64_t stripe_size, uint32_t stripe_count, - uint32_t stripe_index, - uint32_t stripe_coalesce); -int32_t stripe_get_matching_bs (const char *path, stripe_private_t *priv); -int set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data); -int32_t stripe_iatt_merge (struct iatt *from, struct iatt *to); -int32_t stripe_fill_pathinfo_xattr (xlator_t *this, stripe_local_t *local, - char **xattr_serz); -int32_t stripe_free_xattr_str (stripe_local_t *local); -int32_t stripe_xattr_aggregate (char *buffer, stripe_local_t *local, - int32_t *total); -off_t coalesced_offset(off_t offset, uint64_t stripe_size, int stripe_count); -off_t uncoalesced_size(off_t size, uint64_t stripe_size, int stripe_count, - int stripe_index); +void +stripe_local_wipe(stripe_local_t *local); +int32_t +stripe_ctx_handle(xlator_t *this, call_frame_t *prev, stripe_local_t *local, + dict_t *dict); +void +stripe_aggregate_xattr(dict_t *dst, dict_t *src); +int32_t +stripe_xattr_request_build(xlator_t *this, dict_t *dict, uint64_t stripe_size, + uint32_t stripe_count, uint32_t stripe_index, + uint32_t stripe_coalesce); +int32_t +stripe_get_matching_bs(const char *path, stripe_private_t *priv); +int +set_stripe_block_size(xlator_t *this, stripe_private_t *priv, char *data); +int32_t +stripe_iatt_merge(struct iatt *from, struct iatt *to); +int32_t +stripe_fill_pathinfo_xattr(xlator_t *this, stripe_local_t *local, + char **xattr_serz); +int32_t +stripe_free_xattr_str(stripe_local_t *local); +int32_t +stripe_xattr_aggregate(char *buffer, stripe_local_t *local, int32_t *total); +off_t +coalesced_offset(off_t offset, uint64_t stripe_size, int stripe_count); +off_t +uncoalesced_size(off_t size, uint64_t stripe_size, int stripe_count, + int stripe_index); int32_t -stripe_fill_lockinfo_xattr (xlator_t *this, stripe_local_t *local, - void **xattr_serz); +stripe_fill_lockinfo_xattr(xlator_t *this, stripe_local_t *local, + void **xattr_serz); /* * Adjust the size attribute for files if coalesce is enabled. */ -static inline void correct_file_size(struct iatt *buf, stripe_fd_ctx_t *fctx, - call_frame_t *prev) +static inline void +correct_file_size(struct iatt *buf, stripe_fd_ctx_t *fctx, call_frame_t *prev) { - int index; + int index; - if (!IA_ISREG(buf->ia_type)) - return; + if (!IA_ISREG(buf->ia_type)) + return; - if (!fctx || !fctx->stripe_coalesce) - return; + if (!fctx || !fctx->stripe_coalesce) + return; - index = stripe_get_frame_index(fctx, prev); - buf->ia_size = uncoalesced_size(buf->ia_size, fctx->stripe_size, - fctx->stripe_count, index); + index = stripe_get_frame_index(fctx, prev); + buf->ia_size = uncoalesced_size(buf->ia_size, fctx->stripe_size, + fctx->stripe_count, index); } #endif /* _STRIPE_H_ */ diff --git a/xlators/debug/delay-gen/src/delay-gen-mem-types.h b/xlators/debug/delay-gen/src/delay-gen-mem-types.h index 8c54f5f922e..63a15a70da3 100644 --- a/xlators/debug/delay-gen/src/delay-gen-mem-types.h +++ b/xlators/debug/delay-gen/src/delay-gen-mem-types.h @@ -8,15 +8,14 @@ * cases as published by the Free Software Foundation. */ - #ifndef __DELAY_GEN_MEM_TYPES_H__ #define __DELAY_GEN_MEM_TYPES_H__ #include "mem-types.h" enum gf_delay_gen_mem_types_ { - gf_delay_gen_mt_dg_t = gf_common_mt_end + 1, - gf_delay_gen_mt_end + gf_delay_gen_mt_dg_t = gf_common_mt_end + 1, + gf_delay_gen_mt_end }; #endif /* __DELAY_GEN_MEM_TYPES_H__ */ diff --git a/xlators/debug/delay-gen/src/delay-gen.h b/xlators/debug/delay-gen/src/delay-gen.h index e1111c782e2..5e4d179f0b4 100644 --- a/xlators/debug/delay-gen/src/delay-gen.h +++ b/xlators/debug/delay-gen/src/delay-gen.h @@ -8,7 +8,6 @@ * cases as published by the Free Software Foundation. */ - #ifndef __DELAY_GEN_H__ #define __DELAY_GEN_H__ @@ -19,10 +18,10 @@ #include "defaults.h" typedef struct { - int enable[GF_FOP_MAXVALUE]; - int op_count; - int delay_ppm; - int delay_duration; + int enable[GF_FOP_MAXVALUE]; + int op_count; + int delay_ppm; + int delay_duration; } dg_t; #endif /* __DELAY_GEN_H__ */ diff --git a/xlators/debug/error-gen/src/error-gen-mem-types.h b/xlators/debug/error-gen/src/error-gen-mem-types.h index f02280535df..2facd6b27cb 100644 --- a/xlators/debug/error-gen/src/error-gen-mem-types.h +++ b/xlators/debug/error-gen/src/error-gen-mem-types.h @@ -14,7 +14,7 @@ #include "mem-types.h" enum gf_error_gen_mem_types_ { - gf_error_gen_mt_eg_t = gf_common_mt_end + 1, - gf_error_gen_mt_end + gf_error_gen_mt_eg_t = gf_common_mt_end + 1, + gf_error_gen_mt_end }; #endif diff --git a/xlators/debug/error-gen/src/error-gen.h b/xlators/debug/error-gen/src/error-gen.h index 2cd95de335a..ffa09252d0f 100644 --- a/xlators/debug/error-gen/src/error-gen.h +++ b/xlators/debug/error-gen/src/error-gen.h @@ -22,29 +22,29 @@ * range. */ enum GF_PSEUDO_ERRORS { - GF_ERROR_SHORT_WRITE = 1000, /* short writev return value */ - GF_ERROR_MAX + GF_ERROR_SHORT_WRITE = 1000, /* short writev return value */ + GF_ERROR_MAX }; typedef struct { - int enable[GF_FOP_MAXVALUE]; - int op_count; - /* - * This is only an iteration number in the random-failure case. For - * the normal controlled-probability case, it's actually a numerator - * for the failure probability (see FAILURE_GRANULARITY declaration). - * It's just not worth blowing up the diff by changing it. - */ - int failure_iter_no; - char *error_no; - int error_no_int; - gf_boolean_t random_failure; - gf_lock_t lock; + int enable[GF_FOP_MAXVALUE]; + int op_count; + /* + * This is only an iteration number in the random-failure case. For + * the normal controlled-probability case, it's actually a numerator + * for the failure probability (see FAILURE_GRANULARITY declaration). + * It's just not worth blowing up the diff by changing it. + */ + int failure_iter_no; + char *error_no; + int error_no_int; + gf_boolean_t random_failure; + gf_lock_t lock; } eg_t; typedef struct { - int error_no_count; - int error_no[20]; + int error_no_count; + int error_no[20]; } sys_error_t; #endif diff --git a/xlators/debug/io-stats/src/io-stats-mem-types.h b/xlators/debug/io-stats/src/io-stats-mem-types.h index 9dde9373264..bc25fd2ca4e 100644 --- a/xlators/debug/io-stats/src/io-stats-mem-types.h +++ b/xlators/debug/io-stats/src/io-stats-mem-types.h @@ -16,13 +16,12 @@ extern const char *__progname; enum gf_io_stats_mem_types_ { - gf_io_stats_mt_ios_conf = gf_common_mt_end + 1, - gf_io_stats_mt_ios_fd, - gf_io_stats_mt_ios_stat, - gf_io_stats_mt_ios_stat_list, - gf_io_stats_mt_ios_sample_buf, - gf_io_stats_mt_ios_sample, - gf_io_stats_mt_end + gf_io_stats_mt_ios_conf = gf_common_mt_end + 1, + gf_io_stats_mt_ios_fd, + gf_io_stats_mt_ios_stat, + gf_io_stats_mt_ios_stat_list, + gf_io_stats_mt_ios_sample_buf, + gf_io_stats_mt_ios_sample, + gf_io_stats_mt_end }; #endif - diff --git a/xlators/debug/trace/src/trace-mem-types.h b/xlators/debug/trace/src/trace-mem-types.h index 9fa7d97c2ca..cf05a77b9f1 100644 --- a/xlators/debug/trace/src/trace-mem-types.h +++ b/xlators/debug/trace/src/trace-mem-types.h @@ -8,14 +8,13 @@ cases as published by the Free Software Foundation. */ - #ifndef __TRACE_MEM_TYPES_H__ #define __TRACE_MEM_TYPES_H__ #include "mem-types.h" enum gf_trace_mem_types_ { - gf_trace_mt_trace_conf_t = gf_common_mt_end + 1, - gf_trace_mt_end + gf_trace_mt_trace_conf_t = gf_common_mt_end + 1, + gf_trace_mt_end }; #endif diff --git a/xlators/debug/trace/src/trace.h b/xlators/debug/trace/src/trace.h index 3b5f7891d00..815647c05be 100644 --- a/xlators/debug/trace/src/trace.h +++ b/xlators/debug/trace/src/trace.h @@ -22,35 +22,34 @@ #define TRACE_DEFAULT_HISTORY_SIZE 1024 typedef struct { - /* Since the longest fop name is fremovexattr i.e 12 characters, array size - * is kept 24, i.e double of the maximum. - */ - char name[24]; - int enabled; + /* Since the longest fop name is fremovexattr i.e 12 characters, array size + * is kept 24, i.e double of the maximum. + */ + char name[24]; + int enabled; } trace_fop_name_t; trace_fop_name_t trace_fop_names[GF_FOP_MAXVALUE]; typedef struct { - gf_boolean_t log_file; - gf_boolean_t log_history; - size_t history_size; - int trace_log_level; + gf_boolean_t log_file; + gf_boolean_t log_history; + size_t history_size; + int trace_log_level; } trace_conf_t; -#define TRACE_STACK_UNWIND(op, frame, params ...) \ - do { \ - frame->local = NULL; \ - STACK_UNWIND_STRICT (op, frame, params); \ - } while (0); - -#define LOG_ELEMENT(_conf, _string) \ - do { \ - if (_conf) { \ - if ((_conf->log_history) == _gf_true) \ - gf_log_eh ("%s", _string); \ - if ((_conf->log_file) == _gf_true) \ - gf_log (THIS->name, _conf->trace_log_level, \ - "%s", _string); \ - } \ - } while (0); +#define TRACE_STACK_UNWIND(op, frame, params...) \ + do { \ + frame->local = NULL; \ + STACK_UNWIND_STRICT(op, frame, params); \ + } while (0); + +#define LOG_ELEMENT(_conf, _string) \ + do { \ + if (_conf) { \ + if ((_conf->log_history) == _gf_true) \ + gf_log_eh("%s", _string); \ + if ((_conf->log_file) == _gf_true) \ + gf_log(THIS->name, _conf->trace_log_level, "%s", _string); \ + } \ + } while (0); diff --git a/xlators/encryption/crypt/src/crypt-common.h b/xlators/encryption/crypt/src/crypt-common.h index 7c212ad5d25..123d5c2a631 100644 --- a/xlators/encryption/crypt/src/crypt-common.h +++ b/xlators/encryption/crypt/src/crypt-common.h @@ -12,75 +12,79 @@ #define __CRYPT_COMMON_H__ #define INVAL_SUBVERSION_NUMBER (0xff) -#define CRYPT_INVAL_OP (GF_FOP_NULL) - -#define CRYPTO_FORMAT_PREFIX "trusted.glusterfs.crypt.att.cfmt" -#define FSIZE_XATTR_PREFIX "trusted.glusterfs.crypt.att.size" -#define SUBREQ_PREFIX "trusted.glusterfs.crypt.msg.sreq" -#define FSIZE_MSG_PREFIX "trusted.glusterfs.crypt.msg.size" -#define DE_MSG_PREFIX "trusted.glusterfs.crypt.msg.dent" -#define REQUEST_ID_PREFIX "trusted.glusterfs.crypt.msg.rqid" -#define MSGFLAGS_PREFIX "trusted.glusterfs.crypt.msg.xfgs" +#define CRYPT_INVAL_OP (GF_FOP_NULL) +#define CRYPTO_FORMAT_PREFIX "trusted.glusterfs.crypt.att.cfmt" +#define FSIZE_XATTR_PREFIX "trusted.glusterfs.crypt.att.size" +#define SUBREQ_PREFIX "trusted.glusterfs.crypt.msg.sreq" +#define FSIZE_MSG_PREFIX "trusted.glusterfs.crypt.msg.size" +#define DE_MSG_PREFIX "trusted.glusterfs.crypt.msg.dent" +#define REQUEST_ID_PREFIX "trusted.glusterfs.crypt.msg.rqid" +#define MSGFLAGS_PREFIX "trusted.glusterfs.crypt.msg.xfgs" /* messages for crypt_open() */ -#define MSGFLAGS_REQUEST_MTD_RLOCK 1 /* take read lock and don't unlock */ -#define MSGFLAGS_REQUEST_MTD_WLOCK 2 /* take write lock and don't unlock */ +#define MSGFLAGS_REQUEST_MTD_RLOCK 1 /* take read lock and don't unlock */ +#define MSGFLAGS_REQUEST_MTD_WLOCK 2 /* take write lock and don't unlock */ #define AES_BLOCK_BITS (4) /* AES_BLOCK_SIZE == 1 << AES_BLOCK_BITS */ -#define noop do {; } while (0) -#define cassert(cond) ({ switch (-1) { case (cond): case 0: break; } }) +#define noop \ + do { \ + ; \ + } while (0) +#define cassert(cond) \ + ({ \ + switch (-1) { \ + case (cond): \ + case 0: \ + break; \ + } \ + }) #define __round_mask(x, y) ((__typeof__(x))((y)-1)) -#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_up(x, y) ((((x)-1) | __round_mask(x, y)) + 1) /* * Format of file's metadata */ struct crypt_format { - uint8_t loader_id; /* version of metadata loader */ - uint8_t versioned[0]; /* file's metadata of specific version */ + uint8_t loader_id; /* version of metadata loader */ + uint8_t versioned[0]; /* file's metadata of specific version */ } __attribute__((packed)); -typedef enum { - AES_CIPHER_ALG, - LAST_CIPHER_ALG -} cipher_alg_t; +typedef enum { AES_CIPHER_ALG, LAST_CIPHER_ALG } cipher_alg_t; -typedef enum { - XTS_CIPHER_MODE, - LAST_CIPHER_MODE -} cipher_mode_t; +typedef enum { XTS_CIPHER_MODE, LAST_CIPHER_MODE } cipher_mode_t; -typedef enum { - MTD_LOADER_V1, - LAST_MTD_LOADER -} mtd_loader_id; +typedef enum { MTD_LOADER_V1, LAST_MTD_LOADER } mtd_loader_id; -static inline void msgflags_set_mtd_rlock(uint32_t *flags) +static inline void +msgflags_set_mtd_rlock(uint32_t *flags) { - *flags |= MSGFLAGS_REQUEST_MTD_RLOCK; + *flags |= MSGFLAGS_REQUEST_MTD_RLOCK; } -static inline void msgflags_set_mtd_wlock(uint32_t *flags) +static inline void +msgflags_set_mtd_wlock(uint32_t *flags) { - *flags |= MSGFLAGS_REQUEST_MTD_WLOCK; + *flags |= MSGFLAGS_REQUEST_MTD_WLOCK; } -static inline gf_boolean_t msgflags_check_mtd_rlock(uint32_t *flags) +static inline gf_boolean_t +msgflags_check_mtd_rlock(uint32_t *flags) { - return *flags & MSGFLAGS_REQUEST_MTD_RLOCK; + return *flags & MSGFLAGS_REQUEST_MTD_RLOCK; } -static inline gf_boolean_t msgflags_check_mtd_wlock(uint32_t *flags) +static inline gf_boolean_t +msgflags_check_mtd_wlock(uint32_t *flags) { - return *flags & MSGFLAGS_REQUEST_MTD_WLOCK; + return *flags & MSGFLAGS_REQUEST_MTD_WLOCK; } -static inline gf_boolean_t msgflags_check_mtd_lock(uint32_t *flags) +static inline gf_boolean_t +msgflags_check_mtd_lock(uint32_t *flags) { - return msgflags_check_mtd_rlock(flags) || - msgflags_check_mtd_wlock(flags); + return msgflags_check_mtd_rlock(flags) || msgflags_check_mtd_wlock(flags); } /* @@ -88,10 +92,10 @@ static inline gf_boolean_t msgflags_check_mtd_lock(uint32_t *flags) * (maybe partially) by @count bytes * at offset @start. */ -static inline off_t logical_blocks_occupied(uint64_t start, off_t count, - int blkbits) +static inline off_t +logical_blocks_occupied(uint64_t start, off_t count, int blkbits) { - return ((start + count - 1) >> blkbits) - (start >> blkbits) + 1; + return ((start + count - 1) >> blkbits) - (start >> blkbits) + 1; } /* @@ -99,32 +103,20 @@ static inline off_t logical_blocks_occupied(uint64_t start, off_t count, * and @off2 respectively) in the same logical * block. */ -static inline int in_same_lblock(uint64_t off1, uint64_t off2, - int blkbits) +static inline int +in_same_lblock(uint64_t off1, uint64_t off2, int blkbits) { - return off1 >> blkbits == off2 >> blkbits; + return off1 >> blkbits == off2 >> blkbits; } -static inline void dump_cblock(xlator_t *this, unsigned char *buf) +static inline void +dump_cblock(xlator_t *this, unsigned char *buf) { - gf_log(this->name, GF_LOG_DEBUG, - "dump cblock: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", - (buf)[0], - (buf)[1], - (buf)[2], - (buf)[3], - (buf)[4], - (buf)[5], - (buf)[6], - (buf)[7], - (buf)[8], - (buf)[9], - (buf)[10], - (buf)[11], - (buf)[12], - (buf)[13], - (buf)[14], - (buf)[15]); + gf_log(this->name, GF_LOG_DEBUG, + "dump cblock: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", + (buf)[0], (buf)[1], (buf)[2], (buf)[3], (buf)[4], (buf)[5], (buf)[6], + (buf)[7], (buf)[8], (buf)[9], (buf)[10], (buf)[11], (buf)[12], + (buf)[13], (buf)[14], (buf)[15]); } #endif /* __CRYPT_COMMON_H__ */ diff --git a/xlators/encryption/crypt/src/crypt-mem-types.h b/xlators/encryption/crypt/src/crypt-mem-types.h index 1954c579423..7e9fb90ed43 100644 --- a/xlators/encryption/crypt/src/crypt-mem-types.h +++ b/xlators/encryption/crypt/src/crypt-mem-types.h @@ -8,24 +8,23 @@ cases as published by the Free Software Foundation. */ - #ifndef __CRYPT_MEM_TYPES_H__ #define __CRYPT_MEM_TYPES_H__ #include "mem-types.h" enum gf_crypt_mem_types_ { - gf_crypt_mt_priv = gf_common_mt_end + 1, - gf_crypt_mt_inode, - gf_crypt_mt_data, - gf_crypt_mt_mtd, - gf_crypt_mt_loc, - gf_crypt_mt_iatt, - gf_crypt_mt_key, - gf_crypt_mt_iovec, - gf_crypt_mt_char, - gf_crypt_mt_local, - gf_crypt_mt_end, + gf_crypt_mt_priv = gf_common_mt_end + 1, + gf_crypt_mt_inode, + gf_crypt_mt_data, + gf_crypt_mt_mtd, + gf_crypt_mt_loc, + gf_crypt_mt_iatt, + gf_crypt_mt_key, + gf_crypt_mt_iovec, + gf_crypt_mt_char, + gf_crypt_mt_local, + gf_crypt_mt_end, }; #endif /* __CRYPT_MEM_TYPES_H__ */ @@ -40,6 +39,3 @@ enum gf_crypt_mem_types_ { scroll-step: 1 End: */ - - - diff --git a/xlators/encryption/crypt/src/crypt.h b/xlators/encryption/crypt/src/crypt.h index 5a2b1a9cc3b..390eee831b1 100644 --- a/xlators/encryption/crypt/src/crypt.h +++ b/xlators/encryption/crypt/src/crypt.h @@ -20,11 +20,11 @@ #include "crypt-mem-types.h" #include "compat.h" -#define CRYPT_XLATOR_ID (0) +#define CRYPT_XLATOR_ID (0) #define MAX_IOVEC_BITS (3) #define MAX_IOVEC (1 << MAX_IOVEC_BITS) -#define KEY_FACTOR_BITS (6) +#define KEY_FACTOR_BITS (6) #define DEBUG_CRYPT (0) #define TRIVIAL_TFM (0) @@ -40,8 +40,8 @@ typedef off_t loff_t; #endif struct crypt_key { - uint32_t len; - const char *label; + uint32_t len; + const char *label; }; /* @@ -49,113 +49,110 @@ struct crypt_key { * enumeration but before LAST_KEY_TYPE */ typedef enum { - MASTER_VOL_KEY, - NMTD_VOL_KEY, - NMTD_LINK_KEY, - EMTD_FILE_KEY, - DATA_FILE_KEY_256, - DATA_FILE_KEY_512, - LAST_KEY_TYPE -}crypt_key_type; + MASTER_VOL_KEY, + NMTD_VOL_KEY, + NMTD_LINK_KEY, + EMTD_FILE_KEY, + DATA_FILE_KEY_256, + DATA_FILE_KEY_512, + LAST_KEY_TYPE +} crypt_key_type; struct kderive_context { - const unsigned char *pkey;/* parent key */ - uint32_t pkey_len; /* parent key size, bits */ - uint32_t ckey_len; /* child key size, bits */ - unsigned char *fid; /* fixed input data, NIST 800-108, 5.1 */ - uint32_t fid_len; /* fid len, bytes */ - unsigned char *out; /* contains child keying material */ - uint32_t out_len; /* out len, bytes */ + const unsigned char *pkey; /* parent key */ + uint32_t pkey_len; /* parent key size, bits */ + uint32_t ckey_len; /* child key size, bits */ + unsigned char *fid; /* fixed input data, NIST 800-108, 5.1 */ + uint32_t fid_len; /* fid len, bytes */ + unsigned char *out; /* contains child keying material */ + uint32_t out_len; /* out len, bytes */ }; -typedef enum { - DATA_ATOM, - HOLE_ATOM, - LAST_DATA_TYPE -}atom_data_type; +typedef enum { DATA_ATOM, HOLE_ATOM, LAST_DATA_TYPE } atom_data_type; typedef enum { - HEAD_ATOM, - TAIL_ATOM, - FULL_ATOM, - LAST_LOCALITY_TYPE -}atom_locality_type; + HEAD_ATOM, + TAIL_ATOM, + FULL_ATOM, + LAST_LOCALITY_TYPE +} atom_locality_type; typedef enum { - MTD_CREATE, - MTD_APPEND, - MTD_OVERWRITE, - MTD_CUT, - MTD_LAST_OP + MTD_CREATE, + MTD_APPEND, + MTD_OVERWRITE, + MTD_CUT, + MTD_LAST_OP } mtd_op_t; struct xts128_context { - void *key1, *key2; - block128_f block1,block2; + void *key1, *key2; + block128_f block1, block2; }; struct object_cipher_info { - cipher_alg_t o_alg; - cipher_mode_t o_mode; - uint32_t o_block_bits; - uint32_t o_dkey_size; /* raw data key size in bits */ - union { - struct { - unsigned char ivec[16]; - AES_KEY dkey[2]; - AES_KEY tkey; /* key used for tweaking */ - XTS128_CONTEXT xts; - } aes_xts; - } u; + cipher_alg_t o_alg; + cipher_mode_t o_mode; + uint32_t o_block_bits; + uint32_t o_dkey_size; /* raw data key size in bits */ + union { + struct { + unsigned char ivec[16]; + AES_KEY dkey[2]; + AES_KEY tkey; /* key used for tweaking */ + XTS128_CONTEXT xts; + } aes_xts; + } u; }; struct master_cipher_info { - /* - * attributes inherited by newly created regular files - */ - cipher_alg_t m_alg; - cipher_mode_t m_mode; - uint32_t m_block_bits; - uint32_t m_dkey_size; /* raw key size in bits */ - /* - * master key - */ - unsigned char m_key[MASTER_VOL_KEY_SIZE]; - /* - * volume key for oid authentication - */ - unsigned char m_nmtd_key[NMTD_VOL_KEY_SIZE]; + /* + * attributes inherited by newly created regular files + */ + cipher_alg_t m_alg; + cipher_mode_t m_mode; + uint32_t m_block_bits; + uint32_t m_dkey_size; /* raw key size in bits */ + /* + * master key + */ + unsigned char m_key[MASTER_VOL_KEY_SIZE]; + /* + * volume key for oid authentication + */ + unsigned char m_nmtd_key[NMTD_VOL_KEY_SIZE]; }; /* -* This info is not changed during file's life + * This info is not changed during file's life */ struct crypt_inode_info { #if DEBUG_CRYPT - loc_t *loc; /* pathname that the file has been - opened, or created with */ + loc_t *loc; /* pathname that the file has been + opened, or created with */ #endif - uint16_t nr_minor; - uuid_t oid; - struct object_cipher_info cinfo; + uint16_t nr_minor; + uuid_t oid; + struct object_cipher_info cinfo; }; /* * this should locate in secure memory */ typedef struct { - struct master_cipher_info master; + struct master_cipher_info master; } crypt_private_t; -static inline struct master_cipher_info *get_master_cinfo(crypt_private_t *priv) +static inline struct master_cipher_info * +get_master_cinfo(crypt_private_t *priv) { - return &priv->master; + return &priv->master; } -static inline struct object_cipher_info *get_object_cinfo(struct crypt_inode_info - *info) +static inline struct object_cipher_info * +get_object_cinfo(struct crypt_inode_info *info) { - return &info->cinfo; + return &info->cinfo; } /* @@ -163,518 +160,531 @@ static inline struct object_cipher_info *get_object_cinfo(struct crypt_inode_inf * of atoms in an aligned vector */ struct avec_config { - uint32_t atom_size; - atom_data_type type; - size_t orig_size; - off_t orig_offset; - size_t expanded_size; - off_t aligned_offset; - - uint32_t off_in_head; - uint32_t off_in_tail; - uint32_t gap_in_tail; - uint32_t nr_full_blocks; - - struct iovec *avec; /* aligned vector */ - uint32_t acount; /* number of avec components. The same - * as number of occupied logical blocks */ - char **pool; - uint32_t blocks_in_pool; - uint32_t cursor; /* makes sense only for ordered writes, - * so there is no races on this counter. - * - * Cursor is per-config object, we don't - * reset cursor for atoms of different - * localities (head, tail, full) - */ + uint32_t atom_size; + atom_data_type type; + size_t orig_size; + off_t orig_offset; + size_t expanded_size; + off_t aligned_offset; + + uint32_t off_in_head; + uint32_t off_in_tail; + uint32_t gap_in_tail; + uint32_t nr_full_blocks; + + struct iovec *avec; /* aligned vector */ + uint32_t acount; /* number of avec components. The same + * as number of occupied logical blocks */ + char **pool; + uint32_t blocks_in_pool; + uint32_t cursor; /* makes sense only for ordered writes, + * so there is no races on this counter. + * + * Cursor is per-config object, we don't + * reset cursor for atoms of different + * localities (head, tail, full) + */ }; - typedef struct { - glusterfs_fop_t fop; /* code of FOP this local info built for */ - fd_t *fd; - inode_t *inode; - loc_t *loc; - int32_t mac_idx; - loc_t *newloc; - int32_t flags; - int32_t wbflags; - struct crypt_inode_info *info; - struct iobref *iobref; - struct iobref *iobref_data; - off_t offset; - - uint64_t old_file_size; /* per FOP, retrieved under lock held */ - uint64_t cur_file_size; /* per iteration, before issuing IOs */ - uint64_t new_file_size; /* per iteration, after issuing IOs */ - - uint64_t io_offset; /* offset of IOs issued per iteration */ - uint64_t io_offset_nopad; /* offset of user's data in the atom */ - uint32_t io_size; /* size of IOs issued per iteration */ - uint32_t io_size_nopad; /* size of user's data in the IOs */ - uint32_t eof_padding_size; /* size od EOF padding in the IOs */ - - gf_lock_t call_lock; /* protect nr_calls from many cbks */ - int32_t nr_calls; - - atom_data_type active_setup; /* which setup (hole or date) - is currently active */ - /* data setup */ - struct avec_config data_conf; - - /* hole setup */ - int hole_conv_in_proggress; - gf_lock_t hole_lock; /* protect hole config from many cbks */ - int hole_handled; - struct avec_config hole_conf; - struct iatt buf; - struct iatt prebuf; - struct iatt postbuf; - struct iatt *prenewparent; - struct iatt *postnewparent; - int32_t op_ret; - int32_t op_errno; - int32_t rw_count; /* total read or written */ - gf_lock_t rw_count_lock; /* protect the counter above */ - unsigned char *format; /* for create, update format string */ - uint32_t format_size; - uint32_t msgflags; /* messages for crypt_open() */ - dict_t *xdata; - dict_t *xattr; - struct iovec vec; /* contains last file's atom for - read-prune-write sequence */ - gf_boolean_t custom_mtd; - /* - * the next 3 fields are used by readdir and friends - */ - gf_dirent_t *de; /* directory entry */ - char *de_path; /* pathname of directory entry */ - uint32_t de_prefix_len; /* length of the parent's pathname */ - gf_dirent_t *entries; - - uint32_t update_disk_file_size:1; + glusterfs_fop_t fop; /* code of FOP this local info built for */ + fd_t *fd; + inode_t *inode; + loc_t *loc; + int32_t mac_idx; + loc_t *newloc; + int32_t flags; + int32_t wbflags; + struct crypt_inode_info *info; + struct iobref *iobref; + struct iobref *iobref_data; + off_t offset; + + uint64_t old_file_size; /* per FOP, retrieved under lock held */ + uint64_t cur_file_size; /* per iteration, before issuing IOs */ + uint64_t new_file_size; /* per iteration, after issuing IOs */ + + uint64_t io_offset; /* offset of IOs issued per iteration */ + uint64_t io_offset_nopad; /* offset of user's data in the atom */ + uint32_t io_size; /* size of IOs issued per iteration */ + uint32_t io_size_nopad; /* size of user's data in the IOs */ + uint32_t eof_padding_size; /* size od EOF padding in the IOs */ + + gf_lock_t call_lock; /* protect nr_calls from many cbks */ + int32_t nr_calls; + + atom_data_type active_setup; /* which setup (hole or date) + is currently active */ + /* data setup */ + struct avec_config data_conf; + + /* hole setup */ + int hole_conv_in_proggress; + gf_lock_t hole_lock; /* protect hole config from many cbks */ + int hole_handled; + struct avec_config hole_conf; + struct iatt buf; + struct iatt prebuf; + struct iatt postbuf; + struct iatt *prenewparent; + struct iatt *postnewparent; + int32_t op_ret; + int32_t op_errno; + int32_t rw_count; /* total read or written */ + gf_lock_t rw_count_lock; /* protect the counter above */ + unsigned char *format; /* for create, update format string */ + uint32_t format_size; + uint32_t msgflags; /* messages for crypt_open() */ + dict_t *xdata; + dict_t *xattr; + struct iovec vec; /* contains last file's atom for + read-prune-write sequence */ + gf_boolean_t custom_mtd; + /* + * the next 3 fields are used by readdir and friends + */ + gf_dirent_t *de; /* directory entry */ + char *de_path; /* pathname of directory entry */ + uint32_t de_prefix_len; /* length of the parent's pathname */ + gf_dirent_t *entries; + + uint32_t update_disk_file_size : 1; } crypt_local_t; /* This represents a (read)modify-write atom */ struct rmw_atom { - atom_locality_type locality; - /* - * read-modify-write sequence of the atom - */ - int32_t (*rmw)(call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct iovec *vec, - int32_t count, - struct iatt *stbuf, - struct iobref *iobref, - dict_t *xdata); - /* - * offset of the logical block in a file - */ - loff_t (*offset_at)(call_frame_t *frame, - struct object_cipher_info *object); - /* - * IO offset in an atom - */ - uint32_t (*offset_in)(call_frame_t *frame, - struct object_cipher_info *object); - /* - * number of bytes of plain text of this atom that user - * wants to read/write. - * It can be smaller than atom_size in the case of head - * or tail atoms. - */ - uint32_t (*io_size_nopad)(call_frame_t *frame, - struct object_cipher_info *object); - /* - * which iovec represents the atom - */ - struct iovec *(*get_iovec)(call_frame_t *frame, uint32_t count); - /* - * how many bytes of partial block should be uptodated by - * reading from disk. - * This is used to perform a read component of RMW (read-modify-write). - */ - uint32_t (*count_to_uptodate)(call_frame_t *frame, struct object_cipher_info *object); - struct avec_config *(*get_config)(call_frame_t *frame); + atom_locality_type locality; + /* + * read-modify-write sequence of the atom + */ + int32_t (*rmw)(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iovec *vec, + int32_t count, struct iatt *stbuf, struct iobref *iobref, + dict_t *xdata); + /* + * offset of the logical block in a file + */ + loff_t (*offset_at)(call_frame_t *frame, struct object_cipher_info *object); + /* + * IO offset in an atom + */ + uint32_t (*offset_in)(call_frame_t *frame, + struct object_cipher_info *object); + /* + * number of bytes of plain text of this atom that user + * wants to read/write. + * It can be smaller than atom_size in the case of head + * or tail atoms. + */ + uint32_t (*io_size_nopad)(call_frame_t *frame, + struct object_cipher_info *object); + /* + * which iovec represents the atom + */ + struct iovec *(*get_iovec)(call_frame_t *frame, uint32_t count); + /* + * how many bytes of partial block should be uptodated by + * reading from disk. + * This is used to perform a read component of RMW (read-modify-write). + */ + uint32_t (*count_to_uptodate)(call_frame_t *frame, + struct object_cipher_info *object); + struct avec_config *(*get_config)(call_frame_t *frame); }; struct data_cipher_alg { - gf_boolean_t atomic; /* true means that algorithm requires - to pad data before cipher transform */ - gf_boolean_t should_pad; /* true means that algorithm requires - to pad the end of file with extra-data */ - uint32_t blkbits; /* blksize = 1 << blkbits */ - /* - * any preliminary sanity checks goes here - */ - int32_t (*init)(void); - /* - * set alg-mode specific inode info - */ - int32_t (*set_private)(struct crypt_inode_info *info, - struct master_cipher_info *master); - /* - * check alg-mode specific data key - */ - int32_t (*check_key)(uint32_t key_size); - void (*set_iv)(off_t offset, struct object_cipher_info *object); - int32_t (*encrypt)(const unsigned char *from, unsigned char *to, - size_t length, off_t offset, const int enc, - struct object_cipher_info *object); + gf_boolean_t atomic; /* true means that algorithm requires + to pad data before cipher transform */ + gf_boolean_t should_pad; /* true means that algorithm requires + to pad the end of file with extra-data */ + uint32_t blkbits; /* blksize = 1 << blkbits */ + /* + * any preliminary sanity checks goes here + */ + int32_t (*init)(void); + /* + * set alg-mode specific inode info + */ + int32_t (*set_private)(struct crypt_inode_info *info, + struct master_cipher_info *master); + /* + * check alg-mode specific data key + */ + int32_t (*check_key)(uint32_t key_size); + void (*set_iv)(off_t offset, struct object_cipher_info *object); + int32_t (*encrypt)(const unsigned char *from, unsigned char *to, + size_t length, off_t offset, const int enc, + struct object_cipher_info *object); }; /* * version-dependent metadata loader */ struct crypt_mtd_loader { - /* - * return core format size - */ - size_t (*format_size)(mtd_op_t op, size_t old_size); - /* - * pack version-specific metadata of an object - * at ->create() - */ - int32_t (*create_format)(unsigned char *wire, - loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master); - /* - * extract version-specific metadata of an object - * at ->open() time - */ - int32_t (*open_format)(unsigned char *wire, - int32_t len, - loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master, - crypt_local_t *local, - gf_boolean_t load_info); - int32_t (*update_format)(unsigned char *new, - unsigned char *old, - size_t old_len, - int32_t mac_idx, - mtd_op_t op, - loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master, - crypt_local_t *local); + /* + * return core format size + */ + size_t (*format_size)(mtd_op_t op, size_t old_size); + /* + * pack version-specific metadata of an object + * at ->create() + */ + int32_t (*create_format)(unsigned char *wire, loc_t *loc, + struct crypt_inode_info *info, + struct master_cipher_info *master); + /* + * extract version-specific metadata of an object + * at ->open() time + */ + int32_t (*open_format)(unsigned char *wire, int32_t len, loc_t *loc, + struct crypt_inode_info *info, + struct master_cipher_info *master, + crypt_local_t *local, gf_boolean_t load_info); + int32_t (*update_format)(unsigned char *new, unsigned char *old, + size_t old_len, int32_t mac_idx, mtd_op_t op, + loc_t *loc, struct crypt_inode_info *info, + struct master_cipher_info *master, + crypt_local_t *local); }; -typedef int32_t (*end_writeback_handler_t)(call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct iatt *prebuf, - struct iatt *postbuf, - dict_t *xdata); +typedef int32_t (*end_writeback_handler_t)(call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, + struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata); typedef void (*linkop_wind_handler_t)(call_frame_t *frame, xlator_t *this); typedef void (*linkop_unwind_handler_t)(call_frame_t *frame); - /* Declarations */ /* keys.c */ extern struct crypt_key crypt_keys[LAST_KEY_TYPE]; -int32_t get_nmtd_vol_key(struct master_cipher_info *master); -int32_t get_nmtd_link_key(loc_t *loc, - struct master_cipher_info *master, - unsigned char *result); -int32_t get_emtd_file_key(struct crypt_inode_info *info, - struct master_cipher_info *master, - unsigned char *result); -int32_t get_data_file_key(struct crypt_inode_info *info, - struct master_cipher_info *master, - uint32_t keysize, - unsigned char *key); +int32_t +get_nmtd_vol_key(struct master_cipher_info *master); +int32_t +get_nmtd_link_key(loc_t *loc, struct master_cipher_info *master, + unsigned char *result); +int32_t +get_emtd_file_key(struct crypt_inode_info *info, + struct master_cipher_info *master, unsigned char *result); +int32_t +get_data_file_key(struct crypt_inode_info *info, + struct master_cipher_info *master, uint32_t keysize, + unsigned char *key); /* data.c */ -extern struct data_cipher_alg data_cipher_algs[LAST_CIPHER_ALG][LAST_CIPHER_MODE]; -void encrypt_aligned_iov(struct object_cipher_info *object, - struct iovec *vec, - int count, - off_t off); -void decrypt_aligned_iov(struct object_cipher_info *object, - struct iovec *vec, - int count, - off_t off); -int32_t align_iov_by_atoms(xlator_t *this, - crypt_local_t *local, - struct object_cipher_info *object, - struct iovec *vec /* input vector */, - int32_t count /* number of vec components */, - struct iovec *avec /* aligned vector */, - char **blocks /* pool of blocks */, - uint32_t *blocks_allocated, - struct avec_config *conf); -int32_t set_config_avec_data(xlator_t *this, - crypt_local_t *local, - struct avec_config *conf, - struct object_cipher_info *object, - struct iovec *vec, - int32_t vec_count); -int32_t set_config_avec_hole(xlator_t *this, - crypt_local_t *local, - struct avec_config *conf, - struct object_cipher_info *object, - glusterfs_fop_t fop); -void set_gap_at_end(call_frame_t *frame, struct object_cipher_info *object, - struct avec_config *conf, atom_data_type dtype); -void set_config_offsets(call_frame_t *frame, - xlator_t *this, - uint64_t offset, - uint64_t count, - atom_data_type dtype, - int32_t setup_gap_in_tail); +extern struct data_cipher_alg data_cipher_algs[LAST_CIPHER_ALG] + [LAST_CIPHER_MODE]; +void +encrypt_aligned_iov(struct object_cipher_info *object, struct iovec *vec, + int count, off_t off); +void +decrypt_aligned_iov(struct object_cipher_info *object, struct iovec *vec, + int count, off_t off); +int32_t +align_iov_by_atoms(xlator_t *this, crypt_local_t *local, + struct object_cipher_info *object, + struct iovec *vec /* input vector */, + int32_t count /* number of vec components */, + struct iovec *avec /* aligned vector */, + char **blocks /* pool of blocks */, + uint32_t *blocks_allocated, struct avec_config *conf); +int32_t +set_config_avec_data(xlator_t *this, crypt_local_t *local, + struct avec_config *conf, + struct object_cipher_info *object, struct iovec *vec, + int32_t vec_count); +int32_t +set_config_avec_hole(xlator_t *this, crypt_local_t *local, + struct avec_config *conf, + struct object_cipher_info *object, glusterfs_fop_t fop); +void +set_gap_at_end(call_frame_t *frame, struct object_cipher_info *object, + struct avec_config *conf, atom_data_type dtype); +void +set_config_offsets(call_frame_t *frame, xlator_t *this, uint64_t offset, + uint64_t count, atom_data_type dtype, + int32_t setup_gap_in_tail); /* metadata.c */ -extern struct crypt_mtd_loader mtd_loaders [LAST_MTD_LOADER]; - -int32_t alloc_format(crypt_local_t *local, size_t size); -int32_t alloc_format_create(crypt_local_t *local); -void free_format(crypt_local_t *local); -size_t format_size(mtd_op_t op, size_t old_size); -size_t new_format_size(void); -int32_t open_format(unsigned char *str, int32_t len, loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master, crypt_local_t *local, - gf_boolean_t load_info); -int32_t update_format(unsigned char *new, unsigned char *old, - size_t old_len, int32_t mac_idx, mtd_op_t op, loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master, - crypt_local_t *local); -int32_t create_format(unsigned char *wire, - loc_t *loc, - struct crypt_inode_info *info, - struct master_cipher_info *master); +extern struct crypt_mtd_loader mtd_loaders[LAST_MTD_LOADER]; + +int32_t +alloc_format(crypt_local_t *local, size_t size); +int32_t +alloc_format_create(crypt_local_t *local); +void +free_format(crypt_local_t *local); +size_t +format_size(mtd_op_t op, size_t old_size); +size_t +new_format_size(void); +int32_t +open_format(unsigned char *str, int32_t len, loc_t *loc, + struct crypt_inode_info *info, struct master_cipher_info *master, + crypt_local_t *local, gf_boolean_t load_info); +int32_t +update_format(unsigned char *new, unsigned char *old, size_t old_len, + int32_t mac_idx, mtd_op_t op, loc_t *loc, + struct crypt_inode_info *info, struct master_cipher_info *master, + crypt_local_t *local); +int32_t +create_format(unsigned char *wire, loc_t *loc, struct crypt_inode_info *info, + struct master_cipher_info *master); /* atom.c */ -struct rmw_atom *atom_by_types(atom_data_type data, - atom_locality_type locality); -void submit_partial(call_frame_t *frame, - xlator_t *this, - fd_t *fd, - atom_locality_type ltype); -void submit_full(call_frame_t *frame, xlator_t *this); +struct rmw_atom * +atom_by_types(atom_data_type data, atom_locality_type locality); +void +submit_partial(call_frame_t *frame, xlator_t *this, fd_t *fd, + atom_locality_type ltype); +void +submit_full(call_frame_t *frame, xlator_t *this); /* crypt.c */ -end_writeback_handler_t dispatch_end_writeback(glusterfs_fop_t fop); -void set_local_io_params_writev(call_frame_t *frame, - struct object_cipher_info *object, - struct rmw_atom *atom, off_t io_offset, - uint32_t io_size); -void link_wind(call_frame_t *frame, xlator_t *this); -void unlink_wind(call_frame_t *frame, xlator_t *this); -void link_unwind(call_frame_t *frame); -void unlink_unwind(call_frame_t *frame); -void rename_wind(call_frame_t *frame, xlator_t *this); -void rename_unwind(call_frame_t *frame); +end_writeback_handler_t +dispatch_end_writeback(glusterfs_fop_t fop); +void +set_local_io_params_writev(call_frame_t *frame, + struct object_cipher_info *object, + struct rmw_atom *atom, off_t io_offset, + uint32_t io_size); +void +link_wind(call_frame_t *frame, xlator_t *this); +void +unlink_wind(call_frame_t *frame, xlator_t *this); +void +link_unwind(call_frame_t *frame); +void +unlink_unwind(call_frame_t *frame); +void +rename_wind(call_frame_t *frame, xlator_t *this); +void +rename_unwind(call_frame_t *frame); /* Inline functions */ -static inline int32_t crypt_xlator_id(void) +static inline int32_t +crypt_xlator_id(void) { - return CRYPT_XLATOR_ID; + return CRYPT_XLATOR_ID; } -static inline mtd_loader_id current_mtd_loader(void) +static inline mtd_loader_id +current_mtd_loader(void) { - return MTD_LOADER_V1; + return MTD_LOADER_V1; } -static inline uint32_t master_key_size (void) +static inline uint32_t +master_key_size(void) { - return crypt_keys[MASTER_VOL_KEY].len >> 3; + return crypt_keys[MASTER_VOL_KEY].len >> 3; } -static inline uint32_t nmtd_vol_key_size (void) +static inline uint32_t +nmtd_vol_key_size(void) { - return crypt_keys[NMTD_VOL_KEY].len >> 3; + return crypt_keys[NMTD_VOL_KEY].len >> 3; } -static inline uint32_t alg_mode_blkbits(cipher_alg_t alg, - cipher_mode_t mode) +static inline uint32_t +alg_mode_blkbits(cipher_alg_t alg, cipher_mode_t mode) { - return data_cipher_algs[alg][mode].blkbits; + return data_cipher_algs[alg][mode].blkbits; } -static inline uint32_t alg_mode_blksize(cipher_alg_t alg, - cipher_mode_t mode) +static inline uint32_t +alg_mode_blksize(cipher_alg_t alg, cipher_mode_t mode) { - return 1 << alg_mode_blkbits(alg, mode); + return 1 << alg_mode_blkbits(alg, mode); } -static inline gf_boolean_t alg_mode_atomic(cipher_alg_t alg, - cipher_mode_t mode) +static inline gf_boolean_t +alg_mode_atomic(cipher_alg_t alg, cipher_mode_t mode) { - return data_cipher_algs[alg][mode].atomic; + return data_cipher_algs[alg][mode].atomic; } -static inline gf_boolean_t alg_mode_should_pad(cipher_alg_t alg, - cipher_mode_t mode) +static inline gf_boolean_t +alg_mode_should_pad(cipher_alg_t alg, cipher_mode_t mode) { - return data_cipher_algs[alg][mode].should_pad; + return data_cipher_algs[alg][mode].should_pad; } -static inline uint32_t master_alg_blksize(struct master_cipher_info *mr) +static inline uint32_t +master_alg_blksize(struct master_cipher_info *mr) { - return alg_mode_blksize(mr->m_alg, mr->m_mode); + return alg_mode_blksize(mr->m_alg, mr->m_mode); } -static inline uint32_t master_alg_blkbits(struct master_cipher_info *mr) +static inline uint32_t +master_alg_blkbits(struct master_cipher_info *mr) { - return alg_mode_blkbits(mr->m_alg, mr->m_mode); + return alg_mode_blkbits(mr->m_alg, mr->m_mode); } -static inline gf_boolean_t master_alg_atomic(struct master_cipher_info *mr) +static inline gf_boolean_t +master_alg_atomic(struct master_cipher_info *mr) { - return alg_mode_atomic(mr->m_alg, mr->m_mode); + return alg_mode_atomic(mr->m_alg, mr->m_mode); } -static inline gf_boolean_t master_alg_should_pad(struct master_cipher_info *mr) +static inline gf_boolean_t +master_alg_should_pad(struct master_cipher_info *mr) { - return alg_mode_should_pad(mr->m_alg, mr->m_mode); + return alg_mode_should_pad(mr->m_alg, mr->m_mode); } -static inline uint32_t object_alg_blksize(struct object_cipher_info *ob) +static inline uint32_t +object_alg_blksize(struct object_cipher_info *ob) { - return alg_mode_blksize(ob->o_alg, ob->o_mode); + return alg_mode_blksize(ob->o_alg, ob->o_mode); } -static inline uint32_t object_alg_blkbits(struct object_cipher_info *ob) +static inline uint32_t +object_alg_blkbits(struct object_cipher_info *ob) { - return alg_mode_blkbits(ob->o_alg, ob->o_mode); + return alg_mode_blkbits(ob->o_alg, ob->o_mode); } -static inline gf_boolean_t object_alg_atomic(struct object_cipher_info *ob) +static inline gf_boolean_t +object_alg_atomic(struct object_cipher_info *ob) { - return alg_mode_atomic(ob->o_alg, ob->o_mode); + return alg_mode_atomic(ob->o_alg, ob->o_mode); } -static inline gf_boolean_t object_alg_should_pad(struct object_cipher_info *ob) +static inline gf_boolean_t +object_alg_should_pad(struct object_cipher_info *ob) { - return alg_mode_should_pad(ob->o_alg, ob->o_mode); + return alg_mode_should_pad(ob->o_alg, ob->o_mode); } -static inline uint32_t aes_raw_key_size(struct master_cipher_info *master) +static inline uint32_t +aes_raw_key_size(struct master_cipher_info *master) { - return master->m_dkey_size >> 3; + return master->m_dkey_size >> 3; } -static inline struct avec_config *get_hole_conf(call_frame_t *frame) +static inline struct avec_config * +get_hole_conf(call_frame_t *frame) { - return &(((crypt_local_t *)frame->local)->hole_conf); + return &(((crypt_local_t *)frame->local)->hole_conf); } -static inline struct avec_config *get_data_conf(call_frame_t *frame) +static inline struct avec_config * +get_data_conf(call_frame_t *frame) { - return &(((crypt_local_t *)frame->local)->data_conf); + return &(((crypt_local_t *)frame->local)->data_conf); } -static inline int32_t get_atom_bits (struct object_cipher_info *object) +static inline int32_t +get_atom_bits(struct object_cipher_info *object) { - return object->o_block_bits; + return object->o_block_bits; } -static inline int32_t get_atom_size (struct object_cipher_info *object) +static inline int32_t +get_atom_size(struct object_cipher_info *object) { - return 1 << get_atom_bits(object); + return 1 << get_atom_bits(object); } -static inline int32_t has_head_block(struct avec_config *conf) +static inline int32_t +has_head_block(struct avec_config *conf) { - return conf->off_in_head || - (conf->acount == 1 && conf->off_in_tail); + return conf->off_in_head || (conf->acount == 1 && conf->off_in_tail); } -static inline int32_t has_tail_block(struct avec_config *conf) +static inline int32_t +has_tail_block(struct avec_config *conf) { - return conf->off_in_tail && conf->acount > 1; + return conf->off_in_tail && conf->acount > 1; } -static inline int32_t has_full_blocks(struct avec_config *conf) +static inline int32_t +has_full_blocks(struct avec_config *conf) { - return conf->nr_full_blocks; + return conf->nr_full_blocks; } -static inline int32_t should_submit_head_block(struct avec_config *conf) +static inline int32_t +should_submit_head_block(struct avec_config *conf) { - return has_head_block(conf) && (conf->cursor == 0); + return has_head_block(conf) && (conf->cursor == 0); } -static inline int32_t should_submit_tail_block(struct avec_config *conf) +static inline int32_t +should_submit_tail_block(struct avec_config *conf) { - return has_tail_block(conf) && (conf->cursor == conf->acount - 1); + return has_tail_block(conf) && (conf->cursor == conf->acount - 1); } -static inline int32_t should_submit_full_block(struct avec_config *conf) +static inline int32_t +should_submit_full_block(struct avec_config *conf) { - uint32_t start = has_head_block(conf) ? 1 : 0; + uint32_t start = has_head_block(conf) ? 1 : 0; - return has_full_blocks(conf) && - conf->cursor >= start && - conf->cursor < start + conf->nr_full_blocks; + return has_full_blocks(conf) && conf->cursor >= start && + conf->cursor < start + conf->nr_full_blocks; } #if DEBUG_CRYPT -static inline void crypt_check_input_len(size_t len, - struct object_cipher_info *object) +static inline void +crypt_check_input_len(size_t len, struct object_cipher_info *object) { - if (object_alg_should_pad(object) && (len & (object_alg_blksize(object) - 1))) - gf_log ("crypt", GF_LOG_DEBUG, "bad input len: %d", (int)len); + if (object_alg_should_pad(object) && + (len & (object_alg_blksize(object) - 1))) + gf_log("crypt", GF_LOG_DEBUG, "bad input len: %d", (int)len); } -static inline void check_head_block(struct avec_config *conf) +static inline void +check_head_block(struct avec_config *conf) { - if (!has_head_block(conf)) - gf_log("crypt", GF_LOG_DEBUG, "not a head atom"); + if (!has_head_block(conf)) + gf_log("crypt", GF_LOG_DEBUG, "not a head atom"); } -static inline void check_tail_block(struct avec_config *conf) +static inline void +check_tail_block(struct avec_config *conf) { - if (!has_tail_block(conf)) - gf_log("crypt", GF_LOG_DEBUG, "not a tail atom"); + if (!has_tail_block(conf)) + gf_log("crypt", GF_LOG_DEBUG, "not a tail atom"); } -static inline void check_full_block(struct avec_config *conf) +static inline void +check_full_block(struct avec_config *conf) { - if (!has_full_blocks(conf)) - gf_log("crypt", GF_LOG_DEBUG, "not a full atom"); + if (!has_full_blocks(conf)) + gf_log("crypt", GF_LOG_DEBUG, "not a full atom"); } -static inline void check_cursor_head(struct avec_config *conf) +static inline void +check_cursor_head(struct avec_config *conf) { - if (!has_head_block(conf)) - gf_log("crypt", - GF_LOG_DEBUG, "Illegal call of head atom method"); - else if (conf->cursor != 0) - gf_log("crypt", - GF_LOG_DEBUG, "Cursor (%d) is not at head atom", - conf->cursor); + if (!has_head_block(conf)) + gf_log("crypt", GF_LOG_DEBUG, "Illegal call of head atom method"); + else if (conf->cursor != 0) + gf_log("crypt", GF_LOG_DEBUG, "Cursor (%d) is not at head atom", + conf->cursor); } -static inline void check_cursor_full(struct avec_config *conf) +static inline void +check_cursor_full(struct avec_config *conf) { - if (!has_full_blocks(conf)) - gf_log("crypt", - GF_LOG_DEBUG, "Illegal call of full atom method"); - if (has_head_block(conf) && (conf->cursor == 0)) - gf_log("crypt", - GF_LOG_DEBUG, "Cursor is not at full atom"); + if (!has_full_blocks(conf)) + gf_log("crypt", GF_LOG_DEBUG, "Illegal call of full atom method"); + if (has_head_block(conf) && (conf->cursor == 0)) + gf_log("crypt", GF_LOG_DEBUG, "Cursor is not at full atom"); } /* * FIXME: use avec->iov_len to check setup */ -static inline int data_local_invariant(crypt_local_t *local) +static inline int +data_local_invariant(crypt_local_t *local) { - return 0; + return 0; } #else @@ -687,207 +697,225 @@ static inline int data_local_invariant(crypt_local_t *local) #endif /* DEBUG_CRYPT */ -static inline struct avec_config *conf_by_type(call_frame_t *frame, - atom_data_type dtype) +static inline struct avec_config * +conf_by_type(call_frame_t *frame, atom_data_type dtype) { - struct avec_config *conf = NULL; + struct avec_config *conf = NULL; - switch (dtype) { - case HOLE_ATOM: - conf = get_hole_conf(frame); - break; - case DATA_ATOM: - conf = get_data_conf(frame); - break; - default: - gf_log("crypt", GF_LOG_DEBUG, "bad atom type"); - } - return conf; + switch (dtype) { + case HOLE_ATOM: + conf = get_hole_conf(frame); + break; + case DATA_ATOM: + conf = get_data_conf(frame); + break; + default: + gf_log("crypt", GF_LOG_DEBUG, "bad atom type"); + } + return conf; } -static inline uint32_t nr_calls_head(struct avec_config *conf) +static inline uint32_t +nr_calls_head(struct avec_config *conf) { - return has_head_block(conf) ? 1 : 0; + return has_head_block(conf) ? 1 : 0; } -static inline uint32_t nr_calls_tail(struct avec_config *conf) +static inline uint32_t +nr_calls_tail(struct avec_config *conf) { - return has_tail_block(conf) ? 1 : 0; + return has_tail_block(conf) ? 1 : 0; } -static inline uint32_t nr_calls_full(struct avec_config *conf) +static inline uint32_t +nr_calls_full(struct avec_config *conf) { - switch(conf->type) { - case HOLE_ATOM: - return has_full_blocks(conf); - case DATA_ATOM: - return has_full_blocks(conf) ? - logical_blocks_occupied(0, - conf->nr_full_blocks, - MAX_IOVEC_BITS) : 0; - default: - gf_log("crypt", GF_LOG_DEBUG, "bad atom data type"); - return 0; - } + switch (conf->type) { + case HOLE_ATOM: + return has_full_blocks(conf); + case DATA_ATOM: + return has_full_blocks(conf) + ? logical_blocks_occupied(0, conf->nr_full_blocks, + MAX_IOVEC_BITS) + : 0; + default: + gf_log("crypt", GF_LOG_DEBUG, "bad atom data type"); + return 0; + } } -static inline uint32_t nr_calls(struct avec_config *conf) +static inline uint32_t +nr_calls(struct avec_config *conf) { - return nr_calls_head(conf) + nr_calls_tail(conf) + nr_calls_full(conf); + return nr_calls_head(conf) + nr_calls_tail(conf) + nr_calls_full(conf); } -static inline uint32_t nr_calls_data(call_frame_t *frame) +static inline uint32_t +nr_calls_data(call_frame_t *frame) { - return nr_calls(get_data_conf(frame)); + return nr_calls(get_data_conf(frame)); } -static inline uint32_t nr_calls_hole(call_frame_t *frame) +static inline uint32_t +nr_calls_hole(call_frame_t *frame) { - return nr_calls(get_hole_conf(frame)); + return nr_calls(get_hole_conf(frame)); } -static inline void get_one_call_nolock(call_frame_t *frame) +static inline void +get_one_call_nolock(call_frame_t *frame) { - crypt_local_t *local = frame->local; + crypt_local_t *local = frame->local; - ++local->nr_calls; + ++local->nr_calls; - //gf_log("crypt", GF_LOG_DEBUG, "get %d calls", 1); + // gf_log("crypt", GF_LOG_DEBUG, "get %d calls", 1); } -static inline void get_one_call(call_frame_t *frame) +static inline void +get_one_call(call_frame_t *frame) { - crypt_local_t *local = frame->local; + crypt_local_t *local = frame->local; - LOCK(&local->call_lock); - get_one_call_nolock(frame); - UNLOCK(&local->call_lock); + LOCK(&local->call_lock); + get_one_call_nolock(frame); + UNLOCK(&local->call_lock); } -static inline void get_nr_calls_nolock(call_frame_t *frame, int32_t nr) +static inline void +get_nr_calls_nolock(call_frame_t *frame, int32_t nr) { - crypt_local_t *local = frame->local; + crypt_local_t *local = frame->local; - local->nr_calls += nr; + local->nr_calls += nr; - //gf_log("crypt", GF_LOG_DEBUG, "get %d calls", nr); + // gf_log("crypt", GF_LOG_DEBUG, "get %d calls", nr); } -static inline void get_nr_calls(call_frame_t *frame, int32_t nr) +static inline void +get_nr_calls(call_frame_t *frame, int32_t nr) { - crypt_local_t *local = frame->local; + crypt_local_t *local = frame->local; - LOCK(&local->call_lock); - get_nr_calls_nolock(frame, nr); - UNLOCK(&local->call_lock); + LOCK(&local->call_lock); + get_nr_calls_nolock(frame, nr); + UNLOCK(&local->call_lock); } -static inline int put_one_call(crypt_local_t *local) +static inline int +put_one_call(crypt_local_t *local) { - uint32_t last = 0; + uint32_t last = 0; - LOCK(&local->call_lock); - if (--local->nr_calls == 0) - last = 1; + LOCK(&local->call_lock); + if (--local->nr_calls == 0) + last = 1; - //gf_log("crypt", GF_LOG_DEBUG, "put %d calls", 1); + // gf_log("crypt", GF_LOG_DEBUG, "put %d calls", 1); - UNLOCK(&local->call_lock); - return last; + UNLOCK(&local->call_lock); + return last; } -static inline int is_appended_write(call_frame_t *frame) +static inline int +is_appended_write(call_frame_t *frame) { - crypt_local_t *local = frame->local; - struct avec_config *conf = get_data_conf(frame); + crypt_local_t *local = frame->local; + struct avec_config *conf = get_data_conf(frame); - return conf->orig_offset + conf->orig_size > local->old_file_size; + return conf->orig_offset + conf->orig_size > local->old_file_size; } -static inline int is_ordered_mode(call_frame_t *frame) +static inline int +is_ordered_mode(call_frame_t *frame) { #if 0 crypt_local_t *local = frame->local; return local->fop == GF_FOP_FTRUNCATE || (local->fop == GF_FOP_WRITE && is_appended_write(frame)); #endif - return 1; + return 1; } -static inline int32_t hole_conv_completed(crypt_local_t *local) +static inline int32_t +hole_conv_completed(crypt_local_t *local) { - struct avec_config *conf = &local->hole_conf; - return conf->cursor == conf->acount; + struct avec_config *conf = &local->hole_conf; + return conf->cursor == conf->acount; } -static inline int32_t data_write_in_progress(crypt_local_t *local) +static inline int32_t +data_write_in_progress(crypt_local_t *local) { - return local->active_setup == DATA_ATOM; + return local->active_setup == DATA_ATOM; } -static inline int32_t parent_is_crypt_xlator(call_frame_t *frame, - xlator_t *this) +static inline int32_t +parent_is_crypt_xlator(call_frame_t *frame, xlator_t *this) { - return frame->parent->this == this; + return frame->parent->this == this; } -static inline linkop_wind_handler_t linkop_wind_dispatch(glusterfs_fop_t fop) +static inline linkop_wind_handler_t +linkop_wind_dispatch(glusterfs_fop_t fop) { - switch(fop){ - case GF_FOP_LINK: - return link_wind; - case GF_FOP_UNLINK: - return unlink_wind; - case GF_FOP_RENAME: - return rename_wind; - default: - gf_log("crypt", GF_LOG_ERROR, "Bad link operation %d", fop); - return NULL; - } + switch (fop) { + case GF_FOP_LINK: + return link_wind; + case GF_FOP_UNLINK: + return unlink_wind; + case GF_FOP_RENAME: + return rename_wind; + default: + gf_log("crypt", GF_LOG_ERROR, "Bad link operation %d", fop); + return NULL; + } } -static inline linkop_unwind_handler_t linkop_unwind_dispatch(glusterfs_fop_t fop) +static inline linkop_unwind_handler_t +linkop_unwind_dispatch(glusterfs_fop_t fop) { - switch(fop){ - case GF_FOP_LINK: - return link_unwind; - case GF_FOP_UNLINK: - return unlink_unwind; - case GF_FOP_RENAME: - return rename_unwind; - default: - gf_log("crypt", GF_LOG_ERROR, "Bad link operation %d", fop); - return NULL; - } + switch (fop) { + case GF_FOP_LINK: + return link_unwind; + case GF_FOP_UNLINK: + return unlink_unwind; + case GF_FOP_RENAME: + return rename_unwind; + default: + gf_log("crypt", GF_LOG_ERROR, "Bad link operation %d", fop); + return NULL; + } } -static inline mtd_op_t linkop_mtdop_dispatch(glusterfs_fop_t fop) +static inline mtd_op_t +linkop_mtdop_dispatch(glusterfs_fop_t fop) { - switch (fop) { - case GF_FOP_LINK: - return MTD_APPEND; - case GF_FOP_UNLINK: - return MTD_CUT; - case GF_FOP_RENAME: - return MTD_OVERWRITE; - default: - gf_log("crypt", GF_LOG_WARNING, "Bad link operation %d", fop); - return MTD_LAST_OP; - } + switch (fop) { + case GF_FOP_LINK: + return MTD_APPEND; + case GF_FOP_UNLINK: + return MTD_CUT; + case GF_FOP_RENAME: + return MTD_OVERWRITE; + default: + gf_log("crypt", GF_LOG_WARNING, "Bad link operation %d", fop); + return MTD_LAST_OP; + } } -#define CRYPT_STACK_UNWIND(fop, frame, params ...) \ - do { \ - crypt_local_t *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - GF_FREE (__local); \ - } \ - } while (0) +#define CRYPT_STACK_UNWIND(fop, frame, params...) \ + do { \ + crypt_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + GF_FREE(__local); \ + } \ + } while (0) #endif /* __CRYPT_H__ */ diff --git a/xlators/encryption/crypt/src/metadata.h b/xlators/encryption/crypt/src/metadata.h index b67ae25b58c..0bcee1b18c8 100644 --- a/xlators/encryption/crypt/src/metadata.h +++ b/xlators/encryption/crypt/src/metadata.h @@ -11,11 +11,11 @@ #ifndef __METADATA_H__ #define __METADATA_H__ -#define NMTD_8_MAC_SIZE (8) -#define EMTD_8_MAC_SIZE (8) +#define NMTD_8_MAC_SIZE (8) +#define EMTD_8_MAC_SIZE (8) typedef uint8_t nmtd_8_mac_t[NMTD_8_MAC_SIZE]; -typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE] ; +typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE]; /* * Version "v1" of file's metadata. @@ -28,17 +28,17 @@ typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE] ; * exactly one MAC) */ struct mtd_format_v1 { - /* EMTD, encrypted part of meta-data */ - uint8_t alg_id; /* cipher algorithm id (only AES for now) */ - uint8_t mode_id; /* cipher mode id; (only XTS for now) */ - uint8_t block_bits; /* encoded block size */ - uint8_t minor_id; /* client translator id */ - uint8_t dkey_factor; /* encoded size of the data key */ - /* MACs */ - emtd_8_mac_t gmac; /* MAC of the encrypted meta-data, 8 bytes */ - nmtd_8_mac_t omac; /* per-link MACs of the non-encrypted - * meta-data: at least one such MAC is always - * present */ + /* EMTD, encrypted part of meta-data */ + uint8_t alg_id; /* cipher algorithm id (only AES for now) */ + uint8_t mode_id; /* cipher mode id; (only XTS for now) */ + uint8_t block_bits; /* encoded block size */ + uint8_t minor_id; /* client translator id */ + uint8_t dkey_factor; /* encoded size of the data key */ + /* MACs */ + emtd_8_mac_t gmac; /* MAC of the encrypted meta-data, 8 bytes */ + nmtd_8_mac_t omac; /* per-link MACs of the non-encrypted + * meta-data: at least one such MAC is always + * present */ } __attribute__((packed)); /* @@ -46,29 +46,34 @@ struct mtd_format_v1 { * is file's gfid, which is generated on trusted machines. */ #define SIZE_OF_NMTD_V1 (sizeof(uuid_t)) -#define SIZE_OF_EMTD_V1 (offsetof(struct mtd_format_v1, gmac) - \ - offsetof(struct mtd_format_v1, alg_id)) +#define SIZE_OF_EMTD_V1 \ + (offsetof(struct mtd_format_v1, gmac) - \ + offsetof(struct mtd_format_v1, alg_id)) #define SIZE_OF_NMTD_V1_MAC (NMTD_8_MAC_SIZE) #define SIZE_OF_EMTD_V1_MAC (EMTD_8_MAC_SIZE) -static inline unsigned char *get_EMTD_V1(struct mtd_format_v1 *format) +static inline unsigned char * +get_EMTD_V1(struct mtd_format_v1 *format) { - return &format->alg_id; + return &format->alg_id; } -static inline unsigned char *get_NMTD_V1(struct crypt_inode_info *info) +static inline unsigned char * +get_NMTD_V1(struct crypt_inode_info *info) { - return info->oid; + return info->oid; } -static inline unsigned char *get_EMTD_V1_MAC(struct mtd_format_v1 *format) +static inline unsigned char * +get_EMTD_V1_MAC(struct mtd_format_v1 *format) { - return format->gmac; + return format->gmac; } -static inline unsigned char *get_NMTD_V1_MAC(struct mtd_format_v1 *format) +static inline unsigned char * +get_NMTD_V1_MAC(struct mtd_format_v1 *format) { - return format->omac; + return format->omac; } #endif /* __METADATA_H__ */ diff --git a/xlators/encryption/rot-13/src/rot-13.h b/xlators/encryption/rot-13/src/rot-13.h index a2017513437..edbc99798b4 100644 --- a/xlators/encryption/rot-13/src/rot-13.h +++ b/xlators/encryption/rot-13/src/rot-13.h @@ -11,8 +11,8 @@ #define __ROT_13_H__ typedef struct { - gf_boolean_t encrypt_write; - gf_boolean_t decrypt_read; + gf_boolean_t encrypt_write; + gf_boolean_t decrypt_read; } rot_13_private_t; #endif /* __ROT_13_H__ */ diff --git a/xlators/experimental/fdl/src/fdl.h b/xlators/experimental/fdl/src/fdl.h index 32e38c93f2d..827db9f1246 100644 --- a/xlators/experimental/fdl/src/fdl.h +++ b/xlators/experimental/fdl/src/fdl.h @@ -11,20 +11,20 @@ #ifndef _FDL_H_ #define _FDL_H_ -#define NEW_REQUEST (uint8_t)'N' +#define NEW_REQUEST (uint8_t)'N' typedef struct { - uint8_t event_type; /* e.g. NEW_REQUEST */ - uint8_t fop_type; /* e.g. GF_FOP_SETATTR */ - uint16_t request_id; - uint32_t ext_length; + uint8_t event_type; /* e.g. NEW_REQUEST */ + uint8_t fop_type; /* e.g. GF_FOP_SETATTR */ + uint16_t request_id; + uint32_t ext_length; } event_header_t; enum { - FDL_IPC_BASE = 0xfeedbee5, /* ... and they make honey */ - FDL_IPC_CHANGE_TERM, - FDL_IPC_GET_TERMS, - FDL_IPC_JBR_SERVER_ROLLBACK + FDL_IPC_BASE = 0xfeedbee5, /* ... and they make honey */ + FDL_IPC_CHANGE_TERM, + FDL_IPC_GET_TERMS, + FDL_IPC_JBR_SERVER_ROLLBACK }; #endif /* _FDL_H_ */ diff --git a/xlators/experimental/jbr-client/src/jbr-messages.h b/xlators/experimental/jbr-client/src/jbr-messages.h index 9f210184d81..ecbf569ec13 100644 --- a/xlators/experimental/jbr-client/src/jbr-messages.h +++ b/xlators/experimental/jbr-client/src/jbr-messages.h @@ -23,17 +23,8 @@ * glfs-message-id.h. */ -GLFS_MSGID(JBR, - J_MSG_INIT_FAIL, - J_MSG_RETRY_MSG, - J_MSG_MEM_ERR, - J_MSG_DICT_FLR, - J_MSG_GENERIC, - J_MSG_INVALID, - J_MSG_NO_DATA, - J_MSG_SYS_CALL_FAILURE, - J_MSG_QUORUM_NOT_MET, - J_MSG_LOCK_FAILURE -); +GLFS_MSGID(JBR, J_MSG_INIT_FAIL, J_MSG_RETRY_MSG, J_MSG_MEM_ERR, J_MSG_DICT_FLR, + J_MSG_GENERIC, J_MSG_INVALID, J_MSG_NO_DATA, J_MSG_SYS_CALL_FAILURE, + J_MSG_QUORUM_NOT_MET, J_MSG_LOCK_FAILURE); #endif /* _JBR_MESSAGES_H_ */ diff --git a/xlators/experimental/jbr-client/src/jbrc.h b/xlators/experimental/jbr-client/src/jbrc.h index c83259ca1bd..f99178402b3 100644 --- a/xlators/experimental/jbr-client/src/jbrc.h +++ b/xlators/experimental/jbr-client/src/jbrc.h @@ -12,16 +12,16 @@ #define _JBRC_H_ typedef struct { - xlator_t *active; - uint8_t up_children; - uint8_t n_children; - uint32_t kid_state; + xlator_t *active; + uint8_t up_children; + uint8_t n_children; + uint32_t kid_state; } jbrc_private_t; typedef struct { - call_stub_t *stub; - xlator_t *curr_xl; - uint16_t scars; + call_stub_t *stub; + xlator_t *curr_xl; + uint16_t scars; } jbrc_local_t; #endif /* _JBRC_H_ */ diff --git a/xlators/experimental/jbr-server/src/jbr-internal.h b/xlators/experimental/jbr-server/src/jbr-internal.h index 46a29910d1f..f225e988a5f 100644 --- a/xlators/experimental/jbr-server/src/jbr-internal.h +++ b/xlators/experimental/jbr-server/src/jbr-internal.h @@ -11,82 +11,82 @@ #include <sys/stat.h> #include <sys/types.h> -#define LEADER_XATTR "user.jbr.leader" -#define SECOND_CHILD(xl) (xl->children->next->xlator) -#define RECONCILER_PATH JBR_SCRIPT_PREFIX"/reconciler.py" -#define CHANGELOG_ENTRY_SIZE 128 +#define LEADER_XATTR "user.jbr.leader" +#define SECOND_CHILD(xl) (xl->children->next->xlator) +#define RECONCILER_PATH JBR_SCRIPT_PREFIX "/reconciler.py" +#define CHANGELOG_ENTRY_SIZE 128 enum { - gf_mt_jbr_private_t = gf_common_mt_end + 1, - gf_mt_jbr_fd_ctx_t, - gf_mt_jbr_inode_ctx_t, - gf_mt_jbr_dirty_t, - gf_mt_jbr_end + gf_mt_jbr_private_t = gf_common_mt_end + 1, + gf_mt_jbr_fd_ctx_t, + gf_mt_jbr_inode_ctx_t, + gf_mt_jbr_dirty_t, + gf_mt_jbr_end }; typedef enum jbr_recon_notify_ev_id_t { - JBR_RECON_SET_LEADER = 1, - JBR_RECON_ADD_CHILD = 2 + JBR_RECON_SET_LEADER = 1, + JBR_RECON_ADD_CHILD = 2 } jbr_recon_notify_ev_id_t; typedef struct _jbr_recon_notify_ev_s { - jbr_recon_notify_ev_id_t id; - uint32_t index; /* in case of add */ - struct list_head list; + jbr_recon_notify_ev_id_t id; + uint32_t index; /* in case of add */ + struct list_head list; } jbr_recon_notify_ev_t; typedef struct { - /* - * This is a hack to allow a non-leader to accept requests while the - * leader is down, and it only works for n=2. The way it works is that - * "config_leader" indicates the state from our options (via init or - * reconfigure) but "leader" is what the fop code actually looks at. If - * config_leader is true, then leader will *always* be true as well, - * giving that brick precedence. If config_leader is false, then - * leader will only be true if there is no connection to the other - * brick (tracked in jbr_notify). - * - * TBD: implement real leader election - */ - gf_boolean_t config_leader; - gf_boolean_t leader; - uint8_t up_children; - uint8_t n_children; - char *vol_file; - uint32_t current_term; - uint32_t kid_state; - gf_lock_t dirty_lock; - struct list_head dirty_fds; - uint32_t index; - gf_lock_t index_lock; - double quorum_pct; - int term_fd; - long term_total; - long term_read; - /* - * This is a super-duper hack, but it will do for now. The reason it's - * a hack is that we pass this to dict_set_static_bin, so we don't have - * to mess around with allocating and freeing it on every single IPC - * request, but it's totally not thread-safe. On the other hand, there - * should only be one reconciliation thread running and calling these - * functions at a time, so maybe that doesn't matter. - * - * TBD: re-evaluate how to manage this - */ - char term_buf[CHANGELOG_ENTRY_SIZE]; - gf_boolean_t child_up; /* To maintain the state of * - * the translator */ + /* + * This is a hack to allow a non-leader to accept requests while the + * leader is down, and it only works for n=2. The way it works is that + * "config_leader" indicates the state from our options (via init or + * reconfigure) but "leader" is what the fop code actually looks at. If + * config_leader is true, then leader will *always* be true as well, + * giving that brick precedence. If config_leader is false, then + * leader will only be true if there is no connection to the other + * brick (tracked in jbr_notify). + * + * TBD: implement real leader election + */ + gf_boolean_t config_leader; + gf_boolean_t leader; + uint8_t up_children; + uint8_t n_children; + char *vol_file; + uint32_t current_term; + uint32_t kid_state; + gf_lock_t dirty_lock; + struct list_head dirty_fds; + uint32_t index; + gf_lock_t index_lock; + double quorum_pct; + int term_fd; + long term_total; + long term_read; + /* + * This is a super-duper hack, but it will do for now. The reason it's + * a hack is that we pass this to dict_set_static_bin, so we don't have + * to mess around with allocating and freeing it on every single IPC + * request, but it's totally not thread-safe. On the other hand, there + * should only be one reconciliation thread running and calling these + * functions at a time, so maybe that doesn't matter. + * + * TBD: re-evaluate how to manage this + */ + char term_buf[CHANGELOG_ENTRY_SIZE]; + gf_boolean_t child_up; /* To maintain the state of * + * the translator */ } jbr_private_t; typedef struct { - call_stub_t *stub; - call_stub_t *qstub; - uint32_t call_count; - uint32_t successful_acks; - uint32_t successful_op_ret; - fd_t *fd; - struct list_head qlinks; - dict_t *xdata; + call_stub_t *stub; + call_stub_t *qstub; + uint32_t call_count; + uint32_t successful_acks; + uint32_t successful_op_ret; + fd_t *fd; + struct list_head qlinks; + dict_t *xdata; } jbr_local_t; /* @@ -96,22 +96,23 @@ typedef struct { typedef uint32_t log_id_t; typedef struct { - struct list_head links; - log_id_t id; + struct list_head links; + log_id_t id; } jbr_dirty_list_t; typedef struct { - fd_t *fd; - struct list_head dirty_list; - struct list_head fd_list; + fd_t *fd; + struct list_head dirty_list; + struct list_head fd_list; } jbr_fd_ctx_t; typedef struct { - gf_lock_t lock; - uint32_t active; - struct list_head aqueue; - uint32_t pending; - struct list_head pqueue; + gf_lock_t lock; + uint32_t active; + struct list_head aqueue; + uint32_t pending; + struct list_head pqueue; } jbr_inode_ctx_t; -void jbr_start_reconciler (xlator_t *this); +void +jbr_start_reconciler(xlator_t *this); diff --git a/xlators/features/arbiter/src/arbiter-mem-types.h b/xlators/features/arbiter/src/arbiter-mem-types.h index ccf864cdef0..0f77cfd05f4 100644 --- a/xlators/features/arbiter/src/arbiter-mem-types.h +++ b/xlators/features/arbiter/src/arbiter-mem-types.h @@ -12,7 +12,7 @@ #include "mem-types.h" typedef enum gf_arbiter_mem_types_ { - gf_arbiter_mt_inode_ctx_t = gf_common_mt_end + 1, - gf_arbiter_mt_end + gf_arbiter_mt_inode_ctx_t = gf_common_mt_end + 1, + gf_arbiter_mt_end } gf_arbiter_mem_types_t; #endif diff --git a/xlators/features/arbiter/src/arbiter.h b/xlators/features/arbiter/src/arbiter.h index f52b45fad20..ce1c909f70f 100644 --- a/xlators/features/arbiter/src/arbiter.h +++ b/xlators/features/arbiter/src/arbiter.h @@ -15,7 +15,7 @@ #include "common-utils.h" typedef struct arbiter_inode_ctx_ { - struct iatt iattbuf; + struct iatt iattbuf; } arbiter_inode_ctx_t; #endif /* _ARBITER_H */ diff --git a/xlators/features/barrier/src/barrier-mem-types.h b/xlators/features/barrier/src/barrier-mem-types.h index 36647a66966..93ccab633ce 100644 --- a/xlators/features/barrier/src/barrier-mem-types.h +++ b/xlators/features/barrier/src/barrier-mem-types.h @@ -14,7 +14,7 @@ #include "mem-types.h" enum gf_barrier_mem_types_ { - gf_barrier_mt_priv_t = gf_common_mt_end + 1, - gf_barrier_mt_end + gf_barrier_mt_priv_t = gf_common_mt_end + 1, + gf_barrier_mt_end }; #endif diff --git a/xlators/features/barrier/src/barrier.h b/xlators/features/barrier/src/barrier.h index 0d646f90474..d11d71d151e 100644 --- a/xlators/features/barrier/src/barrier.h +++ b/xlators/features/barrier/src/barrier.h @@ -16,67 +16,73 @@ #include "timer.h" #include "call-stub.h" -#define BARRIER_FOP_CBK(fop_name, label, frame, this, params ...) \ - do { \ - barrier_priv_t *_priv = NULL; \ - call_stub_t *_stub = NULL; \ - gf_boolean_t _barrier_enabled= _gf_false; \ - struct list_head queue = {0, }; \ - \ - INIT_LIST_HEAD (&queue); \ - \ - _priv = this->private; \ - GF_ASSERT (_priv); \ - \ - LOCK (&_priv->lock); \ - { \ - if (_priv->barrier_enabled) { \ - _barrier_enabled = _priv->barrier_enabled;\ - \ - _stub = fop_##fop_name##_cbk_stub \ - (frame, \ - barrier_##fop_name##_cbk_resume,\ - params); \ - if (!_stub) { \ - __barrier_disable (this, &queue);\ - goto unlock; \ - } \ - \ - __barrier_enqueue (this, _stub); \ - } \ - } \ -unlock: \ - UNLOCK (&_priv->lock); \ - \ - if (_stub) \ - goto label; \ - \ - if (_barrier_enabled && !_stub) { \ - gf_log (this->name, GF_LOG_CRITICAL, \ - "Failed to barrier FOPs, disabling " \ - "barrier. FOP: %s, ERROR: %s", \ - #fop_name, strerror (ENOMEM)); \ - barrier_dequeue_all (this, &queue); \ - } \ - barrier_local_free_gfid (frame); \ - STACK_UNWIND_STRICT (fop_name, frame, params); \ - goto label; \ - } while (0) +#define BARRIER_FOP_CBK(fop_name, label, frame, this, params...) \ + do { \ + barrier_priv_t *_priv = NULL; \ + call_stub_t *_stub = NULL; \ + gf_boolean_t _barrier_enabled = _gf_false; \ + struct list_head queue = { \ + 0, \ + }; \ + \ + INIT_LIST_HEAD(&queue); \ + \ + _priv = this->private; \ + GF_ASSERT(_priv); \ + \ + LOCK(&_priv->lock); \ + { \ + if (_priv->barrier_enabled) { \ + _barrier_enabled = _priv->barrier_enabled; \ + \ + _stub = fop_##fop_name##_cbk_stub( \ + frame, barrier_##fop_name##_cbk_resume, params); \ + if (!_stub) { \ + __barrier_disable(this, &queue); \ + goto unlock; \ + } \ + \ + __barrier_enqueue(this, _stub); \ + } \ + } \ + unlock: \ + UNLOCK(&_priv->lock); \ + \ + if (_stub) \ + goto label; \ + \ + if (_barrier_enabled && !_stub) { \ + gf_log(this->name, GF_LOG_CRITICAL, \ + "Failed to barrier FOPs, disabling " \ + "barrier. FOP: %s, ERROR: %s", \ + #fop_name, strerror(ENOMEM)); \ + barrier_dequeue_all(this, &queue); \ + } \ + barrier_local_free_gfid(frame); \ + STACK_UNWIND_STRICT(fop_name, frame, params); \ + goto label; \ + } while (0) typedef struct { - gf_timer_t *timer; - gf_boolean_t barrier_enabled; - gf_lock_t lock; - struct list_head queue; - struct timespec timeout; - uint32_t queue_size; + gf_timer_t *timer; + gf_boolean_t barrier_enabled; + gf_lock_t lock; + struct list_head queue; + struct timespec timeout; + uint32_t queue_size; } barrier_priv_t; -int __barrier_enable (xlator_t *this, barrier_priv_t *priv); -void __barrier_enqueue (xlator_t *this, call_stub_t *stub); -void __barrier_disable (xlator_t *this, struct list_head *queue); -void barrier_timeout (void *data); -void barrier_dequeue_all (xlator_t *this, struct list_head *queue); -call_stub_t *__barrier_dequeue (xlator_t *this, struct list_head *queue); +int +__barrier_enable(xlator_t *this, barrier_priv_t *priv); +void +__barrier_enqueue(xlator_t *this, call_stub_t *stub); +void +__barrier_disable(xlator_t *this, struct list_head *queue); +void +barrier_timeout(void *data); +void +barrier_dequeue_all(xlator_t *this, struct list_head *queue); +call_stub_t * +__barrier_dequeue(xlator_t *this, struct list_head *queue); #endif diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h index 89a67cc10b1..6f59933a31d 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h @@ -23,62 +23,30 @@ * glfs-message-id.h. */ -GLFS_MSGID(BITROT_BITD, - BRB_MSG_FD_CREATE_FAILED, - BRB_MSG_READV_FAILED, - BRB_MSG_BLOCK_READ_FAILED, - BRB_MSG_CALC_CHECKSUM_FAILED, - BRB_MSG_NO_MEMORY, - BRB_MSG_GET_SIGN_FAILED, - BRB_MSG_SET_SIGN_FAILED, - BRB_MSG_OP_FAILED, - BRB_MSG_READ_AND_SIGN_FAILED, - BRB_MSG_SIGN_FAILED, - BRB_MSG_GET_SUBVOL_FAILED, - BRB_MSG_SET_TIMER_FAILED, - BRB_MSG_GET_INFO_FAILED, - BRB_MSG_PATH_FAILED, - BRB_MSG_MARK_BAD_FILE, - BRB_MSG_TRIGGER_SIGN, - BRB_MSG_REGISTER_FAILED, - BRB_MSG_CRAWLING_START, - BRB_MSG_SPAWN_FAILED, - BRB_MSG_INVALID_SUBVOL_CHILD, - BRB_MSG_SKIP_OBJECT, - BRB_MSG_NO_CHILD, - BRB_MSG_CHECKSUM_MISMATCH, - BRB_MSG_MARK_CORRUPTED, - BRB_MSG_CRAWLING_FINISH, - BRB_MSG_CALC_ERROR, - BRB_MSG_LOOKUP_FAILED, - BRB_MSG_PARTIAL_VERSION_PRESENCE, - BRB_MSG_MEM_ACNT_FAILED, - BRB_MSG_TIMER_WHEEL_UNAVAILABLE, - BRB_MSG_BITROT_LOADED, - BRB_MSG_SCALE_DOWN_FAILED, - BRB_MSG_SCALE_UP_FAILED, - BRB_MSG_SCALE_DOWN_SCRUBBER, - BRB_MSG_SCALING_UP_SCRUBBER, - BRB_MSG_UNKNOWN_THROTTLE, - BRB_MSG_RATE_LIMIT_INFO, - BRB_MSG_SCRUB_INFO, - BRB_MSG_CONNECTED_TO_BRICK, - BRB_MSG_BRICK_INFO, - BRB_MSG_SUBVOL_CONNECT_FAILED, - BRB_MSG_INVALID_SUBVOL, - BRB_MSG_RESCHEDULE_SCRUBBER_FAILED, - BRB_MSG_SCRUB_START, - BRB_MSG_SCRUB_FINISH, - BRB_MSG_SCRUB_RUNNING, - BRB_MSG_SCRUB_RESCHEDULED, - BRB_MSG_SCRUB_TUNABLE, - BRB_MSG_SCRUB_THREAD_CLEANUP, - BRB_MSG_SCRUBBER_CLEANED, - BRB_MSG_GENERIC_SSM_INFO, - BRB_MSG_ZERO_TIMEOUT_BUG, - BRB_MSG_BAD_OBJ_READDIR_FAIL, - BRB_MSG_SSM_FAILED, - BRB_MSG_SCRUB_WAIT_FAILED -); +GLFS_MSGID(BITROT_BITD, BRB_MSG_FD_CREATE_FAILED, BRB_MSG_READV_FAILED, + BRB_MSG_BLOCK_READ_FAILED, BRB_MSG_CALC_CHECKSUM_FAILED, + BRB_MSG_NO_MEMORY, BRB_MSG_GET_SIGN_FAILED, BRB_MSG_SET_SIGN_FAILED, + BRB_MSG_OP_FAILED, BRB_MSG_READ_AND_SIGN_FAILED, BRB_MSG_SIGN_FAILED, + BRB_MSG_GET_SUBVOL_FAILED, BRB_MSG_SET_TIMER_FAILED, + BRB_MSG_GET_INFO_FAILED, BRB_MSG_PATH_FAILED, BRB_MSG_MARK_BAD_FILE, + BRB_MSG_TRIGGER_SIGN, BRB_MSG_REGISTER_FAILED, + BRB_MSG_CRAWLING_START, BRB_MSG_SPAWN_FAILED, + BRB_MSG_INVALID_SUBVOL_CHILD, BRB_MSG_SKIP_OBJECT, BRB_MSG_NO_CHILD, + BRB_MSG_CHECKSUM_MISMATCH, BRB_MSG_MARK_CORRUPTED, + BRB_MSG_CRAWLING_FINISH, BRB_MSG_CALC_ERROR, BRB_MSG_LOOKUP_FAILED, + BRB_MSG_PARTIAL_VERSION_PRESENCE, BRB_MSG_MEM_ACNT_FAILED, + BRB_MSG_TIMER_WHEEL_UNAVAILABLE, BRB_MSG_BITROT_LOADED, + BRB_MSG_SCALE_DOWN_FAILED, BRB_MSG_SCALE_UP_FAILED, + BRB_MSG_SCALE_DOWN_SCRUBBER, BRB_MSG_SCALING_UP_SCRUBBER, + BRB_MSG_UNKNOWN_THROTTLE, BRB_MSG_RATE_LIMIT_INFO, + BRB_MSG_SCRUB_INFO, BRB_MSG_CONNECTED_TO_BRICK, BRB_MSG_BRICK_INFO, + BRB_MSG_SUBVOL_CONNECT_FAILED, BRB_MSG_INVALID_SUBVOL, + BRB_MSG_RESCHEDULE_SCRUBBER_FAILED, BRB_MSG_SCRUB_START, + BRB_MSG_SCRUB_FINISH, BRB_MSG_SCRUB_RUNNING, + BRB_MSG_SCRUB_RESCHEDULED, BRB_MSG_SCRUB_TUNABLE, + BRB_MSG_SCRUB_THREAD_CLEANUP, BRB_MSG_SCRUBBER_CLEANED, + BRB_MSG_GENERIC_SSM_INFO, BRB_MSG_ZERO_TIMEOUT_BUG, + BRB_MSG_BAD_OBJ_READDIR_FAIL, BRB_MSG_SSM_FAILED, + BRB_MSG_SCRUB_WAIT_FAILED); #endif /* !_BITROT_BITD_MESSAGES_H_ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h index 02bd0fab04e..24128b90a66 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.h @@ -16,33 +16,33 @@ #include <pthread.h> struct br_scrub_stats { - uint64_t scrubbed_files; /* Total number of scrubbed file */ + uint64_t scrubbed_files; /* Total number of scrubbed file */ - uint64_t unsigned_files; /* Total number of unsigned file */ + uint64_t unsigned_files; /* Total number of unsigned file */ - uint64_t scrub_duration; /* Duration of last scrub */ + uint64_t scrub_duration; /* Duration of last scrub */ - char last_scrub_time[1024]; /*last scrub completion time */ + char last_scrub_time[1024]; /*last scrub completion time */ - struct timeval scrub_start_tv; /* Scrubbing starting time*/ + struct timeval scrub_start_tv; /* Scrubbing starting time*/ - struct timeval scrub_end_tv; /* Scrubbing finishing time */ + struct timeval scrub_end_tv; /* Scrubbing finishing time */ - int8_t scrub_running; /* Scrub running or not */ + int8_t scrub_running; /* Scrub running or not */ - pthread_mutex_t lock; + pthread_mutex_t lock; }; typedef struct br_scrub_stats br_scrub_stats_t; void -br_inc_unsigned_file_count (br_scrub_stats_t *scrub_stat); +br_inc_unsigned_file_count(br_scrub_stats_t *scrub_stat); void -br_inc_scrubbed_file (br_scrub_stats_t *scrub_stat); +br_inc_scrubbed_file(br_scrub_stats_t *scrub_stat); void -br_update_scrub_start_time (br_scrub_stats_t *scrub_stat, struct timeval *tv); +br_update_scrub_start_time(br_scrub_stats_t *scrub_stat, struct timeval *tv); void -br_update_scrub_finish_time (br_scrub_stats_t *scrub_stat, char *timestr, - struct timeval *tv); +br_update_scrub_finish_time(br_scrub_stats_t *scrub_stat, char *timestr, + struct timeval *tv); #endif /* __BIT_ROT_SCRUB_STATUS_H__ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h index 8cc88ec153e..7a3c14abb93 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.h @@ -14,24 +14,33 @@ #include "xlator.h" #include "bit-rot.h" -void *br_fsscanner (void *); +void * +br_fsscanner(void *); -int32_t br_fsscan_schedule (xlator_t *); -int32_t br_fsscan_reschedule (xlator_t *); -int32_t br_fsscan_activate (xlator_t *); -int32_t br_fsscan_deactivate (xlator_t *); -int32_t br_fsscan_ondemand (xlator_t *); +int32_t +br_fsscan_schedule(xlator_t *); +int32_t +br_fsscan_reschedule(xlator_t *); +int32_t +br_fsscan_activate(xlator_t *); +int32_t +br_fsscan_deactivate(xlator_t *); +int32_t +br_fsscan_ondemand(xlator_t *); -int32_t br_scrubber_handle_options (xlator_t *, br_private_t *, dict_t *); +int32_t +br_scrubber_handle_options(xlator_t *, br_private_t *, dict_t *); int32_t -br_scrubber_monitor_init (xlator_t *, br_private_t *); +br_scrubber_monitor_init(xlator_t *, br_private_t *); -int32_t br_scrubber_init (xlator_t *, br_private_t *); +int32_t +br_scrubber_init(xlator_t *, br_private_t *); -int32_t br_collect_bad_objects_from_children (xlator_t *this, dict_t *dict); +int32_t +br_collect_bad_objects_from_children(xlator_t *this, dict_t *dict); void -br_child_set_scrub_state (br_child_t *, gf_boolean_t); +br_child_set_scrub_state(br_child_t *, gf_boolean_t); #endif /* __BIT_ROT_SCRUB_H__ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.h b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.h index 8609477180b..f3fbe2928b7 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.h @@ -14,24 +14,25 @@ #include "xlator.h" typedef enum br_scrub_state { - BR_SCRUB_STATE_INACTIVE = 0, - BR_SCRUB_STATE_PENDING, - BR_SCRUB_STATE_ACTIVE, - BR_SCRUB_STATE_PAUSED, - BR_SCRUB_STATE_IPAUSED, - BR_SCRUB_STATE_STALLED, - BR_SCRUB_MAXSTATES, + BR_SCRUB_STATE_INACTIVE = 0, + BR_SCRUB_STATE_PENDING, + BR_SCRUB_STATE_ACTIVE, + BR_SCRUB_STATE_PAUSED, + BR_SCRUB_STATE_IPAUSED, + BR_SCRUB_STATE_STALLED, + BR_SCRUB_MAXSTATES, } br_scrub_state_t; typedef enum br_scrub_event { - BR_SCRUB_EVENT_SCHEDULE = 0, - BR_SCRUB_EVENT_PAUSE, - BR_SCRUB_EVENT_ONDEMAND, - BR_SCRUB_MAXEVENTS, + BR_SCRUB_EVENT_SCHEDULE = 0, + BR_SCRUB_EVENT_PAUSE, + BR_SCRUB_EVENT_ONDEMAND, + BR_SCRUB_MAXEVENTS, } br_scrub_event_t; struct br_monitor; -int32_t br_scrub_state_machine (xlator_t *, gf_boolean_t); +int32_t +br_scrub_state_machine(xlator_t *, gf_boolean_t); #endif /* __BIT_ROT_SSM_H__ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.h b/xlators/features/bit-rot/src/bitd/bit-rot.h index 670060c8d88..962b4d717e6 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot.h @@ -37,271 +37,270 @@ #define BR_WORKERS 4 typedef enum scrub_throttle { - BR_SCRUB_THROTTLE_VOID = -1, - BR_SCRUB_THROTTLE_LAZY = 0, - BR_SCRUB_THROTTLE_NORMAL = 1, - BR_SCRUB_THROTTLE_AGGRESSIVE = 2, - BR_SCRUB_THROTTLE_STALLED = 3, + BR_SCRUB_THROTTLE_VOID = -1, + BR_SCRUB_THROTTLE_LAZY = 0, + BR_SCRUB_THROTTLE_NORMAL = 1, + BR_SCRUB_THROTTLE_AGGRESSIVE = 2, + BR_SCRUB_THROTTLE_STALLED = 3, } scrub_throttle_t; typedef enum scrub_freq { - BR_FSSCRUB_FREQ_HOURLY = 1, - BR_FSSCRUB_FREQ_DAILY, - BR_FSSCRUB_FREQ_WEEKLY, - BR_FSSCRUB_FREQ_BIWEEKLY, - BR_FSSCRUB_FREQ_MONTHLY, - BR_FSSCRUB_FREQ_MINUTE, - BR_FSSCRUB_FREQ_STALLED, + BR_FSSCRUB_FREQ_HOURLY = 1, + BR_FSSCRUB_FREQ_DAILY, + BR_FSSCRUB_FREQ_WEEKLY, + BR_FSSCRUB_FREQ_BIWEEKLY, + BR_FSSCRUB_FREQ_MONTHLY, + BR_FSSCRUB_FREQ_MINUTE, + BR_FSSCRUB_FREQ_STALLED, } scrub_freq_t; -#define signature_size(hl) (sizeof (br_isignature_t) + hl + 1) +#define signature_size(hl) (sizeof(br_isignature_t) + hl + 1) struct br_scanfs { - gf_lock_t entrylock; + gf_lock_t entrylock; - pthread_mutex_t waitlock; - pthread_cond_t waitcond; + pthread_mutex_t waitlock; + pthread_cond_t waitcond; - unsigned int entries; - struct list_head queued; - struct list_head ready; + unsigned int entries; + struct list_head queued; + struct list_head ready; }; /* just need three states to track child status */ typedef enum br_child_state { - BR_CHILD_STATE_CONNECTED = 1, - BR_CHILD_STATE_INITIALIZING, - BR_CHILD_STATE_CONNFAILED, - BR_CHILD_STATE_DISCONNECTED, + BR_CHILD_STATE_CONNECTED = 1, + BR_CHILD_STATE_INITIALIZING, + BR_CHILD_STATE_CONNFAILED, + BR_CHILD_STATE_DISCONNECTED, } br_child_state_t; struct br_child { - pthread_mutex_t lock; /* protects child state */ - char witnessed; /* witnessed at least one successful - connection */ - br_child_state_t c_state; /* current state of this child */ + pthread_mutex_t lock; /* protects child state */ + char witnessed; /* witnessed at least one successful + connection */ + br_child_state_t c_state; /* current state of this child */ - char child_up; /* Indicates whether this child is - up or not */ - xlator_t *xl; /* client xlator corresponding to - this child */ - inode_table_t *table; /* inode table for this child */ - char brick_path[PATH_MAX]; /* brick export directory of this - child */ - struct list_head list; /* hook to attach to the list of - UP children */ - xlator_t *this; /* Bit rot xlator */ + char child_up; /* Indicates whether this child is + up or not */ + xlator_t *xl; /* client xlator corresponding to + this child */ + inode_table_t *table; /* inode table for this child */ + char brick_path[PATH_MAX]; /* brick export directory of this + child */ + struct list_head list; /* hook to attach to the list of + UP children */ + xlator_t *this; /* Bit rot xlator */ - pthread_t thread; /* initial crawler for unsigned - object(s) or scrub crawler */ - int threadrunning; /* active thread */ + pthread_t thread; /* initial crawler for unsigned + object(s) or scrub crawler */ + int threadrunning; /* active thread */ - struct mem_pool *timer_pool; /* timer-wheel's timer mem-pool */ + struct mem_pool *timer_pool; /* timer-wheel's timer mem-pool */ - struct timeval tv; + struct timeval tv; - struct br_scanfs fsscan; /* per subvolume FS scanner */ + struct br_scanfs fsscan; /* per subvolume FS scanner */ - gf_boolean_t active_scrubbing; /* Actively scrubbing or not */ + gf_boolean_t active_scrubbing; /* Actively scrubbing or not */ }; typedef struct br_child br_child_t; struct br_obj_n_workers { - struct list_head objects; /* queue of objects expired from the - timer wheel and ready to be picked - up for signing */ - pthread_t workers[BR_WORKERS]; /* Threads which pick up the objects - from the above queue and start - signing each object */ + struct list_head objects; /* queue of objects expired from the + timer wheel and ready to be picked + up for signing */ + pthread_t workers[BR_WORKERS]; /* Threads which pick up the objects + from the above queue and start + signing each object */ }; struct br_scrubber { - xlator_t *this; + xlator_t *this; - scrub_throttle_t throttle; + scrub_throttle_t throttle; - /** - * frequency of scanning for this subvolume. this should - * normally be per-child, but since all children follow the - * same frequency for a volume, this option ends up here - * instead of br_child_t. - */ - scrub_freq_t frequency; + /** + * frequency of scanning for this subvolume. this should + * normally be per-child, but since all children follow the + * same frequency for a volume, this option ends up here + * instead of br_child_t. + */ + scrub_freq_t frequency; - gf_boolean_t frequency_reconf; - gf_boolean_t throttle_reconf; + gf_boolean_t frequency_reconf; + gf_boolean_t throttle_reconf; - pthread_mutex_t mutex; - pthread_cond_t cond; + pthread_mutex_t mutex; + pthread_cond_t cond; - unsigned int nr_scrubbers; - struct list_head scrubbers; + unsigned int nr_scrubbers; + struct list_head scrubbers; - /** - * list of "rotatable" subvolume(s) undergoing scrubbing - */ - struct list_head scrublist; + /** + * list of "rotatable" subvolume(s) undergoing scrubbing + */ + struct list_head scrublist; }; struct br_monitor { - gf_lock_t lock; - pthread_t thread; /* Monitor thread */ - - gf_boolean_t inited; - pthread_mutex_t mutex; - pthread_cond_t cond; /* Thread starts and will be waiting on cond. - First child which is up wakes this up */ - - xlator_t *this; - /* scheduler */ - uint32_t boot; - - int32_t active_child_count; /* Number of children currently scrubbing */ - gf_boolean_t kick; /* This variable tracks the scrubber is - * kicked or not. Both 'kick' and - * 'active_child_count' uses the same pair - * of mutex-cond variable, i.e, wakelock and - * wakecond. */ - - pthread_mutex_t wakelock; - pthread_cond_t wakecond; - - gf_boolean_t done; - pthread_mutex_t donelock; - pthread_cond_t donecond; - - struct gf_tw_timer_list *timer; - br_scrub_state_t state; /* current scrub state */ + gf_lock_t lock; + pthread_t thread; /* Monitor thread */ + + gf_boolean_t inited; + pthread_mutex_t mutex; + pthread_cond_t cond; /* Thread starts and will be waiting on cond. + First child which is up wakes this up */ + + xlator_t *this; + /* scheduler */ + uint32_t boot; + + int32_t active_child_count; /* Number of children currently scrubbing */ + gf_boolean_t kick; /* This variable tracks the scrubber is + * kicked or not. Both 'kick' and + * 'active_child_count' uses the same pair + * of mutex-cond variable, i.e, wakelock and + * wakecond. */ + + pthread_mutex_t wakelock; + pthread_cond_t wakecond; + + gf_boolean_t done; + pthread_mutex_t donelock; + pthread_cond_t donecond; + + struct gf_tw_timer_list *timer; + br_scrub_state_t state; /* current scrub state */ }; typedef struct br_obj_n_workers br_obj_n_workers_t; typedef struct br_private br_private_t; -typedef void (*br_scrubbed_file_update) (br_private_t *priv); +typedef void (*br_scrubbed_file_update)(br_private_t *priv); struct br_private { - pthread_mutex_t lock; + pthread_mutex_t lock; - struct list_head bricks; /* list of bricks from which enents - have been received */ + struct list_head bricks; /* list of bricks from which enents + have been received */ - struct list_head signing; + struct list_head signing; - pthread_cond_t object_cond; /* handling signing of objects */ - int child_count; - br_child_t *children; /* list of subvolumes */ - int up_children; + pthread_cond_t object_cond; /* handling signing of objects */ + int child_count; + br_child_t *children; /* list of subvolumes */ + int up_children; - pthread_cond_t cond; /* handling CHILD_UP notifications */ - pthread_t thread; /* thread for connecting each UP - child with changelog */ + pthread_cond_t cond; /* handling CHILD_UP notifications */ + pthread_t thread; /* thread for connecting each UP + child with changelog */ - struct tvec_base *timer_wheel; /* timer wheel where the objects which - changelog has sent sits and waits - for expiry */ - br_obj_n_workers_t *obj_queue; /* place holder for all the objects - that are expired from timer wheel - and ready to be picked up for - signing and the workers which sign - the objects */ + struct tvec_base *timer_wheel; /* timer wheel where the objects which + changelog has sent sits and waits + for expiry */ + br_obj_n_workers_t *obj_queue; /* place holder for all the objects + that are expired from timer wheel + and ready to be picked up for + signing and the workers which sign + the objects */ - uint32_t expiry_time; /* objects "wait" time */ + uint32_t expiry_time; /* objects "wait" time */ - tbf_t *tbf; /* token bucket filter */ + tbf_t *tbf; /* token bucket filter */ - gf_boolean_t iamscrubber; /* function as a fs scrubber */ + gf_boolean_t iamscrubber; /* function as a fs scrubber */ - struct br_scrub_stats scrub_stat; /* statistics of scrub*/ + struct br_scrub_stats scrub_stat; /* statistics of scrub*/ - struct br_scrubber fsscrub; /* scrubbers for this subvolume */ + struct br_scrubber fsscrub; /* scrubbers for this subvolume */ - struct br_monitor scrub_monitor; /* scrubber monitor */ + struct br_monitor scrub_monitor; /* scrubber monitor */ }; struct br_object { - xlator_t *this; + xlator_t *this; - uuid_t gfid; + uuid_t gfid; - unsigned long signedversion; /* version against which this object will - be signed */ - br_child_t *child; /* object's subvolume */ + unsigned long signedversion; /* version against which this object will + be signed */ + br_child_t *child; /* object's subvolume */ - int sign_info; + int sign_info; - struct list_head list; /* hook to add to the queue once the - object is expired from timer wheel */ - void *data; + struct list_head list; /* hook to add to the queue once the + object is expired from timer wheel */ + void *data; }; typedef struct br_object br_object_t; -typedef int32_t (br_scrub_ssm_call) (xlator_t *); +typedef int32_t(br_scrub_ssm_call)(xlator_t *); void -br_log_object (xlator_t *, char *, uuid_t, int32_t); +br_log_object(xlator_t *, char *, uuid_t, int32_t); void -br_log_object_path (xlator_t *, char *, const char *, int32_t); +br_log_object_path(xlator_t *, char *, const char *, int32_t); int32_t -br_calculate_obj_checksum (unsigned char *, - br_child_t *, fd_t *, struct iatt *); +br_calculate_obj_checksum(unsigned char *, br_child_t *, fd_t *, struct iatt *); int32_t -br_prepare_loc (xlator_t *, br_child_t *, loc_t *, gf_dirent_t *, loc_t *); +br_prepare_loc(xlator_t *, br_child_t *, loc_t *, gf_dirent_t *, loc_t *); gf_boolean_t -bitd_is_bad_file (xlator_t *, br_child_t *, loc_t *, fd_t *); +bitd_is_bad_file(xlator_t *, br_child_t *, loc_t *, fd_t *); static inline void -_br_set_child_state (br_child_t *child, br_child_state_t state) +_br_set_child_state(br_child_t *child, br_child_state_t state) { - child->c_state = state; + child->c_state = state; } static inline int -_br_is_child_connected (br_child_t *child) +_br_is_child_connected(br_child_t *child) { - return (child->c_state == BR_CHILD_STATE_CONNECTED); + return (child->c_state == BR_CHILD_STATE_CONNECTED); } static inline int -_br_is_child_scrub_active (br_child_t *child) +_br_is_child_scrub_active(br_child_t *child) { - return child->active_scrubbing; + return child->active_scrubbing; } static inline int -_br_child_failed_conn (br_child_t *child) +_br_child_failed_conn(br_child_t *child) { - return (child->c_state == BR_CHILD_STATE_CONNFAILED); + return (child->c_state == BR_CHILD_STATE_CONNFAILED); } static inline int -_br_child_witnessed_connection (br_child_t *child) +_br_child_witnessed_connection(br_child_t *child) { - return (child->witnessed == 1); + return (child->witnessed == 1); } /* scrub state */ static inline void -_br_monitor_set_scrub_state (struct br_monitor *scrub_monitor, - br_scrub_state_t state) +_br_monitor_set_scrub_state(struct br_monitor *scrub_monitor, + br_scrub_state_t state) { - scrub_monitor->state = state; + scrub_monitor->state = state; } static inline br_scrub_event_t -_br_child_get_scrub_event (struct br_scrubber *fsscrub) +_br_child_get_scrub_event(struct br_scrubber *fsscrub) { - return (fsscrub->frequency == BR_FSSCRUB_FREQ_STALLED) - ? BR_SCRUB_EVENT_PAUSE : BR_SCRUB_EVENT_SCHEDULE; + return (fsscrub->frequency == BR_FSSCRUB_FREQ_STALLED) + ? BR_SCRUB_EVENT_PAUSE + : BR_SCRUB_EVENT_SCHEDULE; } int32_t -br_get_bad_objects_list (xlator_t *this, dict_t **dict); - +br_get_bad_objects_list(xlator_t *this, dict_t **dict); #endif /* __BIT_ROT_H__ */ diff --git a/xlators/features/bit-rot/src/stub/bit-rot-common.h b/xlators/features/bit-rot/src/stub/bit-rot-common.h index 2afc9f47c29..ef683ac7f9f 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-common.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-common.h @@ -14,71 +14,71 @@ #include "glusterfs.h" #include "bit-rot-object-version.h" -#define BR_VXATTR_VERSION (1 << 0) +#define BR_VXATTR_VERSION (1 << 0) #define BR_VXATTR_SIGNATURE (1 << 1) #define BR_VXATTR_SIGN_MISSING (BR_VXATTR_SIGNATURE) -#define BR_VXATTR_ALL_MISSING \ - (BR_VXATTR_VERSION | BR_VXATTR_SIGNATURE) +#define BR_VXATTR_ALL_MISSING (BR_VXATTR_VERSION | BR_VXATTR_SIGNATURE) -#define BR_BAD_OBJ_CONTAINER (uuid_t){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} +#define BR_BAD_OBJ_CONTAINER \ + (uuid_t) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 } typedef enum br_vxattr_state { - BR_VXATTR_STATUS_FULL = 0, - BR_VXATTR_STATUS_MISSING = 1, - BR_VXATTR_STATUS_UNSIGNED = 2, - BR_VXATTR_STATUS_INVALID = 3, + BR_VXATTR_STATUS_FULL = 0, + BR_VXATTR_STATUS_MISSING = 1, + BR_VXATTR_STATUS_UNSIGNED = 2, + BR_VXATTR_STATUS_INVALID = 3, } br_vxattr_status_t; typedef enum br_sign_state { - BR_SIGN_INVALID = -1, - BR_SIGN_NORMAL = 0, - BR_SIGN_REOPEN_WAIT = 1, - BR_SIGN_QUICK = 2, + BR_SIGN_INVALID = -1, + BR_SIGN_NORMAL = 0, + BR_SIGN_REOPEN_WAIT = 1, + BR_SIGN_QUICK = 2, } br_sign_state_t; static inline br_vxattr_status_t -br_version_xattr_state (dict_t *xattr, br_version_t **obuf, - br_signature_t **sbuf, gf_boolean_t *objbad) +br_version_xattr_state(dict_t *xattr, br_version_t **obuf, + br_signature_t **sbuf, gf_boolean_t *objbad) { - int32_t ret = 0; - int32_t vxattr = 0; - br_vxattr_status_t status; - void *data = NULL; - - /** - * The key being present in the dict indicates the xattr was set on - * disk. The presence of xattr itself as of now is suffecient to say - * the the object is bad. - */ - *objbad = _gf_false; - ret = dict_get_bin (xattr, BITROT_OBJECT_BAD_KEY, (void **)&data); - if (!ret) - *objbad = _gf_true; - - ret = dict_get_bin (xattr, BITROT_CURRENT_VERSION_KEY, (void **)obuf); - if (ret) - vxattr |= BR_VXATTR_VERSION; - - ret = dict_get_bin (xattr, BITROT_SIGNING_VERSION_KEY, (void **)sbuf); - if (ret) - vxattr |= BR_VXATTR_SIGNATURE; - - switch (vxattr) { + int32_t ret = 0; + int32_t vxattr = 0; + br_vxattr_status_t status; + void *data = NULL; + + /** + * The key being present in the dict indicates the xattr was set on + * disk. The presence of xattr itself as of now is suffecient to say + * the the object is bad. + */ + *objbad = _gf_false; + ret = dict_get_bin(xattr, BITROT_OBJECT_BAD_KEY, (void **)&data); + if (!ret) + *objbad = _gf_true; + + ret = dict_get_bin(xattr, BITROT_CURRENT_VERSION_KEY, (void **)obuf); + if (ret) + vxattr |= BR_VXATTR_VERSION; + + ret = dict_get_bin(xattr, BITROT_SIGNING_VERSION_KEY, (void **)sbuf); + if (ret) + vxattr |= BR_VXATTR_SIGNATURE; + + switch (vxattr) { case 0: - status = BR_VXATTR_STATUS_FULL; - break; + status = BR_VXATTR_STATUS_FULL; + break; case BR_VXATTR_SIGN_MISSING: - status = BR_VXATTR_STATUS_UNSIGNED; - break; + status = BR_VXATTR_STATUS_UNSIGNED; + break; case BR_VXATTR_ALL_MISSING: - status = BR_VXATTR_STATUS_MISSING; - break; + status = BR_VXATTR_STATUS_MISSING; + break; default: - status = BR_VXATTR_STATUS_INVALID; - } + status = BR_VXATTR_STATUS_INVALID; + } - return status; + return status; } /** @@ -86,13 +86,13 @@ br_version_xattr_state (dict_t *xattr, br_version_t **obuf, * signing. */ typedef struct br_isignature_in { - int8_t signaturetype; /* signature type */ + int8_t signaturetype; /* signature type */ - unsigned long signedversion; /* version against which the - object was signed */ + unsigned long signedversion; /* version against which the + object was signed */ - size_t signaturelen; /* signature length */ - char signature[0]; /* object signature */ + size_t signaturelen; /* signature length */ + char signature[0]; /* object signature */ } br_isignature_t; /** @@ -100,80 +100,79 @@ typedef struct br_isignature_in { * verification. */ typedef struct br_isignature_out { - char stale; /* stale signature? */ + char stale; /* stale signature? */ - unsigned long version; /* current signed version */ + unsigned long version; /* current signed version */ - uint32_t time[2]; /* time when the object - got dirtied */ + uint32_t time[2]; /* time when the object + got dirtied */ - int8_t signaturetype; /* hash type */ - size_t signaturelen; /* signature length */ - char signature[0]; /* signature (hash) */ + int8_t signaturetype; /* hash type */ + size_t signaturelen; /* signature length */ + char signature[0]; /* signature (hash) */ } br_isignature_out_t; typedef struct br_stub_init { - uint32_t timebuf[2]; - char export[PATH_MAX]; + uint32_t timebuf[2]; + char export[PATH_MAX]; } br_stub_init_t; typedef enum { - BR_SIGNATURE_TYPE_VOID = -1, /* object is not signed */ - BR_SIGNATURE_TYPE_ZERO = 0, /* min boundary */ - BR_SIGNATURE_TYPE_SHA256 = 1, /* signed with SHA256 */ - BR_SIGNATURE_TYPE_MAX = 2, /* max boundary */ + BR_SIGNATURE_TYPE_VOID = -1, /* object is not signed */ + BR_SIGNATURE_TYPE_ZERO = 0, /* min boundary */ + BR_SIGNATURE_TYPE_SHA256 = 1, /* signed with SHA256 */ + BR_SIGNATURE_TYPE_MAX = 2, /* max boundary */ } br_signature_type; /* BitRot stub start time (virtual xattr) */ -#define GLUSTERFS_GET_BR_STUB_INIT_TIME "trusted.glusterfs.bit-rot.stub-init" +#define GLUSTERFS_GET_BR_STUB_INIT_TIME "trusted.glusterfs.bit-rot.stub-init" /* signing/reopen hint */ #define BR_OBJECT_RESIGN 0 -#define BR_OBJECT_REOPEN 1 -#define BR_REOPEN_SIGN_HINT_KEY "trusted.glusterfs.bit-rot.reopen-hint" +#define BR_OBJECT_REOPEN 1 +#define BR_REOPEN_SIGN_HINT_KEY "trusted.glusterfs.bit-rot.reopen-hint" static inline int -br_is_signature_type_valid (int8_t signaturetype) +br_is_signature_type_valid(int8_t signaturetype) { - return ((signaturetype > BR_SIGNATURE_TYPE_ZERO) - && (signaturetype < BR_SIGNATURE_TYPE_MAX)); + return ((signaturetype > BR_SIGNATURE_TYPE_ZERO) && + (signaturetype < BR_SIGNATURE_TYPE_MAX)); } static inline void -br_set_default_ongoingversion (br_version_t *buf, uint32_t *tv) +br_set_default_ongoingversion(br_version_t *buf, uint32_t *tv) { - buf->ongoingversion = BITROT_DEFAULT_CURRENT_VERSION; - buf->timebuf[0] = tv[0]; - buf->timebuf[1] = tv[1]; + buf->ongoingversion = BITROT_DEFAULT_CURRENT_VERSION; + buf->timebuf[0] = tv[0]; + buf->timebuf[1] = tv[1]; } static inline void -br_set_default_signature (br_signature_t *buf, size_t *size) +br_set_default_signature(br_signature_t *buf, size_t *size) { - buf->signaturetype = (int8_t) BR_SIGNATURE_TYPE_VOID; - buf->signedversion = BITROT_DEFAULT_SIGNING_VERSION; + buf->signaturetype = (int8_t)BR_SIGNATURE_TYPE_VOID; + buf->signedversion = BITROT_DEFAULT_SIGNING_VERSION; - *size = sizeof (br_signature_t); /* no signature */ + *size = sizeof(br_signature_t); /* no signature */ } static inline void -br_set_ongoingversion (br_version_t *buf, - unsigned long version, uint32_t *tv) +br_set_ongoingversion(br_version_t *buf, unsigned long version, uint32_t *tv) { - buf->ongoingversion = version; - buf->timebuf[0] = tv[0]; - buf->timebuf[1] = tv[1]; + buf->ongoingversion = version; + buf->timebuf[0] = tv[0]; + buf->timebuf[1] = tv[1]; } static inline void -br_set_signature (br_signature_t *buf, - br_isignature_t *sign, size_t signaturelen, size_t *size) +br_set_signature(br_signature_t *buf, br_isignature_t *sign, + size_t signaturelen, size_t *size) { - buf->signaturetype = sign->signaturetype; - buf->signedversion = ntohl (sign->signedversion); + buf->signaturetype = sign->signaturetype; + buf->signedversion = ntohl(sign->signedversion); - memcpy (buf->signature, sign->signature, signaturelen); - *size = sizeof (br_signature_t) + signaturelen; + memcpy(buf->signature, sign->signature, signaturelen); + *size = sizeof(br_signature_t) + signaturelen; } #endif /* __BIT_ROT_COMMON_H__ */ diff --git a/xlators/features/bit-rot/src/stub/bit-rot-object-version.h b/xlators/features/bit-rot/src/stub/bit-rot-object-version.h index 1f2497aebe9..7ae6a5200df 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-object-version.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-object-version.h @@ -15,16 +15,16 @@ * on-disk formats for ongoing version and object signature. */ typedef struct br_version { - unsigned long ongoingversion; - uint32_t timebuf[2]; + unsigned long ongoingversion; + uint32_t timebuf[2]; } br_version_t; -typedef struct __attribute__ ((__packed__)) br_signature { - int8_t signaturetype; +typedef struct __attribute__((__packed__)) br_signature { + int8_t signaturetype; - unsigned long signedversion; + unsigned long signedversion; - char signature[0]; + char signature[0]; } br_signature_t; #endif diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h index 1652a3ebf8d..a3e7b03291e 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-mem-types.h @@ -14,22 +14,22 @@ #include "mem-types.h" enum br_mem_types { - gf_br_stub_mt_private_t = gf_common_mt_end + 1, - gf_br_stub_mt_version_t, - gf_br_stub_mt_inode_ctx_t, - gf_br_stub_mt_signature_t, - gf_br_mt_br_private_t, - gf_br_mt_br_child_t, - gf_br_mt_br_object_t, - gf_br_mt_br_ob_n_wk_t, - gf_br_mt_br_scrubber_t, - gf_br_mt_br_fsscan_entry_t, - gf_br_stub_mt_br_stub_fd_t, - gf_br_stub_mt_br_scanner_freq_t, - gf_br_stub_mt_sigstub_t, - gf_br_mt_br_child_event_t, - gf_br_stub_mt_misc, - gf_br_stub_mt_end, + gf_br_stub_mt_private_t = gf_common_mt_end + 1, + gf_br_stub_mt_version_t, + gf_br_stub_mt_inode_ctx_t, + gf_br_stub_mt_signature_t, + gf_br_mt_br_private_t, + gf_br_mt_br_child_t, + gf_br_mt_br_object_t, + gf_br_mt_br_ob_n_wk_t, + gf_br_mt_br_scrubber_t, + gf_br_mt_br_fsscan_entry_t, + gf_br_stub_mt_br_stub_fd_t, + gf_br_stub_mt_br_scanner_freq_t, + gf_br_stub_mt_sigstub_t, + gf_br_mt_br_child_event_t, + gf_br_stub_mt_misc, + gf_br_stub_mt_end, }; #endif diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h index 2ade4f03997..cccc3b9c599 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h @@ -23,40 +23,22 @@ * glfs-message-id.h. */ -GLFS_MSGID(BITROT_STUB, - BRS_MSG_NO_MEMORY, - BRS_MSG_SET_EVENT_FAILED, - BRS_MSG_MEM_ACNT_FAILED, - BRS_MSG_CREATE_FRAME_FAILED, - BRS_MSG_SET_CONTEXT_FAILED, - BRS_MSG_CHANGE_VERSION_FAILED, - BRS_MSG_ADD_FD_TO_LIST_FAILED, - BRS_MSG_SET_FD_CONTEXT_FAILED, - BRS_MSG_CREATE_ANONYMOUS_FD_FAILED, - BRS_MSG_NO_CHILD, - BRS_MSG_STUB_ALLOC_FAILED, - BRS_MSG_GET_INODE_CONTEXT_FAILED, - BRS_MSG_CANCEL_SIGN_THREAD_FAILED, - BRS_MSG_ADD_FD_TO_INODE, - BRS_MSG_SIGN_VERSION_ERROR, - BRS_MSG_BAD_OBJ_MARK_FAIL, - BRS_MSG_NON_SCRUB_BAD_OBJ_MARK, - BRS_MSG_REMOVE_INTERNAL_XATTR, - BRS_MSG_SET_INTERNAL_XATTR, - BRS_MSG_BAD_OBJECT_ACCESS, - BRS_MSG_BAD_CONTAINER_FAIL, - BRS_MSG_BAD_OBJECT_DIR_FAIL, - BRS_MSG_BAD_OBJECT_DIR_SEEK_FAIL, - BRS_MSG_BAD_OBJECT_DIR_TELL_FAIL, - BRS_MSG_BAD_OBJECT_DIR_READ_FAIL, - BRS_MSG_GET_FD_CONTEXT_FAILED, - BRS_MSG_BAD_HANDLE_DIR_NULL, - BRS_MSG_BAD_OBJ_THREAD_FAIL, - BRS_MSG_BAD_OBJ_DIR_CLOSE_FAIL, - BRS_MSG_LINK_FAIL, - BRS_MSG_BAD_OBJ_UNLINK_FAIL, - BRS_MSG_DICT_SET_FAILED, - BRS_MSG_PATH_GET_FAILED -); +GLFS_MSGID(BITROT_STUB, BRS_MSG_NO_MEMORY, BRS_MSG_SET_EVENT_FAILED, + BRS_MSG_MEM_ACNT_FAILED, BRS_MSG_CREATE_FRAME_FAILED, + BRS_MSG_SET_CONTEXT_FAILED, BRS_MSG_CHANGE_VERSION_FAILED, + BRS_MSG_ADD_FD_TO_LIST_FAILED, BRS_MSG_SET_FD_CONTEXT_FAILED, + BRS_MSG_CREATE_ANONYMOUS_FD_FAILED, BRS_MSG_NO_CHILD, + BRS_MSG_STUB_ALLOC_FAILED, BRS_MSG_GET_INODE_CONTEXT_FAILED, + BRS_MSG_CANCEL_SIGN_THREAD_FAILED, BRS_MSG_ADD_FD_TO_INODE, + BRS_MSG_SIGN_VERSION_ERROR, BRS_MSG_BAD_OBJ_MARK_FAIL, + BRS_MSG_NON_SCRUB_BAD_OBJ_MARK, BRS_MSG_REMOVE_INTERNAL_XATTR, + BRS_MSG_SET_INTERNAL_XATTR, BRS_MSG_BAD_OBJECT_ACCESS, + BRS_MSG_BAD_CONTAINER_FAIL, BRS_MSG_BAD_OBJECT_DIR_FAIL, + BRS_MSG_BAD_OBJECT_DIR_SEEK_FAIL, BRS_MSG_BAD_OBJECT_DIR_TELL_FAIL, + BRS_MSG_BAD_OBJECT_DIR_READ_FAIL, BRS_MSG_GET_FD_CONTEXT_FAILED, + BRS_MSG_BAD_HANDLE_DIR_NULL, BRS_MSG_BAD_OBJ_THREAD_FAIL, + BRS_MSG_BAD_OBJ_DIR_CLOSE_FAIL, BRS_MSG_LINK_FAIL, + BRS_MSG_BAD_OBJ_UNLINK_FAIL, BRS_MSG_DICT_SET_FAILED, + BRS_MSG_PATH_GET_FAILED); #endif /* !_BITROT_STUB_MESSAGES_H_ */ diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.h b/xlators/features/bit-rot/src/stub/bit-rot-stub.h index e15f1cecbc0..a15667e323a 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.h @@ -1,11 +1,11 @@ - /* - Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com> - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. +/* + Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #ifndef __BIT_ROT_STUB_H__ #define __BIT_ROT_STUB_H__ @@ -25,305 +25,302 @@ #include "syncop.h" #include "syncop-utils.h" -#define BAD_OBJECT_THREAD_STACK_SIZE ((size_t)(1024*1024)) +#define BAD_OBJECT_THREAD_STACK_SIZE ((size_t)(1024 * 1024)) #define BR_STUB_DUMP_STR_SIZE 65536 -#define BR_PATH_MAX_EXTRA (PATH_MAX+1024) -#define BR_PATH_MAX_PLUS (PATH_MAX+2048) +#define BR_PATH_MAX_EXTRA (PATH_MAX + 1024) +#define BR_PATH_MAX_PLUS (PATH_MAX + 2048) /* * Oops. Spelling mistake. Correcting it */ -#define OLD_BR_STUB_QUARANTINE_DIR GF_HIDDEN_PATH"/quanrantine" -#define BR_STUB_QUARANTINE_DIR GF_HIDDEN_PATH"/quarantine" +#define OLD_BR_STUB_QUARANTINE_DIR GF_HIDDEN_PATH "/quanrantine" +#define BR_STUB_QUARANTINE_DIR GF_HIDDEN_PATH "/quarantine" /* do not reference frame->local in cbk unless initialized. * Assigned 0x1 marks verisoning flag between call path and * cbk path. */ -#define BR_STUB_VER_NOT_ACTIVE_THEN_GOTO(frame, priv, label) do { \ - if (priv->do_versioning) \ - frame->local = (void *)0x1; \ - else \ - goto label; \ - } while (0) - -#define BR_STUB_VER_COND_GOTO(priv, cond, label) do { \ - if (!priv->do_versioning || cond) \ - goto label; \ - } while (0) - -#define BR_STUB_VER_ENABLED_IN_CALLPATH(frame, flag) do { \ - if (frame->local) \ - flag = _gf_true; \ - if (frame->local == (void *) 0x1) \ - frame->local = NULL; \ - } while (0) - -#define BR_STUB_RESET_LOCAL_NULL(frame) do { \ - if (frame->local == (void *)0x1) \ - frame->local = NULL; \ - } while (0) - -typedef int (br_stub_version_cbk) (call_frame_t *, void *, - xlator_t *, int32_t, int32_t, dict_t *); +#define BR_STUB_VER_NOT_ACTIVE_THEN_GOTO(frame, priv, label) \ + do { \ + if (priv->do_versioning) \ + frame->local = (void *)0x1; \ + else \ + goto label; \ + } while (0) + +#define BR_STUB_VER_COND_GOTO(priv, cond, label) \ + do { \ + if (!priv->do_versioning || cond) \ + goto label; \ + } while (0) + +#define BR_STUB_VER_ENABLED_IN_CALLPATH(frame, flag) \ + do { \ + if (frame->local) \ + flag = _gf_true; \ + if (frame->local == (void *)0x1) \ + frame->local = NULL; \ + } while (0) + +#define BR_STUB_RESET_LOCAL_NULL(frame) \ + do { \ + if (frame->local == (void *)0x1) \ + frame->local = NULL; \ + } while (0) + +typedef int(br_stub_version_cbk)(call_frame_t *, void *, xlator_t *, int32_t, + int32_t, dict_t *); typedef struct br_stub_inode_ctx { - int need_writeback; /* does the inode need - a writeback to disk? */ - unsigned long currentversion; /* ongoing version */ - - int info_sign; - struct list_head fd_list; /* list of open fds or fds participating in - write operations */ - gf_boolean_t bad_object; + int need_writeback; /* does the inode need + a writeback to disk? */ + unsigned long currentversion; /* ongoing version */ + + int info_sign; + struct list_head fd_list; /* list of open fds or fds participating in + write operations */ + gf_boolean_t bad_object; } br_stub_inode_ctx_t; typedef struct br_stub_fd { - fd_t *fd; - struct list_head list; - struct bad_object_dir { - DIR *dir; - off_t dir_eof; - } bad_object; + fd_t *fd; + struct list_head list; + struct bad_object_dir { + DIR *dir; + off_t dir_eof; + } bad_object; } br_stub_fd_t; -#define I_DIRTY (1<<0) /* inode needs writeback */ -#define I_MODIFIED (1<<1) -#define WRITEBACK_DURABLE 1 /* writeback is durable */ +#define I_DIRTY (1 << 0) /* inode needs writeback */ +#define I_MODIFIED (1 << 1) +#define WRITEBACK_DURABLE 1 /* writeback is durable */ /** * This could just have been a plain struct without unions and all, * but we may need additional things in the future. */ typedef struct br_stub_local { - call_stub_t *fopstub; /* stub for original fop */ - - int versioningtype; /* not much used atm */ - - union { - struct br_stub_ctx { - fd_t *fd; - uuid_t gfid; - inode_t *inode; - unsigned long version; - } context; - } u; + call_stub_t *fopstub; /* stub for original fop */ + + int versioningtype; /* not much used atm */ + + union { + struct br_stub_ctx { + fd_t *fd; + uuid_t gfid; + inode_t *inode; + unsigned long version; + } context; + } u; } br_stub_local_t; #define BR_STUB_NO_VERSIONING (1 << 0) #define BR_STUB_INCREMENTAL_VERSIONING (1 << 1) typedef struct br_stub_private { - gf_boolean_t do_versioning; + gf_boolean_t do_versioning; - uint32_t boot[2]; - char export[PATH_MAX]; + uint32_t boot[2]; + char export[PATH_MAX]; - pthread_mutex_t lock; - pthread_cond_t cond; + pthread_mutex_t lock; + pthread_cond_t cond; - struct list_head squeue; /* ordered signing queue */ - pthread_t signth; - struct bad_objects_container { - pthread_t thread; - pthread_mutex_t bad_lock; - pthread_cond_t bad_cond; - struct list_head bad_queue; - } container; - struct mem_pool *local_pool; + struct list_head squeue; /* ordered signing queue */ + pthread_t signth; + struct bad_objects_container { + pthread_t thread; + pthread_mutex_t bad_lock; + pthread_cond_t bad_cond; + struct list_head bad_queue; + } container; + struct mem_pool *local_pool; - char stub_basepath[BR_PATH_MAX_EXTRA]; + char stub_basepath[BR_PATH_MAX_EXTRA]; - uuid_t bad_object_dir_gfid; + uuid_t bad_object_dir_gfid; } br_stub_private_t; br_stub_fd_t * -br_stub_fd_new (void); - +br_stub_fd_new(void); int -__br_stub_fd_ctx_set (xlator_t *this, fd_t *fd, br_stub_fd_t *br_stub_fd); +__br_stub_fd_ctx_set(xlator_t *this, fd_t *fd, br_stub_fd_t *br_stub_fd); br_stub_fd_t * -__br_stub_fd_ctx_get (xlator_t *this, fd_t *fd); +__br_stub_fd_ctx_get(xlator_t *this, fd_t *fd); br_stub_fd_t * -br_stub_fd_ctx_get (xlator_t *this, fd_t *fd); +br_stub_fd_ctx_get(xlator_t *this, fd_t *fd); int32_t -br_stub_fd_ctx_set (xlator_t *this, fd_t *fd, br_stub_fd_t *br_stub_fd); +br_stub_fd_ctx_set(xlator_t *this, fd_t *fd, br_stub_fd_t *br_stub_fd); static inline gf_boolean_t -__br_stub_is_bad_object (br_stub_inode_ctx_t *ctx) +__br_stub_is_bad_object(br_stub_inode_ctx_t *ctx) { - return ctx->bad_object; + return ctx->bad_object; } static inline void -__br_stub_mark_object_bad (br_stub_inode_ctx_t *ctx) +__br_stub_mark_object_bad(br_stub_inode_ctx_t *ctx) { - ctx->bad_object = _gf_true; + ctx->bad_object = _gf_true; } /* inode writeback helpers */ static inline void -__br_stub_mark_inode_dirty (br_stub_inode_ctx_t *ctx) +__br_stub_mark_inode_dirty(br_stub_inode_ctx_t *ctx) { - ctx->need_writeback |= I_DIRTY; + ctx->need_writeback |= I_DIRTY; } static inline void -__br_stub_mark_inode_synced (br_stub_inode_ctx_t *ctx) +__br_stub_mark_inode_synced(br_stub_inode_ctx_t *ctx) { - ctx->need_writeback &= ~I_DIRTY; + ctx->need_writeback &= ~I_DIRTY; } static inline int -__br_stub_is_inode_dirty (br_stub_inode_ctx_t *ctx) +__br_stub_is_inode_dirty(br_stub_inode_ctx_t *ctx) { - return (ctx->need_writeback & I_DIRTY); + return (ctx->need_writeback & I_DIRTY); } /* inode mofification markers */ static inline void -__br_stub_set_inode_modified (br_stub_inode_ctx_t *ctx) +__br_stub_set_inode_modified(br_stub_inode_ctx_t *ctx) { - ctx->need_writeback |= I_MODIFIED; + ctx->need_writeback |= I_MODIFIED; } static inline void -__br_stub_unset_inode_modified (br_stub_inode_ctx_t *ctx) +__br_stub_unset_inode_modified(br_stub_inode_ctx_t *ctx) { - ctx->need_writeback &= ~I_MODIFIED; + ctx->need_writeback &= ~I_MODIFIED; } static inline int -__br_stub_is_inode_modified (br_stub_inode_ctx_t *ctx) +__br_stub_is_inode_modified(br_stub_inode_ctx_t *ctx) { - return (ctx->need_writeback & I_MODIFIED); + return (ctx->need_writeback & I_MODIFIED); } - static inline int -br_stub_require_release_call (xlator_t *this, fd_t *fd, br_stub_fd_t **fd_ctx) +br_stub_require_release_call(xlator_t *this, fd_t *fd, br_stub_fd_t **fd_ctx) { - int32_t ret = 0; - br_stub_fd_t *br_stub_fd = NULL; + int32_t ret = 0; + br_stub_fd_t *br_stub_fd = NULL; - br_stub_fd = br_stub_fd_new (); - if (!br_stub_fd) - return -1; + br_stub_fd = br_stub_fd_new(); + if (!br_stub_fd) + return -1; - br_stub_fd->fd = fd; - INIT_LIST_HEAD (&br_stub_fd->list); + br_stub_fd->fd = fd; + INIT_LIST_HEAD(&br_stub_fd->list); - ret = br_stub_fd_ctx_set (this, fd, br_stub_fd); - if (ret) - gf_msg (this->name, GF_LOG_WARNING, 0, - BRS_MSG_SET_CONTEXT_FAILED, - "could not set fd context (for release callback"); - else - *fd_ctx = br_stub_fd; + ret = br_stub_fd_ctx_set(this, fd, br_stub_fd); + if (ret) + gf_msg(this->name, GF_LOG_WARNING, 0, BRS_MSG_SET_CONTEXT_FAILED, + "could not set fd context (for release callback"); + else + *fd_ctx = br_stub_fd; - return ret; + return ret; } /* get/set inode context helpers */ static inline int -__br_stub_get_inode_ctx (xlator_t *this, - inode_t *inode, uint64_t *ctx) +__br_stub_get_inode_ctx(xlator_t *this, inode_t *inode, uint64_t *ctx) { - return __inode_ctx_get (inode, this, ctx); + return __inode_ctx_get(inode, this, ctx); } static inline int -br_stub_get_inode_ctx (xlator_t *this, - inode_t *inode, uint64_t *ctx) +br_stub_get_inode_ctx(xlator_t *this, inode_t *inode, uint64_t *ctx) { - int ret = -1; + int ret = -1; - LOCK (&inode->lock); - { - ret = __br_stub_get_inode_ctx (this, inode, ctx); - } - UNLOCK (&inode->lock); + LOCK(&inode->lock); + { + ret = __br_stub_get_inode_ctx(this, inode, ctx); + } + UNLOCK(&inode->lock); - return ret; + return ret; } static inline int -br_stub_set_inode_ctx (xlator_t *this, - inode_t *inode, br_stub_inode_ctx_t *ctx) +br_stub_set_inode_ctx(xlator_t *this, inode_t *inode, br_stub_inode_ctx_t *ctx) { - uint64_t ctx_addr = (uint64_t) ctx; - return inode_ctx_set (inode, this, &ctx_addr); + uint64_t ctx_addr = (uint64_t)ctx; + return inode_ctx_set(inode, this, &ctx_addr); } /* version get/set helpers */ static inline unsigned long -__br_stub_writeback_version (br_stub_inode_ctx_t *ctx) +__br_stub_writeback_version(br_stub_inode_ctx_t *ctx) { - return (ctx->currentversion + 1); + return (ctx->currentversion + 1); } static inline void -__br_stub_set_ongoing_version (br_stub_inode_ctx_t *ctx, unsigned long version) +__br_stub_set_ongoing_version(br_stub_inode_ctx_t *ctx, unsigned long version) { - if (ctx->currentversion < version) - ctx->currentversion = version; - else - gf_msg ("bit-rot-stub", GF_LOG_WARNING, 0, - BRS_MSG_CHANGE_VERSION_FAILED, "current version: %lu" - "new version: %lu", ctx->currentversion, version); + if (ctx->currentversion < version) + ctx->currentversion = version; + else + gf_msg("bit-rot-stub", GF_LOG_WARNING, 0, BRS_MSG_CHANGE_VERSION_FAILED, + "current version: %lu" + "new version: %lu", + ctx->currentversion, version); } static inline int -__br_stub_can_trigger_release (inode_t *inode, - br_stub_inode_ctx_t *ctx, unsigned long *version) +__br_stub_can_trigger_release(inode_t *inode, br_stub_inode_ctx_t *ctx, + unsigned long *version) { - /** - * If the inode is modified, then it has to be dirty. An inode is - * marked dirty once version is increased. Its marked as modified - * when the modification call (write/truncate) which triggered - * the versioning is successful. - */ - if (__br_stub_is_inode_modified (ctx) - && list_empty (&ctx->fd_list) - && (ctx->info_sign != BR_SIGN_REOPEN_WAIT)) { - - GF_ASSERT (__br_stub_is_inode_dirty (ctx) == 0); - - if (version) - *version = htonl (ctx->currentversion); - return 1; - } - - return 0; + /** + * If the inode is modified, then it has to be dirty. An inode is + * marked dirty once version is increased. Its marked as modified + * when the modification call (write/truncate) which triggered + * the versioning is successful. + */ + if (__br_stub_is_inode_modified(ctx) && list_empty(&ctx->fd_list) && + (ctx->info_sign != BR_SIGN_REOPEN_WAIT)) { + GF_ASSERT(__br_stub_is_inode_dirty(ctx) == 0); + + if (version) + *version = htonl(ctx->currentversion); + return 1; + } + + return 0; } static inline int32_t -br_stub_get_ongoing_version (xlator_t *this, - inode_t *inode, unsigned long *version) +br_stub_get_ongoing_version(xlator_t *this, inode_t *inode, + unsigned long *version) { - int32_t ret = 0; - uint64_t ctx_addr = 0; - br_stub_inode_ctx_t *ctx = NULL; - - LOCK (&inode->lock); - { - ret = __inode_ctx_get (inode, this, &ctx_addr); - if (ret < 0) - goto unblock; - ctx = (br_stub_inode_ctx_t *) (long) ctx_addr; - *version = ctx->currentversion; - } - unblock: - UNLOCK (&inode->lock); - - return ret; + int32_t ret = 0; + uint64_t ctx_addr = 0; + br_stub_inode_ctx_t *ctx = NULL; + + LOCK(&inode->lock); + { + ret = __inode_ctx_get(inode, this, &ctx_addr); + if (ret < 0) + goto unblock; + ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; + *version = ctx->currentversion; + } +unblock: + UNLOCK(&inode->lock); + + return ret; } /** @@ -332,45 +329,44 @@ br_stub_get_ongoing_version (xlator_t *this, * *needs* to be valid in the caller. */ static inline br_stub_inode_ctx_t * -__br_stub_get_ongoing_version_ctx (xlator_t *this, - inode_t *inode, unsigned long *version) +__br_stub_get_ongoing_version_ctx(xlator_t *this, inode_t *inode, + unsigned long *version) { - int32_t ret = 0; - uint64_t ctx_addr = 0; - br_stub_inode_ctx_t *ctx = NULL; - - ret = __inode_ctx_get (inode, this, &ctx_addr); - if (ret < 0) - return NULL; - ctx = (br_stub_inode_ctx_t *) (long) ctx_addr; - if (version) - *version = ctx->currentversion; - - return ctx; + int32_t ret = 0; + uint64_t ctx_addr = 0; + br_stub_inode_ctx_t *ctx = NULL; + + ret = __inode_ctx_get(inode, this, &ctx_addr); + if (ret < 0) + return NULL; + ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; + if (version) + *version = ctx->currentversion; + + return ctx; } /* filter for xattr fetch */ static inline int -br_stub_is_internal_xattr (const char *name) +br_stub_is_internal_xattr(const char *name) { - if (name - && ((strncmp (name, BITROT_CURRENT_VERSION_KEY, - SLEN (BITROT_CURRENT_VERSION_KEY)) == 0) - || (strncmp (name, BITROT_SIGNING_VERSION_KEY, - SLEN (BITROT_SIGNING_VERSION_KEY)) == 0))) - return 1; - return 0; + if (name && ((strncmp(name, BITROT_CURRENT_VERSION_KEY, + SLEN(BITROT_CURRENT_VERSION_KEY)) == 0) || + (strncmp(name, BITROT_SIGNING_VERSION_KEY, + SLEN(BITROT_SIGNING_VERSION_KEY)) == 0))) + return 1; + return 0; } static inline void -br_stub_remove_vxattrs (dict_t *xattr) +br_stub_remove_vxattrs(dict_t *xattr) { - if (xattr) { - dict_del (xattr, BITROT_OBJECT_BAD_KEY); - dict_del (xattr, BITROT_CURRENT_VERSION_KEY); - dict_del (xattr, BITROT_SIGNING_VERSION_KEY); - dict_del (xattr, BITROT_SIGNING_XATTR_SIZE_KEY); - } + if (xattr) { + dict_del(xattr, BITROT_OBJECT_BAD_KEY); + dict_del(xattr, BITROT_CURRENT_VERSION_KEY); + dict_del(xattr, BITROT_SIGNING_VERSION_KEY); + dict_del(xattr, BITROT_SIGNING_XATTR_SIZE_KEY); + } } /** @@ -384,64 +380,63 @@ br_stub_remove_vxattrs (dict_t *xattr) * errors can be made into enums. */ static inline int -br_stub_is_bad_object (xlator_t *this, inode_t *inode) +br_stub_is_bad_object(xlator_t *this, inode_t *inode) { - int bad_object = 0; - gf_boolean_t tmp = _gf_false; - uint64_t ctx_addr = 0; - br_stub_inode_ctx_t *ctx = NULL; - int32_t ret = -1; - - ret = br_stub_get_inode_ctx (this, inode, &ctx_addr); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - BRS_MSG_GET_INODE_CONTEXT_FAILED, - "failed to get the inode context for the inode %s", - uuid_utoa (inode->gfid)); - bad_object = -1; - goto out; - } - - ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; - - LOCK (&inode->lock); - { - tmp = __br_stub_is_bad_object (ctx); - if (tmp) - bad_object = -2; - } - UNLOCK (&inode->lock); + int bad_object = 0; + gf_boolean_t tmp = _gf_false; + uint64_t ctx_addr = 0; + br_stub_inode_ctx_t *ctx = NULL; + int32_t ret = -1; + + ret = br_stub_get_inode_ctx(this, inode, &ctx_addr); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, BRS_MSG_GET_INODE_CONTEXT_FAILED, + "failed to get the inode context for the inode %s", + uuid_utoa(inode->gfid)); + bad_object = -1; + goto out; + } + + ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; + + LOCK(&inode->lock); + { + tmp = __br_stub_is_bad_object(ctx); + if (tmp) + bad_object = -2; + } + UNLOCK(&inode->lock); out: - return bad_object; + return bad_object; } static inline int32_t -br_stub_mark_object_bad (xlator_t *this, inode_t *inode) +br_stub_mark_object_bad(xlator_t *this, inode_t *inode) { - int32_t ret = -1; - uint64_t ctx_addr = 0; - br_stub_inode_ctx_t *ctx = NULL; - - ret = br_stub_get_inode_ctx (this, inode, &ctx_addr); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the " - "inode context for the inode %s", - uuid_utoa (inode->gfid)); - goto out; - } - - ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; - - LOCK (&inode->lock); - { - __br_stub_mark_object_bad (ctx); - } - UNLOCK (&inode->lock); + int32_t ret = -1; + uint64_t ctx_addr = 0; + br_stub_inode_ctx_t *ctx = NULL; + + ret = br_stub_get_inode_ctx(this, inode, &ctx_addr); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, BRS_MSG_GET_INODE_CONTEXT_FAILED, + "failed to get the " + "inode context for the inode %s", + uuid_utoa(inode->gfid)); + goto out; + } + + ctx = (br_stub_inode_ctx_t *)(long)ctx_addr; + + LOCK(&inode->lock); + { + __br_stub_mark_object_bad(ctx); + } + UNLOCK(&inode->lock); out: - return ret; + return ret; } /** @@ -449,68 +444,68 @@ out: * given to the caller and the caller has to decide what to do. */ static inline int32_t -br_stub_mark_xdata_bad_object (xlator_t *this, inode_t *inode, dict_t *xdata) +br_stub_mark_xdata_bad_object(xlator_t *this, inode_t *inode, dict_t *xdata) { - int32_t ret = 0; + int32_t ret = 0; - if (br_stub_is_bad_object (this, inode) == -2) - ret = dict_set_int32 (xdata, GLUSTERFS_BAD_INODE, 1); + if (br_stub_is_bad_object(this, inode) == -2) + ret = dict_set_int32(xdata, GLUSTERFS_BAD_INODE, 1); - return ret; + return ret; } int32_t -br_stub_add_fd_to_inode (xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx); +br_stub_add_fd_to_inode(xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx); br_sign_state_t -__br_stub_inode_sign_state (br_stub_inode_ctx_t *ctx, glusterfs_fop_t fop, - fd_t *fd); +__br_stub_inode_sign_state(br_stub_inode_ctx_t *ctx, glusterfs_fop_t fop, + fd_t *fd); int -br_stub_dir_create (xlator_t *this, br_stub_private_t *priv); +br_stub_dir_create(xlator_t *this, br_stub_private_t *priv); int -br_stub_add (xlator_t *this, uuid_t gfid); +br_stub_add(xlator_t *this, uuid_t gfid); int32_t -br_stub_create_stub_gfid (xlator_t *this, char *stub_gfid_path, uuid_t gfid); +br_stub_create_stub_gfid(xlator_t *this, char *stub_gfid_path, uuid_t gfid); int -br_stub_dir_create (xlator_t *this, br_stub_private_t *priv); +br_stub_dir_create(xlator_t *this, br_stub_private_t *priv); call_stub_t * -__br_stub_dequeue (struct list_head *callstubs); +__br_stub_dequeue(struct list_head *callstubs); void -__br_stub_enqueue (struct list_head *callstubs, call_stub_t *stub); +__br_stub_enqueue(struct list_head *callstubs, call_stub_t *stub); void -br_stub_worker_enqueue (xlator_t *this, call_stub_t *stub); +br_stub_worker_enqueue(xlator_t *this, call_stub_t *stub); void * -br_stub_worker (void *data); +br_stub_worker(void *data); int32_t -br_stub_lookup_wrapper (call_frame_t *frame, xlator_t *this, - loc_t *loc, dict_t *xattr_req); +br_stub_lookup_wrapper(call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xattr_req); int32_t -br_stub_readdir_wrapper (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t off, dict_t *xdata); +br_stub_readdir_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, + size_t size, off_t off, dict_t *xdata); int -br_stub_del (xlator_t *this, uuid_t gfid); +br_stub_del(xlator_t *this, uuid_t gfid); int -br_stub_bad_objects_path (xlator_t *this, fd_t *fd, gf_dirent_t *entries, - dict_t **dict); +br_stub_bad_objects_path(xlator_t *this, fd_t *fd, gf_dirent_t *entries, + dict_t **dict); void -br_stub_entry_xattr_fill (xlator_t *this, char *hpath, gf_dirent_t *entry, - dict_t *dict); +br_stub_entry_xattr_fill(xlator_t *this, char *hpath, gf_dirent_t *entry, + dict_t *dict); int -br_stub_get_path_of_gfid (xlator_t *this, inode_t *parent, inode_t *inode, - uuid_t gfid, char **path); +br_stub_get_path_of_gfid(xlator_t *this, inode_t *parent, inode_t *inode, + uuid_t gfid, char **path); #endif /* __BIT_ROT_STUB_H__ */ diff --git a/xlators/features/changelog/lib/src/changelog-lib-messages.h b/xlators/features/changelog/lib/src/changelog-lib-messages.h index 2061217b801..32b3497d89d 100644 --- a/xlators/features/changelog/lib/src/changelog-lib-messages.h +++ b/xlators/features/changelog/lib/src/changelog-lib-messages.h @@ -23,39 +23,26 @@ * glfs-message-id.h. */ -GLFS_MSGID(CHANGELOG_LIB, - CHANGELOG_LIB_MSG_OPEN_FAILED, - CHANGELOG_LIB_MSG_FAILED_TO_RMDIR, - CHANGELOG_LIB_MSG_SCRATCH_DIR_ENTRIES_CREATION_ERROR, - CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED, - CHANGELOG_LIB_MSG_OPENDIR_ERROR, - CHANGELOG_LIB_MSG_RENAME_FAILED, - CHANGELOG_LIB_MSG_READ_ERROR, - CHANGELOG_LIB_MSG_HTIME_ERROR, - CHANGELOG_LIB_MSG_GET_TIME_ERROR, - CHANGELOG_LIB_MSG_WRITE_FAILED, - CHANGELOG_LIB_MSG_PTHREAD_ERROR, - CHANGELOG_LIB_MSG_MMAP_FAILED, - CHANGELOG_LIB_MSG_MUNMAP_FAILED, - CHANGELOG_LIB_MSG_ASCII_ERROR, - CHANGELOG_LIB_MSG_STAT_FAILED, - CHANGELOG_LIB_MSG_GET_XATTR_FAILED, - CHANGELOG_LIB_MSG_PUBLISH_ERROR, - CHANGELOG_LIB_MSG_PARSE_ERROR, - CHANGELOG_LIB_MSG_TOTAL_LOG_INFO, - CHANGELOG_LIB_MSG_CLEANUP_ERROR, - CHANGELOG_LIB_MSG_UNLINK_FAILED, - CHANGELOG_LIB_MSG_NOTIFY_REGISTER_FAILED, - CHANGELOG_LIB_MSG_INVOKE_RPC_FAILED, - CHANGELOG_LIB_MSG_DRAINING_EVENT_INFO, - CHANGELOG_LIB_MSG_CLEANING_BRICK_ENTRY_INFO, - CHANGELOG_LIB_MSG_FREEING_ENTRY_INFO, - CHANGELOG_LIB_MSG_XDR_DECODING_FAILED, - CHANGELOG_LIB_MSG_NOTIFY_REGISTER_INFO, - CHANGELOG_LIB_MSG_THREAD_CLEANUP_WARNING, - CHANGELOG_LIB_MSG_COPY_FROM_BUFFER_FAILED, - CHANGELOG_LIB_MSG_PTHREAD_JOIN_FAILED, - CHANGELOG_LIB_MSG_HIST_FAILED -); +GLFS_MSGID( + CHANGELOG_LIB, CHANGELOG_LIB_MSG_OPEN_FAILED, + CHANGELOG_LIB_MSG_FAILED_TO_RMDIR, + CHANGELOG_LIB_MSG_SCRATCH_DIR_ENTRIES_CREATION_ERROR, + CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED, CHANGELOG_LIB_MSG_OPENDIR_ERROR, + CHANGELOG_LIB_MSG_RENAME_FAILED, CHANGELOG_LIB_MSG_READ_ERROR, + CHANGELOG_LIB_MSG_HTIME_ERROR, CHANGELOG_LIB_MSG_GET_TIME_ERROR, + CHANGELOG_LIB_MSG_WRITE_FAILED, CHANGELOG_LIB_MSG_PTHREAD_ERROR, + CHANGELOG_LIB_MSG_MMAP_FAILED, CHANGELOG_LIB_MSG_MUNMAP_FAILED, + CHANGELOG_LIB_MSG_ASCII_ERROR, CHANGELOG_LIB_MSG_STAT_FAILED, + CHANGELOG_LIB_MSG_GET_XATTR_FAILED, CHANGELOG_LIB_MSG_PUBLISH_ERROR, + CHANGELOG_LIB_MSG_PARSE_ERROR, CHANGELOG_LIB_MSG_TOTAL_LOG_INFO, + CHANGELOG_LIB_MSG_CLEANUP_ERROR, CHANGELOG_LIB_MSG_UNLINK_FAILED, + CHANGELOG_LIB_MSG_NOTIFY_REGISTER_FAILED, + CHANGELOG_LIB_MSG_INVOKE_RPC_FAILED, CHANGELOG_LIB_MSG_DRAINING_EVENT_INFO, + CHANGELOG_LIB_MSG_CLEANING_BRICK_ENTRY_INFO, + CHANGELOG_LIB_MSG_FREEING_ENTRY_INFO, CHANGELOG_LIB_MSG_XDR_DECODING_FAILED, + CHANGELOG_LIB_MSG_NOTIFY_REGISTER_INFO, + CHANGELOG_LIB_MSG_THREAD_CLEANUP_WARNING, + CHANGELOG_LIB_MSG_COPY_FROM_BUFFER_FAILED, + CHANGELOG_LIB_MSG_PTHREAD_JOIN_FAILED, CHANGELOG_LIB_MSG_HIST_FAILED); #endif /* !_CHANGELOG_MESSAGES_H_ */ diff --git a/xlators/features/changelog/lib/src/gf-changelog-helpers.h b/xlators/features/changelog/lib/src/gf-changelog-helpers.h index b05628ee70d..cfb26a0081e 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-helpers.h +++ b/xlators/features/changelog/lib/src/gf-changelog-helpers.h @@ -23,27 +23,28 @@ #include "changelog-rpc-common.h" #include "gf-changelog-journal.h" -#define GF_CHANGELOG_TRACKER "tracker" +#define GF_CHANGELOG_TRACKER "tracker" -#define GF_CHANGELOG_CURRENT_DIR ".current" -#define GF_CHANGELOG_PROCESSED_DIR ".processed" +#define GF_CHANGELOG_CURRENT_DIR ".current" +#define GF_CHANGELOG_PROCESSED_DIR ".processed" #define GF_CHANGELOG_PROCESSING_DIR ".processing" -#define GF_CHANGELOG_HISTORY_DIR ".history" +#define GF_CHANGELOG_HISTORY_DIR ".history" #define TIMESTAMP_LENGTH 10 #ifndef MAXLINE #define MAXLINE 4096 #endif -#define GF_CHANGELOG_FILL_BUFFER(ptr, ascii, off, len) do { \ - memcpy (ascii + off, ptr, len); \ - off += len; \ - } while (0) +#define GF_CHANGELOG_FILL_BUFFER(ptr, ascii, off, len) \ + do { \ + memcpy(ascii + off, ptr, len); \ + off += len; \ + } while (0) typedef struct read_line { - int rl_cnt; - char *rl_bufptr; - char rl_buf[MAXLINE]; + int rl_cnt; + char *rl_bufptr; + char rl_buf[MAXLINE]; } read_line_t; struct gf_changelog; @@ -55,51 +56,50 @@ struct gf_event; * ->next_seq holds the next _expected_ sequence number. */ struct gf_event_list { - pthread_mutex_t lock; /* protects this structure */ - pthread_cond_t cond; + pthread_mutex_t lock; /* protects this structure */ + pthread_cond_t cond; - pthread_t invoker; + pthread_t invoker; - unsigned long next_seq; /* next sequence number expected: - zero during bootstrap */ + unsigned long next_seq; /* next sequence number expected: + zero during bootstrap */ - struct gf_changelog *entry; /* backpointer to it's brick - encapsulator (entry) */ - struct list_head events; /* list of events */ + struct gf_changelog *entry; /* backpointer to it's brick + encapsulator (entry) */ + struct list_head events; /* list of events */ }; /** * include a refcount if it's of use by additional layers */ struct gf_event { - int count; + int count; - unsigned long seq; + unsigned long seq; - struct list_head list; + struct list_head list; - struct iovec iov[0]; + struct iovec iov[0]; }; -#define GF_EVENT_CALLOC_SIZE(cnt, len) \ - (sizeof (struct gf_event) + (cnt * sizeof (struct iovec)) + len) +#define GF_EVENT_CALLOC_SIZE(cnt, len) \ + (sizeof(struct gf_event) + (cnt * sizeof(struct iovec)) + len) /** * assign the base address of the IO vector to the correct memory o * area and set it's addressable length. */ -#define GF_EVENT_ASSIGN_IOVEC(vec, event, len, pos) \ - do { \ - vec->iov_base = ((char *)event) + \ - sizeof (struct gf_event) + \ - (event->count * sizeof (struct iovec)) + pos; \ - vec->iov_len = len; \ - pos += len; \ - } while (0) +#define GF_EVENT_ASSIGN_IOVEC(vec, event, len, pos) \ + do { \ + vec->iov_base = ((char *)event) + sizeof(struct gf_event) + \ + (event->count * sizeof(struct iovec)) + pos; \ + vec->iov_len = len; \ + pos += len; \ + } while (0) typedef enum gf_changelog_conn_state { - GF_CHANGELOG_CONN_STATE_PENDING = 0, - GF_CHANGELOG_CONN_STATE_ACCEPTED, - GF_CHANGELOG_CONN_STATE_DISCONNECTED, + GF_CHANGELOG_CONN_STATE_PENDING = 0, + GF_CHANGELOG_CONN_STATE_ACCEPTED, + GF_CHANGELOG_CONN_STATE_DISCONNECTED, } gf_changelog_conn_state_t; /** @@ -107,153 +107,152 @@ typedef enum gf_changelog_conn_state { * notifications are streamed. */ typedef struct gf_changelog { - gf_lock_t statelock; - gf_changelog_conn_state_t connstate; + gf_lock_t statelock; + gf_changelog_conn_state_t connstate; - xlator_t *this; + xlator_t *this; - struct list_head list; /* list of instances */ + struct list_head list; /* list of instances */ - char brick[PATH_MAX]; /* brick path for this end-point */ + char brick[PATH_MAX]; /* brick path for this end-point */ - changelog_rpc_t grpc; /* rpc{-clnt,svc} for this brick */ -#define RPC_PROBER(ent) ent->grpc.rpc -#define RPC_REBORP(ent) ent->grpc.svc -#define RPC_SOCK(ent) ent->grpc.sock + changelog_rpc_t grpc; /* rpc{-clnt,svc} for this brick */ +#define RPC_PROBER(ent) ent->grpc.rpc +#define RPC_REBORP(ent) ent->grpc.svc +#define RPC_SOCK(ent) ent->grpc.sock - unsigned int notify; /* notification flag(s) */ + unsigned int notify; /* notification flag(s) */ - FINI *fini; /* destructor callback */ - CALLBACK *callback; /* event callback dispatcher */ - CONNECT *connected; /* connect callback */ - DISCONNECT *disconnected; /* disconnection callback */ + FINI *fini; /* destructor callback */ + CALLBACK *callback; /* event callback dispatcher */ + CONNECT *connected; /* connect callback */ + DISCONNECT *disconnected; /* disconnection callback */ - void *ptr; /* owner specific private data */ - xlator_t *invokerxl; /* consumers _this_, if valid, - assigned to THIS before cbk is - invoked */ + void *ptr; /* owner specific private data */ + xlator_t *invokerxl; /* consumers _this_, if valid, + assigned to THIS before cbk is + invoked */ - gf_boolean_t ordered; + gf_boolean_t ordered; - void (*queueevent) (struct gf_event_list *, struct gf_event *); - void (*pickevent) (struct gf_event_list *, struct gf_event **); + void (*queueevent)(struct gf_event_list *, struct gf_event *); + void (*pickevent)(struct gf_event_list *, struct gf_event **); - struct gf_event_list event; + struct gf_event_list event; } gf_changelog_t; static inline int -gf_changelog_filter_check (gf_changelog_t *entry, changelog_event_t *event) +gf_changelog_filter_check(gf_changelog_t *entry, changelog_event_t *event) { - if (event->ev_type & entry->notify) - return 1; - return 0; + if (event->ev_type & entry->notify) + return 1; + return 0; } -#define GF_NEED_ORDERED_EVENTS(ent) (ent->ordered == _gf_true) +#define GF_NEED_ORDERED_EVENTS(ent) (ent->ordered == _gf_true) /** private structure */ typedef struct gf_private { - pthread_mutex_t lock; /* protects ->connections, cleanups */ - pthread_cond_t cond; + pthread_mutex_t lock; /* protects ->connections, cleanups */ + pthread_cond_t cond; - void *api; /* pointer for API access */ + void *api; /* pointer for API access */ - pthread_t poller; /* event poller thread */ - pthread_t connectionjanitor; /* connection cleaner */ + pthread_t poller; /* event poller thread */ + pthread_t connectionjanitor; /* connection cleaner */ - struct list_head connections; /* list of connections */ - struct list_head cleanups; /* list of connection to be - cleaned up */ + struct list_head connections; /* list of connections */ + struct list_head cleanups; /* list of connection to be + cleaned up */ } gf_private_t; -#define GF_CHANGELOG_GET_API_PTR(this) (((gf_private_t *) this->private)->api) +#define GF_CHANGELOG_GET_API_PTR(this) (((gf_private_t *)this->private)->api) /** * upcall: invoke callback with _correct_ THIS */ -#define GF_CHANGELOG_INVOKE_CBK(this, cbk, brick, args ...) \ - do { \ - xlator_t *old_this = NULL; \ - xlator_t *invokerxl = NULL; \ - \ - invokerxl = entry->invokerxl; \ - old_this = this; \ - \ - if (invokerxl) { \ - THIS = invokerxl; \ - } \ - \ - cbk (invokerxl, brick, args); \ - THIS = old_this; \ - \ - } while (0) - -#define SAVE_THIS(xl) \ - do { \ - old_this = xl; \ - THIS = master; \ - } while (0) - -#define RESTORE_THIS() \ - do { \ - if (old_this) \ - THIS = old_this; \ - } while (0) +#define GF_CHANGELOG_INVOKE_CBK(this, cbk, brick, args...) \ + do { \ + xlator_t *old_this = NULL; \ + xlator_t *invokerxl = NULL; \ + \ + invokerxl = entry->invokerxl; \ + old_this = this; \ + \ + if (invokerxl) { \ + THIS = invokerxl; \ + } \ + \ + cbk(invokerxl, brick, args); \ + THIS = old_this; \ + \ + } while (0) + +#define SAVE_THIS(xl) \ + do { \ + old_this = xl; \ + THIS = master; \ + } while (0) + +#define RESTORE_THIS() \ + do { \ + if (old_this) \ + THIS = old_this; \ + } while (0) /** APIs and the rest */ void * -gf_changelog_process (void *data); +gf_changelog_process(void *data); ssize_t -gf_changelog_read_path (int fd, char *buffer, size_t bufsize); +gf_changelog_read_path(int fd, char *buffer, size_t bufsize); void -gf_rfc3986_encode_space_newline (unsigned char *s, char *enc, char *estr); +gf_rfc3986_encode_space_newline(unsigned char *s, char *enc, char *estr); size_t -gf_changelog_write (int fd, char *buffer, size_t len); +gf_changelog_write(int fd, char *buffer, size_t len); ssize_t -gf_readline (int fd, void *vptr, size_t maxlen); +gf_readline(int fd, void *vptr, size_t maxlen); int -gf_ftruncate (int fd, off_t length); +gf_ftruncate(int fd, off_t length); off_t -gf_lseek (int fd, off_t offset, int whence); +gf_lseek(int fd, off_t offset, int whence); int -gf_changelog_consume (xlator_t *this, - gf_changelog_journal_t *jnl, - char *from_path, gf_boolean_t no_publish); +gf_changelog_consume(xlator_t *this, gf_changelog_journal_t *jnl, + char *from_path, gf_boolean_t no_publish); int -gf_changelog_publish (xlator_t *this, - gf_changelog_journal_t *jnl, char *from_path); +gf_changelog_publish(xlator_t *this, gf_changelog_journal_t *jnl, + char *from_path); int -gf_thread_cleanup (xlator_t *this, pthread_t thread); +gf_thread_cleanup(xlator_t *this, pthread_t thread); void * -gf_changelog_callback_invoker (void *arg); +gf_changelog_callback_invoker(void *arg); int -gf_cleanup_event (xlator_t *, struct gf_event_list *); +gf_cleanup_event(xlator_t *, struct gf_event_list *); /* (un)ordered event queueing */ void -queue_ordered_event (struct gf_event_list *, struct gf_event *); +queue_ordered_event(struct gf_event_list *, struct gf_event *); void -queue_unordered_event (struct gf_event_list *, struct gf_event *); +queue_unordered_event(struct gf_event_list *, struct gf_event *); /* (un)ordered event picking */ void -pick_event_ordered (struct gf_event_list *, struct gf_event **); +pick_event_ordered(struct gf_event_list *, struct gf_event **); void -pick_event_unordered (struct gf_event_list *, struct gf_event **); +pick_event_unordered(struct gf_event_list *, struct gf_event **); /* connection janitor thread */ void * -gf_changelog_connection_janitor (void *); +gf_changelog_connection_janitor(void *); #endif diff --git a/xlators/features/changelog/lib/src/gf-changelog-journal.h b/xlators/features/changelog/lib/src/gf-changelog-journal.h index 46d50f159d9..ba5b9bf827e 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-journal.h +++ b/xlators/features/changelog/lib/src/gf-changelog-journal.h @@ -17,91 +17,91 @@ #include "changelog.h" enum api_conn { - JNL_API_CONNECTED, - JNL_API_CONN_INPROGESS, - JNL_API_DISCONNECTED, + JNL_API_CONNECTED, + JNL_API_CONN_INPROGESS, + JNL_API_DISCONNECTED, }; typedef struct gf_changelog_entry { - char path[PATH_MAX]; + char path[PATH_MAX]; - struct list_head list; + struct list_head list; } gf_changelog_entry_t; typedef struct gf_changelog_processor { - pthread_mutex_t lock; /* protects ->entries */ - pthread_cond_t cond; /* waiter during empty list */ - gf_boolean_t waiting; + pthread_mutex_t lock; /* protects ->entries */ + pthread_cond_t cond; /* waiter during empty list */ + gf_boolean_t waiting; - pthread_t processor; /* thread-id of journal processing thread */ + pthread_t processor; /* thread-id of journal processing thread */ - struct list_head entries; + struct list_head entries; } gf_changelog_processor_t; typedef struct gf_changelog_journal { - DIR *jnl_dir; /* 'processing' directory stream */ + DIR *jnl_dir; /* 'processing' directory stream */ - int jnl_fd; /* fd to the tracker file */ + int jnl_fd; /* fd to the tracker file */ - char jnl_brickpath[PATH_MAX]; /* brick path for this end-point */ + char jnl_brickpath[PATH_MAX]; /* brick path for this end-point */ - gf_changelog_processor_t *jnl_proc; + gf_changelog_processor_t *jnl_proc; - char *jnl_working_dir; /* scratch directory */ + char *jnl_working_dir; /* scratch directory */ - char jnl_current_dir[PATH_MAX]; - char jnl_processed_dir[PATH_MAX]; - char jnl_processing_dir[PATH_MAX]; + char jnl_current_dir[PATH_MAX]; + char jnl_processed_dir[PATH_MAX]; + char jnl_processing_dir[PATH_MAX]; - char rfc3986_space_newline[256]; /* RFC 3986 string encoding */ + char rfc3986_space_newline[256]; /* RFC 3986 string encoding */ - struct gf_changelog_journal *hist_jnl; - int hist_done; /* holds 0 done scanning, - 1 keep scanning and -1 error */ + struct gf_changelog_journal *hist_jnl; + int hist_done; /* holds 0 done scanning, + 1 keep scanning and -1 error */ - pthread_spinlock_t lock; - int connected; - xlator_t *this; + pthread_spinlock_t lock; + int connected; + xlator_t *this; } gf_changelog_journal_t; -#define JNL_SET_API_STATE(jnl, state) (jnl->connected = state) -#define JNL_IS_API_DISCONNECTED(jnl) (jnl->connected == JNL_API_DISCONNECTED) +#define JNL_SET_API_STATE(jnl, state) (jnl->connected = state) +#define JNL_IS_API_DISCONNECTED(jnl) (jnl->connected == JNL_API_DISCONNECTED) /* History API */ typedef struct gf_changelog_history_data { - int len; + int len; - int htime_fd; + int htime_fd; - /* parallelism count */ - int n_parallel; + /* parallelism count */ + int n_parallel; - /* history from, to indexes */ - unsigned long from; - unsigned long to; - xlator_t *this; + /* history from, to indexes */ + unsigned long from; + unsigned long to; + xlator_t *this; } gf_changelog_history_data_t; typedef struct gf_changelog_consume_data { - /** set of inputs */ + /** set of inputs */ - /* fd to read from */ - int fd; + /* fd to read from */ + int fd; - /* from @offset */ - off_t offset; + /* from @offset */ + off_t offset; - xlator_t *this; + xlator_t *this; - gf_changelog_journal_t *jnl; + gf_changelog_journal_t *jnl; - /** set of outputs */ + /** set of outputs */ - /* return value */ - int retval; + /* return value */ + int retval; - /* journal processed */ - char changelog[PATH_MAX]; + /* journal processed */ + char changelog[PATH_MAX]; } gf_changelog_consume_data_t; /* event handler */ diff --git a/xlators/features/changelog/lib/src/gf-changelog-rpc.h b/xlators/features/changelog/lib/src/gf-changelog-rpc.h index 1c982eef809..975307b99d3 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-rpc.h +++ b/xlators/features/changelog/lib/src/gf-changelog-rpc.h @@ -16,11 +16,13 @@ #include "gf-changelog-helpers.h" #include "changelog-rpc-common.h" -struct rpc_clnt *gf_changelog_rpc_init (xlator_t *, gf_changelog_t *); +struct rpc_clnt * +gf_changelog_rpc_init(xlator_t *, gf_changelog_t *); -int gf_changelog_invoke_rpc (xlator_t *, gf_changelog_t *, int); +int +gf_changelog_invoke_rpc(xlator_t *, gf_changelog_t *, int); rpcsvc_t * -gf_changelog_reborp_init_rpc_listner (xlator_t *, char *, char *, void *); +gf_changelog_reborp_init_rpc_listner(xlator_t *, char *, char *, void *); #endif diff --git a/xlators/features/changelog/src/changelog-encoders.h b/xlators/features/changelog/src/changelog-encoders.h index d6a50cc9ef7..ca42c4c4fe0 100644 --- a/xlators/features/changelog/src/changelog-encoders.h +++ b/xlators/features/changelog/src/changelog-encoders.h @@ -16,36 +16,34 @@ #include "changelog-helpers.h" -#define CHANGELOG_STORE_ASCII(priv, buf, off, gfid, gfid_len, cld) do { \ - CHANGELOG_FILL_BUFFER (buffer, off, \ - priv->maps[cld->cld_type], 1); \ - CHANGELOG_FILL_BUFFER (buffer, \ - off, gfid, gfid_len); \ - } while (0) - -#define CHANGELOG_STORE_BINARY(priv, buf, off, gfid, cld) do { \ - CHANGELOG_FILL_BUFFER (buffer, off, \ - priv->maps[cld->cld_type], 1); \ - CHANGELOG_FILL_BUFFER (buffer, \ - off, gfid, sizeof (uuid_t)); \ - } while (0) +#define CHANGELOG_STORE_ASCII(priv, buf, off, gfid, gfid_len, cld) \ + do { \ + CHANGELOG_FILL_BUFFER(buffer, off, priv->maps[cld->cld_type], 1); \ + CHANGELOG_FILL_BUFFER(buffer, off, gfid, gfid_len); \ + } while (0) + +#define CHANGELOG_STORE_BINARY(priv, buf, off, gfid, cld) \ + do { \ + CHANGELOG_FILL_BUFFER(buffer, off, priv->maps[cld->cld_type], 1); \ + CHANGELOG_FILL_BUFFER(buffer, off, gfid, sizeof(uuid_t)); \ + } while (0) size_t -entry_fn (void *data, char *buffer, gf_boolean_t encode); +entry_fn(void *data, char *buffer, gf_boolean_t encode); size_t -del_entry_fn (void *data, char *buffer, gf_boolean_t encode); +del_entry_fn(void *data, char *buffer, gf_boolean_t encode); size_t -fop_fn (void *data, char *buffer, gf_boolean_t encode); +fop_fn(void *data, char *buffer, gf_boolean_t encode); size_t -number_fn (void *data, char *buffer, gf_boolean_t encode); +number_fn(void *data, char *buffer, gf_boolean_t encode); void -entry_free_fn (void *data); +entry_free_fn(void *data); void -del_entry_free_fn (void *data); +del_entry_free_fn(void *data); int -changelog_encode_binary (xlator_t *, changelog_log_data_t *); +changelog_encode_binary(xlator_t *, changelog_log_data_t *); int -changelog_encode_ascii (xlator_t *, changelog_log_data_t *); +changelog_encode_ascii(xlator_t *, changelog_log_data_t *); void changelog_encode_change(changelog_priv_t *); diff --git a/xlators/features/changelog/src/changelog-ev-handle.h b/xlators/features/changelog/src/changelog-ev-handle.h index e89af8793a8..7e543a0edb3 100644 --- a/xlators/features/changelog/src/changelog-ev-handle.h +++ b/xlators/features/changelog/src/changelog-ev-handle.h @@ -20,59 +20,58 @@ struct changelog_clnt; typedef struct changelog_rpc_clnt { - xlator_t *this; + xlator_t *this; - gf_lock_t lock; + gf_lock_t lock; - gf_atomic_t ref; - gf_boolean_t disconnected; + gf_atomic_t ref; + gf_boolean_t disconnected; - unsigned int filter; - char sock[UNIX_PATH_MAX]; + unsigned int filter; + char sock[UNIX_PATH_MAX]; - struct changelog_clnt *c_clnt; /* back pointer to list holder */ + struct changelog_clnt *c_clnt; /* back pointer to list holder */ - struct rpc_clnt *rpc; /* RPC client endpoint */ + struct rpc_clnt *rpc; /* RPC client endpoint */ - struct list_head list; /* ->pending, ->waitq, ->active */ + struct list_head list; /* ->pending, ->waitq, ->active */ - void (*cleanup) - (struct changelog_rpc_clnt *); /* cleanup handler */ + void (*cleanup)(struct changelog_rpc_clnt *); /* cleanup handler */ } changelog_rpc_clnt_t; static inline void -changelog_rpc_clnt_ref (changelog_rpc_clnt_t *crpc) +changelog_rpc_clnt_ref(changelog_rpc_clnt_t *crpc) { - GF_ATOMIC_INC (crpc->ref); + GF_ATOMIC_INC(crpc->ref); } static inline void -changelog_set_disconnect_flag (changelog_rpc_clnt_t *crpc, gf_boolean_t flag) +changelog_set_disconnect_flag(changelog_rpc_clnt_t *crpc, gf_boolean_t flag) { - crpc->disconnected = flag; + crpc->disconnected = flag; } static inline int -changelog_rpc_clnt_is_disconnected (changelog_rpc_clnt_t *crpc) +changelog_rpc_clnt_is_disconnected(changelog_rpc_clnt_t *crpc) { - return (crpc->disconnected == _gf_true); + return (crpc->disconnected == _gf_true); } static inline void -changelog_rpc_clnt_unref (changelog_rpc_clnt_t *crpc) +changelog_rpc_clnt_unref(changelog_rpc_clnt_t *crpc) { - gf_boolean_t gone = _gf_false; - uint64_t ref = 0; + gf_boolean_t gone = _gf_false; + uint64_t ref = 0; - ref = GF_ATOMIC_DEC (crpc->ref); + ref = GF_ATOMIC_DEC(crpc->ref); - if (!ref && changelog_rpc_clnt_is_disconnected (crpc)) { - list_del (&crpc->list); - gone = _gf_true; - } + if (!ref && changelog_rpc_clnt_is_disconnected(crpc)) { + list_del(&crpc->list); + gone = _gf_true; + } - if (gone) - crpc->cleanup (crpc); + if (gone) + crpc->cleanup(crpc); } /** @@ -100,35 +99,36 @@ changelog_rpc_clnt_unref (changelog_rpc_clnt_t *crpc) */ typedef struct changelog_clnt { - xlator_t *this; + xlator_t *this; - /* pending connections */ - pthread_mutex_t pending_lock; - pthread_cond_t pending_cond; - struct list_head pending; + /* pending connections */ + pthread_mutex_t pending_lock; + pthread_cond_t pending_cond; + struct list_head pending; - /* current active connections */ - gf_lock_t active_lock; - struct list_head active; + /* current active connections */ + gf_lock_t active_lock; + struct list_head active; - gf_lock_t wait_lock; - struct list_head waitq; + gf_lock_t wait_lock; + struct list_head waitq; - /* consumer part of rot-buffs */ - rbuf_t *rbuf; - unsigned long sequence; + /* consumer part of rot-buffs */ + rbuf_t *rbuf; + unsigned long sequence; } changelog_clnt_t; -void *changelog_ev_connector (void *); +void * +changelog_ev_connector(void *); -void *changelog_ev_dispatch (void *); +void * +changelog_ev_dispatch(void *); /* APIs */ void -changelog_ev_queue_connection (changelog_clnt_t *, changelog_rpc_clnt_t *); +changelog_ev_queue_connection(changelog_clnt_t *, changelog_rpc_clnt_t *); void -changelog_ev_cleanup_connections (xlator_t *, changelog_clnt_t *); +changelog_ev_cleanup_connections(xlator_t *, changelog_clnt_t *); #endif - diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h index 1551337c16f..10d457e8cf5 100644 --- a/xlators/features/changelog/src/changelog-helpers.h +++ b/xlators/features/changelog/src/changelog-helpers.h @@ -30,44 +30,44 @@ * the changelog entry */ typedef struct changelog_log_data { - /* rollover related */ - unsigned long cld_roll_time; + /* rollover related */ + unsigned long cld_roll_time; - /* reopen changelog? */ - gf_boolean_t cld_finale; + /* reopen changelog? */ + gf_boolean_t cld_finale; - changelog_log_type cld_type; + changelog_log_type cld_type; - /** - * sincd gfid is _always_ a necessity, it's not a part - * of the iobuf. by doing this we do not add any overhead - * for data and metadata related fops. - */ - uuid_t cld_gfid; + /** + * sincd gfid is _always_ a necessity, it's not a part + * of the iobuf. by doing this we do not add any overhead + * for data and metadata related fops. + */ + uuid_t cld_gfid; - /** - * iobufs are used for optionals records: pargfid, path, - * write offsets etc.. It's the fop implementers job - * to allocate (iobuf_get() in the fop) and get unref'ed - * in the callback (CHANGELOG_STACK_UNWIND). - */ - struct iobuf *cld_iobuf; + /** + * iobufs are used for optionals records: pargfid, path, + * write offsets etc.. It's the fop implementers job + * to allocate (iobuf_get() in the fop) and get unref'ed + * in the callback (CHANGELOG_STACK_UNWIND). + */ + struct iobuf *cld_iobuf; #define cld_ptr cld_iobuf->ptr - /** - * after allocation you can point this to the length of - * usable data, but make sure it does not exceed the - * the size of the requested iobuf. - */ - size_t cld_iobuf_len; + /** + * after allocation you can point this to the length of + * usable data, but make sure it does not exceed the + * the size of the requested iobuf. + */ + size_t cld_iobuf_len; #define cld_ptr_len cld_iobuf_len - /** - * number of optional records - */ - int cld_xtra_records; + /** + * number of optional records + */ + int cld_xtra_records; } changelog_log_data_t; /** @@ -77,55 +77,54 @@ typedef struct changelog_log_data { typedef struct changelog_priv changelog_priv_t; typedef struct changelog_dispatcher { - void *cd_data; - int (*dispatchfn) (xlator_t *, changelog_priv_t *, void *, - changelog_log_data_t *, changelog_log_data_t *); + void *cd_data; + int (*dispatchfn)(xlator_t *, changelog_priv_t *, void *, + changelog_log_data_t *, changelog_log_data_t *); } changelog_dispatcher_t; struct changelog_bootstrap { - changelog_mode_t mode; - int (*ctor) (xlator_t *, changelog_dispatcher_t *); - int (*dtor) (xlator_t *, changelog_dispatcher_t *); + changelog_mode_t mode; + int (*ctor)(xlator_t *, changelog_dispatcher_t *); + int (*dtor)(xlator_t *, changelog_dispatcher_t *); }; struct changelog_encoder { - changelog_encoder_t encoder; - int (*encode) (xlator_t *, changelog_log_data_t *); + changelog_encoder_t encoder; + int (*encode)(xlator_t *, changelog_log_data_t *); }; - /* xlator private */ typedef struct changelog_time_slice { - /** - * just in case we need nanosecond granularity some day. - * field is unused as of now (maybe we'd need it later). - */ - struct timeval tv_start; - - /** - * version of changelog file, incremented each time changes - * rollover. - */ - unsigned long changelog_version[CHANGELOG_MAX_TYPE]; + /** + * just in case we need nanosecond granularity some day. + * field is unused as of now (maybe we'd need it later). + */ + struct timeval tv_start; + + /** + * version of changelog file, incremented each time changes + * rollover. + */ + unsigned long changelog_version[CHANGELOG_MAX_TYPE]; } changelog_time_slice_t; typedef struct changelog_rollover { - /* rollover thread */ - pthread_t rollover_th; + /* rollover thread */ + pthread_t rollover_th; - xlator_t *this; + xlator_t *this; - pthread_mutex_t lock; - pthread_cond_t cond; - gf_boolean_t notify; + pthread_mutex_t lock; + pthread_cond_t cond; + gf_boolean_t notify; } changelog_rollover_t; typedef struct changelog_fsync { - /* fsync() thread */ - pthread_t fsync_th; + /* fsync() thread */ + pthread_t fsync_th; - xlator_t *this; + xlator_t *this; } changelog_fsync_t; /* Draining during changelog rollover (for geo-rep snapshot dependency): @@ -145,198 +144,197 @@ typedef struct changelog_fsync { */ typedef enum chlog_fop_color { - FOP_COLOR_BLACK, - FOP_COLOR_WHITE + FOP_COLOR_BLACK, + FOP_COLOR_WHITE } chlog_fop_color_t; /* Barrier notify variable */ typedef struct barrier_notify { - pthread_mutex_t bnotify_mutex; - pthread_cond_t bnotify_cond; - gf_boolean_t bnotify; - gf_boolean_t bnotify_error; + pthread_mutex_t bnotify_mutex; + pthread_cond_t bnotify_cond; + gf_boolean_t bnotify; + gf_boolean_t bnotify_error; } barrier_notify_t; /* Two separate mutex and conditional variable set is used * to drain white and black fops. */ typedef struct drain_mgmt { - pthread_mutex_t drain_black_mutex; - pthread_cond_t drain_black_cond; - pthread_mutex_t drain_white_mutex; - pthread_cond_t drain_white_cond; - /* Represents black fops count in-transit */ - unsigned long black_fop_cnt; - /* Represents white fops count in-transit */ - unsigned long white_fop_cnt; - gf_boolean_t drain_wait_black; - gf_boolean_t drain_wait_white; + pthread_mutex_t drain_black_mutex; + pthread_cond_t drain_black_cond; + pthread_mutex_t drain_white_mutex; + pthread_cond_t drain_white_cond; + /* Represents black fops count in-transit */ + unsigned long black_fop_cnt; + /* Represents white fops count in-transit */ + unsigned long white_fop_cnt; + gf_boolean_t drain_wait_black; + gf_boolean_t drain_wait_white; } drain_mgmt_t; /* External barrier as a result of snap on/off indicating flag*/ typedef struct barrier_flags { - gf_lock_t lock; - gf_boolean_t barrier_ext; + gf_lock_t lock; + gf_boolean_t barrier_ext; } barrier_flags_t; /* Event selection */ typedef struct changelog_ev_selector { - gf_lock_t reflock; + gf_lock_t reflock; - /** - * Array of references for each selection bit. - */ - unsigned int ref[CHANGELOG_EV_SELECTION_RANGE]; + /** + * Array of references for each selection bit. + */ + unsigned int ref[CHANGELOG_EV_SELECTION_RANGE]; } changelog_ev_selector_t; - /* changelog's private structure */ struct changelog_priv { - gf_boolean_t active; + gf_boolean_t active; - /* to generate unique socket file per brick */ - char *changelog_brick; + /* to generate unique socket file per brick */ + char *changelog_brick; - /* logging directory */ - char *changelog_dir; + /* logging directory */ + char *changelog_dir; - /* htime directory */ - char *htime_dir; + /* htime directory */ + char *htime_dir; - /* one file for all changelog types */ - int changelog_fd; + /* one file for all changelog types */ + int changelog_fd; - /* htime fd for current changelog session */ - int htime_fd; + /* htime fd for current changelog session */ + int htime_fd; - /* c_snap_fd is fd for call-path changelog */ - int c_snap_fd; + /* c_snap_fd is fd for call-path changelog */ + int c_snap_fd; - /* rollover_count used by htime */ - int rollover_count; + /* rollover_count used by htime */ + int rollover_count; - gf_lock_t lock; + gf_lock_t lock; - /* lock to synchronize CSNAP updation */ - gf_lock_t c_snap_lock; + /* lock to synchronize CSNAP updation */ + gf_lock_t c_snap_lock; - /* written end of the pipe */ - int wfd; + /* written end of the pipe */ + int wfd; - /* rollover time */ - int32_t rollover_time; + /* rollover time */ + int32_t rollover_time; - /* fsync() interval */ - int32_t fsync_interval; + /* fsync() interval */ + int32_t fsync_interval; - /* changelog type maps */ - const char *maps[CHANGELOG_MAX_TYPE]; + /* changelog type maps */ + const char *maps[CHANGELOG_MAX_TYPE]; - /* time slicer */ - changelog_time_slice_t slice; + /* time slicer */ + changelog_time_slice_t slice; - /* context of the updater */ - changelog_dispatcher_t cd; + /* context of the updater */ + changelog_dispatcher_t cd; - /* context of the rollover thread */ - changelog_rollover_t cr; + /* context of the rollover thread */ + changelog_rollover_t cr; - /* context of fsync thread */ - changelog_fsync_t cf; + /* context of fsync thread */ + changelog_fsync_t cf; - /* operation mode */ - changelog_mode_t op_mode; + /* operation mode */ + changelog_mode_t op_mode; - /* bootstrap routine for 'current' logger */ - struct changelog_bootstrap *cb; + /* bootstrap routine for 'current' logger */ + struct changelog_bootstrap *cb; - /* encoder mode */ - changelog_encoder_t encode_mode; + /* encoder mode */ + changelog_encoder_t encode_mode; - /* encoder */ - struct changelog_encoder *ce; + /* encoder */ + struct changelog_encoder *ce; - /** - * snapshot dependency changes - */ + /** + * snapshot dependency changes + */ - /* Draining of fops*/ - drain_mgmt_t dm; + /* Draining of fops*/ + drain_mgmt_t dm; - /* Represents the active color. Initially by default black */ - chlog_fop_color_t current_color; + /* Represents the active color. Initially by default black */ + chlog_fop_color_t current_color; - /* flag to determine explicit rollover is triggered */ - gf_boolean_t explicit_rollover; + /* flag to determine explicit rollover is triggered */ + gf_boolean_t explicit_rollover; - /* barrier notification variable protected by mutex */ - barrier_notify_t bn; + /* barrier notification variable protected by mutex */ + barrier_notify_t bn; - /* barrier on/off indicating flags */ - barrier_flags_t bflags; + /* barrier on/off indicating flags */ + barrier_flags_t bflags; - /* changelog barrier on/off indicating flag */ - gf_boolean_t barrier_enabled; - struct list_head queue; - uint32_t queue_size; - gf_timer_t *timer; - struct timespec timeout; + /* changelog barrier on/off indicating flag */ + gf_boolean_t barrier_enabled; + struct list_head queue; + uint32_t queue_size; + gf_timer_t *timer; + struct timespec timeout; - /** - * buffers, RPC, event selection, notifications and other - * beasts. - */ + /** + * buffers, RPC, event selection, notifications and other + * beasts. + */ - /* epoll pthread */ - pthread_t poller; + /* epoll pthread */ + pthread_t poller; - /* rotational buffer */ - rbuf_t *rbuf; + /* rotational buffer */ + rbuf_t *rbuf; - /* changelog RPC server */ - rpcsvc_t *rpc; + /* changelog RPC server */ + rpcsvc_t *rpc; - /* event selection */ - changelog_ev_selector_t ev_selection; + /* event selection */ + changelog_ev_selector_t ev_selection; - /* client handling (reverse connection) */ - pthread_t connector; + /* client handling (reverse connection) */ + pthread_t connector; - int nr_dispatchers; - pthread_t *ev_dispatcher; + int nr_dispatchers; + pthread_t *ev_dispatcher; - changelog_clnt_t connections; + changelog_clnt_t connections; - /* glusterfind dependency to capture paths on deleted entries*/ - gf_boolean_t capture_del_path; + /* glusterfind dependency to capture paths on deleted entries*/ + gf_boolean_t capture_del_path; }; struct changelog_local { - inode_t *inode; - gf_boolean_t update_no_check; + inode_t *inode; + gf_boolean_t update_no_check; - changelog_log_data_t cld; + changelog_log_data_t cld; - /** - * ->prev_entry is used in cases when there needs to be - * additional changelog entry for the parent (eg. rename) - * It's analogous to ->next in single linked list world, - * but we call it as ->prev_entry... ha ha ha - */ - struct changelog_local *prev_entry; + /** + * ->prev_entry is used in cases when there needs to be + * additional changelog entry for the parent (eg. rename) + * It's analogous to ->next in single linked list world, + * but we call it as ->prev_entry... ha ha ha + */ + struct changelog_local *prev_entry; - /* snap dependency changes */ - chlog_fop_color_t color; + /* snap dependency changes */ + chlog_fop_color_t color; }; typedef struct changelog_local changelog_local_t; /* inode version is stored in inode ctx */ typedef struct changelog_inode_ctx { - unsigned long iversion[CHANGELOG_MAX_TYPE]; + unsigned long iversion[CHANGELOG_MAX_TYPE]; } changelog_inode_ctx_t; -#define CHANGELOG_INODE_VERSION_TYPE(ctx, type) &(ctx->iversion[type]) +#define CHANGELOG_INODE_VERSION_TYPE(ctx, type) &(ctx->iversion[type]) /** * Optional Records: @@ -344,269 +342,279 @@ typedef struct changelog_inode_ctx { * @changelog_opt_t struct. The array is allocated via @iobufs. */ typedef enum { - CHANGELOG_OPT_REC_FOP, - CHANGELOG_OPT_REC_ENTRY, - CHANGELOG_OPT_REC_UINT32, + CHANGELOG_OPT_REC_FOP, + CHANGELOG_OPT_REC_ENTRY, + CHANGELOG_OPT_REC_UINT32, } changelog_optional_rec_type_t; struct changelog_entry_fields { - uuid_t cef_uuid; - char *cef_bname; - char *cef_path; + uuid_t cef_uuid; + char *cef_bname; + char *cef_path; }; typedef struct { - /** - * @co_covert can be used to do post-processing of the record before - * it's persisted to the CHANGELOG. If this is NULL, then the record - * is persisted as per it's in memory format. - */ - size_t (*co_convert) (void *data, char *buffer, gf_boolean_t encode); - - /* release routines */ - void (*co_free) (void *data); - - /* type of the field */ - changelog_optional_rec_type_t co_type; - - /** - * sizeof of the 'valid' field in the union. This field is not used if - * @co_convert is specified. - */ - size_t co_len; - - union { - unsigned int co_uint32; - glusterfs_fop_t co_fop; - struct changelog_entry_fields co_entry; - }; + /** + * @co_covert can be used to do post-processing of the record before + * it's persisted to the CHANGELOG. If this is NULL, then the record + * is persisted as per it's in memory format. + */ + size_t (*co_convert)(void *data, char *buffer, gf_boolean_t encode); + + /* release routines */ + void (*co_free)(void *data); + + /* type of the field */ + changelog_optional_rec_type_t co_type; + + /** + * sizeof of the 'valid' field in the union. This field is not used if + * @co_convert is specified. + */ + size_t co_len; + + union { + unsigned int co_uint32; + glusterfs_fop_t co_fop; + struct changelog_entry_fields co_entry; + }; } changelog_opt_t; -#define CHANGELOG_OPT_RECORD_LEN sizeof (changelog_opt_t) +#define CHANGELOG_OPT_RECORD_LEN sizeof(changelog_opt_t) /** * helpers routines */ int -changelog_thread_cleanup (xlator_t *this, pthread_t thr_id); +changelog_thread_cleanup(xlator_t *this, pthread_t thr_id); void * -changelog_get_usable_buffer (changelog_local_t *local); +changelog_get_usable_buffer(changelog_local_t *local); void -changelog_set_usable_record_and_length (changelog_local_t *local, - size_t len, int xr); +changelog_set_usable_record_and_length(changelog_local_t *local, size_t len, + int xr); void -changelog_local_cleanup (xlator_t *xl, changelog_local_t *local); +changelog_local_cleanup(xlator_t *xl, changelog_local_t *local); changelog_local_t * -changelog_local_init (xlator_t *this, inode_t *inode, uuid_t gfid, - int xtra_records, gf_boolean_t update_flag); +changelog_local_init(xlator_t *this, inode_t *inode, uuid_t gfid, + int xtra_records, gf_boolean_t update_flag); int -changelog_start_next_change (xlator_t *this, - changelog_priv_t *priv, - unsigned long ts, gf_boolean_t finale); +changelog_start_next_change(xlator_t *this, changelog_priv_t *priv, + unsigned long ts, gf_boolean_t finale); int -changelog_open_journal (xlator_t *this, changelog_priv_t *priv); +changelog_open_journal(xlator_t *this, changelog_priv_t *priv); int -changelog_fill_rollover_data (changelog_log_data_t *cld, gf_boolean_t is_last); +changelog_fill_rollover_data(changelog_log_data_t *cld, gf_boolean_t is_last); int -changelog_inject_single_event (xlator_t *this, - changelog_priv_t *priv, - changelog_log_data_t *cld); +changelog_inject_single_event(xlator_t *this, changelog_priv_t *priv, + changelog_log_data_t *cld); size_t -changelog_entry_length (); +changelog_entry_length(); int -changelog_write (int fd, char *buffer, size_t len); +changelog_write(int fd, char *buffer, size_t len); int -changelog_write_change (changelog_priv_t *priv, char *buffer, size_t len); +changelog_write_change(changelog_priv_t *priv, char *buffer, size_t len); int -changelog_handle_change (xlator_t *this, - changelog_priv_t *priv, changelog_log_data_t *cld); +changelog_handle_change(xlator_t *this, changelog_priv_t *priv, + changelog_log_data_t *cld); void -changelog_update (xlator_t *this, changelog_priv_t *priv, - changelog_local_t *local, changelog_log_type type); +changelog_update(xlator_t *this, changelog_priv_t *priv, + changelog_local_t *local, changelog_log_type type); void * -changelog_rollover (void *data); +changelog_rollover(void *data); void * -changelog_fsync_thread (void *data); +changelog_fsync_thread(void *data); int -changelog_forget (xlator_t *this, inode_t *inode); +changelog_forget(xlator_t *this, inode_t *inode); int -htime_update (xlator_t *this, changelog_priv_t *priv, - unsigned long ts, char * buffer); +htime_update(xlator_t *this, changelog_priv_t *priv, unsigned long ts, + char *buffer); int -htime_open (xlator_t *this, changelog_priv_t *priv, unsigned long ts); +htime_open(xlator_t *this, changelog_priv_t *priv, unsigned long ts); int -htime_create (xlator_t *this, changelog_priv_t *priv, unsigned long ts); +htime_create(xlator_t *this, changelog_priv_t *priv, unsigned long ts); /* Geo-Rep snapshot dependency changes */ void -changelog_color_fop_and_inc_cnt (xlator_t *this, changelog_priv_t *priv, - changelog_local_t *local); +changelog_color_fop_and_inc_cnt(xlator_t *this, changelog_priv_t *priv, + changelog_local_t *local); void -changelog_inc_fop_cnt (xlator_t *this, changelog_priv_t *priv, - changelog_local_t *local); +changelog_inc_fop_cnt(xlator_t *this, changelog_priv_t *priv, + changelog_local_t *local); void -changelog_dec_fop_cnt (xlator_t *this, changelog_priv_t *priv, - changelog_local_t *local); +changelog_dec_fop_cnt(xlator_t *this, changelog_priv_t *priv, + changelog_local_t *local); int -changelog_barrier_notify (changelog_priv_t *priv, char* buf); +changelog_barrier_notify(changelog_priv_t *priv, char *buf); void -changelog_barrier_cleanup (xlator_t *this, changelog_priv_t *priv, - struct list_head *queue); +changelog_barrier_cleanup(xlator_t *this, changelog_priv_t *priv, + struct list_head *queue); void -changelog_drain_white_fops (xlator_t *this, changelog_priv_t *priv); +changelog_drain_white_fops(xlator_t *this, changelog_priv_t *priv); void -changelog_drain_black_fops (xlator_t *this, changelog_priv_t *priv); +changelog_drain_black_fops(xlator_t *this, changelog_priv_t *priv); /* Crash consistency of changelog wrt snapshot */ int -changelog_snap_logging_stop ( xlator_t *this, changelog_priv_t *priv); +changelog_snap_logging_stop(xlator_t *this, changelog_priv_t *priv); int -changelog_snap_logging_start ( xlator_t *this, changelog_priv_t *priv); +changelog_snap_logging_start(xlator_t *this, changelog_priv_t *priv); int -changelog_snap_open ( xlator_t *this, changelog_priv_t *priv); +changelog_snap_open(xlator_t *this, changelog_priv_t *priv); int -changelog_snap_handle_ascii_change (xlator_t *this, - changelog_log_data_t *cld); +changelog_snap_handle_ascii_change(xlator_t *this, changelog_log_data_t *cld); int -changelog_snap_write_change (changelog_priv_t *priv, char *buffer, size_t len); +changelog_snap_write_change(changelog_priv_t *priv, char *buffer, size_t len); /* Changelog barrier routines */ -void __chlog_barrier_enqueue (xlator_t *this, call_stub_t *stub); -void __chlog_barrier_disable (xlator_t *this, struct list_head *queue); -void chlog_barrier_dequeue_all (xlator_t *this, struct list_head *queue); -call_stub_t *__chlog_barrier_dequeue (xlator_t *this, struct list_head *queue); -int __chlog_barrier_enable (xlator_t *this, changelog_priv_t *priv); +void +__chlog_barrier_enqueue(xlator_t *this, call_stub_t *stub); +void +__chlog_barrier_disable(xlator_t *this, struct list_head *queue); +void +chlog_barrier_dequeue_all(xlator_t *this, struct list_head *queue); +call_stub_t * +__chlog_barrier_dequeue(xlator_t *this, struct list_head *queue); +int +__chlog_barrier_enable(xlator_t *this, changelog_priv_t *priv); int32_t -changelog_fill_entry_buf (call_frame_t *frame, xlator_t *this, - loc_t *loc, changelog_local_t **local); +changelog_fill_entry_buf(call_frame_t *frame, xlator_t *this, loc_t *loc, + changelog_local_t **local); /* event selection routines */ -void changelog_select_event (xlator_t *, - changelog_ev_selector_t *, unsigned int); -void changelog_deselect_event (xlator_t *, - changelog_ev_selector_t *, unsigned int); -int changelog_init_event_selection (xlator_t *, - changelog_ev_selector_t *); -int changelog_cleanup_event_selection (xlator_t *, - changelog_ev_selector_t *); -int changelog_ev_selected (xlator_t *, - changelog_ev_selector_t *, unsigned int); void -changelog_dispatch_event (xlator_t *, changelog_priv_t *, changelog_event_t *); +changelog_select_event(xlator_t *, changelog_ev_selector_t *, unsigned int); +void +changelog_deselect_event(xlator_t *, changelog_ev_selector_t *, unsigned int); +int +changelog_init_event_selection(xlator_t *, changelog_ev_selector_t *); +int +changelog_cleanup_event_selection(xlator_t *, changelog_ev_selector_t *); +int +changelog_ev_selected(xlator_t *, changelog_ev_selector_t *, unsigned int); +void +changelog_dispatch_event(xlator_t *, changelog_priv_t *, changelog_event_t *); changelog_inode_ctx_t * -__changelog_inode_ctx_get (xlator_t *, inode_t *, unsigned long **, - unsigned long *, changelog_log_type); +__changelog_inode_ctx_get(xlator_t *, inode_t *, unsigned long **, + unsigned long *, changelog_log_type); int -resolve_pargfid_to_path (xlator_t *this, const uuid_t gfid, char **path, - char *bname); +resolve_pargfid_to_path(xlator_t *this, const uuid_t gfid, char **path, + char *bname); /* macros */ -#define CHANGELOG_STACK_UNWIND(fop, frame, params ...) do { \ - changelog_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - if (frame) { \ - __local = frame->local; \ - __xl = frame->this; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local && __local->prev_entry) \ - changelog_local_cleanup (__xl, \ - __local->prev_entry); \ - changelog_local_cleanup (__xl, __local); \ - } while (0) - -#define CHANGELOG_IOBUF_REF(iobuf) do { \ - if (iobuf) \ - iobuf_ref (iobuf); \ - } while (0) - -#define CHANGELOG_IOBUF_UNREF(iobuf) do { \ - if (iobuf) \ - iobuf_unref (iobuf); \ - } while (0) - -#define CHANGELOG_FILL_BUFFER(buffer, off, val, len) do { \ - memcpy (buffer + off, val, len); \ - off += len; \ - } while (0) - -#define SLICE_VERSION_UPDATE(slice) do { \ - int i = 0; \ - for (; i < CHANGELOG_MAX_TYPE; i++) { \ - slice->changelog_version[i]++; \ - } \ - } while (0) - -#define CHANGELOG_FILL_UINT32(co, number, converter, xlen) do { \ - co->co_convert = converter; \ - co->co_free = NULL; \ - co->co_type = CHANGELOG_OPT_REC_UINT32; \ - co->co_uint32 = number; \ - xlen += sizeof (unsigned int); \ - } while (0) - -#define CHANGLOG_FILL_FOP_NUMBER(co, fop, converter, xlen) do { \ - co->co_convert = converter; \ - co->co_free = NULL; \ - co->co_type = CHANGELOG_OPT_REC_FOP; \ - co->co_fop = fop; \ - xlen += sizeof (fop); \ - } while (0) - -#define CHANGELOG_FILL_ENTRY(co, pargfid, bname, \ - converter, freefn, xlen, label) \ - do { \ - co->co_convert = converter; \ - co->co_free = freefn; \ - co->co_type = CHANGELOG_OPT_REC_ENTRY; \ - gf_uuid_copy (co->co_entry.cef_uuid, pargfid); \ - co->co_entry.cef_bname = gf_strdup(bname); \ - if (!co->co_entry.cef_bname) \ - goto label; \ - xlen += (UUID_CANONICAL_FORM_LEN + strlen (bname)); \ - } while (0) - -#define CHANGELOG_FILL_ENTRY_DIR_PATH(co, pargfid, bname, converter, \ - del_freefn, xlen, label, capture_del) \ - do { \ - co->co_convert = converter; \ - co->co_free = del_freefn; \ - co->co_type = CHANGELOG_OPT_REC_ENTRY; \ - gf_uuid_copy (co->co_entry.cef_uuid, pargfid); \ - co->co_entry.cef_bname = gf_strdup(bname); \ - if (!co->co_entry.cef_bname) \ - goto label; \ - xlen += (UUID_CANONICAL_FORM_LEN + strlen (bname)); \ - if (!capture_del || resolve_pargfid_to_path (this, pargfid, \ - &(co->co_entry.cef_path), co->co_entry.cef_bname)) { \ - co->co_entry.cef_path = gf_strdup ("\0"); \ - xlen += 1; \ - } else { \ - xlen += (strlen (co->co_entry.cef_path)); \ - } \ - } while (0) - -#define CHANGELOG_INIT(this, local, inode, gfid, xrec) \ - local = changelog_local_init (this, inode, gfid, xrec, _gf_false) - -#define CHANGELOG_INIT_NOCHECK(this, local, inode, gfid, xrec) \ - local = changelog_local_init (this, inode, gfid, xrec, _gf_true) - -#define CHANGELOG_NOT_ACTIVE_THEN_GOTO(frame, priv, label) do { \ - if (!priv->active) \ - goto label; \ - /* ignore rebalance process's activity. */ \ - if ((frame->root->pid == GF_CLIENT_PID_DEFRAG) || \ - (frame->root->pid == GF_CLIENT_PID_TIER_DEFRAG)) \ - goto label; \ - } while (0) +#define CHANGELOG_STACK_UNWIND(fop, frame, params...) \ + do { \ + changelog_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + if (frame) { \ + __local = frame->local; \ + __xl = frame->this; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local && __local->prev_entry) \ + changelog_local_cleanup(__xl, __local->prev_entry); \ + changelog_local_cleanup(__xl, __local); \ + } while (0) + +#define CHANGELOG_IOBUF_REF(iobuf) \ + do { \ + if (iobuf) \ + iobuf_ref(iobuf); \ + } while (0) + +#define CHANGELOG_IOBUF_UNREF(iobuf) \ + do { \ + if (iobuf) \ + iobuf_unref(iobuf); \ + } while (0) + +#define CHANGELOG_FILL_BUFFER(buffer, off, val, len) \ + do { \ + memcpy(buffer + off, val, len); \ + off += len; \ + } while (0) + +#define SLICE_VERSION_UPDATE(slice) \ + do { \ + int i = 0; \ + for (; i < CHANGELOG_MAX_TYPE; i++) { \ + slice->changelog_version[i]++; \ + } \ + } while (0) + +#define CHANGELOG_FILL_UINT32(co, number, converter, xlen) \ + do { \ + co->co_convert = converter; \ + co->co_free = NULL; \ + co->co_type = CHANGELOG_OPT_REC_UINT32; \ + co->co_uint32 = number; \ + xlen += sizeof(unsigned int); \ + } while (0) + +#define CHANGLOG_FILL_FOP_NUMBER(co, fop, converter, xlen) \ + do { \ + co->co_convert = converter; \ + co->co_free = NULL; \ + co->co_type = CHANGELOG_OPT_REC_FOP; \ + co->co_fop = fop; \ + xlen += sizeof(fop); \ + } while (0) + +#define CHANGELOG_FILL_ENTRY(co, pargfid, bname, converter, freefn, xlen, \ + label) \ + do { \ + co->co_convert = converter; \ + co->co_free = freefn; \ + co->co_type = CHANGELOG_OPT_REC_ENTRY; \ + gf_uuid_copy(co->co_entry.cef_uuid, pargfid); \ + co->co_entry.cef_bname = gf_strdup(bname); \ + if (!co->co_entry.cef_bname) \ + goto label; \ + xlen += (UUID_CANONICAL_FORM_LEN + strlen(bname)); \ + } while (0) + +#define CHANGELOG_FILL_ENTRY_DIR_PATH(co, pargfid, bname, converter, \ + del_freefn, xlen, label, capture_del) \ + do { \ + co->co_convert = converter; \ + co->co_free = del_freefn; \ + co->co_type = CHANGELOG_OPT_REC_ENTRY; \ + gf_uuid_copy(co->co_entry.cef_uuid, pargfid); \ + co->co_entry.cef_bname = gf_strdup(bname); \ + if (!co->co_entry.cef_bname) \ + goto label; \ + xlen += (UUID_CANONICAL_FORM_LEN + strlen(bname)); \ + if (!capture_del || \ + resolve_pargfid_to_path(this, pargfid, &(co->co_entry.cef_path), \ + co->co_entry.cef_bname)) { \ + co->co_entry.cef_path = gf_strdup("\0"); \ + xlen += 1; \ + } else { \ + xlen += (strlen(co->co_entry.cef_path)); \ + } \ + } while (0) + +#define CHANGELOG_INIT(this, local, inode, gfid, xrec) \ + local = changelog_local_init(this, inode, gfid, xrec, _gf_false) + +#define CHANGELOG_INIT_NOCHECK(this, local, inode, gfid, xrec) \ + local = changelog_local_init(this, inode, gfid, xrec, _gf_true) + +#define CHANGELOG_NOT_ACTIVE_THEN_GOTO(frame, priv, label) \ + do { \ + if (!priv->active) \ + goto label; \ + /* ignore rebalance process's activity. */ \ + if ((frame->root->pid == GF_CLIENT_PID_DEFRAG) || \ + (frame->root->pid == GF_CLIENT_PID_TIER_DEFRAG)) \ + goto label; \ + } while (0) /* If it is a METADATA entry and fop num being GF_FOP_NULL, don't * log in the changelog as it is of no use. And also if it is @@ -615,78 +623,80 @@ resolve_pargfid_to_path (xlator_t *this, const uuid_t gfid, char **path, * to same changelog will be missed. Hence check for boundary * condition. */ -#define CHANGELOG_OP_BOUNDARY_CHECK(frame, label) do { \ - if (frame->root->op <= GF_FOP_NULL || \ - frame->root->op >= GF_FOP_MAXVALUE) \ - goto label; \ - } while (0) +#define CHANGELOG_OP_BOUNDARY_CHECK(frame, label) \ + do { \ + if (frame->root->op <= GF_FOP_NULL || \ + frame->root->op >= GF_FOP_MAXVALUE) \ + goto label; \ + } while (0) /** * ignore internal fops for all clients except AFR self-heal daemon */ -#define CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label) do { \ - if ((frame->root->pid != GF_CLIENT_PID_SELF_HEALD) \ - && dict \ - && dict_get (dict, GLUSTERFS_INTERNAL_FOP_KEY)) \ - goto label; \ - } while (0) - -#define CHANGELOG_COND_GOTO(priv, cond, label) do { \ - if (!priv->active || cond) \ - goto label; \ - } while (0) +#define CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label) \ + do { \ + if ((frame->root->pid != GF_CLIENT_PID_SELF_HEALD) && dict && \ + dict_get(dict, GLUSTERFS_INTERNAL_FOP_KEY)) \ + goto label; \ + } while (0) + +#define CHANGELOG_COND_GOTO(priv, cond, label) \ + do { \ + if (!priv->active || cond) \ + goto label; \ + } while (0) /* Begin: Geo-Rep snapshot dependency changes */ -#define DICT_ERROR -1 -#define BARRIER_OFF 0 -#define BARRIER_ON 1 -#define DICT_DEFAULT 2 - -#define CHANGELOG_NOT_ON_THEN_GOTO(priv, ret, label) do { \ - if (!priv->active) { \ - gf_msg (this->name, GF_LOG_WARNING, 0, \ - CHANGELOG_MSG_NOT_ACTIVE, \ - "Changelog is not active, return success"); \ - ret = 0; \ - goto label; \ - } \ - } while (0) +#define DICT_ERROR -1 +#define BARRIER_OFF 0 +#define BARRIER_ON 1 +#define DICT_DEFAULT 2 + +#define CHANGELOG_NOT_ON_THEN_GOTO(priv, ret, label) \ + do { \ + if (!priv->active) { \ + gf_msg(this->name, GF_LOG_WARNING, 0, CHANGELOG_MSG_NOT_ACTIVE, \ + "Changelog is not active, return success"); \ + ret = 0; \ + goto label; \ + } \ + } while (0) /* Log pthread error and goto label */ -#define CHANGELOG_PTHREAD_ERROR_HANDLE_0(ret, label) do { \ - if (ret) { \ - gf_smsg (this->name, GF_LOG_ERROR, \ - 0, CHANGELOG_MSG_PTHREAD_ERROR, \ - "pthread error", "error=%d", ret, NULL); \ - ret = -1; \ - goto label; \ - } \ - } while (0); +#define CHANGELOG_PTHREAD_ERROR_HANDLE_0(ret, label) \ + do { \ + if (ret) { \ + gf_smsg(this->name, GF_LOG_ERROR, 0, CHANGELOG_MSG_PTHREAD_ERROR, \ + "pthread error", "error=%d", ret, NULL); \ + ret = -1; \ + goto label; \ + } \ + } while (0); /* Log pthread error, set flag and goto label */ -#define CHANGELOG_PTHREAD_ERROR_HANDLE_1(ret, label, flag) do { \ - if (ret) { \ - gf_smsg (this->name, GF_LOG_ERROR, 0, \ - CHANGELOG_MSG_PTHREAD_ERROR, \ - "pthread error", "error=%d", ret, NULL); \ - ret = -1; \ - flag = _gf_true; \ - goto label; \ - } \ - } while (0) +#define CHANGELOG_PTHREAD_ERROR_HANDLE_1(ret, label, flag) \ + do { \ + if (ret) { \ + gf_smsg(this->name, GF_LOG_ERROR, 0, CHANGELOG_MSG_PTHREAD_ERROR, \ + "pthread error", "error=%d", ret, NULL); \ + ret = -1; \ + flag = _gf_true; \ + goto label; \ + } \ + } while (0) /* Log pthread error, unlock mutex and goto label */ -#define CHANGELOG_PTHREAD_ERROR_HANDLE_2(ret, label, mutex) do { \ - if (ret) { \ - gf_smsg (this->name, GF_LOG_ERROR, \ - 0, CHANGELOG_MSG_PTHREAD_ERROR, \ - "pthread error", "error=%d", ret, NULL); \ - ret = -1; \ - pthread_mutex_unlock (&mutex); \ - goto label; \ - } \ - } while (0) +#define CHANGELOG_PTHREAD_ERROR_HANDLE_2(ret, label, mutex) \ + do { \ + if (ret) { \ + gf_smsg(this->name, GF_LOG_ERROR, 0, CHANGELOG_MSG_PTHREAD_ERROR, \ + "pthread error", "error=%d", ret, NULL); \ + ret = -1; \ + pthread_mutex_unlock(&mutex); \ + goto label; \ + } \ + } while (0) /* End: Geo-Rep snapshot dependency changes */ diff --git a/xlators/features/changelog/src/changelog-mem-types.h b/xlators/features/changelog/src/changelog-mem-types.h index 33fea31b979..1e3786c6298 100644 --- a/xlators/features/changelog/src/changelog-mem-types.h +++ b/xlators/features/changelog/src/changelog-mem-types.h @@ -14,21 +14,21 @@ #include "mem-types.h" enum gf_changelog_mem_types { - gf_changelog_mt_priv_t = gf_common_mt_end + 1, - gf_changelog_mt_str_t = gf_common_mt_end + 2, - gf_changelog_mt_batch_t = gf_common_mt_end + 3, - gf_changelog_mt_rt_t = gf_common_mt_end + 4, - gf_changelog_mt_inode_ctx_t = gf_common_mt_end + 5, - gf_changelog_mt_rpc_clnt_t = gf_common_mt_end + 6, - gf_changelog_mt_libgfchangelog_t = gf_common_mt_end + 7, - gf_changelog_mt_libgfchangelog_entry_t = gf_common_mt_end + 8, - gf_changelog_mt_libgfchangelog_rl_t = gf_common_mt_end + 9, - gf_changelog_mt_changelog_buffer_t = gf_common_mt_end + 10, - gf_changelog_mt_history_data_t = gf_common_mt_end + 11, - gf_changelog_mt_libgfchangelog_call_pool_t = gf_common_mt_end + 12, - gf_changelog_mt_libgfchangelog_event_t = gf_common_mt_end + 13, - gf_changelog_mt_ev_dispatcher_t = gf_common_mt_end + 14, - gf_changelog_mt_end + gf_changelog_mt_priv_t = gf_common_mt_end + 1, + gf_changelog_mt_str_t = gf_common_mt_end + 2, + gf_changelog_mt_batch_t = gf_common_mt_end + 3, + gf_changelog_mt_rt_t = gf_common_mt_end + 4, + gf_changelog_mt_inode_ctx_t = gf_common_mt_end + 5, + gf_changelog_mt_rpc_clnt_t = gf_common_mt_end + 6, + gf_changelog_mt_libgfchangelog_t = gf_common_mt_end + 7, + gf_changelog_mt_libgfchangelog_entry_t = gf_common_mt_end + 8, + gf_changelog_mt_libgfchangelog_rl_t = gf_common_mt_end + 9, + gf_changelog_mt_changelog_buffer_t = gf_common_mt_end + 10, + gf_changelog_mt_history_data_t = gf_common_mt_end + 11, + gf_changelog_mt_libgfchangelog_call_pool_t = gf_common_mt_end + 12, + gf_changelog_mt_libgfchangelog_event_t = gf_common_mt_end + 13, + gf_changelog_mt_ev_dispatcher_t = gf_common_mt_end + 14, + gf_changelog_mt_end }; #endif diff --git a/xlators/features/changelog/src/changelog-messages.h b/xlators/features/changelog/src/changelog-messages.h index bbef2f2bde5..dbf133ec836 100644 --- a/xlators/features/changelog/src/changelog-messages.h +++ b/xlators/features/changelog/src/changelog-messages.h @@ -23,63 +23,35 @@ * glfs-message-id.h. */ -GLFS_MSGID(CHANGELOG, - CHANGELOG_MSG_OPEN_FAILED, - CHANGELOG_MSG_NO_MEMORY, - CHANGELOG_MSG_VOL_MISCONFIGURED, - CHANGELOG_MSG_RENAME_ERROR, - CHANGELOG_MSG_READ_ERROR, - CHANGELOG_MSG_HTIME_ERROR, - CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, - CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, - CHANGELOG_MSG_CHILD_MISCONFIGURED, - CHANGELOG_MSG_DIR_OPTIONS_NOT_SET, - CHANGELOG_MSG_CLOSE_ERROR, - CHANGELOG_MSG_PIPE_CREATION_ERROR, - CHANGELOG_MSG_DICT_GET_FAILED, - CHANGELOG_MSG_BARRIER_INFO, - CHANGELOG_MSG_BARRIER_ERROR, - CHANGELOG_MSG_GET_TIME_OP_FAILED, - CHANGELOG_MSG_WRITE_FAILED, - CHANGELOG_MSG_PTHREAD_ERROR, - CHANGELOG_MSG_INODE_NOT_FOUND, - CHANGELOG_MSG_FSYNC_OP_FAILED, - CHANGELOG_MSG_TOTAL_LOG_INFO, - CHANGELOG_MSG_SNAP_INFO, - CHANGELOG_MSG_SELECT_FAILED, - CHANGELOG_MSG_FCNTL_FAILED, - CHANGELOG_MSG_BNOTIFY_INFO, - CHANGELOG_MSG_ENTRY_BUF_INFO, - CHANGELOG_MSG_NOT_ACTIVE, - CHANGELOG_MSG_LOCAL_INIT_FAILED, - CHANGELOG_MSG_NOTIFY_REGISTER_FAILED, - CHANGELOG_MSG_PROGRAM_NAME_REG_FAILED, - CHANGELOG_MSG_HANDLE_PROBE_ERROR, - CHANGELOG_MSG_SET_FD_CONTEXT, - CHANGELOG_MSG_FREEUP_FAILED, - CHANGELOG_MSG_HTIME_INFO, - CHANGELOG_MSG_RPC_SUBMIT_REPLY_FAILED, - CHANGELOG_MSG_RPC_BUILD_ERROR, - CHANGELOG_MSG_RPC_CONNECT_ERROR, - CHANGELOG_MSG_RPC_START_ERROR, - CHANGELOG_MSG_BUFFER_STARVATION_ERROR, - CHANGELOG_MSG_SCAN_DIR_FAILED, - CHANGELOG_MSG_FSETXATTR_FAILED, - CHANGELOG_MSG_FGETXATTR_FAILED, - CHANGELOG_MSG_CLEANUP_ON_ACTIVE_REF, - CHANGELOG_MSG_DISPATCH_EVENT_FAILED, - CHANGELOG_MSG_PUT_BUFFER_FAILED, - CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, - CHANGELOG_MSG_PTHREAD_CANCEL_FAILED, - CHANGELOG_MSG_INJECT_FSYNC_FAILED, - CHANGELOG_MSG_CREATE_FRAME_FAILED, - CHANGELOG_MSG_FSTAT_OP_FAILED, - CHANGELOG_MSG_LSEEK_OP_FAILED, - CHANGELOG_MSG_STRSTR_OP_FAILED, - CHANGELOG_MSG_UNLINK_OP_FAILED, - CHANGELOG_MSG_DETECT_EMPTY_CHANGELOG_FAILED, - CHANGELOG_MSG_READLINK_OP_FAILED, - CHANGELOG_MSG_EXPLICIT_ROLLOVER_FAILED -); +GLFS_MSGID( + CHANGELOG, CHANGELOG_MSG_OPEN_FAILED, CHANGELOG_MSG_NO_MEMORY, + CHANGELOG_MSG_VOL_MISCONFIGURED, CHANGELOG_MSG_RENAME_ERROR, + CHANGELOG_MSG_READ_ERROR, CHANGELOG_MSG_HTIME_ERROR, + CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, + CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, CHANGELOG_MSG_CHILD_MISCONFIGURED, + CHANGELOG_MSG_DIR_OPTIONS_NOT_SET, CHANGELOG_MSG_CLOSE_ERROR, + CHANGELOG_MSG_PIPE_CREATION_ERROR, CHANGELOG_MSG_DICT_GET_FAILED, + CHANGELOG_MSG_BARRIER_INFO, CHANGELOG_MSG_BARRIER_ERROR, + CHANGELOG_MSG_GET_TIME_OP_FAILED, CHANGELOG_MSG_WRITE_FAILED, + CHANGELOG_MSG_PTHREAD_ERROR, CHANGELOG_MSG_INODE_NOT_FOUND, + CHANGELOG_MSG_FSYNC_OP_FAILED, CHANGELOG_MSG_TOTAL_LOG_INFO, + CHANGELOG_MSG_SNAP_INFO, CHANGELOG_MSG_SELECT_FAILED, + CHANGELOG_MSG_FCNTL_FAILED, CHANGELOG_MSG_BNOTIFY_INFO, + CHANGELOG_MSG_ENTRY_BUF_INFO, CHANGELOG_MSG_NOT_ACTIVE, + CHANGELOG_MSG_LOCAL_INIT_FAILED, CHANGELOG_MSG_NOTIFY_REGISTER_FAILED, + CHANGELOG_MSG_PROGRAM_NAME_REG_FAILED, CHANGELOG_MSG_HANDLE_PROBE_ERROR, + CHANGELOG_MSG_SET_FD_CONTEXT, CHANGELOG_MSG_FREEUP_FAILED, + CHANGELOG_MSG_HTIME_INFO, CHANGELOG_MSG_RPC_SUBMIT_REPLY_FAILED, + CHANGELOG_MSG_RPC_BUILD_ERROR, CHANGELOG_MSG_RPC_CONNECT_ERROR, + CHANGELOG_MSG_RPC_START_ERROR, CHANGELOG_MSG_BUFFER_STARVATION_ERROR, + CHANGELOG_MSG_SCAN_DIR_FAILED, CHANGELOG_MSG_FSETXATTR_FAILED, + CHANGELOG_MSG_FGETXATTR_FAILED, CHANGELOG_MSG_CLEANUP_ON_ACTIVE_REF, + CHANGELOG_MSG_DISPATCH_EVENT_FAILED, CHANGELOG_MSG_PUT_BUFFER_FAILED, + CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, CHANGELOG_MSG_PTHREAD_CANCEL_FAILED, + CHANGELOG_MSG_INJECT_FSYNC_FAILED, CHANGELOG_MSG_CREATE_FRAME_FAILED, + CHANGELOG_MSG_FSTAT_OP_FAILED, CHANGELOG_MSG_LSEEK_OP_FAILED, + CHANGELOG_MSG_STRSTR_OP_FAILED, CHANGELOG_MSG_UNLINK_OP_FAILED, + CHANGELOG_MSG_DETECT_EMPTY_CHANGELOG_FAILED, + CHANGELOG_MSG_READLINK_OP_FAILED, CHANGELOG_MSG_EXPLICIT_ROLLOVER_FAILED); #endif /* !_CHANGELOG_MESSAGES_H_ */ diff --git a/xlators/features/changelog/src/changelog-misc.h b/xlators/features/changelog/src/changelog-misc.h index e96533f7365..04d1bdeba03 100644 --- a/xlators/features/changelog/src/changelog-misc.h +++ b/xlators/features/changelog/src/changelog-misc.h @@ -14,7 +14,7 @@ #include "glusterfs.h" #include "common-utils.h" -#define CHANGELOG_MAX_TYPE 4 +#define CHANGELOG_MAX_TYPE 4 #define CHANGELOG_FILE_NAME "CHANGELOG" #define HTIME_FILE_NAME "HTIME" #define CSNAP_FILE_NAME "CHANGELOG.SNAP" @@ -22,111 +22,110 @@ #define HTIME_CURRENT "trusted.glusterfs.current_htime" #define HTIME_INITIAL_VALUE "0:0" -#define CHANGELOG_VERSION_MAJOR 1 -#define CHANGELOG_VERSION_MINOR 2 +#define CHANGELOG_VERSION_MAJOR 1 +#define CHANGELOG_VERSION_MINOR 2 -#define CHANGELOG_UNIX_SOCK DEFAULT_VAR_RUN_DIRECTORY"/changelog-%s.sock" -#define CHANGELOG_TMP_UNIX_SOCK DEFAULT_VAR_RUN_DIRECTORY"/.%s%lu.sock" +#define CHANGELOG_UNIX_SOCK DEFAULT_VAR_RUN_DIRECTORY "/changelog-%s.sock" +#define CHANGELOG_TMP_UNIX_SOCK DEFAULT_VAR_RUN_DIRECTORY "/.%s%lu.sock" /** * header starts with the version and the format of the changelog. * 'version' not much of a use now. */ -#define CHANGELOG_HEADER \ - "GlusterFS Changelog | version: v%d.%d | encoding : %d\n" - -#define CHANGELOG_MAKE_SOCKET_PATH(brick_path, sockpath, len) do { \ - char xxh64[GF_XXH64_DIGEST_LENGTH*2+1] = {0,}; \ - gf_xxh64_wrapper ((unsigned char *)brick_path, \ - strlen(brick_path), \ - GF_XXHSUM64_DEFAULT_SEED, xxh64); \ - (void) snprintf (sockpath, len, \ - CHANGELOG_UNIX_SOCK, xxh64); \ - } while (0) - -#define CHANGELOG_MAKE_TMP_SOCKET_PATH(brick_path, sockpath, len) do { \ - unsigned long pid = 0; \ - char xxh64[GF_XXH64_DIGEST_LENGTH*2+1] = {0,}; \ - pid = (unsigned long) getpid (); \ - gf_xxh64_wrapper ((unsigned char *)brick_path, \ - strlen(brick_path), \ - GF_XXHSUM64_DEFAULT_SEED, xxh64); \ - (void) snprintf (sockpath, \ - len, CHANGELOG_TMP_UNIX_SOCK, \ - xxh64, pid); \ - } while (0) - +#define CHANGELOG_HEADER \ + "GlusterFS Changelog | version: v%d.%d | encoding : %d\n" + +#define CHANGELOG_MAKE_SOCKET_PATH(brick_path, sockpath, len) \ + do { \ + char xxh64[GF_XXH64_DIGEST_LENGTH * 2 + 1] = { \ + 0, \ + }; \ + gf_xxh64_wrapper((unsigned char *)brick_path, strlen(brick_path), \ + GF_XXHSUM64_DEFAULT_SEED, xxh64); \ + (void)snprintf(sockpath, len, CHANGELOG_UNIX_SOCK, xxh64); \ + } while (0) + +#define CHANGELOG_MAKE_TMP_SOCKET_PATH(brick_path, sockpath, len) \ + do { \ + unsigned long pid = 0; \ + char xxh64[GF_XXH64_DIGEST_LENGTH * 2 + 1] = { \ + 0, \ + }; \ + pid = (unsigned long)getpid(); \ + gf_xxh64_wrapper((unsigned char *)brick_path, strlen(brick_path), \ + GF_XXHSUM64_DEFAULT_SEED, xxh64); \ + (void)snprintf(sockpath, len, CHANGELOG_TMP_UNIX_SOCK, xxh64, pid); \ + } while (0) /** * ... used by libgfchangelog. */ -#define CHANGELOG_GET_HEADER_INFO(fd, buffer, len, enc, maj, min, elen) do { \ - FILE *fp; \ - int fd_dup; \ - \ - enc = -1; \ - maj = -1; \ - min = -1; \ - fd_dup = dup (fd); \ - \ - if (fd_dup != -1) { \ - fp = fdopen (fd_dup, "r"); \ - if (fp) { \ - if (fgets (buffer, len, fp)) { \ - elen = strlen (buffer); \ - sscanf (buffer, \ - CHANGELOG_HEADER, \ - &maj, &min, &enc); \ - } \ - fclose (fp); \ - } else { \ - sys_close (fd_dup); \ - } \ - } \ - } while (0) - -#define CHANGELOG_FILL_HTIME_DIR(changelog_dir, path) do { \ - snprintf (path, sizeof (path), "%s/htime", \ - changelog_dir); \ - } while(0) - -#define CHANGELOG_FILL_CSNAP_DIR(changelog_dir, path) do { \ - snprintf (path, sizeof (path), "%s/csnap", \ - changelog_dir); \ - } while(0) +#define CHANGELOG_GET_HEADER_INFO(fd, buffer, len, enc, maj, min, elen) \ + do { \ + FILE *fp; \ + int fd_dup; \ + \ + enc = -1; \ + maj = -1; \ + min = -1; \ + fd_dup = dup(fd); \ + \ + if (fd_dup != -1) { \ + fp = fdopen(fd_dup, "r"); \ + if (fp) { \ + if (fgets(buffer, len, fp)) { \ + elen = strlen(buffer); \ + sscanf(buffer, CHANGELOG_HEADER, &maj, &min, &enc); \ + } \ + fclose(fp); \ + } else { \ + sys_close(fd_dup); \ + } \ + } \ + } while (0) + +#define CHANGELOG_FILL_HTIME_DIR(changelog_dir, path) \ + do { \ + snprintf(path, sizeof(path), "%s/htime", changelog_dir); \ + } while (0) + +#define CHANGELOG_FILL_CSNAP_DIR(changelog_dir, path) \ + do { \ + snprintf(path, sizeof(path), "%s/csnap", changelog_dir); \ + } while (0) /** * everything after 'CHANGELOG_TYPE_METADATA_XATTR' are internal types * (ie. none of the fops trigger this type of event), hence * CHANGELOG_MAX_TYPE = 4 */ typedef enum { - CHANGELOG_TYPE_DATA = 0, - CHANGELOG_TYPE_METADATA, - CHANGELOG_TYPE_ENTRY, - CHANGELOG_TYPE_METADATA_XATTR, - CHANGELOG_TYPE_ROLLOVER, - CHANGELOG_TYPE_FSYNC, + CHANGELOG_TYPE_DATA = 0, + CHANGELOG_TYPE_METADATA, + CHANGELOG_TYPE_ENTRY, + CHANGELOG_TYPE_METADATA_XATTR, + CHANGELOG_TYPE_ROLLOVER, + CHANGELOG_TYPE_FSYNC, } changelog_log_type; /* operation modes - RT for now */ typedef enum { - CHANGELOG_MODE_RT = 0, + CHANGELOG_MODE_RT = 0, } changelog_mode_t; /* encoder types */ typedef enum { - CHANGELOG_ENCODE_MIN = 0, - CHANGELOG_ENCODE_BINARY, - CHANGELOG_ENCODE_ASCII, - CHANGELOG_ENCODE_MAX, + CHANGELOG_ENCODE_MIN = 0, + CHANGELOG_ENCODE_BINARY, + CHANGELOG_ENCODE_ASCII, + CHANGELOG_ENCODE_MAX, } changelog_encoder_t; -#define CHANGELOG_VALID_ENCODING(enc) \ - (enc > CHANGELOG_ENCODE_MIN && enc < CHANGELOG_ENCODE_MAX) +#define CHANGELOG_VALID_ENCODING(enc) \ + (enc > CHANGELOG_ENCODE_MIN && enc < CHANGELOG_ENCODE_MAX) -#define CHANGELOG_TYPE_IS_ENTRY(type) (type == CHANGELOG_TYPE_ENTRY) -#define CHANGELOG_TYPE_IS_ROLLOVER(type) (type == CHANGELOG_TYPE_ROLLOVER) -#define CHANGELOG_TYPE_IS_FSYNC(type) (type == CHANGELOG_TYPE_FSYNC) +#define CHANGELOG_TYPE_IS_ENTRY(type) (type == CHANGELOG_TYPE_ENTRY) +#define CHANGELOG_TYPE_IS_ROLLOVER(type) (type == CHANGELOG_TYPE_ROLLOVER) +#define CHANGELOG_TYPE_IS_FSYNC(type) (type == CHANGELOG_TYPE_FSYNC) #endif /* _CHANGELOG_MISC_H */ diff --git a/xlators/features/changelog/src/changelog-rpc-common.h b/xlators/features/changelog/src/changelog-rpc-common.h index 1a630536924..2d3f06e60c0 100644 --- a/xlators/features/changelog/src/changelog-rpc-common.h +++ b/xlators/features/changelog/src/changelog-rpc-common.h @@ -24,61 +24,62 @@ /** * Let's keep this non-configurable for now. */ -#define NR_ROTT_BUFFS 4 +#define NR_ROTT_BUFFS 4 #define NR_DISPATCHERS (NR_ROTT_BUFFS - 1) enum changelog_rpc_procnum { - CHANGELOG_RPC_PROC_NULL = 0, - CHANGELOG_RPC_PROBE_FILTER = 1, - CHANGELOG_RPC_PROC_MAX = 2, + CHANGELOG_RPC_PROC_NULL = 0, + CHANGELOG_RPC_PROBE_FILTER = 1, + CHANGELOG_RPC_PROC_MAX = 2, }; -#define CHANGELOG_RPC_PROGNUM 1885957735 -#define CHANGELOG_RPC_PROGVER 1 +#define CHANGELOG_RPC_PROGNUM 1885957735 +#define CHANGELOG_RPC_PROGVER 1 /** * reverse connection: data xfer path */ enum changelog_reverse_rpc_procnum { - CHANGELOG_REV_PROC_NULL = 0, - CHANGELOG_REV_PROC_EVENT = 1, - CHANGELOG_REV_PROC_MAX = 2, + CHANGELOG_REV_PROC_NULL = 0, + CHANGELOG_REV_PROC_EVENT = 1, + CHANGELOG_REV_PROC_MAX = 2, }; -#define CHANGELOG_REV_RPC_PROCNUM 1886350951 -#define CHANGELOG_REV_RPC_PROCVER 1 +#define CHANGELOG_REV_RPC_PROCNUM 1886350951 +#define CHANGELOG_REV_RPC_PROCVER 1 typedef struct changelog_rpc { - rpcsvc_t *svc; - struct rpc_clnt *rpc; - char sock[UNIX_PATH_MAX]; /* tied to server */ + rpcsvc_t *svc; + struct rpc_clnt *rpc; + char sock[UNIX_PATH_MAX]; /* tied to server */ } changelog_rpc_t; /* event poller */ -void *changelog_rpc_poller (void *); +void * +changelog_rpc_poller(void *); /* CLIENT API */ struct rpc_clnt * -changelog_rpc_client_init (xlator_t *, void *, char *, rpc_clnt_notify_t); +changelog_rpc_client_init(xlator_t *, void *, char *, rpc_clnt_notify_t); int -changelog_rpc_sumbit_req (struct rpc_clnt *, void *, call_frame_t *, - rpc_clnt_prog_t *, int , struct iovec *, int, - struct iobref *, xlator_t *, fop_cbk_fn_t, xdrproc_t); +changelog_rpc_sumbit_req(struct rpc_clnt *, void *, call_frame_t *, + rpc_clnt_prog_t *, int, struct iovec *, int, + struct iobref *, xlator_t *, fop_cbk_fn_t, xdrproc_t); int -changelog_invoke_rpc (xlator_t *, struct rpc_clnt *, - rpc_clnt_prog_t *, int , void *); +changelog_invoke_rpc(xlator_t *, struct rpc_clnt *, rpc_clnt_prog_t *, int, + void *); /* SERVER API */ int -changelog_rpc_sumbit_reply (rpcsvc_request_t *, void *, - struct iovec *, int, struct iobref *, xdrproc_t); +changelog_rpc_sumbit_reply(rpcsvc_request_t *, void *, struct iovec *, int, + struct iobref *, xdrproc_t); rpcsvc_t * -changelog_rpc_server_init (xlator_t *, char *, void*, - rpcsvc_notify_t, struct rpcsvc_program **); +changelog_rpc_server_init(xlator_t *, char *, void *, rpcsvc_notify_t, + struct rpcsvc_program **); void -changelog_rpc_server_destroy (xlator_t *, rpcsvc_t *, char *, - rpcsvc_notify_t, struct rpcsvc_program **); +changelog_rpc_server_destroy(xlator_t *, rpcsvc_t *, char *, rpcsvc_notify_t, + struct rpcsvc_program **); #endif diff --git a/xlators/features/changelog/src/changelog-rpc.h b/xlators/features/changelog/src/changelog-rpc.h index 9f1e2d223a3..8002cea5091 100644 --- a/xlators/features/changelog/src/changelog-rpc.h +++ b/xlators/features/changelog/src/changelog-rpc.h @@ -18,14 +18,14 @@ #include "socket.h" #include "changelog-rpc-common.h" -#define CHANGELOG_RPC_PROGNAME "GlusterFS Changelog" +#define CHANGELOG_RPC_PROGNAME "GlusterFS Changelog" rpcsvc_t * -changelog_init_rpc_listener (xlator_t *, changelog_priv_t *, rbuf_t *, int); +changelog_init_rpc_listener(xlator_t *, changelog_priv_t *, rbuf_t *, int); void -changelog_destroy_rpc_listner (xlator_t *, changelog_priv_t *); +changelog_destroy_rpc_listner(xlator_t *, changelog_priv_t *); int -changelog_cleanup_rpc_threads (xlator_t *this, changelog_priv_t *priv); +changelog_cleanup_rpc_threads(xlator_t *this, changelog_priv_t *priv); #endif diff --git a/xlators/features/changelog/src/changelog-rt.h b/xlators/features/changelog/src/changelog-rt.h index 1fc2bbc5bb9..df0d5b03487 100644 --- a/xlators/features/changelog/src/changelog-rt.h +++ b/xlators/features/changelog/src/changelog-rt.h @@ -19,15 +19,15 @@ /* unused as of now - may be you would need it later */ typedef struct changelog_rt { - gf_lock_t lock; + gf_lock_t lock; } changelog_rt_t; int -changelog_rt_init (xlator_t *this, changelog_dispatcher_t *cd); +changelog_rt_init(xlator_t *this, changelog_dispatcher_t *cd); int -changelog_rt_fini (xlator_t *this, changelog_dispatcher_t *cd); +changelog_rt_fini(xlator_t *this, changelog_dispatcher_t *cd); int -changelog_rt_enqueue (xlator_t *this, changelog_priv_t *priv, void *cbatch, - changelog_log_data_t *cld_0, changelog_log_data_t *cld_1); +changelog_rt_enqueue(xlator_t *this, changelog_priv_t *priv, void *cbatch, + changelog_log_data_t *cld_0, changelog_log_data_t *cld_1); #endif /* _CHANGELOG_RT_H */ diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index f821201d3a5..3268c9d2fb9 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -11,7 +11,6 @@ #ifndef __CTR_HELPER_H #define __CTR_HELPER_H - #include "xlator.h" #include "ctr_mem_types.h" #include "iatt.h" @@ -28,37 +27,34 @@ #include "ctr-xlator-ctx.h" #include "ctr-messages.h" -#define CTR_DEFAULT_HARDLINK_EXP_PERIOD 300 /* Five mins */ -#define CTR_DEFAULT_INODE_EXP_PERIOD 300 /* Five mins */ - +#define CTR_DEFAULT_HARDLINK_EXP_PERIOD 300 /* Five mins */ +#define CTR_DEFAULT_INODE_EXP_PERIOD 300 /* Five mins */ typedef struct ctr_query_cbk_args { - int query_fd; - int count; + int query_fd; + int count; } ctr_query_cbk_args_t; - /*CTR Xlator Private structure*/ typedef struct gf_ctr_private { - gf_boolean_t enabled; - char *ctr_db_path; - gf_boolean_t ctr_hot_brick; - gf_boolean_t ctr_record_wind; - gf_boolean_t ctr_record_unwind; - gf_boolean_t ctr_record_counter; - gf_boolean_t ctr_record_metadata_heat; - gf_boolean_t ctr_link_consistency; - gfdb_db_type_t gfdb_db_type; - gfdb_sync_type_t gfdb_sync_type; - gfdb_conn_node_t *_db_conn; - uint64_t ctr_lookupheal_link_timeout; - uint64_t ctr_lookupheal_inode_timeout; - gf_boolean_t compact_active; - gf_boolean_t compact_mode_switched; - pthread_mutex_t compact_lock; + gf_boolean_t enabled; + char *ctr_db_path; + gf_boolean_t ctr_hot_brick; + gf_boolean_t ctr_record_wind; + gf_boolean_t ctr_record_unwind; + gf_boolean_t ctr_record_counter; + gf_boolean_t ctr_record_metadata_heat; + gf_boolean_t ctr_link_consistency; + gfdb_db_type_t gfdb_db_type; + gfdb_sync_type_t gfdb_sync_type; + gfdb_conn_node_t *_db_conn; + uint64_t ctr_lookupheal_link_timeout; + uint64_t ctr_lookupheal_inode_timeout; + gf_boolean_t compact_active; + gf_boolean_t compact_mode_switched; + pthread_mutex_t compact_lock; } gf_ctr_private_t; - /* * gf_ctr_local_t is the ctr xlator local data structure that is stored in * the call_frame of each FOP. @@ -76,67 +72,63 @@ typedef struct gf_ctr_private { * but currently we record only file inode information. * * is_internal_fop in gf_ctr_local will tell us if this is a internal fop and - * take special/no action. We don't record change/access times or increement heat - * counter for internal fops from rebalancer. + * take special/no action. We don't record change/access times or increement + * heat counter for internal fops from rebalancer. * */ typedef struct gf_ctr_local { - gfdb_db_record_t gfdb_db_record; - ia_type_t ia_inode_type; - gf_boolean_t is_internal_fop; - gf_special_pid_t client_pid; + gfdb_db_record_t gfdb_db_record; + ia_type_t ia_inode_type; + gf_boolean_t is_internal_fop; + gf_special_pid_t client_pid; } gf_ctr_local_t; /* * Easy access of gfdb_db_record of ctr_local * */ -#define CTR_DB_REC(ctr_local)\ - (ctr_local->gfdb_db_record) +#define CTR_DB_REC(ctr_local) (ctr_local->gfdb_db_record) /*Clear db record*/ -#define CLEAR_CTR_DB_RECORD(ctr_local)\ -do {\ - ctr_local->gfdb_db_record.gfdb_fop_path = GFDB_FOP_INVALID;\ - memset(&(ctr_local->gfdb_db_record.gfdb_wind_change_time),\ - 0, sizeof(gfdb_time_t));\ - memset(&(ctr_local->gfdb_db_record.gfdb_unwind_change_time),\ - 0, sizeof(gfdb_time_t));\ - gf_uuid_clear (ctr_local->gfdb_db_record.gfid);\ - gf_uuid_clear (ctr_local->gfdb_db_record.pargfid);\ - memset(ctr_local->gfdb_db_record.file_name, 0, GF_NAME_MAX + 1);\ - memset(ctr_local->gfdb_db_record.old_file_name, 0, GF_NAME_MAX + 1);\ - ctr_local->gfdb_db_record.gfdb_fop_type = GFDB_FOP_INVALID_OP;\ - ctr_local->ia_inode_type = IA_INVAL;\ -} while (0) - +#define CLEAR_CTR_DB_RECORD(ctr_local) \ + do { \ + ctr_local->gfdb_db_record.gfdb_fop_path = GFDB_FOP_INVALID; \ + memset(&(ctr_local->gfdb_db_record.gfdb_wind_change_time), 0, \ + sizeof(gfdb_time_t)); \ + memset(&(ctr_local->gfdb_db_record.gfdb_unwind_change_time), 0, \ + sizeof(gfdb_time_t)); \ + gf_uuid_clear(ctr_local->gfdb_db_record.gfid); \ + gf_uuid_clear(ctr_local->gfdb_db_record.pargfid); \ + memset(ctr_local->gfdb_db_record.file_name, 0, GF_NAME_MAX + 1); \ + memset(ctr_local->gfdb_db_record.old_file_name, 0, GF_NAME_MAX + 1); \ + ctr_local->gfdb_db_record.gfdb_fop_type = GFDB_FOP_INVALID_OP; \ + ctr_local->ia_inode_type = IA_INVAL; \ + } while (0) static gf_ctr_local_t * -init_ctr_local_t (xlator_t *this) { +init_ctr_local_t(xlator_t *this) +{ + gf_ctr_local_t *ctr_local = NULL; - gf_ctr_local_t *ctr_local = NULL; + GF_ASSERT(this); - GF_ASSERT(this); + ctr_local = mem_get0(this->local_pool); + if (!ctr_local) { + gf_msg(GFDB_DATA_STORE, GF_LOG_ERROR, 0, + CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, + "Error while creating ctr local"); + goto out; + } - ctr_local = mem_get0 (this->local_pool); - if (!ctr_local) { - gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, - CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, - "Error while creating ctr local"); - goto out; - } - - CLEAR_CTR_DB_RECORD (ctr_local); + CLEAR_CTR_DB_RECORD(ctr_local); out: - return ctr_local; + return ctr_local; } static void -free_ctr_local (gf_ctr_local_t *ctr_local) +free_ctr_local(gf_ctr_local_t *ctr_local) { - if (ctr_local) - mem_put (ctr_local); + if (ctr_local) + mem_put(ctr_local); } - - /****************************************************************************** * * @@ -159,94 +151,85 @@ free_ctr_local (gf_ctr_local_t *ctr_local) * * */ - /*Context Carrier Structure for hard links*/ +/*Context Carrier Structure for hard links*/ typedef struct gf_ctr_link_context { - uuid_t *pargfid; - const char *basename; + uuid_t *pargfid; + const char *basename; } gf_ctr_link_context_t; - /*Context Carrier Structure for inodes*/ +/*Context Carrier Structure for inodes*/ typedef struct gf_ctr_inode_context { - ia_type_t ia_type; - uuid_t *gfid; - uuid_t *old_gfid; - gf_ctr_link_context_t *new_link_cx; - gf_ctr_link_context_t *old_link_cx; - gfdb_fop_type_t fop_type; - gfdb_fop_path_t fop_path; - gf_boolean_t is_internal_fop; - /* Indicating metadata fops */ - gf_boolean_t is_metadata_fop; + ia_type_t ia_type; + uuid_t *gfid; + uuid_t *old_gfid; + gf_ctr_link_context_t *new_link_cx; + gf_ctr_link_context_t *old_link_cx; + gfdb_fop_type_t fop_type; + gfdb_fop_path_t fop_path; + gf_boolean_t is_internal_fop; + /* Indicating metadata fops */ + gf_boolean_t is_metadata_fop; } gf_ctr_inode_context_t; - /*******************Util Macros for Context Carrier Structures*****************/ /*Checks if ctr_link_cx is sane!*/ -#define IS_CTR_LINK_CX_SANE(ctr_link_cx)\ -do {\ - if (ctr_link_cx) {\ - if (ctr_link_cx->pargfid)\ - GF_ASSERT (*(ctr_link_cx->pargfid));\ - GF_ASSERT (ctr_link_cx->basename);\ - };\ -} while (0) +#define IS_CTR_LINK_CX_SANE(ctr_link_cx) \ + do { \ + if (ctr_link_cx) { \ + if (ctr_link_cx->pargfid) \ + GF_ASSERT(*(ctr_link_cx->pargfid)); \ + GF_ASSERT(ctr_link_cx->basename); \ + }; \ + } while (0) /*Clear and fill the ctr_link_context with values*/ -#define FILL_CTR_LINK_CX(ctr_link_cx, _pargfid, _basename, label)\ -do {\ - GF_VALIDATE_OR_GOTO ("ctr", ctr_link_cx, label);\ - GF_VALIDATE_OR_GOTO ("ctr", _pargfid, label);\ - GF_VALIDATE_OR_GOTO ("ctr", _basename, label);\ - memset (ctr_link_cx, 0, sizeof (*ctr_link_cx));\ - ctr_link_cx->pargfid = &_pargfid;\ - ctr_link_cx->basename = _basename;\ -} while (0) - -#define NEW_LINK_CX(ctr_inode_cx)\ - ctr_inode_cx->new_link_cx\ - -#define OLD_LINK_CX(ctr_inode_cx)\ - ctr_inode_cx->old_link_cx\ +#define FILL_CTR_LINK_CX(ctr_link_cx, _pargfid, _basename, label) \ + do { \ + GF_VALIDATE_OR_GOTO("ctr", ctr_link_cx, label); \ + GF_VALIDATE_OR_GOTO("ctr", _pargfid, label); \ + GF_VALIDATE_OR_GOTO("ctr", _basename, label); \ + memset(ctr_link_cx, 0, sizeof(*ctr_link_cx)); \ + ctr_link_cx->pargfid = &_pargfid; \ + ctr_link_cx->basename = _basename; \ + } while (0) + +#define NEW_LINK_CX(ctr_inode_cx) ctr_inode_cx->new_link_cx + +#define OLD_LINK_CX(ctr_inode_cx) ctr_inode_cx->old_link_cx /*Checks if ctr_inode_cx is sane!*/ -#define IS_CTR_INODE_CX_SANE(ctr_inode_cx)\ -do {\ - GF_ASSERT (ctr_inode_cx);\ - GF_ASSERT (ctr_inode_cx->gfid);\ - GF_ASSERT (*(ctr_inode_cx->gfid));\ - GF_ASSERT (ctr_inode_cx->fop_type != GFDB_FOP_INVALID_OP);\ - GF_ASSERT (ctr_inode_cx->fop_path != GFDB_FOP_INVALID);\ - IS_CTR_LINK_CX_SANE (NEW_LINK_CX(ctr_inode_cx));\ - IS_CTR_LINK_CX_SANE (OLD_LINK_CX(ctr_inode_cx));\ -} while (0) +#define IS_CTR_INODE_CX_SANE(ctr_inode_cx) \ + do { \ + GF_ASSERT(ctr_inode_cx); \ + GF_ASSERT(ctr_inode_cx->gfid); \ + GF_ASSERT(*(ctr_inode_cx->gfid)); \ + GF_ASSERT(ctr_inode_cx->fop_type != GFDB_FOP_INVALID_OP); \ + GF_ASSERT(ctr_inode_cx->fop_path != GFDB_FOP_INVALID); \ + IS_CTR_LINK_CX_SANE(NEW_LINK_CX(ctr_inode_cx)); \ + IS_CTR_LINK_CX_SANE(OLD_LINK_CX(ctr_inode_cx)); \ + } while (0) /*Clear and fill the ctr_inode_context with values*/ -#define FILL_CTR_INODE_CONTEXT(ctr_inode_cx,\ - _ia_type,\ - _gfid,\ - _new_link_cx,\ - _old_link_cx,\ - _fop_type,\ - _fop_path)\ -do {\ - GF_ASSERT (ctr_inode_cx);\ - GF_ASSERT (_gfid);\ - GF_ASSERT (_fop_type != GFDB_FOP_INVALID_OP);\ - GF_ASSERT (_fop_path != GFDB_FOP_INVALID);\ - memset(ctr_inode_cx, 0, sizeof(*ctr_inode_cx));\ - ctr_inode_cx->ia_type = _ia_type;\ - ctr_inode_cx->gfid = &_gfid;\ - IS_CTR_LINK_CX_SANE(NEW_LINK_CX(ctr_inode_cx));\ - if (_new_link_cx)\ - NEW_LINK_CX(ctr_inode_cx) = _new_link_cx;\ - IS_CTR_LINK_CX_SANE(OLD_LINK_CX(ctr_inode_cx));\ - if (_old_link_cx)\ - OLD_LINK_CX(ctr_inode_cx) = _old_link_cx;\ - ctr_inode_cx->fop_type = _fop_type;\ - ctr_inode_cx->fop_path = _fop_path;\ -} while (0) - +#define FILL_CTR_INODE_CONTEXT(ctr_inode_cx, _ia_type, _gfid, _new_link_cx, \ + _old_link_cx, _fop_type, _fop_path) \ + do { \ + GF_ASSERT(ctr_inode_cx); \ + GF_ASSERT(_gfid); \ + GF_ASSERT(_fop_type != GFDB_FOP_INVALID_OP); \ + GF_ASSERT(_fop_path != GFDB_FOP_INVALID); \ + memset(ctr_inode_cx, 0, sizeof(*ctr_inode_cx)); \ + ctr_inode_cx->ia_type = _ia_type; \ + ctr_inode_cx->gfid = &_gfid; \ + IS_CTR_LINK_CX_SANE(NEW_LINK_CX(ctr_inode_cx)); \ + if (_new_link_cx) \ + NEW_LINK_CX(ctr_inode_cx) = _new_link_cx; \ + IS_CTR_LINK_CX_SANE(OLD_LINK_CX(ctr_inode_cx)); \ + if (_old_link_cx) \ + OLD_LINK_CX(ctr_inode_cx) = _old_link_cx; \ + ctr_inode_cx->fop_type = _fop_type; \ + ctr_inode_cx->fop_path = _fop_path; \ + } while (0) /****************************************************************************** * @@ -256,11 +239,12 @@ do {\ * ****************************************************************************/ /* Free ctr frame local */ static inline void -ctr_free_frame_local (call_frame_t *frame) { - if (frame) { - free_ctr_local ((gf_ctr_local_t *) frame->local); - frame->local = NULL; - } +ctr_free_frame_local(call_frame_t *frame) +{ + if (frame) { + free_ctr_local((gf_ctr_local_t *)frame->local); + frame->local = NULL; + } } /* Setting GF_REQUEST_LINK_COUNT_XDATA in dict @@ -271,170 +255,161 @@ ctr_free_frame_local (call_frame_t *frame) { * return -1 for failure. * */ static inline int -set_posix_link_request (xlator_t *this, - dict_t **xdata) +set_posix_link_request(xlator_t *this, dict_t **xdata) { - int ret = -1; - gf_boolean_t is_created = _gf_false; - - GF_VALIDATE_OR_GOTO ("ctr", this, out); - GF_VALIDATE_OR_GOTO (this->name, xdata, out); - - /*create xdata if NULL*/ - if (!*xdata) { - *xdata = dict_new(); - is_created = _gf_true; - ret = 1; - } else { - ret = 0; - } - - if (!*xdata) { - gf_msg (this->name, GF_LOG_ERROR, 0, CTR_MSG_XDATA_NULL, - "xdata is NULL :Cannot send " - "GF_REQUEST_LINK_COUNT_XDATA to posix"); - ret = -1; - goto out; - } - - ret = dict_set_int32 (*xdata, GF_REQUEST_LINK_COUNT_XDATA, 1); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_SET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, - "Failed setting GF_REQUEST_LINK_COUNT_XDATA"); - ret = -1; - goto out; - } + int ret = -1; + gf_boolean_t is_created = _gf_false; + + GF_VALIDATE_OR_GOTO("ctr", this, out); + GF_VALIDATE_OR_GOTO(this->name, xdata, out); + + /*create xdata if NULL*/ + if (!*xdata) { + *xdata = dict_new(); + is_created = _gf_true; + ret = 1; + } else { ret = 0; + } + + if (!*xdata) { + gf_msg(this->name, GF_LOG_ERROR, 0, CTR_MSG_XDATA_NULL, + "xdata is NULL :Cannot send " + "GF_REQUEST_LINK_COUNT_XDATA to posix"); + ret = -1; + goto out; + } + + ret = dict_set_int32(*xdata, GF_REQUEST_LINK_COUNT_XDATA, 1); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_SET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, + "Failed setting GF_REQUEST_LINK_COUNT_XDATA"); + ret = -1; + goto out; + } + ret = 0; out: - if (ret == -1) { - if (*xdata && is_created) { - dict_unref (*xdata); - } + if (ret == -1) { + if (*xdata && is_created) { + dict_unref(*xdata); } - return ret; + } + return ret; } - /* * If a bitrot fop * */ -#define BITROT_FOP(frame)\ - (frame->root->pid == GF_CLIENT_PID_BITD ||\ - frame->root->pid == GF_CLIENT_PID_SCRUB) - +#define BITROT_FOP(frame) \ + (frame->root->pid == GF_CLIENT_PID_BITD || \ + frame->root->pid == GF_CLIENT_PID_SCRUB) /* * If a rebalancer fop * */ -#define REBALANCE_FOP(frame)\ - (frame->root->pid == GF_CLIENT_PID_DEFRAG) +#define REBALANCE_FOP(frame) (frame->root->pid == GF_CLIENT_PID_DEFRAG) /* * If its a tiering rebalancer fop * */ -#define TIER_REBALANCE_FOP(frame)\ - (frame->root->pid == GF_CLIENT_PID_TIER_DEFRAG) +#define TIER_REBALANCE_FOP(frame) \ + (frame->root->pid == GF_CLIENT_PID_TIER_DEFRAG) /* * If its a AFR SELF HEAL * */ - #define AFR_SELF_HEAL_FOP(frame)\ - (frame->root->pid == GF_CLIENT_PID_SELF_HEALD) +#define AFR_SELF_HEAL_FOP(frame) (frame->root->pid == GF_CLIENT_PID_SELF_HEALD) /* * if a rebalancer fop goto * */ -#define CTR_IF_REBALANCE_FOP_THEN_GOTO(frame, label)\ -do {\ - if (REBALANCE_FOP (frame))\ - goto label;\ -} while (0) +#define CTR_IF_REBALANCE_FOP_THEN_GOTO(frame, label) \ + do { \ + if (REBALANCE_FOP(frame)) \ + goto label; \ + } while (0) /* * Internal fop * * */ static inline gf_boolean_t -is_internal_fop (call_frame_t *frame, - dict_t *xdata) +is_internal_fop(call_frame_t *frame, dict_t *xdata) { - gf_boolean_t ret = _gf_false; - - GF_ASSERT(frame); - GF_ASSERT(frame->root); - - if (AFR_SELF_HEAL_FOP (frame)) { - ret = _gf_true; - } - if (BITROT_FOP (frame)) { - ret = _gf_true; - } - if (REBALANCE_FOP (frame) || TIER_REBALANCE_FOP (frame)) { - ret = _gf_true; - if (xdata && dict_get (xdata, CTR_ATTACH_TIER_LOOKUP)) { - ret = _gf_false; - } - } - if (xdata && dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { - ret = _gf_true; + gf_boolean_t ret = _gf_false; + + GF_ASSERT(frame); + GF_ASSERT(frame->root); + + if (AFR_SELF_HEAL_FOP(frame)) { + ret = _gf_true; + } + if (BITROT_FOP(frame)) { + ret = _gf_true; + } + if (REBALANCE_FOP(frame) || TIER_REBALANCE_FOP(frame)) { + ret = _gf_true; + if (xdata && dict_get(xdata, CTR_ATTACH_TIER_LOOKUP)) { + ret = _gf_false; } + } + if (xdata && dict_get(xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { + ret = _gf_true; + } - return ret; + return ret; } -#define CTR_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label)\ -do {\ - if (is_internal_fop (frame, dict)) \ - goto label; \ -} while (0) +#define CTR_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label) \ + do { \ + if (is_internal_fop(frame, dict)) \ + goto label; \ + } while (0) /* if fop has failed exit */ -#define CTR_IF_FOP_FAILED_THEN_GOTO(this, op_ret, op_errno, label)\ -do {\ - if (op_ret == -1) {\ - gf_msg_trace (this->name, 0, "Failed fop with %s",\ - strerror (op_errno));\ - goto label;\ - };\ -} while (0) +#define CTR_IF_FOP_FAILED_THEN_GOTO(this, op_ret, op_errno, label) \ + do { \ + if (op_ret == -1) { \ + gf_msg_trace(this->name, 0, "Failed fop with %s", \ + strerror(op_errno)); \ + goto label; \ + }; \ + } while (0) /* * IS CTR Xlator is disabled then goto to label * */ - #define CTR_IS_DISABLED_THEN_GOTO(this, label)\ - do {\ - gf_ctr_private_t *_priv = NULL;\ - GF_ASSERT (this);\ - GF_ASSERT (this->private);\ - _priv = this->private;\ - if (!_priv->_db_conn)\ - goto label;\ - } while (0) +#define CTR_IS_DISABLED_THEN_GOTO(this, label) \ + do { \ + gf_ctr_private_t *_priv = NULL; \ + GF_ASSERT(this); \ + GF_ASSERT(this->private); \ + _priv = this->private; \ + if (!_priv->_db_conn) \ + goto label; \ + } while (0) /* * IS CTR record metadata heat is disabled then goto to label * */ - #define CTR_RECORD_METADATA_HEAT_IS_DISABLED_THEN_GOTO(this, label)\ - do {\ - gf_ctr_private_t *_priv = NULL;\ - GF_ASSERT (this);\ - GF_ASSERT (this->private);\ - _priv = this->private;\ - if (!_priv->ctr_record_metadata_heat)\ - goto label;\ - } while (0) +#define CTR_RECORD_METADATA_HEAT_IS_DISABLED_THEN_GOTO(this, label) \ + do { \ + gf_ctr_private_t *_priv = NULL; \ + GF_ASSERT(this); \ + GF_ASSERT(this->private); \ + _priv = this->private; \ + if (!_priv->ctr_record_metadata_heat) \ + goto label; \ + } while (0) int -fill_db_record_for_unwind (xlator_t *this, - gf_ctr_local_t *ctr_local, - gfdb_fop_type_t fop_type, - gfdb_fop_path_t fop_path); +fill_db_record_for_unwind(xlator_t *this, gf_ctr_local_t *ctr_local, + gfdb_fop_type_t fop_type, gfdb_fop_path_t fop_path); int -fill_db_record_for_wind (xlator_t *this, - gf_ctr_local_t *ctr_local, - gf_ctr_inode_context_t *ctr_inode_cx); +fill_db_record_for_wind(xlator_t *this, gf_ctr_local_t *ctr_local, + gf_ctr_inode_context_t *ctr_inode_cx); /******************************************************************************* * CTR INSERT WIND @@ -445,116 +420,108 @@ fill_db_record_for_wind (xlator_t *this, * ****************************************************************************/ static inline int -ctr_insert_wind (call_frame_t *frame, - xlator_t *this, - gf_ctr_inode_context_t *ctr_inode_cx) +ctr_insert_wind(call_frame_t *frame, xlator_t *this, + gf_ctr_inode_context_t *ctr_inode_cx) { - int ret = -1; - gf_ctr_private_t *_priv = NULL; - gf_ctr_local_t *ctr_local = NULL; - - GF_ASSERT(frame); - GF_ASSERT(frame->root); - GF_ASSERT(this); - IS_CTR_INODE_CX_SANE(ctr_inode_cx); - - _priv = this->private; - GF_ASSERT (_priv); - - GF_ASSERT(_priv->_db_conn); - - /*If record_wind option of CTR is on record wind for - * regular files only*/ - if (_priv->ctr_record_wind && ctr_inode_cx->ia_type != IA_IFDIR) { - frame->local = init_ctr_local_t (this); - if (!frame->local) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, - "WIND: Error while creating ctr local"); - goto out; - }; - ctr_local = frame->local; - ctr_local->client_pid = frame->root->pid; - ctr_local->is_internal_fop = ctr_inode_cx->is_internal_fop; - - /* Decide whether to record counters or not */ - CTR_DB_REC(ctr_local).do_record_counters = _gf_false; - /* If record counter is enabled */ - if (_priv->ctr_record_counter) { - /* If not a internal fop */ - if (!(ctr_local->is_internal_fop)) { - /* If its a metadata fop AND - * record metadata heat - * OR - * its NOT a metadata fop */ - if ((ctr_inode_cx->is_metadata_fop - && _priv->ctr_record_metadata_heat) - || - (!ctr_inode_cx->is_metadata_fop)) { - CTR_DB_REC(ctr_local).do_record_counters - = _gf_true; - } - } - } - - /* Decide whether to record times or not - * For non internal FOPS record times as usual*/ - CTR_DB_REC(ctr_local).do_record_times = _gf_false; - if (!ctr_local->is_internal_fop) { - /* If its a metadata fop AND - * record metadata heat - * OR - * its NOT a metadata fop */ - if ((ctr_inode_cx->is_metadata_fop && - _priv->ctr_record_metadata_heat) - || - (!ctr_inode_cx->is_metadata_fop)) { - CTR_DB_REC(ctr_local).do_record_times = - (_priv->ctr_record_wind - || _priv->ctr_record_unwind); - } - } - /* when its a internal FOPS*/ - else { - /* Record times only for create - * i.e when the inode is created */ - CTR_DB_REC(ctr_local).do_record_times = - (isdentrycreatefop(ctr_inode_cx->fop_type)) ? - _gf_true : _gf_false; - } - - /*Fill the db record for insertion*/ - ret = fill_db_record_for_wind (this, ctr_local, ctr_inode_cx); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_FILL_CTR_LOCAL_ERROR_WIND, - "WIND: Error filling ctr local"); - goto out; + int ret = -1; + gf_ctr_private_t *_priv = NULL; + gf_ctr_local_t *ctr_local = NULL; + + GF_ASSERT(frame); + GF_ASSERT(frame->root); + GF_ASSERT(this); + IS_CTR_INODE_CX_SANE(ctr_inode_cx); + + _priv = this->private; + GF_ASSERT(_priv); + + GF_ASSERT(_priv->_db_conn); + + /*If record_wind option of CTR is on record wind for + * regular files only*/ + if (_priv->ctr_record_wind && ctr_inode_cx->ia_type != IA_IFDIR) { + frame->local = init_ctr_local_t(this); + if (!frame->local) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, + "WIND: Error while creating ctr local"); + goto out; + }; + ctr_local = frame->local; + ctr_local->client_pid = frame->root->pid; + ctr_local->is_internal_fop = ctr_inode_cx->is_internal_fop; + + /* Decide whether to record counters or not */ + CTR_DB_REC(ctr_local).do_record_counters = _gf_false; + /* If record counter is enabled */ + if (_priv->ctr_record_counter) { + /* If not a internal fop */ + if (!(ctr_local->is_internal_fop)) { + /* If its a metadata fop AND + * record metadata heat + * OR + * its NOT a metadata fop */ + if ((ctr_inode_cx->is_metadata_fop && + _priv->ctr_record_metadata_heat) || + (!ctr_inode_cx->is_metadata_fop)) { + CTR_DB_REC(ctr_local).do_record_counters = _gf_true; } + } + } - /*Insert the db record*/ - ret = insert_record (_priv->_db_conn, - &ctr_local->gfdb_db_record); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_INSERT_RECORD_WIND_FAILED, - "WIND: Inserting of record failed!"); - goto out; - } + /* Decide whether to record times or not + * For non internal FOPS record times as usual*/ + CTR_DB_REC(ctr_local).do_record_times = _gf_false; + if (!ctr_local->is_internal_fop) { + /* If its a metadata fop AND + * record metadata heat + * OR + * its NOT a metadata fop */ + if ((ctr_inode_cx->is_metadata_fop && + _priv->ctr_record_metadata_heat) || + (!ctr_inode_cx->is_metadata_fop)) { + CTR_DB_REC(ctr_local).do_record_times = + (_priv->ctr_record_wind || _priv->ctr_record_unwind); + } + } + /* when its a internal FOPS*/ + else { + /* Record times only for create + * i.e when the inode is created */ + CTR_DB_REC(ctr_local).do_record_times = (isdentrycreatefop( + ctr_inode_cx->fop_type)) + ? _gf_true + : _gf_false; } - ret = 0; -out: + /*Fill the db record for insertion*/ + ret = fill_db_record_for_wind(this, ctr_local, ctr_inode_cx); if (ret) { - free_ctr_local (ctr_local); - frame->local = NULL; + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_FILL_CTR_LOCAL_ERROR_WIND, + "WIND: Error filling ctr local"); + goto out; } - return ret; -} - + /*Insert the db record*/ + ret = insert_record(_priv->_db_conn, &ctr_local->gfdb_db_record); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_INSERT_RECORD_WIND_FAILED, + "WIND: Inserting of record failed!"); + goto out; + } + } + ret = 0; +out: + if (ret) { + free_ctr_local(ctr_local); + frame->local = NULL; + } + return ret; +} /******************************************************************************* * CTR INSERT UNWIND @@ -564,168 +531,148 @@ out: * call at the end. * ****************************************************************************/ static inline int -ctr_insert_unwind (call_frame_t *frame, - xlator_t *this, - gfdb_fop_type_t fop_type, - gfdb_fop_path_t fop_path) +ctr_insert_unwind(call_frame_t *frame, xlator_t *this, gfdb_fop_type_t fop_type, + gfdb_fop_path_t fop_path) { - int ret = -1; - gf_ctr_private_t *_priv = NULL; - gf_ctr_local_t *ctr_local = NULL; - - GF_ASSERT(frame); - GF_ASSERT(this); + int ret = -1; + gf_ctr_private_t *_priv = NULL; + gf_ctr_local_t *ctr_local = NULL; - _priv = this->private; - GF_ASSERT (_priv); + GF_ASSERT(frame); + GF_ASSERT(this); - GF_ASSERT(_priv->_db_conn); + _priv = this->private; + GF_ASSERT(_priv); - ctr_local = frame->local; + GF_ASSERT(_priv->_db_conn); - if (ctr_local - && (_priv->ctr_record_unwind || isdentryfop(fop_type)) - && (ctr_local->ia_inode_type != IA_IFDIR)) { + ctr_local = frame->local; - CTR_DB_REC(ctr_local).do_record_uwind_time = - _priv->ctr_record_unwind; + if (ctr_local && (_priv->ctr_record_unwind || isdentryfop(fop_type)) && + (ctr_local->ia_inode_type != IA_IFDIR)) { + CTR_DB_REC(ctr_local).do_record_uwind_time = _priv->ctr_record_unwind; - ret = fill_db_record_for_unwind(this, ctr_local, fop_type, - fop_path); - if (ret == -1) { - gf_msg(this->name, GF_LOG_ERROR, 0, - CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, - "UNWIND: Error filling ctr local"); - goto out; - } + ret = fill_db_record_for_unwind(this, ctr_local, fop_type, fop_path); + if (ret == -1) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, + "UNWIND: Error filling ctr local"); + goto out; + } - ret = insert_record(_priv->_db_conn, - &ctr_local->gfdb_db_record); - if (ret == -1) { - gf_msg(this->name, GF_LOG_ERROR, 0, - CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, - "UNWIND: Error filling ctr local"); - goto out; - } + ret = insert_record(_priv->_db_conn, &ctr_local->gfdb_db_record); + if (ret == -1) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, + "UNWIND: Error filling ctr local"); + goto out; } - ret = 0; + } + ret = 0; out: - return ret; + return ret; } /****************************************************************************** * Delete file/flink record/s from db * ****************************************************************************/ static inline int -ctr_delete_hard_link_from_db (xlator_t *this, - uuid_t gfid, - uuid_t pargfid, - char *basename, - gfdb_fop_type_t fop_type, - gfdb_fop_path_t fop_path) +ctr_delete_hard_link_from_db(xlator_t *this, uuid_t gfid, uuid_t pargfid, + char *basename, gfdb_fop_type_t fop_type, + gfdb_fop_path_t fop_path) { - int ret = -1; - gfdb_db_record_t gfdb_db_record; - gf_ctr_private_t *_priv = NULL; - - _priv = this->private; - GF_VALIDATE_OR_GOTO (this->name, _priv, out); - GF_VALIDATE_OR_GOTO (this->name, (!gf_uuid_is_null (gfid)), out); - GF_VALIDATE_OR_GOTO (this->name, (!gf_uuid_is_null (pargfid)), out); - GF_VALIDATE_OR_GOTO (this->name, (fop_type == GFDB_FOP_DENTRY_WRITE), - out); - GF_VALIDATE_OR_GOTO (this->name, - (fop_path == GFDB_FOP_UNDEL || GFDB_FOP_UNDEL_ALL), - out); - - /* Set gfdb_db_record to 0 */ - memset (&gfdb_db_record, 0, sizeof(gfdb_db_record)); - - /* Copy basename */ - if (snprintf (gfdb_db_record.file_name, GF_NAME_MAX, "%s", - basename) >= GF_NAME_MAX) - goto out; - - /* Copy gfid into db record */ - gf_uuid_copy (gfdb_db_record.gfid, gfid); - - /* Copy pargid into db record */ - gf_uuid_copy (gfdb_db_record.pargfid, pargfid); - - gfdb_db_record.gfdb_fop_path = fop_path; - gfdb_db_record.gfdb_fop_type = fop_type; - - /*send delete request to db*/ - ret = insert_record (_priv->_db_conn, &gfdb_db_record); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_INSERT_RECORD_WIND_FAILED, - "Failed to delete record. %s", basename); - goto out; - } - - ret = 0; + int ret = -1; + gfdb_db_record_t gfdb_db_record; + gf_ctr_private_t *_priv = NULL; + + _priv = this->private; + GF_VALIDATE_OR_GOTO(this->name, _priv, out); + GF_VALIDATE_OR_GOTO(this->name, (!gf_uuid_is_null(gfid)), out); + GF_VALIDATE_OR_GOTO(this->name, (!gf_uuid_is_null(pargfid)), out); + GF_VALIDATE_OR_GOTO(this->name, (fop_type == GFDB_FOP_DENTRY_WRITE), out); + GF_VALIDATE_OR_GOTO( + this->name, (fop_path == GFDB_FOP_UNDEL || GFDB_FOP_UNDEL_ALL), out); + + /* Set gfdb_db_record to 0 */ + memset(&gfdb_db_record, 0, sizeof(gfdb_db_record)); + + /* Copy basename */ + if (snprintf(gfdb_db_record.file_name, GF_NAME_MAX, "%s", basename) >= + GF_NAME_MAX) + goto out; + + /* Copy gfid into db record */ + gf_uuid_copy(gfdb_db_record.gfid, gfid); + + /* Copy pargid into db record */ + gf_uuid_copy(gfdb_db_record.pargfid, pargfid); + + gfdb_db_record.gfdb_fop_path = fop_path; + gfdb_db_record.gfdb_fop_type = fop_type; + + /*send delete request to db*/ + ret = insert_record(_priv->_db_conn, &gfdb_db_record); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, CTR_MSG_INSERT_RECORD_WIND_FAILED, + "Failed to delete record. %s", basename); + goto out; + } + + ret = 0; out: - return ret; + return ret; } /******************************* Hard link function ***************************/ static inline gf_boolean_t -__is_inode_expired (ctr_xlator_ctx_t *ctr_xlator_ctx, - gf_ctr_private_t *_priv, - gfdb_time_t *current_time) +__is_inode_expired(ctr_xlator_ctx_t *ctr_xlator_ctx, gf_ctr_private_t *_priv, + gfdb_time_t *current_time) { - gf_boolean_t ret = _gf_false; - uint64_t time_diff = 0; + gf_boolean_t ret = _gf_false; + uint64_t time_diff = 0; - GF_ASSERT (ctr_xlator_ctx); - GF_ASSERT (_priv); - GF_ASSERT (current_time); + GF_ASSERT(ctr_xlator_ctx); + GF_ASSERT(_priv); + GF_ASSERT(current_time); - time_diff = current_time->tv_sec - - ctr_xlator_ctx->inode_heal_period; + time_diff = current_time->tv_sec - ctr_xlator_ctx->inode_heal_period; - ret = (time_diff >= _priv->ctr_lookupheal_inode_timeout) ? - _gf_true : _gf_false; - return ret; + ret = (time_diff >= _priv->ctr_lookupheal_inode_timeout) ? _gf_true + : _gf_false; + return ret; } static inline gf_boolean_t -__is_hardlink_expired (ctr_hard_link_t *ctr_hard_link, - gf_ctr_private_t *_priv, - gfdb_time_t *current_time) +__is_hardlink_expired(ctr_hard_link_t *ctr_hard_link, gf_ctr_private_t *_priv, + gfdb_time_t *current_time) { - gf_boolean_t ret = _gf_false; - uint64_t time_diff = 0; + gf_boolean_t ret = _gf_false; + uint64_t time_diff = 0; - GF_ASSERT (ctr_hard_link); - GF_ASSERT (_priv); - GF_ASSERT (current_time); + GF_ASSERT(ctr_hard_link); + GF_ASSERT(_priv); + GF_ASSERT(current_time); - time_diff = current_time->tv_sec - - ctr_hard_link->hardlink_heal_period; + time_diff = current_time->tv_sec - ctr_hard_link->hardlink_heal_period; - ret = ret || (time_diff >= _priv->ctr_lookupheal_link_timeout) ? - _gf_true : _gf_false; + ret = ret || (time_diff >= _priv->ctr_lookupheal_link_timeout) ? _gf_true + : _gf_false; - return ret; + return ret; } - /* Return values of heal*/ typedef enum ctr_heal_ret_val { - CTR_CTX_ERROR = -1, - /* No healing required */ - CTR_TRY_NO_HEAL = 0, - /* Try healing hard link */ - CTR_TRY_HARDLINK_HEAL = 1, - /* Try healing inode */ - CTR_TRY_INODE_HEAL = 2, + CTR_CTX_ERROR = -1, + /* No healing required */ + CTR_TRY_NO_HEAL = 0, + /* Try healing hard link */ + CTR_TRY_HARDLINK_HEAL = 1, + /* Try healing inode */ + CTR_TRY_INODE_HEAL = 2, } ctr_heal_ret_val_t; - - /** * @brief Function to add hard link to the inode context variable. * The inode context maintainences a in-memory list. This is used @@ -737,180 +684,161 @@ typedef enum ctr_heal_ret_val { */ static inline ctr_heal_ret_val_t -add_hard_link_ctx (call_frame_t *frame, - xlator_t *this, - inode_t *inode) +add_hard_link_ctx(call_frame_t *frame, xlator_t *this, inode_t *inode) { - ctr_heal_ret_val_t ret_val = CTR_TRY_NO_HEAL; - int ret = -1; - gf_ctr_local_t *ctr_local = NULL; - ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; - ctr_hard_link_t *ctr_hard_link = NULL; - gf_ctr_private_t *_priv = NULL; - gfdb_time_t current_time = {0}; - - - GF_ASSERT (frame); - GF_ASSERT (this); - GF_ASSERT (inode); - GF_ASSERT (this->private); - - _priv = this->private; - - ctr_local = frame->local; - if (!ctr_local) { - goto out; - } - - ctr_xlator_ctx = init_ctr_xlator_ctx (this, inode); - if (!ctr_xlator_ctx) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, - "Failed accessing ctr inode context"); - goto out; + ctr_heal_ret_val_t ret_val = CTR_TRY_NO_HEAL; + int ret = -1; + gf_ctr_local_t *ctr_local = NULL; + ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; + ctr_hard_link_t *ctr_hard_link = NULL; + gf_ctr_private_t *_priv = NULL; + gfdb_time_t current_time = {0}; + + GF_ASSERT(frame); + GF_ASSERT(this); + GF_ASSERT(inode); + GF_ASSERT(this->private); + + _priv = this->private; + + ctr_local = frame->local; + if (!ctr_local) { + goto out; + } + + ctr_xlator_ctx = init_ctr_xlator_ctx(this, inode); + if (!ctr_xlator_ctx) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, + "Failed accessing ctr inode context"); + goto out; + } + + LOCK(&ctr_xlator_ctx->lock); + + /* Check if the hard link already exists + * in the ctr inode context*/ + ctr_hard_link = ctr_search_hard_link_ctx(this, ctr_xlator_ctx, + CTR_DB_REC(ctr_local).pargfid, + CTR_DB_REC(ctr_local).file_name); + /* if there then ignore */ + if (ctr_hard_link) { + ret = gettimeofday(¤t_time, NULL); + if (ret == -1) { + gf_log(this->name, GF_LOG_ERROR, "Failed to get current time"); + ret_val = CTR_CTX_ERROR; + goto unlock; } - LOCK (&ctr_xlator_ctx->lock); - - /* Check if the hard link already exists - * in the ctr inode context*/ - ctr_hard_link = ctr_search_hard_link_ctx (this, - ctr_xlator_ctx, - CTR_DB_REC(ctr_local).pargfid, - CTR_DB_REC(ctr_local).file_name); - /* if there then ignore */ - if (ctr_hard_link) { - - ret = gettimeofday (¤t_time, NULL); - if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, - "Failed to get current time"); - ret_val = CTR_CTX_ERROR; - goto unlock; - } - - if (__is_hardlink_expired (ctr_hard_link, - _priv, ¤t_time)) { - ctr_hard_link->hardlink_heal_period = - current_time.tv_sec; - ret_val = ret_val | CTR_TRY_HARDLINK_HEAL; - } - - if (__is_inode_expired (ctr_xlator_ctx, - _priv, ¤t_time)) { - ctr_xlator_ctx->inode_heal_period = - current_time.tv_sec; - ret_val = ret_val | CTR_TRY_INODE_HEAL; - } - - goto unlock; + if (__is_hardlink_expired(ctr_hard_link, _priv, ¤t_time)) { + ctr_hard_link->hardlink_heal_period = current_time.tv_sec; + ret_val = ret_val | CTR_TRY_HARDLINK_HEAL; } - /* Add the hard link to the list*/ - ret = ctr_add_hard_link (this, ctr_xlator_ctx, - CTR_DB_REC(ctr_local).pargfid, - CTR_DB_REC(ctr_local).file_name); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_ADD_HARDLINK_TO_CTR_INODE_CONTEXT_FAILED, - "Failed to add hardlink to the ctr inode context"); - ret_val = CTR_CTX_ERROR; - goto unlock; + if (__is_inode_expired(ctr_xlator_ctx, _priv, ¤t_time)) { + ctr_xlator_ctx->inode_heal_period = current_time.tv_sec; + ret_val = ret_val | CTR_TRY_INODE_HEAL; } - ret_val = CTR_TRY_NO_HEAL; + goto unlock; + } + + /* Add the hard link to the list*/ + ret = ctr_add_hard_link(this, ctr_xlator_ctx, CTR_DB_REC(ctr_local).pargfid, + CTR_DB_REC(ctr_local).file_name); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_ADD_HARDLINK_TO_CTR_INODE_CONTEXT_FAILED, + "Failed to add hardlink to the ctr inode context"); + ret_val = CTR_CTX_ERROR; + goto unlock; + } + + ret_val = CTR_TRY_NO_HEAL; unlock: - UNLOCK (&ctr_xlator_ctx->lock); + UNLOCK(&ctr_xlator_ctx->lock); out: - return ret_val; + return ret_val; } static inline int -delete_hard_link_ctx (call_frame_t *frame, - xlator_t *this, - inode_t *inode) +delete_hard_link_ctx(call_frame_t *frame, xlator_t *this, inode_t *inode) { - int ret = -1; - ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; - gf_ctr_local_t *ctr_local = NULL; - - GF_ASSERT (frame); - GF_ASSERT (this); - GF_ASSERT (inode); - - ctr_local = frame->local; - if (!ctr_local) { - goto out; - } - - ctr_xlator_ctx = get_ctr_xlator_ctx (this, inode); - if (!ctr_xlator_ctx) { - /* Since there is no ctr inode context so nothing more to do */ - ret = 0; - goto out; - } + int ret = -1; + ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; + gf_ctr_local_t *ctr_local = NULL; + + GF_ASSERT(frame); + GF_ASSERT(this); + GF_ASSERT(inode); + + ctr_local = frame->local; + if (!ctr_local) { + goto out; + } + + ctr_xlator_ctx = get_ctr_xlator_ctx(this, inode); + if (!ctr_xlator_ctx) { + /* Since there is no ctr inode context so nothing more to do */ + ret = 0; + goto out; + } - ret = ctr_delete_hard_link (this, ctr_xlator_ctx, - CTR_DB_REC(ctr_local).pargfid, - CTR_DB_REC(ctr_local).file_name); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_DELETE_HARDLINK_FAILED, - "Failed to delete hard link"); - goto out; - } + ret = ctr_delete_hard_link(this, ctr_xlator_ctx, + CTR_DB_REC(ctr_local).pargfid, + CTR_DB_REC(ctr_local).file_name); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, CTR_MSG_DELETE_HARDLINK_FAILED, + "Failed to delete hard link"); + goto out; + } - ret = 0; + ret = 0; out: - return ret; + return ret; } static inline int -update_hard_link_ctx (call_frame_t *frame, - xlator_t *this, - inode_t *inode) +update_hard_link_ctx(call_frame_t *frame, xlator_t *this, inode_t *inode) { - int ret = -1; - ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; - gf_ctr_local_t *ctr_local = NULL; - - GF_ASSERT (frame); - GF_ASSERT (this); - GF_ASSERT (inode); - - ctr_local = frame->local; - if (!ctr_local) { - goto out; - } - - ctr_xlator_ctx = init_ctr_xlator_ctx (this, inode); - if (!ctr_xlator_ctx) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, - "Failed accessing ctr inode context"); - goto out; - } - - ret = ctr_update_hard_link (this, ctr_xlator_ctx, - CTR_DB_REC(ctr_local).pargfid, - CTR_DB_REC(ctr_local).file_name, - CTR_DB_REC(ctr_local).old_pargfid, - CTR_DB_REC(ctr_local).old_file_name); - if (ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CTR_MSG_DELETE_HARDLINK_FAILED, - "Failed to delete hard link"); - goto out; - } - - ret = 0; + int ret = -1; + ctr_xlator_ctx_t *ctr_xlator_ctx = NULL; + gf_ctr_local_t *ctr_local = NULL; + + GF_ASSERT(frame); + GF_ASSERT(this); + GF_ASSERT(inode); + + ctr_local = frame->local; + if (!ctr_local) { + goto out; + } + + ctr_xlator_ctx = init_ctr_xlator_ctx(this, inode); + if (!ctr_xlator_ctx) { + gf_msg(this->name, GF_LOG_ERROR, 0, + CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, + "Failed accessing ctr inode context"); + goto out; + } + + ret = ctr_update_hard_link( + this, ctr_xlator_ctx, CTR_DB_REC(ctr_local).pargfid, + CTR_DB_REC(ctr_local).file_name, CTR_DB_REC(ctr_local).old_pargfid, + CTR_DB_REC(ctr_local).old_file_name); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, CTR_MSG_DELETE_HARDLINK_FAILED, + "Failed to delete hard link"); + goto out; + } + + ret = 0; out: - return ret; + return ret; } - /****************************************************************************** * * CTR xlator init related functions @@ -918,12 +846,9 @@ out: * * ****************************************************************************/ int -extract_db_params (xlator_t *this, - dict_t *params_dict, - gfdb_db_type_t db_type); +extract_db_params(xlator_t *this, dict_t *params_dict, gfdb_db_type_t db_type); int -extract_ctr_options (xlator_t *this, - gf_ctr_private_t *_priv); +extract_ctr_options(xlator_t *this, gf_ctr_private_t *_priv); #endif diff --git a/xlators/features/changetimerecorder/src/ctr-messages.h b/xlators/features/changetimerecorder/src/ctr-messages.h index bc9a9e0f3ab..105d2265430 100644 --- a/xlators/features/changetimerecorder/src/ctr-messages.h +++ b/xlators/features/changetimerecorder/src/ctr-messages.h @@ -23,64 +23,39 @@ * glfs-message-id.h. */ -GLFS_MSGID(CTR, - CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, - CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, - CTR_MSG_FILL_CTR_LOCAL_ERROR_WIND, - CTR_MSG_INSERT_LINK_WIND_FAILED, - CTR_MSG_INSERT_WRITEV_WIND_FAILED, - CTR_MSG_INSERT_WRITEV_UNWIND_FAILED, - CTR_MSG_INSERT_SETATTR_WIND_FAILED, - CTR_MSG_INSERT_SETATTR_UNWIND_FAILED, - CTR_MSG_INSERT_FREMOVEXATTR_UNWIND_FAILED, - CTR_MSG_INSERT_FREMOVEXATTR_WIND_FAILED, - CTR_MSG_INSERT_REMOVEXATTR_WIND_FAILED, - CTR_MSG_INSERT_REMOVEXATTR_UNWIND_FAILED, - CTR_MSG_INSERT_TRUNCATE_WIND_FAILED, - CTR_MSG_INSERT_TRUNCATE_UNWIND_FAILED, - CTR_MSG_INSERT_FTRUNCATE_UNWIND_FAILED, - CTR_MSG_INSERT_FTRUNCATE_WIND_FAILED, - CTR_MSG_INSERT_RENAME_WIND_FAILED, - CTR_MSG_INSERT_RENAME_UNWIND_FAILED, - CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, - CTR_MSG_ADD_HARDLINK_FAILED, - CTR_MSG_DELETE_HARDLINK_FAILED, - CTR_MSG_UPDATE_HARDLINK_FAILED, - CTR_MSG_GET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, - CTR_MSG_SET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, - CTR_MSG_INSERT_UNLINK_UNWIND_FAILED, - CTR_MSG_INSERT_UNLINK_WIND_FAILED, - CTR_MSG_XDATA_NULL, - CTR_MSG_INSERT_FSYNC_WIND_FAILED, - CTR_MSG_INSERT_FSYNC_UNWIND_FAILED, - CTR_MSG_INSERT_MKNOD_UNWIND_FAILED, - CTR_MSG_INSERT_MKNOD_WIND_FAILED, - CTR_MSG_INSERT_CREATE_WIND_FAILED, - CTR_MSG_INSERT_CREATE_UNWIND_FAILED, - CTR_MSG_INSERT_RECORD_WIND_FAILED, - CTR_MSG_INSERT_READV_WIND_FAILED, - CTR_MSG_GET_GFID_FROM_DICT_FAILED, - CTR_MSG_SET, - CTR_MSG_FATAL_ERROR, - CTR_MSG_DANGLING_VOLUME, - CTR_MSG_CALLOC_FAILED, - CTR_MSG_EXTRACT_CTR_XLATOR_OPTIONS_FAILED, - CTR_MSG_INIT_DB_PARAMS_FAILED, - CTR_MSG_CREATE_LOCAL_MEMORY_POOL_FAILED, - CTR_MSG_MEM_ACC_INIT_FAILED, - CTR_MSG_CLOSE_DB_CONN_FAILED, - CTR_MSG_FILL_UNWIND_TIME_REC_ERROR, - CTR_MSG_WRONG_FOP_PATH, - CTR_MSG_CONSTRUCT_DB_PATH_FAILED, - CTR_MSG_SET_VALUE_TO_SQL_PARAM_FAILED, - CTR_MSG_XLATOR_DISABLED, - CTR_MSG_HARDLINK_MISSING_IN_LIST, - CTR_MSG_ADD_HARDLINK_TO_LIST_FAILED, - CTR_MSG_INIT_LOCK_FAILED, - CTR_MSG_COPY_FAILED, - CTR_MSG_EXTRACT_DB_PARAM_OPTIONS_FAILED, - CTR_MSG_ADD_HARDLINK_TO_CTR_INODE_CONTEXT_FAILED, - CTR_MSG_NULL_LOCAL -); +GLFS_MSGID( + CTR, CTR_MSG_CREATE_CTR_LOCAL_ERROR_WIND, + CTR_MSG_FILL_CTR_LOCAL_ERROR_UNWIND, CTR_MSG_FILL_CTR_LOCAL_ERROR_WIND, + CTR_MSG_INSERT_LINK_WIND_FAILED, CTR_MSG_INSERT_WRITEV_WIND_FAILED, + CTR_MSG_INSERT_WRITEV_UNWIND_FAILED, CTR_MSG_INSERT_SETATTR_WIND_FAILED, + CTR_MSG_INSERT_SETATTR_UNWIND_FAILED, + CTR_MSG_INSERT_FREMOVEXATTR_UNWIND_FAILED, + CTR_MSG_INSERT_FREMOVEXATTR_WIND_FAILED, + CTR_MSG_INSERT_REMOVEXATTR_WIND_FAILED, + CTR_MSG_INSERT_REMOVEXATTR_UNWIND_FAILED, + CTR_MSG_INSERT_TRUNCATE_WIND_FAILED, CTR_MSG_INSERT_TRUNCATE_UNWIND_FAILED, + CTR_MSG_INSERT_FTRUNCATE_UNWIND_FAILED, + CTR_MSG_INSERT_FTRUNCATE_WIND_FAILED, CTR_MSG_INSERT_RENAME_WIND_FAILED, + CTR_MSG_INSERT_RENAME_UNWIND_FAILED, + CTR_MSG_ACCESS_CTR_INODE_CONTEXT_FAILED, CTR_MSG_ADD_HARDLINK_FAILED, + CTR_MSG_DELETE_HARDLINK_FAILED, CTR_MSG_UPDATE_HARDLINK_FAILED, + CTR_MSG_GET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, + CTR_MSG_SET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, + CTR_MSG_INSERT_UNLINK_UNWIND_FAILED, CTR_MSG_INSERT_UNLINK_WIND_FAILED, + CTR_MSG_XDATA_NULL, CTR_MSG_INSERT_FSYNC_WIND_FAILED, + CTR_MSG_INSERT_FSYNC_UNWIND_FAILED, CTR_MSG_INSERT_MKNOD_UNWIND_FAILED, + CTR_MSG_INSERT_MKNOD_WIND_FAILED, CTR_MSG_INSERT_CREATE_WIND_FAILED, + CTR_MSG_INSERT_CREATE_UNWIND_FAILED, CTR_MSG_INSERT_RECORD_WIND_FAILED, + CTR_MSG_INSERT_READV_WIND_FAILED, CTR_MSG_GET_GFID_FROM_DICT_FAILED, + CTR_MSG_SET, CTR_MSG_FATAL_ERROR, CTR_MSG_DANGLING_VOLUME, + CTR_MSG_CALLOC_FAILED, CTR_MSG_EXTRACT_CTR_XLATOR_OPTIONS_FAILED, + CTR_MSG_INIT_DB_PARAMS_FAILED, CTR_MSG_CREATE_LOCAL_MEMORY_POOL_FAILED, + CTR_MSG_MEM_ACC_INIT_FAILED, CTR_MSG_CLOSE_DB_CONN_FAILED, + CTR_MSG_FILL_UNWIND_TIME_REC_ERROR, CTR_MSG_WRONG_FOP_PATH, + CTR_MSG_CONSTRUCT_DB_PATH_FAILED, CTR_MSG_SET_VALUE_TO_SQL_PARAM_FAILED, + CTR_MSG_XLATOR_DISABLED, CTR_MSG_HARDLINK_MISSING_IN_LIST, + CTR_MSG_ADD_HARDLINK_TO_LIST_FAILED, CTR_MSG_INIT_LOCK_FAILED, + CTR_MSG_COPY_FAILED, CTR_MSG_EXTRACT_DB_PARAM_OPTIONS_FAILED, + CTR_MSG_ADD_HARDLINK_TO_CTR_INODE_CONTEXT_FAILED, CTR_MSG_NULL_LOCAL); #endif /* !_CTR_MESSAGES_H_ */ diff --git a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.h b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.h index 7f1c6cb1712..584d3b79ba4 100644 --- a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.h +++ b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.h @@ -23,68 +23,46 @@ #include <sys/time.h> typedef struct ctr_hard_link { - uuid_t pgfid; - char *base_name; - /* Hardlink expiry : Defines the expiry period after which a - * database heal is attempted. */ - uint64_t hardlink_heal_period; - struct list_head list; + uuid_t pgfid; + char *base_name; + /* Hardlink expiry : Defines the expiry period after which a + * database heal is attempted. */ + uint64_t hardlink_heal_period; + struct list_head list; } ctr_hard_link_t; typedef struct ctr_xlator_ctx { - /* This represents the looked up hardlinks - * NOTE: This doesn't represent all physical hardlinks of the inode*/ - struct list_head hardlink_list; - uint64_t inode_heal_period; - gf_lock_t lock; + /* This represents the looked up hardlinks + * NOTE: This doesn't represent all physical hardlinks of the inode*/ + struct list_head hardlink_list; + uint64_t inode_heal_period; + gf_lock_t lock; } ctr_xlator_ctx_t; - ctr_hard_link_t * -ctr_search_hard_link_ctx (xlator_t *this, - ctr_xlator_ctx_t *ctr_xlator_ctx, - uuid_t pgfid, - const char *base_name); - +ctr_search_hard_link_ctx(xlator_t *this, ctr_xlator_ctx_t *ctr_xlator_ctx, + uuid_t pgfid, const char *base_name); int -ctr_add_hard_link (xlator_t *this, - ctr_xlator_ctx_t *ctr_xlator_ctx, - uuid_t pgfid, - const char *base_name); - - +ctr_add_hard_link(xlator_t *this, ctr_xlator_ctx_t *ctr_xlator_ctx, + uuid_t pgfid, const char *base_name); int -ctr_delete_hard_link (xlator_t *this, - ctr_xlator_ctx_t *ctr_xlator_ctx, - uuid_t pgfid, - const char *base_name); - +ctr_delete_hard_link(xlator_t *this, ctr_xlator_ctx_t *ctr_xlator_ctx, + uuid_t pgfid, const char *base_name); int -ctr_update_hard_link (xlator_t *this, - ctr_xlator_ctx_t *ctr_xlator_ctx, - uuid_t pgfid, - const char *base_name, - uuid_t old_pgfid, - const char *old_base_name); - +ctr_update_hard_link(xlator_t *this, ctr_xlator_ctx_t *ctr_xlator_ctx, + uuid_t pgfid, const char *base_name, uuid_t old_pgfid, + const char *old_base_name); ctr_xlator_ctx_t * -get_ctr_xlator_ctx (xlator_t *this, - inode_t *inode); - - - +get_ctr_xlator_ctx(xlator_t *this, inode_t *inode); ctr_xlator_ctx_t * -init_ctr_xlator_ctx (xlator_t *this, - inode_t *inode); - +init_ctr_xlator_ctx(xlator_t *this, inode_t *inode); void -fini_ctr_xlator_ctx (xlator_t *this, - inode_t *inode); +fini_ctr_xlator_ctx(xlator_t *this, inode_t *inode); #endif diff --git a/xlators/features/changetimerecorder/src/ctr_mem_types.h b/xlators/features/changetimerecorder/src/ctr_mem_types.h index f408c028e24..7b8f531ddec 100644 --- a/xlators/features/changetimerecorder/src/ctr_mem_types.h +++ b/xlators/features/changetimerecorder/src/ctr_mem_types.h @@ -8,17 +8,15 @@ cases as published by the Free Software Foundation. */ - #ifndef __CTR_MEM_TYPES_H__ #define __CTR_MEM_TYPES_H__ #include "gfdb_mem-types.h" enum gf_ctr_mem_types_ { - gf_ctr_mt_private_t = gfdb_mt_end + 1, - gf_ctr_mt_xlator_ctx, - gf_ctr_mt_hard_link_t, - gf_ctr_mt_end + gf_ctr_mt_private_t = gfdb_mt_end + 1, + gf_ctr_mt_xlator_ctx, + gf_ctr_mt_hard_link_t, + gf_ctr_mt_end }; #endif - diff --git a/xlators/features/cloudsync/src/cloudsync-common.h b/xlators/features/cloudsync/src/cloudsync-common.h index 3298ab0a6f2..0be6a446456 100644 --- a/xlators/features/cloudsync/src/cloudsync-common.h +++ b/xlators/features/cloudsync/src/cloudsync-common.h @@ -18,80 +18,82 @@ #include "cloudsync-messages.h" typedef struct cs_local { - loc_t loc; - fd_t *fd; - call_stub_t *stub; - call_frame_t *main_frame; - int op_errno; - int op_ret; - fd_t *dlfd; - off_t dloffset; - struct iatt stbuf; - dict_t *xattr_rsp; - dict_t *xattr_req; - glusterfs_fop_t fop; - gf_boolean_t locked; - int call_cnt; - inode_t *inode; - char *remotepath; + loc_t loc; + fd_t *fd; + call_stub_t *stub; + call_frame_t *main_frame; + int op_errno; + int op_ret; + fd_t *dlfd; + off_t dloffset; + struct iatt stbuf; + dict_t *xattr_rsp; + dict_t *xattr_req; + glusterfs_fop_t fop; + gf_boolean_t locked; + int call_cnt; + inode_t *inode; + char *remotepath; } cs_local_t; -typedef int (*fop_download_t) (call_frame_t *frame, void *config); +typedef int (*fop_download_t)(call_frame_t *frame, void *config); -typedef void *(*store_init) (xlator_t *this); +typedef void *(*store_init)(xlator_t *this); -typedef int (*store_reconfigure) (xlator_t *this, dict_t *options); +typedef int (*store_reconfigure)(xlator_t *this, dict_t *options); -typedef void (*store_fini) (void *config); +typedef void (*store_fini)(void *config); struct cs_remote_stores { - char *name; /* store name */ - void *config; /* store related information */ - fop_download_t dlfop; /* store specific download function */ - store_init init; /* store init to initialize store config */ - store_reconfigure reconfigure; /* reconfigure store config */ - store_fini fini; - void *handle; /* shared library handle*/ + char *name; /* store name */ + void *config; /* store related information */ + fop_download_t dlfop; /* store specific download function */ + store_init init; /* store init to initialize store config */ + store_reconfigure reconfigure; /* reconfigure store config */ + store_fini fini; + void *handle; /* shared library handle*/ }; typedef struct cs_private { - xlator_t *this; - struct cs_remote_stores *stores; - gf_boolean_t abortdl; - pthread_spinlock_t lock; + xlator_t *this; + struct cs_remote_stores *stores; + gf_boolean_t abortdl; + pthread_spinlock_t lock; } cs_private_t; void -cs_local_wipe (xlator_t *this, cs_local_t *local); +cs_local_wipe(xlator_t *this, cs_local_t *local); -#define CS_STACK_UNWIND(fop, frame, params ...) do { \ - cs_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - if (frame) { \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - cs_local_wipe (__xl, __local); \ -} while (0) +#define CS_STACK_UNWIND(fop, frame, params...) \ + do { \ + cs_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + if (frame) { \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + cs_local_wipe(__xl, __local); \ + } while (0) -#define CS_STACK_DESTROY(frame) do { \ - cs_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - cs_local_wipe (__xl, __local); \ -} while (0) +#define CS_STACK_DESTROY(frame) \ + do { \ + cs_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + cs_local_wipe(__xl, __local); \ + } while (0) typedef struct store_methods { - int (*fop_download) (call_frame_t *frame, void *config); - /* return type should be the store config */ - void *(*fop_init) (xlator_t *this); - int (*fop_reconfigure) (xlator_t *this, dict_t *options); - void (*fop_fini) (void *config); + int (*fop_download)(call_frame_t *frame, void *config); + /* return type should be the store config */ + void *(*fop_init)(xlator_t *this); + int (*fop_reconfigure)(xlator_t *this, dict_t *options); + void (*fop_fini)(void *config); } store_methods_t; #endif /* _CLOUDSYNC_COMMON_H */ diff --git a/xlators/features/cloudsync/src/cloudsync-mem-types.h b/xlators/features/cloudsync/src/cloudsync-mem-types.h index 6ebcb16552b..46d4f3aa2a1 100644 --- a/xlators/features/cloudsync/src/cloudsync-mem-types.h +++ b/xlators/features/cloudsync/src/cloudsync-mem-types.h @@ -8,16 +8,14 @@ * cases as published by the Free Software Foundation. */ - #ifndef __CLOUDSYNC_MEM_TYPES_H__ #define __CLOUDSYNC_MEM_TYPES_H__ #include "mem-types.h" enum cs_mem_types_ { - gf_cs_mt_cs_private_t = gf_common_mt_end + 1, - gf_cs_mt_cs_remote_stores_t, - gf_cs_mt_cs_inode_ctx_t, - gf_cs_mt_end + gf_cs_mt_cs_private_t = gf_common_mt_end + 1, + gf_cs_mt_cs_remote_stores_t, + gf_cs_mt_cs_inode_ctx_t, + gf_cs_mt_end }; #endif /* __CLOUDSYNC_MEM_TYPES_H__ */ - diff --git a/xlators/features/cloudsync/src/cloudsync-messages.h b/xlators/features/cloudsync/src/cloudsync-messages.h index ad4b7d2e0b8..fb08f72de7f 100644 --- a/xlators/features/cloudsync/src/cloudsync-messages.h +++ b/xlators/features/cloudsync/src/cloudsync-messages.h @@ -8,12 +8,9 @@ * cases as published by the Free Software Foundation. */ - #ifndef __CLOUDSYNC_MESSAGES_H__ #define __CLOUDSYNC_MESSAGES_H__ /*TODO: define relevant message ids */ - #endif /* __CLOUDSYNC_MESSAGES_H__ */ - diff --git a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3-mem-types.h b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3-mem-types.h index dd9314ec8d8..0aaab1fe955 100644 --- a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3-mem-types.h +++ b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3-mem-types.h @@ -8,14 +8,12 @@ * cases as published by the Free Software Foundation. */ - #ifndef __LIBAWS_MEM_TYPES_H__ #define __LIBAWS_MEM_TYPES_H__ #include "mem-types.h" enum libaws_mem_types_ { - gf_libaws_mt_aws_private_t = gf_common_mt_end + 1, - gf_libaws_mt_end + gf_libaws_mt_aws_private_t = gf_common_mt_end + 1, + gf_libaws_mt_end }; #endif /* __CLOUDSYNC_MEM_TYPES_H__ */ - diff --git a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.h b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.h index c233e1c96f7..b1a95f8cbf9 100644 --- a/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.h +++ b/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.h @@ -18,34 +18,33 @@ #include "cloudsync-common.h" #include "libcloudsyncs3-mem-types.h" - -char* +char * aws_b64_encode(const unsigned char *input, int length); size_t aws_write_callback(void *dlbuf, size_t size, size_t nitems, void *mainframe); int -aws_download_s3 (call_frame_t *frame, void *config); +aws_download_s3(call_frame_t *frame, void *config); int -aws_dlwritev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +aws_dlwritev_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct iatt *prebuf, struct iatt *postbuf, + dict_t *xdata); void * -aws_init (xlator_t *this); +aws_init(xlator_t *this); int -aws_reconfigure (xlator_t *this, dict_t *options); +aws_reconfigure(xlator_t *this, dict_t *options); char * -aws_form_request (char *resource, char **date, char *reqtype, char *bucketid, - char *filepath); +aws_form_request(char *resource, char **date, char *reqtype, char *bucketid, + char *filepath); char * aws_sign_request(char *const str, char *awssekey); void -aws_fini (void *config); +aws_fini(void *config); #endif diff --git a/xlators/features/cloudsync/src/cloudsync.h b/xlators/features/cloudsync/src/cloudsync.h index 18840a6523d..7c70c744d2b 100644 --- a/xlators/features/cloudsync/src/cloudsync.h +++ b/xlators/features/cloudsync/src/cloudsync.h @@ -8,7 +8,6 @@ * cases as published by the Free Software Foundation. */ - #ifndef __CLOUDSYNC_H__ #define __CLOUDSYNC_H__ @@ -20,87 +19,85 @@ #include "cloudsync-common.h" #include "cloudsync-autogen-fops.h" - #define CS_LOCK_DOMAIN "cs.protect.file.stat" typedef struct cs_dlstore { - off_t off; - struct iovec *vector; - int32_t count; - struct iobref *iobref; - uint32_t flags; + off_t off; + struct iovec *vector; + int32_t count; + struct iobref *iobref; + uint32_t flags; } cs_dlstore; typedef struct cs_inode_ctx { - gf_cs_obj_state state; + gf_cs_obj_state state; } cs_inode_ctx_t; struct cs_plugin { - char *name; /* store name */ - char *library; /* library to load for the given store */ - char *description; /* description about the store */ + char *name; /* store name */ + char *library; /* library to load for the given store */ + char *description; /* description about the store */ }; cs_local_t * -cs_local_init (xlator_t *this, call_frame_t *frame, loc_t *loc, fd_t *fd, - glusterfs_fop_t fop); +cs_local_init(xlator_t *this, call_frame_t *frame, loc_t *loc, fd_t *fd, + glusterfs_fop_t fop); int -locate_and_execute (call_frame_t *frame); - +locate_and_execute(call_frame_t *frame); int32_t -cs_resume_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *dict, int32_t flags, dict_t *xdata); +cs_resume_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata); int32_t -cs_inodelk_unlock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, dict_t *xdata); +cs_inodelk_unlock_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata); size_t -cs_write_callback (void *lcurlbuf, size_t size, size_t nitems, void *frame); +cs_write_callback(void *lcurlbuf, size_t size, size_t nitems, void *frame); void -cs_common_cbk (call_frame_t *frame); +cs_common_cbk(call_frame_t *frame); gf_boolean_t -cs_is_file_remote (struct iatt *stbuf, dict_t *xattr); +cs_is_file_remote(struct iatt *stbuf, dict_t *xattr); int32_t -cs_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata); +cs_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata); int -cs_build_loc (loc_t *loc, call_frame_t *frame); +cs_build_loc(loc_t *loc, call_frame_t *frame); int -cs_blocking_inodelk_cbk (call_frame_t *lock_frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata); +cs_blocking_inodelk_cbk(call_frame_t *lock_frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *xdata); -int cs_read_authinfo(xlator_t *this); +int +cs_read_authinfo(xlator_t *this); int -__cs_inode_ctx_update (xlator_t *this, inode_t *inode, uint64_t val); +__cs_inode_ctx_update(xlator_t *this, inode_t *inode, uint64_t val); int -cs_inode_ctx_reset (xlator_t *this, inode_t *inode); +cs_inode_ctx_reset(xlator_t *this, inode_t *inode); void -__cs_inode_ctx_get (xlator_t *this, inode_t *inode, cs_inode_ctx_t **ctx); +__cs_inode_ctx_get(xlator_t *this, inode_t *inode, cs_inode_ctx_t **ctx); gf_cs_obj_state -__cs_get_file_state (xlator_t *this, inode_t *inode, cs_inode_ctx_t *ctx); +__cs_get_file_state(xlator_t *this, inode_t *inode, cs_inode_ctx_t *ctx); int -cs_inodelk_unlock (call_frame_t *main_frame); +cs_inodelk_unlock(call_frame_t *main_frame); int -cs_resume_postprocess (xlator_t *this, call_frame_t *frame, inode_t *inode); +cs_resume_postprocess(xlator_t *this, call_frame_t *frame, inode_t *inode); int32_t -cs_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata); +cs_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata); int32_t -cs_resume_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, - off_t offset, dict_t *xattr_req); +cs_resume_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, + off_t offset, dict_t *xattr_req); #endif /* __CLOUDSYNC_H__ */ - diff --git a/xlators/features/compress/src/cdc-mem-types.h b/xlators/features/compress/src/cdc-mem-types.h index ead2c70ba6e..56a5a05ee8c 100644 --- a/xlators/features/compress/src/cdc-mem-types.h +++ b/xlators/features/compress/src/cdc-mem-types.h @@ -14,10 +14,10 @@ #include "mem-types.h" enum gf_cdc_mem_types { - gf_cdc_mt_priv_t = gf_common_mt_end + 1, - gf_cdc_mt_vec_t = gf_common_mt_end + 2, - gf_cdc_mt_gzip_trailer_t = gf_common_mt_end + 3, - gf_cdc_mt_end = gf_common_mt_end + 4, + gf_cdc_mt_priv_t = gf_common_mt_end + 1, + gf_cdc_mt_vec_t = gf_common_mt_end + 2, + gf_cdc_mt_gzip_trailer_t = gf_common_mt_end + 3, + gf_cdc_mt_end = gf_common_mt_end + 4, }; #endif diff --git a/xlators/features/compress/src/cdc.h b/xlators/features/compress/src/cdc.h index 71f4d2317bb..764f2028c75 100644 --- a/xlators/features/compress/src/cdc.h +++ b/xlators/features/compress/src/cdc.h @@ -22,34 +22,34 @@ #endif typedef struct cdc_priv { - int window_size; - int mem_level; - int cdc_level; - int min_file_size; - int op_mode; - gf_boolean_t debug; - gf_lock_t lock; + int window_size; + int mem_level; + int cdc_level; + int min_file_size; + int op_mode; + gf_boolean_t debug; + gf_lock_t lock; } cdc_priv_t; typedef struct cdc_info { - /* input bits */ - int count; - int32_t ibytes; - struct iovec *vector; - struct iatt *buf; - - /* output bits */ - int ncount; - int nbytes; - int buffer_size; - struct iovec vec[MAX_IOVEC]; - struct iobref *iobref; - - /* zlib bits */ + /* input bits */ + int count; + int32_t ibytes; + struct iovec *vector; + struct iatt *buf; + + /* output bits */ + int ncount; + int nbytes; + int buffer_size; + struct iovec vec[MAX_IOVEC]; + struct iobref *iobref; + + /* zlib bits */ #ifdef HAVE_LIB_Z - z_stream stream; + z_stream stream; #endif - unsigned long crc; + unsigned long crc; } cdc_info_t; #define NVEC(ci) (ci->ncount - 1) @@ -57,8 +57,8 @@ typedef struct cdc_info { #define THIS_VEC(ci, i) ci->vector[i] /* Gzip defaults */ -#define GF_CDC_DEF_WINDOWSIZE -15 /* default value */ -#define GF_CDC_MAX_WINDOWSIZE -8 /* max value */ +#define GF_CDC_DEF_WINDOWSIZE -15 /* default value */ +#define GF_CDC_MAX_WINDOWSIZE -8 /* max value */ #ifdef HAVE_LIB_Z #define GF_CDC_DEF_COMPRESSION Z_DEFAULT_COMPRESSION @@ -66,15 +66,15 @@ typedef struct cdc_info { #define GF_CDC_DEF_COMPRESSION -1 #endif -#define GF_CDC_DEF_MEMLEVEL 8 -#define GF_CDC_DEF_BUFFERSIZE 262144 // 256K - default compression buffer size +#define GF_CDC_DEF_MEMLEVEL 8 +#define GF_CDC_DEF_BUFFERSIZE 262144 // 256K - default compression buffer size /* Operation mode * If xlator is loaded on client, readv decompresses and writev compresses * If xlator is loaded on server, readv compresses and writev decompresses */ -#define GF_CDC_MODE_CLIENT 0 -#define GF_CDC_MODE_SERVER 1 +#define GF_CDC_MODE_CLIENT 0 +#define GF_CDC_MODE_SERVER 1 /* min size of data to do cmpression * 0 == compress even 1byte @@ -87,21 +87,13 @@ typedef struct cdc_info { #define GF_CDC_DEFLATE_CANARY_VAL "deflate" #define GF_CDC_DEBUG_DUMP_FILE "/tmp/cdcdump.gz" -#define GF_CDC_MODE_IS_CLIENT(m) \ - (strcmp (m, "client") == 0) +#define GF_CDC_MODE_IS_CLIENT(m) (strcmp(m, "client") == 0) -#define GF_CDC_MODE_IS_SERVER(m) \ - (strcmp (m, "server") == 0) +#define GF_CDC_MODE_IS_SERVER(m) (strcmp(m, "server") == 0) int32_t -cdc_compress (xlator_t *this, - cdc_priv_t *priv, - cdc_info_t *ci, - dict_t **xdata); +cdc_compress(xlator_t *this, cdc_priv_t *priv, cdc_info_t *ci, dict_t **xdata); int32_t -cdc_decompress (xlator_t *this, - cdc_priv_t *priv, - cdc_info_t *ci, - dict_t *xdata); +cdc_decompress(xlator_t *this, cdc_priv_t *priv, cdc_info_t *ci, dict_t *xdata); #endif diff --git a/xlators/features/gfid-access/src/gfid-access-mem-types.h b/xlators/features/gfid-access/src/gfid-access-mem-types.h index 168d67b431f..ee7fd794da8 100644 --- a/xlators/features/gfid-access/src/gfid-access-mem-types.h +++ b/xlators/features/gfid-access/src/gfid-access-mem-types.h @@ -14,10 +14,9 @@ #include "mem-types.h" enum gf_changelog_mem_types { - gf_gfid_access_mt_priv_t = gf_common_mt_end + 1, - gf_gfid_access_mt_gfid_t, - gf_gfid_access_mt_end + gf_gfid_access_mt_priv_t = gf_common_mt_end + 1, + gf_gfid_access_mt_gfid_t, + gf_gfid_access_mt_end }; #endif - diff --git a/xlators/features/gfid-access/src/gfid-access.h b/xlators/features/gfid-access/src/gfid-access.h index 2b5e4fd4184..68ebe539564 100644 --- a/xlators/features/gfid-access/src/gfid-access.h +++ b/xlators/features/gfid-access/src/gfid-access.h @@ -20,87 +20,87 @@ #define UUID_CANONICAL_FORM_LEN 36 #define GF_FUSE_AUX_GFID_NEWFILE "glusterfs.gfid.newfile" -#define GF_FUSE_AUX_GFID_HEAL "glusterfs.gfid.heal" +#define GF_FUSE_AUX_GFID_HEAL "glusterfs.gfid.heal" #define GF_GFID_KEY "GLUSTERFS_GFID" #define GF_GFID_DIR ".gfid" #define GF_AUX_GFID 0xd -#define GFID_ACCESS_ENTRY_OP_CHECK(loc,err,lbl) do { \ - /* need to check if the lookup is on virtual dir */ \ - if ((loc->name && !strcmp (GF_GFID_DIR, loc->name)) && \ - ((loc->parent && \ - __is_root_gfid (loc->parent->gfid)) || \ - __is_root_gfid (loc->pargfid))) { \ - err = ENOTSUP; \ - goto lbl; \ - } \ - \ - /* now, check if the lookup() is on an existing */ \ - /* entry, but on gfid-path */ \ - if ((loc->parent && \ - __is_gfid_access_dir (loc->parent->gfid)) || \ - __is_gfid_access_dir (loc->pargfid)) { \ - err = EPERM; \ - goto lbl; \ - } \ - } while (0) +#define GFID_ACCESS_ENTRY_OP_CHECK(loc, err, lbl) \ + do { \ + /* need to check if the lookup is on virtual dir */ \ + if ((loc->name && !strcmp(GF_GFID_DIR, loc->name)) && \ + ((loc->parent && __is_root_gfid(loc->parent->gfid)) || \ + __is_root_gfid(loc->pargfid))) { \ + err = ENOTSUP; \ + goto lbl; \ + } \ + \ + /* now, check if the lookup() is on an existing */ \ + /* entry, but on gfid-path */ \ + if ((loc->parent && __is_gfid_access_dir(loc->parent->gfid)) || \ + __is_gfid_access_dir(loc->pargfid)) { \ + err = EPERM; \ + goto lbl; \ + } \ + } while (0) -#define GFID_ACCESS_INODE_OP_CHECK(loc,err,lbl) do { \ - /*Check if it is on .gfid*/ \ - if (__is_gfid_access_dir(loc->gfid)) { \ - err = ENOTSUP; \ - goto lbl; \ - } \ - } while (0) +#define GFID_ACCESS_INODE_OP_CHECK(loc, err, lbl) \ + do { \ + /*Check if it is on .gfid*/ \ + if (__is_gfid_access_dir(loc->gfid)) { \ + err = ENOTSUP; \ + goto lbl; \ + } \ + } while (0) typedef struct { - unsigned int uid; - unsigned int gid; - char gfid[UUID_CANONICAL_FORM_LEN + 1]; - unsigned int st_mode; - char *bname; + unsigned int uid; + unsigned int gid; + char gfid[UUID_CANONICAL_FORM_LEN + 1]; + unsigned int st_mode; + char *bname; - union { - struct _symlink_in { - char *linkpath; - } __attribute__ ((__packed__)) symlink; + union { + struct _symlink_in { + char *linkpath; + } __attribute__((__packed__)) symlink; - struct _mknod_in { - unsigned int mode; - unsigned int rdev; - unsigned int umask; - } __attribute__ ((__packed__)) mknod; + struct _mknod_in { + unsigned int mode; + unsigned int rdev; + unsigned int umask; + } __attribute__((__packed__)) mknod; - struct _mkdir_in { - unsigned int mode; - unsigned int umask; - } __attribute__ ((__packed__)) mkdir; - } __attribute__ ((__packed__)) args; + struct _mkdir_in { + unsigned int mode; + unsigned int umask; + } __attribute__((__packed__)) mkdir; + } __attribute__((__packed__)) args; } __attribute__((__packed__)) ga_newfile_args_t; typedef struct { - char gfid[UUID_CANONICAL_FORM_LEN + 1]; - char *bname; /* a null terminated basename */ + char gfid[UUID_CANONICAL_FORM_LEN + 1]; + char *bname; /* a null terminated basename */ } __attribute__((__packed__)) ga_heal_args_t; struct ga_private { - /* root inode's stbuf */ - struct iatt root_stbuf; - struct iatt gfiddir_stbuf; - struct mem_pool *newfile_args_pool; - struct mem_pool *heal_args_pool; + /* root inode's stbuf */ + struct iatt root_stbuf; + struct iatt gfiddir_stbuf; + struct mem_pool *newfile_args_pool; + struct mem_pool *heal_args_pool; }; typedef struct ga_private ga_private_t; struct __ga_local { - call_frame_t *orig_frame; - unsigned int uid; - unsigned int gid; - loc_t loc; - mode_t mode; - dev_t rdev; - mode_t umask; - dict_t *xdata; + call_frame_t *orig_frame; + unsigned int uid; + unsigned int gid; + loc_t loc; + mode_t mode; + dev_t rdev; + mode_t umask; + dict_t *xdata; }; typedef struct __ga_local ga_local_t; diff --git a/xlators/features/glupy/src/glupy.h b/xlators/features/glupy/src/glupy.h index 1488c55c331..851b02154d2 100644 --- a/xlators/features/glupy/src/glupy.h +++ b/xlators/features/glupy/src/glupy.h @@ -14,43 +14,43 @@ #include "mem-types.h" enum { - GLUPY_LOOKUP = 0, - GLUPY_CREATE, - GLUPY_OPEN, - GLUPY_READV, - GLUPY_WRITEV, - GLUPY_OPENDIR, - GLUPY_READDIR, - GLUPY_READDIRP, - GLUPY_STAT, - GLUPY_FSTAT, - GLUPY_STATFS, - GLUPY_SETXATTR, - GLUPY_GETXATTR, - GLUPY_FSETXATTR, - GLUPY_FGETXATTR, - GLUPY_REMOVEXATTR, - GLUPY_FREMOVEXATTR, - GLUPY_LINK, - GLUPY_UNLINK, - GLUPY_READLINK, - GLUPY_SYMLINK, - GLUPY_MKNOD, - GLUPY_MKDIR, - GLUPY_RMDIR, - GLUPY_N_FUNCS + GLUPY_LOOKUP = 0, + GLUPY_CREATE, + GLUPY_OPEN, + GLUPY_READV, + GLUPY_WRITEV, + GLUPY_OPENDIR, + GLUPY_READDIR, + GLUPY_READDIRP, + GLUPY_STAT, + GLUPY_FSTAT, + GLUPY_STATFS, + GLUPY_SETXATTR, + GLUPY_GETXATTR, + GLUPY_FSETXATTR, + GLUPY_FGETXATTR, + GLUPY_REMOVEXATTR, + GLUPY_FREMOVEXATTR, + GLUPY_LINK, + GLUPY_UNLINK, + GLUPY_READLINK, + GLUPY_SYMLINK, + GLUPY_MKNOD, + GLUPY_MKDIR, + GLUPY_RMDIR, + GLUPY_N_FUNCS }; typedef struct { - PyObject *py_module; - PyObject *py_xlator; - long fops[GLUPY_N_FUNCS]; - long cbks[GLUPY_N_FUNCS]; + PyObject *py_module; + PyObject *py_xlator; + long fops[GLUPY_N_FUNCS]; + long cbks[GLUPY_N_FUNCS]; } glupy_private_t; enum gf_glupy_mem_types_ { - gf_glupy_mt_priv = gf_common_mt_end + 1, - gf_glupy_mt_end + gf_glupy_mt_priv = gf_common_mt_end + 1, + gf_glupy_mt_end }; #endif /* __GLUPY_H__ */ diff --git a/xlators/features/index/src/index-mem-types.h b/xlators/features/index/src/index-mem-types.h index ca291cfba7e..f5d456e84be 100644 --- a/xlators/features/index/src/index-mem-types.h +++ b/xlators/features/index/src/index-mem-types.h @@ -14,10 +14,10 @@ #include "mem-types.h" enum gf_index_mem_types_ { - gf_index_mt_priv_t = gf_common_mt_end + 1, - gf_index_inode_ctx_t = gf_common_mt_end + 2, - gf_index_fd_ctx_t = gf_common_mt_end + 3, - gf_index_mt_local_t = gf_common_mt_end + 4, - gf_index_mt_end + gf_index_mt_priv_t = gf_common_mt_end + 1, + gf_index_inode_ctx_t = gf_common_mt_end + 2, + gf_index_fd_ctx_t = gf_common_mt_end + 3, + gf_index_mt_local_t = gf_common_mt_end + 4, + gf_index_mt_end }; #endif diff --git a/xlators/features/index/src/index-messages.h b/xlators/features/index/src/index-messages.h index 7ab2bb0ad4b..3495fb080f0 100644 --- a/xlators/features/index/src/index-messages.h +++ b/xlators/features/index/src/index-messages.h @@ -23,17 +23,11 @@ * glfs-message-id.h. */ -GLFS_MSGID(INDEX, - INDEX_MSG_INDEX_DIR_CREATE_FAILED, - INDEX_MSG_INDEX_READDIR_FAILED, - INDEX_MSG_INDEX_ADD_FAILED, - INDEX_MSG_INDEX_DEL_FAILED, - INDEX_MSG_DICT_SET_FAILED, - INDEX_MSG_INODE_CTX_GET_SET_FAILED, - INDEX_MSG_INVALID_ARGS, - INDEX_MSG_FD_OP_FAILED, - INDEX_MSG_WORKER_THREAD_CREATE_FAILED, - INDEX_MSG_INVALID_GRAPH -); +GLFS_MSGID(INDEX, INDEX_MSG_INDEX_DIR_CREATE_FAILED, + INDEX_MSG_INDEX_READDIR_FAILED, INDEX_MSG_INDEX_ADD_FAILED, + INDEX_MSG_INDEX_DEL_FAILED, INDEX_MSG_DICT_SET_FAILED, + INDEX_MSG_INODE_CTX_GET_SET_FAILED, INDEX_MSG_INVALID_ARGS, + INDEX_MSG_FD_OP_FAILED, INDEX_MSG_WORKER_THREAD_CREATE_FAILED, + INDEX_MSG_INVALID_GRAPH); #endif /* !_INDEX_MESSAGES_H_ */ diff --git a/xlators/features/index/src/index.h b/xlators/features/index/src/index.h index ae9091d69c9..f1e0293b794 100644 --- a/xlators/features/index/src/index.h +++ b/xlators/features/index/src/index.h @@ -18,71 +18,67 @@ #include "common-utils.h" #include "index-mem-types.h" -#define INDEX_THREAD_STACK_SIZE ((size_t)(1024*1024)) +#define INDEX_THREAD_STACK_SIZE ((size_t)(1024 * 1024)) -typedef enum { - UNKNOWN, - IN, - NOTIN -} index_state_t; +typedef enum { UNKNOWN, IN, NOTIN } index_state_t; typedef enum { - XATTROP_TYPE_UNSET = -1, - XATTROP, - DIRTY, - ENTRY_CHANGES, - XATTROP_TYPE_END + XATTROP_TYPE_UNSET = -1, + XATTROP, + DIRTY, + ENTRY_CHANGES, + XATTROP_TYPE_END } index_xattrop_type_t; typedef struct index_inode_ctx { - gf_boolean_t processing; - struct list_head callstubs; - int state[XATTROP_TYPE_END]; - uuid_t virtual_pargfid; /* virtual gfid of dir under - .glusterfs/indices/entry-changes. */ + gf_boolean_t processing; + struct list_head callstubs; + int state[XATTROP_TYPE_END]; + uuid_t virtual_pargfid; /* virtual gfid of dir under + .glusterfs/indices/entry-changes. */ } index_inode_ctx_t; typedef struct index_fd_ctx { - DIR *dir; - off_t dir_eof; + DIR *dir; + off_t dir_eof; } index_fd_ctx_t; typedef struct index_priv { - char *index_basepath; - char *dirty_basepath; - uuid_t index; - gf_lock_t lock; - uuid_t internal_vgfid[XATTROP_TYPE_END]; - struct list_head callstubs; - pthread_mutex_t mutex; - pthread_cond_t cond; - dict_t *dirty_watchlist; - dict_t *pending_watchlist; - dict_t *complete_watchlist; - int64_t pending_count; - pthread_t thread; - gf_boolean_t down; + char *index_basepath; + char *dirty_basepath; + uuid_t index; + gf_lock_t lock; + uuid_t internal_vgfid[XATTROP_TYPE_END]; + struct list_head callstubs; + pthread_mutex_t mutex; + pthread_cond_t cond; + dict_t *dirty_watchlist; + dict_t *pending_watchlist; + dict_t *complete_watchlist; + int64_t pending_count; + pthread_t thread; + gf_boolean_t down; } index_priv_t; typedef struct index_local { - inode_t *inode; - dict_t *xdata; + inode_t *inode; + dict_t *xdata; } index_local_t; -#define INDEX_STACK_UNWIND(fop, frame, params ...) \ -do { \ - index_local_t *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - inode_unref (__local->inode); \ - if (__local->xdata) \ - dict_unref (__local->xdata); \ - mem_put (__local); \ - } \ -} while (0) +#define INDEX_STACK_UNWIND(fop, frame, params...) \ + do { \ + index_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + inode_unref(__local->inode); \ + if (__local->xdata) \ + dict_unref(__local->xdata); \ + mem_put(__local); \ + } \ + } while (0) #endif diff --git a/xlators/features/leases/src/leases-mem-types.h b/xlators/features/leases/src/leases-mem-types.h index d1a59c1db2e..59d3cbaf0b3 100644 --- a/xlators/features/leases/src/leases-mem-types.h +++ b/xlators/features/leases/src/leases-mem-types.h @@ -14,15 +14,15 @@ #include "mem-types.h" enum gf_leases_mem_types_ { - gf_leases_mt_conf_t = gf_common_mt_end + 1, - gf_leases_mt_private_t, - gf_leases_mt_lease_client_t, - gf_leases_mt_lease_inode_t, - gf_leases_mt_fd_ctx_t, - gf_leases_mt_lease_inode_ctx_t, - gf_leases_mt_lease_id_entry_t, - gf_leases_mt_fop_stub_t, - gf_leases_mt_timer_data_t, - gf_leases_mt_end + gf_leases_mt_conf_t = gf_common_mt_end + 1, + gf_leases_mt_private_t, + gf_leases_mt_lease_client_t, + gf_leases_mt_lease_inode_t, + gf_leases_mt_fd_ctx_t, + gf_leases_mt_lease_inode_ctx_t, + gf_leases_mt_lease_id_entry_t, + gf_leases_mt_fop_stub_t, + gf_leases_mt_timer_data_t, + gf_leases_mt_end }; #endif diff --git a/xlators/features/leases/src/leases-messages.h b/xlators/features/leases/src/leases-messages.h index f4dc169b8d6..81a517f63cd 100644 --- a/xlators/features/leases/src/leases-messages.h +++ b/xlators/features/leases/src/leases-messages.h @@ -23,18 +23,11 @@ * glfs-message-id.h. */ -GLFS_MSGID(LEASES, - LEASE_MSG_NO_MEM, - LEASE_MSG_RECALL_FAIL, - LEASE_MSG_INVAL_LEASE_ID, - LEASE_MSG_INVAL_UNLK_LEASE, - LEASE_MSG_INVAL_INODE_CTX, - LEASE_MSG_NOT_ENABLED, - LEASE_MSG_NO_TIMER_WHEEL, - LEASE_MSG_CLNT_NOTFOUND, - LEASE_MSG_INODE_NOTFOUND, - LEASE_MSG_INVAL_FD_CTX, - LEASE_MSG_INVAL_LEASE_TYPE -); +GLFS_MSGID(LEASES, LEASE_MSG_NO_MEM, LEASE_MSG_RECALL_FAIL, + LEASE_MSG_INVAL_LEASE_ID, LEASE_MSG_INVAL_UNLK_LEASE, + LEASE_MSG_INVAL_INODE_CTX, LEASE_MSG_NOT_ENABLED, + LEASE_MSG_NO_TIMER_WHEEL, LEASE_MSG_CLNT_NOTFOUND, + LEASE_MSG_INODE_NOTFOUND, LEASE_MSG_INVAL_FD_CTX, + LEASE_MSG_INVAL_LEASE_TYPE); #endif /* !_LEASES_MESSAGES_H_ */ diff --git a/xlators/features/leases/src/leases.h b/xlators/features/leases/src/leases.h index 80dbcbb06b9..d5fc451289d 100644 --- a/xlators/features/leases/src/leases.h +++ b/xlators/features/leases/src/leases.h @@ -39,24 +39,27 @@ #define BLOCK_FOP 0x0001 #define WIND_FOP 0x0002 -#define EXIT_IF_LEASES_OFF(this, label) do { \ +#define EXIT_IF_LEASES_OFF(this, label) \ + do { \ if (!is_leases_enabled(this)) \ - goto label; \ -} while (0) + goto label; \ + } while (0) -#define GET_LEASE_ID(xdata, lease_id, client_uid) do { \ - int ret_val = -1; \ - ret_val = dict_get_bin (xdata, "lease-id", (void **)&lease_id); \ +#define GET_LEASE_ID(xdata, lease_id, client_uid) \ + do { \ + int ret_val = -1; \ + ret_val = dict_get_bin(xdata, "lease-id", (void **)&lease_id); \ if (ret_val) { \ - ret_val = 0; \ - gf_msg_debug ("leases", 0, "Lease id is not set for client:%s", client_uid); \ + ret_val = 0; \ + gf_msg_debug("leases", 0, "Lease id is not set for client:%s", \ + client_uid); \ } \ -} while (0) + } while (0) #define GET_FLAGS(fop, fd_flags) \ -do { \ + do { \ if ((fd_flags & (O_WRONLY | O_RDWR)) && fop == GF_FOP_OPEN) \ - fop_flags = DATA_MODIFY_FOP; \ + fop_flags = DATA_MODIFY_FOP; \ \ if (fop == GF_FOP_UNLINK || fop == GF_FOP_RENAME || \ fop == GF_FOP_TRUNCATE || fop == GF_FOP_FTRUNCATE || \ @@ -65,185 +68,181 @@ do { \ fop == GF_FOP_DISCARD || fop == GF_FOP_ZEROFILL || \ fop == GF_FOP_SETATTR || fop == GF_FOP_FSETATTR || \ fop == GF_FOP_LINK) \ - fop_flags = DATA_MODIFY_FOP; \ + fop_flags = DATA_MODIFY_FOP; \ \ if (!(fd_flags & (O_NONBLOCK | O_NDELAY))) \ - fop_flags |= BLOCKING_FOP; \ + fop_flags |= BLOCKING_FOP; \ \ -} while (0) \ - + } while (0) #define GET_FLAGS_LK(cmd, l_type, fd_flags) \ -do { \ + do { \ /* TODO: handle F_RESLK_LCK and other glusterfs_lk_recovery_cmds_t */ \ - if ((cmd == F_SETLKW || cmd == F_SETLKW64 || \ - cmd == F_SETLK || cmd == F_SETLK64) && \ + if ((cmd == F_SETLKW || cmd == F_SETLKW64 || cmd == F_SETLK || \ + cmd == F_SETLK64) && \ l_type == F_WRLCK) \ - fop_flags = DATA_MODIFY_FOP; \ + fop_flags = DATA_MODIFY_FOP; \ \ if (fd_flags & (O_NONBLOCK | O_NDELAY) && \ (cmd == F_SETLKW || cmd == F_SETLKW64)) \ - fop_flags |= BLOCKING_FOP; \ + fop_flags |= BLOCKING_FOP; \ \ -} while (0) \ + } while (0) -#define LEASE_BLOCK_FOP(inode, fop_name, frame, this, params ...) \ -do { \ - call_stub_t *__stub = NULL; \ - fop_stub_t *blk_fop = NULL; \ - lease_inode_ctx_t *lease_ctx = NULL; \ +#define LEASE_BLOCK_FOP(inode, fop_name, frame, this, params...) \ + do { \ + call_stub_t *__stub = NULL; \ + fop_stub_t *blk_fop = NULL; \ + lease_inode_ctx_t *lease_ctx = NULL; \ \ - __stub = fop_##fop_name##_stub (frame, default_##fop_name##_resume, \ - params); \ + __stub = fop_##fop_name##_stub(frame, default_##fop_name##_resume, \ + params); \ if (!__stub) { \ - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, \ - LEASE_MSG_NO_MEM, \ - "Unable to create stub"); \ - ret = -ENOMEM; \ - goto __out; \ + gf_msg(this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \ + "Unable to create stub"); \ + ret = -ENOMEM; \ + goto __out; \ } \ \ - blk_fop = GF_CALLOC (1, sizeof (*blk_fop), \ - gf_leases_mt_fop_stub_t); \ + blk_fop = GF_CALLOC(1, sizeof(*blk_fop), gf_leases_mt_fop_stub_t); \ if (!blk_fop) { \ - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, \ - LEASE_MSG_NO_MEM, \ - "Unable to create lease fop stub"); \ - ret = -ENOMEM; \ - goto __out; \ + gf_msg(this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \ + "Unable to create lease fop stub"); \ + ret = -ENOMEM; \ + goto __out; \ } \ \ - lease_ctx = lease_ctx_get (inode, this); \ + lease_ctx = lease_ctx_get(inode, this); \ if (!lease_ctx) { \ - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, \ - LEASE_MSG_NO_MEM, \ - "Unable to create/get inode ctx"); \ - ret = -ENOMEM; \ - goto __out; \ + gf_msg(this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \ + "Unable to create/get inode ctx"); \ + ret = -ENOMEM; \ + goto __out; \ } \ \ blk_fop->stub = __stub; \ - pthread_mutex_lock (&lease_ctx->lock); \ + pthread_mutex_lock(&lease_ctx->lock); \ { \ - /*TODO: If the lease is unlocked btw check lease conflict and \ - * by now, then this fop shouldn't be add to the blocked fop \ - * list, can use generation number for the same?*/ \ - list_add_tail (&blk_fop->list, &lease_ctx->blocked_list); \ + /*TODO: If the lease is unlocked btw check lease conflict and \ + * by now, then this fop shouldn't be add to the blocked fop \ + * list, can use generation number for the same?*/ \ + list_add_tail(&blk_fop->list, &lease_ctx->blocked_list); \ } \ - pthread_mutex_unlock (&lease_ctx->lock); \ + pthread_mutex_unlock(&lease_ctx->lock); \ \ -__out: \ + __out: \ if (ret < 0) { \ - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \ - "Unable to create stub for blocking the fop:%s (%s)", \ - gf_fop_list[frame->root->op], strerror(ENOMEM)); \ - if (__stub != NULL) { \ - call_stub_destroy (__stub); \ - } \ - GF_FREE (blk_fop); \ - goto err; \ + gf_msg(this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \ + "Unable to create stub for blocking the fop:%s (%s)", \ + gf_fop_list[frame->root->op], strerror(ENOMEM)); \ + if (__stub != NULL) { \ + call_stub_destroy(__stub); \ + } \ + GF_FREE(blk_fop); \ + goto err; \ } \ -} while (0) \ + } while (0) struct _leases_private { - gf_boolean_t leases_enabled; - int32_t recall_lease_timeout; - struct list_head client_list; - struct list_head recall_list; - struct tvec_base *timer_wheel; /* timer wheel where the recall request - is qued and waits for unlock/expiry */ - gf_boolean_t fini; - pthread_t recall_thr; - gf_boolean_t inited_recall_thr; - pthread_mutex_t mutex; - pthread_cond_t cond; + gf_boolean_t leases_enabled; + int32_t recall_lease_timeout; + struct list_head client_list; + struct list_head recall_list; + struct tvec_base *timer_wheel; /* timer wheel where the recall request + is qued and waits for unlock/expiry */ + gf_boolean_t fini; + pthread_t recall_thr; + gf_boolean_t inited_recall_thr; + pthread_mutex_t mutex; + pthread_cond_t cond; }; typedef struct _leases_private leases_private_t; struct _lease_client { - char *client_uid; - struct list_head client_list; - struct list_head inode_list; + char *client_uid; + struct list_head client_list; + struct list_head inode_list; }; typedef struct _lease_client lease_client_t; struct _lease_inode { - inode_t *inode; - struct list_head list; /* This can be part of both inode_list and recall_list */ + inode_t *inode; + struct list_head + list; /* This can be part of both inode_list and recall_list */ }; typedef struct _lease_inode lease_inode_t; struct _lease_fd_ctx { - char *client_uid; - char lease_id[LEASE_ID_SIZE]; + char *client_uid; + char lease_id[LEASE_ID_SIZE]; }; typedef struct _lease_fd_ctx lease_fd_ctx_t; struct _lease_inode_ctx { - struct list_head lease_id_list; /* clients that have taken leases */ - int lease_type_cnt[GF_LEASE_MAX_TYPE+1]; - int lease_type; /* Types of leases acquired */ - uint64_t lease_cnt; /* Total number of leases on this inode */ - uint64_t openfd_cnt; /* number of fds open */ - gf_boolean_t recall_in_progress; /* if lease recall is sent on this inode */ - struct list_head blocked_list; /* List of fops blocked until the - lease recall is complete */ - inode_t *inode; /* this represents the inode on which the - lock was taken, required mainly during - disconnect cleanup */ - struct gf_tw_timer_list *timer; - pthread_mutex_t lock; + struct list_head lease_id_list; /* clients that have taken leases */ + int lease_type_cnt[GF_LEASE_MAX_TYPE + 1]; + int lease_type; /* Types of leases acquired */ + uint64_t lease_cnt; /* Total number of leases on this inode */ + uint64_t openfd_cnt; /* number of fds open */ + gf_boolean_t recall_in_progress; /* if lease recall is sent on this inode */ + struct list_head blocked_list; /* List of fops blocked until the + lease recall is complete */ + inode_t *inode; /* this represents the inode on which the + lock was taken, required mainly during + disconnect cleanup */ + struct gf_tw_timer_list *timer; + pthread_mutex_t lock; }; typedef struct _lease_inode_ctx lease_inode_ctx_t; struct _lease_id_entry { - struct list_head lease_id_list; - char lease_id[LEASE_ID_SIZE]; - char *client_uid; /* uid of the client that has - taken the lease */ - int lease_type_cnt[GF_LEASE_MAX_TYPE+1]; /* count of each lease type */ - int lease_type; /* Union of all the leases taken - under the given lease id */ - uint64_t lease_cnt; /* Number of leases taken under the - given lease id */ - time_t recall_time; /* time @ which recall was sent */ + struct list_head lease_id_list; + char lease_id[LEASE_ID_SIZE]; + char *client_uid; /* uid of the client that has + taken the lease */ + int lease_type_cnt[GF_LEASE_MAX_TYPE + 1]; /* count of each lease type */ + int lease_type; /* Union of all the leases taken + under the given lease id */ + uint64_t lease_cnt; /* Number of leases taken under the + given lease id */ + time_t recall_time; /* time @ which recall was sent */ }; typedef struct _lease_id_entry lease_id_entry_t; /* Required? as stub itself will have list */ struct __fop_stub { - struct list_head list; - call_stub_t *stub; + struct list_head list; + call_stub_t *stub; }; typedef struct __fop_stub fop_stub_t; struct __lease_timer_data { - inode_t *inode; - xlator_t *this; + inode_t *inode; + xlator_t *this; }; typedef struct __lease_timer_data lease_timer_data_t; gf_boolean_t -is_leases_enabled (xlator_t *this); +is_leases_enabled(xlator_t *this); int32_t -get_recall_lease_timeout (xlator_t *this); +get_recall_lease_timeout(xlator_t *this); lease_inode_ctx_t * -lease_ctx_get (inode_t *inode, xlator_t *this); +lease_ctx_get(inode_t *inode, xlator_t *this); int -process_lease_req (call_frame_t *frame, xlator_t *this, - inode_t *inode, struct gf_lease *lease); +process_lease_req(call_frame_t *frame, xlator_t *this, inode_t *inode, + struct gf_lease *lease); int -check_lease_conflict (call_frame_t *frame, inode_t *inode, - const char *lease_id, uint32_t fop_flags); +check_lease_conflict(call_frame_t *frame, inode_t *inode, const char *lease_id, + uint32_t fop_flags); int -cleanup_client_leases (xlator_t *this, const char *client_uid); +cleanup_client_leases(xlator_t *this, const char *client_uid); void * -expired_recall_cleanup (void *data); +expired_recall_cleanup(void *data); #endif /* _LEASES_H */ diff --git a/xlators/features/locks/src/clear.h b/xlators/features/locks/src/clear.h index 78fc5ae3398..08662746f98 100644 --- a/xlators/features/locks/src/clear.h +++ b/xlators/features/locks/src/clear.h @@ -16,56 +16,56 @@ #include "locks.h" typedef enum { - CLRLK_INODE, - CLRLK_ENTRY, - CLRLK_POSIX, - CLRLK_TYPE_MAX + CLRLK_INODE, + CLRLK_ENTRY, + CLRLK_POSIX, + CLRLK_TYPE_MAX } clrlk_type; typedef enum { - CLRLK_BLOCKED = 1, - CLRLK_GRANTED, - CLRLK_ALL, - CLRLK_KIND_MAX + CLRLK_BLOCKED = 1, + CLRLK_GRANTED, + CLRLK_ALL, + CLRLK_KIND_MAX } clrlk_kind; typedef enum { - KW_TYPE, - KW_KIND, - /*add new keywords here*/ - KW_MAX + KW_TYPE, + KW_KIND, + /*add new keywords here*/ + KW_MAX } clrlk_opts; struct _clrlk_args; typedef struct _clrlk_args clrlk_args; struct _clrlk_args { - int type; - int kind; - char *opts; + int type; + int kind; + char *opts; }; int -clrlk_get__kind (char *kind); +clrlk_get__kind(char *kind); int -clrlk_get_type (char *type); +clrlk_get_type(char *type); int -clrlk_get_lock_range (char *range_str, struct gf_flock *ulock, - gf_boolean_t *chk_range); +clrlk_get_lock_range(char *range_str, struct gf_flock *ulock, + gf_boolean_t *chk_range); int -clrlk_parse_args (const char* cmd, clrlk_args *args); +clrlk_parse_args(const char *cmd, clrlk_args *args); int -clrlk_clear_posixlk (xlator_t *this, pl_inode_t *pl_inode, clrlk_args *args, - int *blkd, int *granted, int *op_errno); +clrlk_clear_posixlk(xlator_t *this, pl_inode_t *pl_inode, clrlk_args *args, + int *blkd, int *granted, int *op_errno); int -clrlk_clear_inodelk (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, - clrlk_args *args, int *blkd, int *granted, int *op_errno); +clrlk_clear_inodelk(xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, + clrlk_args *args, int *blkd, int *granted, int *op_errno); int -clrlk_clear_entrylk (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, - clrlk_args *args, int *blkd, int *granted, int *op_errno); +clrlk_clear_entrylk(xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, + clrlk_args *args, int *blkd, int *granted, int *op_errno); int -clrlk_clear_lks_in_all_domains (xlator_t *this, pl_inode_t *pl_inode, - clrlk_args *args, int *blkd, int *granted, - int *op_errno); +clrlk_clear_lks_in_all_domains(xlator_t *this, pl_inode_t *pl_inode, + clrlk_args *args, int *blkd, int *granted, + int *op_errno); #endif /* __CLEAR_H__ */ diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h index 50c156feb38..c3d0e361933 100644 --- a/xlators/features/locks/src/common.h +++ b/xlators/features/locks/src/common.h @@ -12,163 +12,173 @@ #include "lkowner.h" /*dump locks format strings */ -#define RANGE_FMT "type=%s, whence=%hd, start=%llu, len=%llu" -#define ENTRY_FMT "type=%s on basename=%s" -#define DUMP_GEN_FMT "pid = %llu, owner=%s, client=%p" -#define GRNTD_AT "granted at %s" -#define BLKD_AT "blocked at %s" -#define CONN_ID "connection-id=%s" -#define DUMP_BLKD_FMT DUMP_GEN_FMT", "CONN_ID", "BLKD_AT -#define DUMP_GRNTD_FMT DUMP_GEN_FMT", "CONN_ID", "GRNTD_AT -#define DUMP_BLKD_GRNTD_FMT DUMP_GEN_FMT", "CONN_ID", "BLKD_AT", "GRNTD_AT - -#define ENTRY_BLKD_FMT ENTRY_FMT", "DUMP_BLKD_FMT -#define ENTRY_GRNTD_FMT ENTRY_FMT", "DUMP_GRNTD_FMT -#define ENTRY_BLKD_GRNTD_FMT ENTRY_FMT", "DUMP_BLKD_GRNTD_FMT - -#define RANGE_BLKD_FMT RANGE_FMT", "DUMP_BLKD_FMT -#define RANGE_GRNTD_FMT RANGE_FMT", "DUMP_GRNTD_FMT -#define RANGE_BLKD_GRNTD_FMT RANGE_FMT", "DUMP_BLKD_GRNTD_FMT +#define RANGE_FMT "type=%s, whence=%hd, start=%llu, len=%llu" +#define ENTRY_FMT "type=%s on basename=%s" +#define DUMP_GEN_FMT "pid = %llu, owner=%s, client=%p" +#define GRNTD_AT "granted at %s" +#define BLKD_AT "blocked at %s" +#define CONN_ID "connection-id=%s" +#define DUMP_BLKD_FMT DUMP_GEN_FMT ", " CONN_ID ", " BLKD_AT +#define DUMP_GRNTD_FMT DUMP_GEN_FMT ", " CONN_ID ", " GRNTD_AT +#define DUMP_BLKD_GRNTD_FMT DUMP_GEN_FMT ", " CONN_ID ", " BLKD_AT ", " GRNTD_AT + +#define ENTRY_BLKD_FMT ENTRY_FMT ", " DUMP_BLKD_FMT +#define ENTRY_GRNTD_FMT ENTRY_FMT ", " DUMP_GRNTD_FMT +#define ENTRY_BLKD_GRNTD_FMT ENTRY_FMT ", " DUMP_BLKD_GRNTD_FMT + +#define RANGE_BLKD_FMT RANGE_FMT ", " DUMP_BLKD_FMT +#define RANGE_GRNTD_FMT RANGE_FMT ", " DUMP_GRNTD_FMT +#define RANGE_BLKD_GRNTD_FMT RANGE_FMT ", " DUMP_BLKD_GRNTD_FMT #define SET_FLOCK_PID(flock, lock) ((flock)->l_pid = lock->client_pid) - posix_lock_t * -new_posix_lock (struct gf_flock *flock, client_t *client, pid_t client_pid, - gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, - int can_block); +new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, + gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int can_block); pl_inode_t * -pl_inode_get (xlator_t *this, inode_t *inode); +pl_inode_get(xlator_t *this, inode_t *inode); posix_lock_t * -pl_getlk (pl_inode_t *inode, posix_lock_t *lock); +pl_getlk(pl_inode_t *inode, posix_lock_t *lock); int -pl_setlk (xlator_t *this, pl_inode_t *inode, posix_lock_t *lock, - int can_block); +pl_setlk(xlator_t *this, pl_inode_t *inode, posix_lock_t *lock, int can_block); void -grant_blocked_locks (xlator_t *this, pl_inode_t *inode); +grant_blocked_locks(xlator_t *this, pl_inode_t *inode); void -posix_lock_to_flock (posix_lock_t *lock, struct gf_flock *flock); +posix_lock_to_flock(posix_lock_t *lock, struct gf_flock *flock); int -locks_overlap (posix_lock_t *l1, posix_lock_t *l2); +locks_overlap(posix_lock_t *l1, posix_lock_t *l2); int -same_owner (posix_lock_t *l1, posix_lock_t *l2); +same_owner(posix_lock_t *l1, posix_lock_t *l2); -void __delete_lock (posix_lock_t *); +void +__delete_lock(posix_lock_t *); -void __destroy_lock (posix_lock_t *); +void +__destroy_lock(posix_lock_t *); pl_dom_list_t * -get_domain (pl_inode_t *pl_inode, const char *volume); +get_domain(pl_inode_t *pl_inode, const char *volume); void -grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, - pl_dom_list_t *dom, struct timespec *now, - struct list_head *contend); +grant_blocked_inode_locks(xlator_t *this, pl_inode_t *pl_inode, + pl_dom_list_t *dom, struct timespec *now, + struct list_head *contend); void -inodelk_contention_notify (xlator_t *this, struct list_head *contend); +inodelk_contention_notify(xlator_t *this, struct list_head *contend); void -__delete_inode_lock (pl_inode_lock_t *lock); +__delete_inode_lock(pl_inode_lock_t *lock); void -__pl_inodelk_unref (pl_inode_lock_t *lock); +__pl_inodelk_unref(pl_inode_lock_t *lock); void -grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode, - pl_dom_list_t *dom, struct timespec *now, - struct list_head *contend); +grant_blocked_entry_locks(xlator_t *this, pl_inode_t *pl_inode, + pl_dom_list_t *dom, struct timespec *now, + struct list_head *contend); void -entrylk_contention_notify (xlator_t *this, struct list_head *contend); +entrylk_contention_notify(xlator_t *this, struct list_head *contend); -void pl_update_refkeeper (xlator_t *this, inode_t *inode); +void +pl_update_refkeeper(xlator_t *this, inode_t *inode); int32_t -__get_inodelk_count (xlator_t *this, pl_inode_t *pl_inode, char *domname); +__get_inodelk_count(xlator_t *this, pl_inode_t *pl_inode, char *domname); int32_t -get_inodelk_count (xlator_t *this, inode_t *inode, char *domname); +get_inodelk_count(xlator_t *this, inode_t *inode, char *domname); int32_t -__get_entrylk_count (xlator_t *this, pl_inode_t *pl_inode); +__get_entrylk_count(xlator_t *this, pl_inode_t *pl_inode); int32_t -get_entrylk_count (xlator_t *this, inode_t *inode); +get_entrylk_count(xlator_t *this, inode_t *inode); -void pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, const char *domain); +void +pl_trace_in(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, int cmd, + struct gf_flock *flock, const char *domain); -void pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, int op_ret, int op_errno, const char *domain); +void +pl_trace_out(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, int cmd, + struct gf_flock *flock, int op_ret, int op_errno, + const char *domain); -void pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, const char *domain); +void +pl_trace_block(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct gf_flock *flock, const char *domain); -void pl_trace_flush (xlator_t *this, call_frame_t *frame, fd_t *fd); +void +pl_trace_flush(xlator_t *this, call_frame_t *frame, fd_t *fd); -void entrylk_trace_in (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type); +void +entrylk_trace_in(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type); -void entrylk_trace_out (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type, - int op_ret, int op_errno); +void +entrylk_trace_out(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type, int op_ret, int op_errno); -void entrylk_trace_block (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type); +void +entrylk_trace_block(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type); void -pl_print_verdict (char *str, int size, int op_ret, int op_errno); +pl_print_verdict(char *str, int size, int op_ret, int op_errno); void -pl_print_lockee (char *str, int size, fd_t *fd, loc_t *loc); +pl_print_lockee(char *str, int size, fd_t *fd, loc_t *loc); void -pl_print_locker (char *str, int size, xlator_t *this, call_frame_t *frame); +pl_print_locker(char *str, int size, xlator_t *this, call_frame_t *frame); void -pl_print_inodelk (char *str, int size, int cmd, struct gf_flock *flock, const char *domain); +pl_print_inodelk(char *str, int size, int cmd, struct gf_flock *flock, + const char *domain); void -pl_trace_release (xlator_t *this, fd_t *fd); +pl_trace_release(xlator_t *this, fd_t *fd); unsigned long -fd_to_fdnum (fd_t *fd); +fd_to_fdnum(fd_t *fd); fd_t * -fd_from_fdnum (posix_lock_t *lock); +fd_from_fdnum(posix_lock_t *lock); int -pl_reserve_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, - int can_block); +pl_reserve_setlk(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, + int can_block); int -reservelks_equal (posix_lock_t *l1, posix_lock_t *l2); +reservelks_equal(posix_lock_t *l1, posix_lock_t *l2); int -pl_verify_reservelk (xlator_t *this, pl_inode_t *pl_inode, - posix_lock_t *lock, int can_block); +pl_verify_reservelk(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, + int can_block); int -pl_reserve_unlock (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *reqlock); +pl_reserve_unlock(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *reqlock); int32_t -check_entrylk_on_basename (xlator_t *this, inode_t *parent, char *basename); +check_entrylk_on_basename(xlator_t *this, inode_t *parent, char *basename); -void __pl_inodelk_unref (pl_inode_lock_t *lock); -void __pl_entrylk_unref (pl_entry_lock_t *lock); +void +__pl_inodelk_unref(pl_inode_lock_t *lock); +void +__pl_entrylk_unref(pl_entry_lock_t *lock); int -pl_metalock_is_active (pl_inode_t *pl_inode); +pl_metalock_is_active(pl_inode_t *pl_inode); int -__pl_queue_lock (pl_inode_t *pl_inode, posix_lock_t *reqlock, int can_block); +__pl_queue_lock(pl_inode_t *pl_inode, posix_lock_t *reqlock, int can_block); gf_boolean_t pl_does_monkey_want_stuck_lock(); diff --git a/xlators/features/locks/src/locks-mem-types.h b/xlators/features/locks/src/locks-mem-types.h index a48b35c2044..240c1957a42 100644 --- a/xlators/features/locks/src/locks-mem-types.h +++ b/xlators/features/locks/src/locks-mem-types.h @@ -14,17 +14,16 @@ #include "mem-types.h" enum gf_locks_mem_types_ { - gf_locks_mt_pl_dom_list_t = gf_common_mt_end + 1, - gf_locks_mt_pl_inode_t, - gf_locks_mt_posix_lock_t, - gf_locks_mt_pl_entry_lock_t, - gf_locks_mt_pl_inode_lock_t, - gf_locks_mt_truncate_ops, - gf_locks_mt_pl_rw_req_t, - gf_locks_mt_posix_locks_private_t, - gf_locks_mt_pl_fdctx_t, - gf_locks_mt_pl_meta_lock_t, - gf_locks_mt_end + gf_locks_mt_pl_dom_list_t = gf_common_mt_end + 1, + gf_locks_mt_pl_inode_t, + gf_locks_mt_posix_lock_t, + gf_locks_mt_pl_entry_lock_t, + gf_locks_mt_pl_inode_lock_t, + gf_locks_mt_truncate_ops, + gf_locks_mt_pl_rw_req_t, + gf_locks_mt_posix_locks_private_t, + gf_locks_mt_pl_fdctx_t, + gf_locks_mt_pl_meta_lock_t, + gf_locks_mt_end }; #endif - diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h index e9b75fb3f13..cf2849fc251 100644 --- a/xlators/features/locks/src/locks.h +++ b/xlators/features/locks/src/locks.h @@ -19,234 +19,233 @@ #include "lkowner.h" typedef enum { - MLK_NONE, - MLK_FILE_BASED, - MLK_FORCED, - MLK_OPTIMAL + MLK_NONE, + MLK_FILE_BASED, + MLK_FORCED, + MLK_OPTIMAL } mlk_mode_t; /* defines different mandatory locking modes*/ struct __pl_fd; struct __posix_lock { - struct list_head list; + struct list_head list; - short fl_type; - off_t fl_start; - off_t fl_end; - uint32_t lk_flags; + short fl_type; + off_t fl_start; + off_t fl_end; + uint32_t lk_flags; - short blocked; /* waiting to acquire */ - struct gf_flock user_flock; /* the flock supplied by the user */ - xlator_t *this; /* required for blocked locks */ - unsigned long fd_num; + short blocked; /* waiting to acquire */ + struct gf_flock user_flock; /* the flock supplied by the user */ + xlator_t *this; /* required for blocked locks */ + unsigned long fd_num; - fd_t *fd; - call_frame_t *frame; + fd_t *fd; + call_frame_t *frame; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ - /* These two together serve to uniquely identify each process - across nodes */ + /* These two together serve to uniquely identify each process + across nodes */ - void *client; /* to identify client node */ + void *client; /* to identify client node */ - /* This field uniquely identifies the client the lock belongs to. As - * lock migration is handled by rebalance, the client_t object will be - * overwritten by rebalance and can't be deemed as the owner of the - * lock on destination. Hence, the below field is migrated from - * source to destination by lock_migration_info_t and updated on the - * destination. So that on client-server disconnection, server can - * cleanup the locks proper;y. */ + /* This field uniquely identifies the client the lock belongs to. As + * lock migration is handled by rebalance, the client_t object will be + * overwritten by rebalance and can't be deemed as the owner of the + * lock on destination. Hence, the below field is migrated from + * source to destination by lock_migration_info_t and updated on the + * destination. So that on client-server disconnection, server can + * cleanup the locks proper;y. */ - char *client_uid; - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + char *client_uid; + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - int blocking; + int blocking; }; typedef struct __posix_lock posix_lock_t; struct __pl_inode_lock { - struct list_head list; - struct list_head blocked_locks; /* list_head pointing to blocked_inodelks */ - struct list_head contend; /* list of contending locks */ - int ref; + struct list_head list; + struct list_head blocked_locks; /* list_head pointing to blocked_inodelks */ + struct list_head contend; /* list of contending locks */ + int ref; - short fl_type; - off_t fl_start; - off_t fl_end; + short fl_type; + off_t fl_start; + off_t fl_end; - const char *volume; + const char *volume; - struct gf_flock user_flock; /* the flock supplied by the user */ - xlator_t *this; /* required for blocked locks */ - struct __pl_inode *pl_inode; + struct gf_flock user_flock; /* the flock supplied by the user */ + xlator_t *this; /* required for blocked locks */ + struct __pl_inode *pl_inode; - call_frame_t *frame; + call_frame_t *frame; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ - /*last time at which lock contention was detected and notified*/ - struct timespec contention_time; + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ + /*last time at which lock contention was detected and notified*/ + struct timespec contention_time; - /* These two together serve to uniquely identify each process - across nodes */ + /* These two together serve to uniquely identify each process + across nodes */ - void *client; /* to identify client node */ - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + void *client; /* to identify client node */ + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - char *connection_id; /* stores the client connection id */ + char *connection_id; /* stores the client connection id */ - struct list_head client_list; /* list of all locks from a client */ + struct list_head client_list; /* list of all locks from a client */ }; typedef struct __pl_inode_lock pl_inode_lock_t; struct _pl_rw_req { - struct list_head list; - call_stub_t *stub; - posix_lock_t region; + struct list_head list; + call_stub_t *stub; + posix_lock_t region; }; typedef struct _pl_rw_req pl_rw_req_t; struct _pl_dom_list { - struct list_head inode_list; /* list_head back to pl_inode_t */ - const char *domain; - struct list_head entrylk_list; /* List of entry locks */ - struct list_head blocked_entrylks; /* List of all blocked entrylks */ - struct list_head inodelk_list; /* List of inode locks */ - struct list_head blocked_inodelks; /* List of all blocked inodelks */ + struct list_head inode_list; /* list_head back to pl_inode_t */ + const char *domain; + struct list_head entrylk_list; /* List of entry locks */ + struct list_head blocked_entrylks; /* List of all blocked entrylks */ + struct list_head inodelk_list; /* List of inode locks */ + struct list_head blocked_inodelks; /* List of all blocked inodelks */ }; typedef struct _pl_dom_list pl_dom_list_t; struct __entry_lock { - struct list_head domain_list; /* list_head back to pl_dom_list_t */ - struct list_head blocked_locks; /* list_head back to blocked_entrylks */ - struct list_head contend; /* list of contending locks */ - int ref; + struct list_head domain_list; /* list_head back to pl_dom_list_t */ + struct list_head blocked_locks; /* list_head back to blocked_entrylks */ + struct list_head contend; /* list of contending locks */ + int ref; - call_frame_t *frame; - xlator_t *this; - struct __pl_inode *pinode; + call_frame_t *frame; + xlator_t *this; + struct __pl_inode *pinode; - const char *volume; + const char *volume; - const char *basename; - entrylk_type type; + const char *basename; + entrylk_type type; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ - /*last time at which lock contention was detected and notified*/ - struct timespec contention_time; + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ + /*last time at which lock contention was detected and notified*/ + struct timespec contention_time; - void *client; - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + void *client; + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - char *connection_id; /* stores the client connection id */ + char *connection_id; /* stores the client connection id */ - struct list_head client_list; /* list of all locks from a client */ + struct list_head client_list; /* list of all locks from a client */ }; typedef struct __entry_lock pl_entry_lock_t; - /* The "simulated" inode. This contains a list of all the locks associated with this file */ struct __pl_inode { - pthread_mutex_t mutex; - - struct list_head dom_list; /* list of domains */ - struct list_head ext_list; /* list of fcntl locks */ - struct list_head rw_list; /* list of waiting r/w requests */ - struct list_head reservelk_list; /* list of reservelks */ - struct list_head blocked_reservelks; /* list of blocked reservelks */ - struct list_head blocked_calls; /* List of blocked lock calls while a reserve is held*/ - struct list_head metalk_list; /* Meta lock list */ - /* This is to store the incoming lock - requests while meta lock is enabled */ - struct list_head queued_locks; - int mandatory; /* if mandatory locking is enabled */ - - inode_t *refkeeper; /* hold refs on an inode while locks are - held to prevent pruning */ - uuid_t gfid; /* placeholder for gfid of the inode */ - inode_t *inode; /* pointer to be used for ref and unref - of inode_t as long as there are - locks on it */ - gf_boolean_t migrated; + pthread_mutex_t mutex; + + struct list_head dom_list; /* list of domains */ + struct list_head ext_list; /* list of fcntl locks */ + struct list_head rw_list; /* list of waiting r/w requests */ + struct list_head reservelk_list; /* list of reservelks */ + struct list_head blocked_reservelks; /* list of blocked reservelks */ + struct list_head + blocked_calls; /* List of blocked lock calls while a reserve is held*/ + struct list_head metalk_list; /* Meta lock list */ + /* This is to store the incoming lock + requests while meta lock is enabled */ + struct list_head queued_locks; + int mandatory; /* if mandatory locking is enabled */ + + inode_t *refkeeper; /* hold refs on an inode while locks are + held to prevent pruning */ + uuid_t gfid; /* placeholder for gfid of the inode */ + inode_t *inode; /* pointer to be used for ref and unref + of inode_t as long as there are + locks on it */ + gf_boolean_t migrated; }; typedef struct __pl_inode pl_inode_t; struct __pl_metalk { - pthread_mutex_t mutex; - /* For pl_inode meta lock list */ - struct list_head list; - /* For pl_ctx_t list */ - struct list_head client_list; - char *client_uid; - - pl_inode_t *pl_inode; - int ref; + pthread_mutex_t mutex; + /* For pl_inode meta lock list */ + struct list_head list; + /* For pl_ctx_t list */ + struct list_head client_list; + char *client_uid; + + pl_inode_t *pl_inode; + int ref; }; typedef struct __pl_metalk pl_meta_lock_t; typedef struct { - mlk_mode_t mandatory_mode; /* holds current mandatory locking mode */ - gf_boolean_t trace; /* trace lock requests in and out */ - char *brickname; - gf_boolean_t monkey_unlocking; - uint32_t revocation_secs; - gf_boolean_t revocation_clear_all; - uint32_t revocation_max_blocked; - gf_boolean_t notify_contention; - uint32_t notify_contention_delay; + mlk_mode_t mandatory_mode; /* holds current mandatory locking mode */ + gf_boolean_t trace; /* trace lock requests in and out */ + char *brickname; + gf_boolean_t monkey_unlocking; + uint32_t revocation_secs; + gf_boolean_t revocation_clear_all; + uint32_t revocation_max_blocked; + gf_boolean_t notify_contention; + uint32_t notify_contention_delay; } posix_locks_private_t; - typedef struct { - gf_boolean_t entrylk_count_req; - gf_boolean_t inodelk_count_req; - gf_boolean_t posixlk_count_req; - gf_boolean_t parent_entrylk_req; - data_t *inodelk_dom_count_req; - - dict_t *xdata; - loc_t loc[2]; - fd_t *fd; - off_t offset; - glusterfs_fop_t op; + gf_boolean_t entrylk_count_req; + gf_boolean_t inodelk_count_req; + gf_boolean_t posixlk_count_req; + gf_boolean_t parent_entrylk_req; + data_t *inodelk_dom_count_req; + + dict_t *xdata; + loc_t loc[2]; + fd_t *fd; + off_t offset; + glusterfs_fop_t op; } pl_local_t; - typedef struct { - struct list_head locks_list; + struct list_head locks_list; } pl_fdctx_t; - struct _locker { - struct list_head lockers; - char *volume; - inode_t *inode; - gf_lkowner_t owner; + struct list_head lockers; + char *volume; + inode_t *inode; + gf_lkowner_t owner; }; typedef struct _locks_ctx { - pthread_mutex_t lock; - struct list_head inodelk_lockers; - struct list_head entrylk_lockers; - struct list_head metalk_list; + pthread_mutex_t lock; + struct list_head inodelk_lockers; + struct list_head entrylk_lockers; + struct list_head metalk_list; } pl_ctx_t; - pl_ctx_t * -pl_ctx_get (client_t *client, xlator_t *xlator); +pl_ctx_get(client_t *client, xlator_t *xlator); int -pl_inodelk_client_cleanup (xlator_t *this, pl_ctx_t *ctx); +pl_inodelk_client_cleanup(xlator_t *this, pl_ctx_t *ctx); int -pl_entrylk_client_cleanup (xlator_t *this, pl_ctx_t *ctx); +pl_entrylk_client_cleanup(xlator_t *this, pl_ctx_t *ctx); #endif /* __POSIX_LOCKS_H__ */ diff --git a/xlators/features/locks/src/pl-messages.h b/xlators/features/locks/src/pl-messages.h index e5a276f35b5..a99e1bbce43 100644 --- a/xlators/features/locks/src/pl-messages.h +++ b/xlators/features/locks/src/pl-messages.h @@ -23,10 +23,7 @@ * glfs-message-id.h. */ -GLFS_MSGID(PL, - PL_MSG_LOCK_NUMBER, - PL_MSG_INODELK_CONTENTION_FAILED, - PL_MSG_ENTRYLK_CONTENTION_FAILED -); +GLFS_MSGID(PL, PL_MSG_LOCK_NUMBER, PL_MSG_INODELK_CONTENTION_FAILED, + PL_MSG_ENTRYLK_CONTENTION_FAILED); #endif /* !_PL_MESSAGES_H_ */ diff --git a/xlators/features/marker/src/marker-common.h b/xlators/features/marker/src/marker-common.h index fbe9a2ce4b0..449d55b5ef0 100644 --- a/xlators/features/marker/src/marker-common.h +++ b/xlators/features/marker/src/marker-common.h @@ -14,8 +14,8 @@ #include "marker.h" int32_t -marker_force_inode_ctx_get (inode_t *, xlator_t *, marker_inode_ctx_t **); +marker_force_inode_ctx_get(inode_t *, xlator_t *, marker_inode_ctx_t **); int -marker_filter_quota_xattr (dict_t *, char *, data_t *, void *); +marker_filter_quota_xattr(dict_t *, char *, data_t *, void *); #endif diff --git a/xlators/features/marker/src/marker-mem-types.h b/xlators/features/marker/src/marker-mem-types.h index dc5ad16ed76..7d590d7ec84 100644 --- a/xlators/features/marker/src/marker-mem-types.h +++ b/xlators/features/marker/src/marker-mem-types.h @@ -13,15 +13,15 @@ #include "mem-types.h" enum gf_marker_mem_types_ { - gf_marker_mt_marker_conf_t = gf_common_mt_end + 1, - gf_marker_mt_loc_t, - gf_marker_mt_volume_mark, - gf_marker_mt_int64_t, - gf_marker_mt_quota_inode_ctx_t, - gf_marker_mt_marker_inode_ctx_t, - gf_marker_mt_inode_contribution_t, - gf_marker_mt_quota_meta_t, - gf_marker_mt_quota_synctask_t, - gf_marker_mt_end + gf_marker_mt_marker_conf_t = gf_common_mt_end + 1, + gf_marker_mt_loc_t, + gf_marker_mt_volume_mark, + gf_marker_mt_int64_t, + gf_marker_mt_quota_inode_ctx_t, + gf_marker_mt_marker_inode_ctx_t, + gf_marker_mt_inode_contribution_t, + gf_marker_mt_quota_meta_t, + gf_marker_mt_quota_synctask_t, + gf_marker_mt_end }; #endif diff --git a/xlators/features/marker/src/marker-quota-helper.h b/xlators/features/marker/src/marker-quota-helper.h index 444ba7ca71e..99723def1b9 100644 --- a/xlators/features/marker/src/marker-quota-helper.h +++ b/xlators/features/marker/src/marker-quota-helper.h @@ -13,66 +13,66 @@ #include "marker.h" -#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \ - do { \ - LOCK (&ctx->lock); \ - { \ - list_del_init (&_contribution->contri_list); \ - GF_REF_PUT (_contribution); \ - } \ - UNLOCK (&ctx->lock); \ - } while (0) - -#define QUOTA_SAFE_INCREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var ++; \ - UNLOCK (lock); \ - } while (0) - -#define QUOTA_SAFE_DECREMENT(lock, var, value) \ - do { \ - LOCK (lock); \ - { \ - value = --var; \ - } \ - UNLOCK (lock); \ - } while (0) +#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \ + do { \ + LOCK(&ctx->lock); \ + { \ + list_del_init(&_contribution->contri_list); \ + GF_REF_PUT(_contribution); \ + } \ + UNLOCK(&ctx->lock); \ + } while (0) + +#define QUOTA_SAFE_INCREMENT(lock, var) \ + do { \ + LOCK(lock); \ + var++; \ + UNLOCK(lock); \ + } while (0) + +#define QUOTA_SAFE_DECREMENT(lock, var, value) \ + do { \ + LOCK(lock); \ + { \ + value = --var; \ + } \ + UNLOCK(lock); \ + } while (0) inode_contribution_t * -mq_add_new_contribution_node (xlator_t *, quota_inode_ctx_t *, loc_t *); +mq_add_new_contribution_node(xlator_t *, quota_inode_ctx_t *, loc_t *); int32_t -mq_dict_set_contribution (xlator_t *, dict_t *, loc_t *, uuid_t, char *); +mq_dict_set_contribution(xlator_t *, dict_t *, loc_t *, uuid_t, char *); quota_inode_ctx_t * -mq_inode_ctx_new (inode_t *, xlator_t *); +mq_inode_ctx_new(inode_t *, xlator_t *); int32_t -mq_inode_ctx_get (inode_t *, xlator_t *, quota_inode_ctx_t **); +mq_inode_ctx_get(inode_t *, xlator_t *, quota_inode_ctx_t **); int32_t -mq_delete_contribution_node (dict_t *, char *, inode_contribution_t *); +mq_delete_contribution_node(dict_t *, char *, inode_contribution_t *); int32_t -mq_inode_loc_fill (const char *, inode_t *, loc_t *); +mq_inode_loc_fill(const char *, inode_t *, loc_t *); quota_local_t * -mq_local_new (); +mq_local_new(); quota_local_t * -mq_local_ref (quota_local_t *); +mq_local_ref(quota_local_t *); int32_t -mq_local_unref (xlator_t *, quota_local_t *); +mq_local_unref(xlator_t *, quota_local_t *); -inode_contribution_t* -mq_contri_init (inode_t *inode); +inode_contribution_t * +mq_contri_init(inode_t *inode); inode_contribution_t * -mq_get_contribution_node (inode_t *, quota_inode_ctx_t *); +mq_get_contribution_node(inode_t *, quota_inode_ctx_t *); inode_contribution_t * -mq_get_contribution_from_loc (xlator_t *this, loc_t *loc); +mq_get_contribution_from_loc(xlator_t *this, loc_t *loc); #endif diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h index 51e062537b8..7f63e268203 100644 --- a/xlators/features/marker/src/marker-quota.h +++ b/xlators/features/marker/src/marker-quota.h @@ -19,138 +19,131 @@ #define QUOTA_XATTR_PREFIX "trusted.glusterfs" #define QUOTA_DIRTY_KEY "trusted.glusterfs.quota.dirty" -#define CONTRIBUTION "contri" +#define CONTRIBUTION "contri" #define QUOTA_KEY_MAX 512 #define READDIR_BUF 4096 - -#define QUOTA_STACK_DESTROY(_frame, _this) \ - do { \ - quota_local_t *_local = NULL; \ - _local = _frame->local; \ - _frame->local = NULL; \ - STACK_DESTROY (_frame->root); \ - mq_local_unref (_this, _local); \ - } while (0) - - -#define QUOTA_ALLOC(var, type, ret) \ - do { \ - ret = 0; \ - var = GF_CALLOC (sizeof (type), 1, \ - gf_marker_mt_##type); \ - if (!var) { \ - ret = -1; \ - } \ - } while (0); - -#define QUOTA_ALLOC_OR_GOTO(var, type, ret, label) \ - do { \ - var = GF_CALLOC (sizeof (type), 1, \ - gf_marker_mt_##type); \ - if (!var) { \ - gf_log ("", GF_LOG_ERROR, \ - "out of memory"); \ - ret = -1; \ - goto label; \ - } \ - ret = 0; \ - } while (0); - -#define GET_QUOTA_KEY(_this, var, key, _ret) \ - do { \ - marker_conf_t *_priv = _this->private; \ - if (_priv->version > 0) \ - _ret = snprintf (var, QUOTA_KEY_MAX, "%s.%d", \ - key, _priv->version); \ - else \ - _ret = snprintf (var, QUOTA_KEY_MAX, "%s", key); \ - } while (0) - -#define GET_CONTRI_KEY(_this, var, _gfid, _ret) \ - do { \ - char _tmp_var[QUOTA_KEY_MAX] = {0, }; \ - if (_gfid != NULL) { \ - char _gfid_unparsed[40]; \ - gf_uuid_unparse (_gfid, _gfid_unparsed); \ - _ret = snprintf (_tmp_var, QUOTA_KEY_MAX, \ - QUOTA_XATTR_PREFIX \ - ".%s.%s." CONTRIBUTION, \ - "quota", _gfid_unparsed); \ - } else { \ - _ret = snprintf (_tmp_var, QUOTA_KEY_MAX, \ - QUOTA_XATTR_PREFIX \ - ".%s.." CONTRIBUTION, \ - "quota"); \ - } \ - GET_QUOTA_KEY (_this, var, _tmp_var, _ret); \ - } while (0) - -#define GET_SIZE_KEY(_this, var, _ret) \ - { \ - GET_QUOTA_KEY (_this, var, QUOTA_SIZE_KEY, _ret); \ - } - -#define QUOTA_SAFE_INCREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var ++; \ - UNLOCK (lock); \ - } while (0) +#define QUOTA_STACK_DESTROY(_frame, _this) \ + do { \ + quota_local_t *_local = NULL; \ + _local = _frame->local; \ + _frame->local = NULL; \ + STACK_DESTROY(_frame->root); \ + mq_local_unref(_this, _local); \ + } while (0) + +#define QUOTA_ALLOC(var, type, ret) \ + do { \ + ret = 0; \ + var = GF_CALLOC(sizeof(type), 1, gf_marker_mt_##type); \ + if (!var) { \ + ret = -1; \ + } \ + } while (0); + +#define QUOTA_ALLOC_OR_GOTO(var, type, ret, label) \ + do { \ + var = GF_CALLOC(sizeof(type), 1, gf_marker_mt_##type); \ + if (!var) { \ + gf_log("", GF_LOG_ERROR, "out of memory"); \ + ret = -1; \ + goto label; \ + } \ + ret = 0; \ + } while (0); + +#define GET_QUOTA_KEY(_this, var, key, _ret) \ + do { \ + marker_conf_t *_priv = _this->private; \ + if (_priv->version > 0) \ + _ret = snprintf(var, QUOTA_KEY_MAX, "%s.%d", key, _priv->version); \ + else \ + _ret = snprintf(var, QUOTA_KEY_MAX, "%s", key); \ + } while (0) + +#define GET_CONTRI_KEY(_this, var, _gfid, _ret) \ + do { \ + char _tmp_var[QUOTA_KEY_MAX] = { \ + 0, \ + }; \ + if (_gfid != NULL) { \ + char _gfid_unparsed[40]; \ + gf_uuid_unparse(_gfid, _gfid_unparsed); \ + _ret = snprintf(_tmp_var, QUOTA_KEY_MAX, \ + QUOTA_XATTR_PREFIX ".%s.%s." CONTRIBUTION, \ + "quota", _gfid_unparsed); \ + } else { \ + _ret = snprintf(_tmp_var, QUOTA_KEY_MAX, \ + QUOTA_XATTR_PREFIX ".%s.." CONTRIBUTION, "quota"); \ + } \ + GET_QUOTA_KEY(_this, var, _tmp_var, _ret); \ + } while (0) + +#define GET_SIZE_KEY(_this, var, _ret) \ + { \ + GET_QUOTA_KEY(_this, var, QUOTA_SIZE_KEY, _ret); \ + } + +#define QUOTA_SAFE_INCREMENT(lock, var) \ + do { \ + LOCK(lock); \ + var++; \ + UNLOCK(lock); \ + } while (0) struct quota_inode_ctx { - int64_t size; - int64_t file_count; - int64_t dir_count; - int8_t dirty; - gf_boolean_t create_status; - gf_boolean_t updation_status; - gf_boolean_t dirty_status; - gf_lock_t lock; - struct list_head contribution_head; + int64_t size; + int64_t file_count; + int64_t dir_count; + int8_t dirty; + gf_boolean_t create_status; + gf_boolean_t updation_status; + gf_boolean_t dirty_status; + gf_lock_t lock; + struct list_head contribution_head; }; typedef struct quota_inode_ctx quota_inode_ctx_t; struct quota_synctask { - xlator_t *this; - loc_t loc; - quota_meta_t contri; - gf_boolean_t is_static; - uint32_t ia_nlink; - call_stub_t *stub; + xlator_t *this; + loc_t loc; + quota_meta_t contri; + gf_boolean_t is_static; + uint32_t ia_nlink; + call_stub_t *stub; }; typedef struct quota_synctask quota_synctask_t; struct inode_contribution { - struct list_head contri_list; - int64_t contribution; - int64_t file_count; - int64_t dir_count; - uuid_t gfid; - gf_lock_t lock; - GF_REF_DECL; + struct list_head contri_list; + int64_t contribution; + int64_t file_count; + int64_t dir_count; + uuid_t gfid; + gf_lock_t lock; + GF_REF_DECL; }; typedef struct inode_contribution inode_contribution_t; int32_t -mq_req_xattr (xlator_t *, loc_t *, dict_t *, char *, char *); +mq_req_xattr(xlator_t *, loc_t *, dict_t *, char *, char *); int32_t -mq_xattr_state (xlator_t *, loc_t *, dict_t *, struct iatt); +mq_xattr_state(xlator_t *, loc_t *, dict_t *, struct iatt); int -mq_initiate_quota_txn (xlator_t *, loc_t *, struct iatt *); +mq_initiate_quota_txn(xlator_t *, loc_t *, struct iatt *); int -mq_initiate_quota_blocking_txn (xlator_t *, loc_t *, struct iatt *); +mq_initiate_quota_blocking_txn(xlator_t *, loc_t *, struct iatt *); int -mq_create_xattrs_txn (xlator_t *this, loc_t *loc, struct iatt *buf); +mq_create_xattrs_txn(xlator_t *this, loc_t *loc, struct iatt *buf); int32_t -mq_reduce_parent_size_txn (xlator_t *, loc_t *, quota_meta_t *, - uint32_t nlink, call_stub_t *stub); +mq_reduce_parent_size_txn(xlator_t *, loc_t *, quota_meta_t *, uint32_t nlink, + call_stub_t *stub); int32_t -mq_forget (xlator_t *, quota_inode_ctx_t *); +mq_forget(xlator_t *, quota_inode_ctx_t *); #endif diff --git a/xlators/features/marker/src/marker.h b/xlators/features/marker/src/marker.h index 4726880b82f..3b6f4ec8b72 100644 --- a/xlators/features/marker/src/marker.h +++ b/xlators/features/marker/src/marker.h @@ -17,132 +17,131 @@ #include "call-stub.h" #define MARKER_XATTR_PREFIX "trusted.glusterfs" -#define XTIME "xtime" -#define VOLUME_MARK "volume-mark" -#define VOLUME_UUID "volume-uuid" -#define TIMESTAMP_FILE "timestamp-file" +#define XTIME "xtime" +#define VOLUME_MARK "volume-mark" +#define VOLUME_UUID "volume-uuid" +#define TIMESTAMP_FILE "timestamp-file" enum { - GF_QUOTA = 1, - GF_XTIME = 2, - GF_XTIME_GSYNC_FORCE = 4, - GF_INODE_QUOTA = 8, + GF_QUOTA = 1, + GF_XTIME = 2, + GF_XTIME_GSYNC_FORCE = 4, + GF_INODE_QUOTA = 8, }; /*initialize the local variable*/ -#define MARKER_INIT_LOCAL(_frame,_local) do { \ - _frame->local = _local; \ - _local->pid = _frame->root->pid; \ - memset (&_local->loc, 0, sizeof (loc_t)); \ - _local->ref = 1; \ - _local->uid = -1; \ - _local->gid = -1; \ - LOCK_INIT (&_local->lock); \ - _local->oplocal = NULL; \ - } while (0) +#define MARKER_INIT_LOCAL(_frame, _local) \ + do { \ + _frame->local = _local; \ + _local->pid = _frame->root->pid; \ + memset(&_local->loc, 0, sizeof(loc_t)); \ + _local->ref = 1; \ + _local->uid = -1; \ + _local->gid = -1; \ + LOCK_INIT(&_local->lock); \ + _local->oplocal = NULL; \ + } while (0) /* try alloc and if it fails, goto label */ -#define ALLOCATE_OR_GOTO(var, type, label) do { \ - var = GF_CALLOC (sizeof (type), 1, \ - gf_marker_mt_##type); \ - if (!var) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "out of memory :("); \ - goto label; \ - } \ - } while (0) - -#define _MARKER_SET_UID_GID(dest, src) \ - do { \ - if (src->uid != -1 && \ - src->gid != -1) { \ - dest->uid = src->uid; \ - dest->gid = src->gid; \ - } \ - } while (0) - -#define MARKER_SET_UID_GID(frame, dest, src) \ - do { \ - _MARKER_SET_UID_GID (dest, src); \ - frame->root->uid = 0; \ - frame->root->gid = 0; \ - frame->cookie = (void *) _GF_UID_GID_CHANGED; \ - } while (0) - -#define MARKER_RESET_UID_GID(frame, dest, src) \ - do { \ - _MARKER_SET_UID_GID (dest, src); \ - frame->cookie = NULL; \ - } while (0) - -#define MARKER_STACK_UNWIND(fop, frame, params...) \ - do { \ - quota_local_t *_local = NULL; \ - if (frame) { \ - _local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (_local) \ - marker_local_unref (_local); \ - } while (0) - -struct marker_local{ - uint32_t timebuf[2]; - pid_t pid; - loc_t loc; - loc_t parent_loc; - uid_t uid; - gid_t gid; - int32_t ref; - uint32_t ia_nlink; - struct iatt buf; - gf_lock_t lock; - mode_t mode; - int32_t err; - call_stub_t *stub; - call_frame_t *lk_frame; - quota_meta_t contribution; - struct marker_local *oplocal; - - /* marker quota specific */ - int64_t delta; - int64_t d_off; - int64_t sum; - int64_t size; - int32_t hl_count; - int32_t dentry_child_count; - - fd_t *fd; - call_frame_t *frame; - - quota_inode_ctx_t *ctx; - inode_contribution_t *contri; - - int xflag; - dict_t *xdata; - gf_boolean_t skip_txn; +#define ALLOCATE_OR_GOTO(var, type, label) \ + do { \ + var = GF_CALLOC(sizeof(type), 1, gf_marker_mt_##type); \ + if (!var) { \ + gf_log(this->name, GF_LOG_ERROR, "out of memory :("); \ + goto label; \ + } \ + } while (0) + +#define _MARKER_SET_UID_GID(dest, src) \ + do { \ + if (src->uid != -1 && src->gid != -1) { \ + dest->uid = src->uid; \ + dest->gid = src->gid; \ + } \ + } while (0) + +#define MARKER_SET_UID_GID(frame, dest, src) \ + do { \ + _MARKER_SET_UID_GID(dest, src); \ + frame->root->uid = 0; \ + frame->root->gid = 0; \ + frame->cookie = (void *)_GF_UID_GID_CHANGED; \ + } while (0) + +#define MARKER_RESET_UID_GID(frame, dest, src) \ + do { \ + _MARKER_SET_UID_GID(dest, src); \ + frame->cookie = NULL; \ + } while (0) + +#define MARKER_STACK_UNWIND(fop, frame, params...) \ + do { \ + quota_local_t *_local = NULL; \ + if (frame) { \ + _local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (_local) \ + marker_local_unref(_local); \ + } while (0) + +struct marker_local { + uint32_t timebuf[2]; + pid_t pid; + loc_t loc; + loc_t parent_loc; + uid_t uid; + gid_t gid; + int32_t ref; + uint32_t ia_nlink; + struct iatt buf; + gf_lock_t lock; + mode_t mode; + int32_t err; + call_stub_t *stub; + call_frame_t *lk_frame; + quota_meta_t contribution; + struct marker_local *oplocal; + + /* marker quota specific */ + int64_t delta; + int64_t d_off; + int64_t sum; + int64_t size; + int32_t hl_count; + int32_t dentry_child_count; + + fd_t *fd; + call_frame_t *frame; + + quota_inode_ctx_t *ctx; + inode_contribution_t *contri; + + int xflag; + dict_t *xdata; + gf_boolean_t skip_txn; }; typedef struct marker_local marker_local_t; #define quota_local_t marker_local_t struct marker_inode_ctx { - struct quota_inode_ctx *quota_ctx; + struct quota_inode_ctx *quota_ctx; }; typedef struct marker_inode_ctx marker_inode_ctx_t; -struct marker_conf{ - char feature_enabled; - char *size_key; - char *dirty_key; - char *volume_uuid; - uuid_t volume_uuid_bin; - char *timestamp_file; - char *marker_xattr; - uint64_t quota_lk_owner; - gf_lock_t lock; - int32_t version; +struct marker_conf { + char feature_enabled; + char *size_key; + char *dirty_key; + char *volume_uuid; + uuid_t volume_uuid_bin; + char *timestamp_file; + char *marker_xattr; + uint64_t quota_lk_owner; + gf_lock_t lock; + int32_t version; }; typedef struct marker_conf marker_conf_t; diff --git a/xlators/features/namespace/src/namespace.h b/xlators/features/namespace/src/namespace.h index 1dbec50e024..4c04cb3f471 100644 --- a/xlators/features/namespace/src/namespace.h +++ b/xlators/features/namespace/src/namespace.h @@ -12,12 +12,12 @@ #define GF_NAMESPACE "namespace" typedef struct { - gf_boolean_t tag_namespaces; + gf_boolean_t tag_namespaces; } ns_private_t; typedef struct { - loc_t loc; /* We store a "fake" loc_t for the getxattr wind. */ - call_stub_t *stub; /* A stub back to the function we're resuming. */ + loc_t loc; /* We store a "fake" loc_t for the getxattr wind. */ + call_stub_t *stub; /* A stub back to the function we're resuming. */ } ns_local_t; #endif /* __NAMESPACE_H__ */ diff --git a/xlators/features/quiesce/src/quiesce-mem-types.h b/xlators/features/quiesce/src/quiesce-mem-types.h index 31346c1a794..914bfb22ed0 100644 --- a/xlators/features/quiesce/src/quiesce-mem-types.h +++ b/xlators/features/quiesce/src/quiesce-mem-types.h @@ -14,8 +14,8 @@ #include "mem-types.h" enum gf_quiesce_mem_types_ { - gf_quiesce_mt_priv_t = gf_common_mt_end + 1, - gf_quiesce_mt_failover_hosts, - gf_quiesce_mt_end + gf_quiesce_mt_priv_t = gf_common_mt_end + 1, + gf_quiesce_mt_failover_hosts, + gf_quiesce_mt_end }; #endif diff --git a/xlators/features/quiesce/src/quiesce-messages.h b/xlators/features/quiesce/src/quiesce-messages.h index 8af3b10b06e..864a18147dc 100644 --- a/xlators/features/quiesce/src/quiesce-messages.h +++ b/xlators/features/quiesce/src/quiesce-messages.h @@ -23,9 +23,6 @@ * glfs-message-id.h. */ -GLFS_MSGID(QUIESCE, - QUIESCE_MSG_INVAL_HOST, - QUIESCE_MSG_FAILOVER_FAILED -); +GLFS_MSGID(QUIESCE, QUIESCE_MSG_INVAL_HOST, QUIESCE_MSG_FAILOVER_FAILED); #endif /* __NL_CACHE_MESSAGES_H__ */ diff --git a/xlators/features/quiesce/src/quiesce.h b/xlators/features/quiesce/src/quiesce.h index c084801c6c6..ed8f8fa2934 100644 --- a/xlators/features/quiesce/src/quiesce.h +++ b/xlators/features/quiesce/src/quiesce.h @@ -19,47 +19,47 @@ #define GF_FOPS_EXPECTED_IN_PARALLEL 512 typedef struct { - struct list_head list; - char *addr; - gf_boolean_t tried; /* indicates attempted connecting */ + struct list_head list; + char *addr; + gf_boolean_t tried; /* indicates attempted connecting */ } quiesce_failover_hosts_t; typedef struct { - gf_timer_t *timer; - gf_boolean_t pass_through; - gf_lock_t lock; - struct list_head req; - int queue_size; - pthread_t thr; - struct mem_pool *local_pool; - uint32_t timeout; - char *failover_hosts; - struct list_head failover_list; + gf_timer_t *timer; + gf_boolean_t pass_through; + gf_lock_t lock; + struct list_head req; + int queue_size; + pthread_t thr; + struct mem_pool *local_pool; + uint32_t timeout; + char *failover_hosts; + struct list_head failover_list; } quiesce_priv_t; typedef struct { - fd_t *fd; - char *name; - char *volname; - loc_t loc; - off_t size; - off_t offset; - mode_t mode; - int32_t flag; - struct iatt stbuf; - struct iovec *vector; - struct iobref *iobref; - dict_t *dict; - struct gf_flock flock; - entrylk_cmd cmd; - entrylk_type type; - gf_xattrop_flags_t xattrop_flags; - int32_t wbflags; - uint32_t io_flag; - /* for fallocate */ - size_t len; - /* for lseek */ - gf_seek_what_t what; + fd_t *fd; + char *name; + char *volname; + loc_t loc; + off_t size; + off_t offset; + mode_t mode; + int32_t flag; + struct iatt stbuf; + struct iovec *vector; + struct iobref *iobref; + dict_t *dict; + struct gf_flock flock; + entrylk_cmd cmd; + entrylk_type type; + gf_xattrop_flags_t xattrop_flags; + int32_t wbflags; + uint32_t io_flag; + /* for fallocate */ + size_t len; + /* for lseek */ + gf_seek_what_t what; } quiesce_local_t; #endif diff --git a/xlators/features/quota/src/quota-mem-types.h b/xlators/features/quota/src/quota-mem-types.h index 97d9165681f..e04d2e846cd 100644 --- a/xlators/features/quota/src/quota-mem-types.h +++ b/xlators/features/quota/src/quota-mem-types.h @@ -13,18 +13,17 @@ #include "mem-types.h" enum gf_quota_mem_types_ { - gf_quota_mt_quota_priv_t = gf_common_mt_end + 1, - gf_quota_mt_quota_inode_ctx_t, - gf_quota_mt_loc_t, - gf_quota_mt_char, - gf_quota_mt_int64_t, - gf_quota_mt_int32_t, - gf_quota_mt_limits_t, - gf_quota_mt_quota_dentry_t, - gf_quota_mt_quota_limits_level_t, - gf_quota_mt_qd_vols_conf_t, - gf_quota_mt_aggregator_state_t, - gf_quota_mt_end + gf_quota_mt_quota_priv_t = gf_common_mt_end + 1, + gf_quota_mt_quota_inode_ctx_t, + gf_quota_mt_loc_t, + gf_quota_mt_char, + gf_quota_mt_int64_t, + gf_quota_mt_int32_t, + gf_quota_mt_limits_t, + gf_quota_mt_quota_dentry_t, + gf_quota_mt_quota_limits_level_t, + gf_quota_mt_qd_vols_conf_t, + gf_quota_mt_aggregator_state_t, + gf_quota_mt_end }; #endif - diff --git a/xlators/features/quota/src/quota-messages.h b/xlators/features/quota/src/quota-messages.h index 85f5abf7b29..5129d2ee9ad 100644 --- a/xlators/features/quota/src/quota-messages.h +++ b/xlators/features/quota/src/quota-messages.h @@ -23,33 +23,17 @@ * glfs-message-id.h. */ -GLFS_MSGID(QUOTA, - Q_MSG_ENFORCEMENT_FAILED, - Q_MSG_ENOMEM, - Q_MSG_PARENT_NULL, - Q_MSG_CROSSED_SOFT_LIMIT, - Q_MSG_QUOTA_ENFORCER_RPC_INIT_FAILED, - Q_MSG_REMOTE_OPERATION_FAILED, - Q_MSG_FAILED_TO_SEND_FOP, - Q_MSG_INVALID_VOLFILE, - Q_MSG_INODE_PARENT_NOT_FOUND, - Q_MSG_XDR_DECODE_ERROR, - Q_MSG_DICT_UNSERIALIZE_FAIL, - Q_MSG_DICT_SERIALIZE_FAIL, - Q_MSG_RPCSVC_INIT_FAILED, - Q_MSG_RPCSVC_LISTENER_CREATION_FAILED, - Q_MSG_RPCSVC_REGISTER_FAILED, - Q_MSG_XDR_DECODING_FAILED, - Q_MSG_RPCCLNT_REGISTER_NOTIFY_FAILED, - Q_MSG_ANCESTRY_BUILD_FAILED, - Q_MSG_SIZE_KEY_MISSING, - Q_MSG_INODE_CTX_GET_FAILED, - Q_MSG_INODE_CTX_SET_FAILED, - Q_MSG_LOOKUP_FAILED, - Q_MSG_RPC_SUBMIT_FAILED, - Q_MSG_ENFORCEMENT_SKIPPED, - Q_MSG_INTERNAL_FOP_KEY_MISSING -); +GLFS_MSGID(QUOTA, Q_MSG_ENFORCEMENT_FAILED, Q_MSG_ENOMEM, Q_MSG_PARENT_NULL, + Q_MSG_CROSSED_SOFT_LIMIT, Q_MSG_QUOTA_ENFORCER_RPC_INIT_FAILED, + Q_MSG_REMOTE_OPERATION_FAILED, Q_MSG_FAILED_TO_SEND_FOP, + Q_MSG_INVALID_VOLFILE, Q_MSG_INODE_PARENT_NOT_FOUND, + Q_MSG_XDR_DECODE_ERROR, Q_MSG_DICT_UNSERIALIZE_FAIL, + Q_MSG_DICT_SERIALIZE_FAIL, Q_MSG_RPCSVC_INIT_FAILED, + Q_MSG_RPCSVC_LISTENER_CREATION_FAILED, Q_MSG_RPCSVC_REGISTER_FAILED, + Q_MSG_XDR_DECODING_FAILED, Q_MSG_RPCCLNT_REGISTER_NOTIFY_FAILED, + Q_MSG_ANCESTRY_BUILD_FAILED, Q_MSG_SIZE_KEY_MISSING, + Q_MSG_INODE_CTX_GET_FAILED, Q_MSG_INODE_CTX_SET_FAILED, + Q_MSG_LOOKUP_FAILED, Q_MSG_RPC_SUBMIT_FAILED, + Q_MSG_ENFORCEMENT_SKIPPED, Q_MSG_INTERNAL_FOP_KEY_MISSING); #endif /* !_QUOTA_MESSAGES_H_ */ - diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h index 9fe0e3e0a51..7ced27a6188 100644 --- a/xlators/features/quota/src/quota.h +++ b/xlators/features/quota/src/quota.h @@ -31,246 +31,235 @@ #include "quota-common-utils.h" #include "quota-messages.h" -#define DIRTY "dirty" -#define SIZE "size" -#define CONTRIBUTION "contri" -#define VAL_LENGTH 8 -#define READDIR_BUF 4096 +#define DIRTY "dirty" +#define SIZE "size" +#define CONTRIBUTION "contri" +#define VAL_LENGTH 8 +#define READDIR_BUF 4096 #ifndef UUID_CANONICAL_FORM_LEN #define UUID_CANONICAL_FORM_LEN 36 #endif -#define WIND_IF_QUOTAOFF(is_quota_on, label) \ - if (!is_quota_on) \ - goto label; - -#define QUOTA_WIND_FOR_INTERNAL_FOP(xdata, label) \ - do { \ - if (xdata && dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) \ - goto label; \ - } while (0) - -#define DID_REACH_LIMIT(lim, prev_size, cur_size) \ - ((cur_size) >= (lim) && (prev_size) < (lim)) - -#define QUOTA_SAFE_INCREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var ++; \ - UNLOCK (lock); \ - } while (0) - -#define QUOTA_SAFE_DECREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var --; \ - UNLOCK (lock); \ - } while (0) - -#define QUOTA_ALLOC_OR_GOTO(var, type, label) \ - do { \ - var = GF_CALLOC (sizeof (type), 1, \ - gf_quota_mt_##type); \ - if (!var) { \ - gf_msg ("", GF_LOG_ERROR, \ - ENOMEM, Q_MSG_ENOMEM, \ - "out of memory"); \ - ret = -1; \ - goto label; \ - } \ - } while (0); - -#define QUOTA_STACK_WIND_TAIL(frame, params...) \ - do { \ - quota_local_t *_local = NULL; \ - \ - if (frame) { \ - _local = frame->local; \ - frame->local = NULL; \ - } \ - \ - STACK_WIND_TAIL (frame, params); \ - \ - if (_local) \ - quota_local_cleanup (_local); \ - } while (0) - -#define QUOTA_STACK_UNWIND(fop, frame, params...) \ - do { \ - quota_local_t *_local = NULL; \ - if (frame) { \ - _local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - quota_local_cleanup (_local); \ - } while (0) - -#define QUOTA_FREE_CONTRIBUTION_NODE(_contribution) \ - do { \ - list_del (&_contribution->contri_list); \ - GF_FREE (_contribution); \ - } while (0) - -#define GET_CONTRI_KEY(var, _vol_name, _gfid, _ret) \ - do { \ - char _gfid_unparsed[40]; \ - if (_gfid != NULL) { \ - gf_uuid_unparse (_gfid, _gfid_unparsed);\ - _ret = gf_asprintf (var, QUOTA_XATTR_PREFIX \ - "%s.%s." CONTRIBUTION, \ - _vol_name, _gfid_unparsed); \ - } else { \ - _ret = gf_asprintf (var, QUOTA_XATTR_PREFIX \ - "%s.." CONTRIBUTION, \ - _vol_name); \ - } \ - } while (0) - - -#define GET_CONTRI_KEY_OR_GOTO(var, _vol_name, _gfid, label) \ - do { \ - GET_CONTRI_KEY(var, _vol_name, _gfid, ret); \ - if (ret == -1) \ - goto label; \ - } while (0) - -#define GET_DIRTY_KEY_OR_GOTO(var, _vol_name, label) \ - do { \ - ret = gf_asprintf (var, QUOTA_XATTR_PREFIX \ - "%s." DIRTY, _vol_name); \ - if (ret == -1) \ - goto label; \ - } while (0) - -#define QUOTA_REG_OR_LNK_FILE(ia_type) \ - (IA_ISREG (ia_type) || IA_ISLNK (ia_type)) - - +#define WIND_IF_QUOTAOFF(is_quota_on, label) \ + if (!is_quota_on) \ + goto label; + +#define QUOTA_WIND_FOR_INTERNAL_FOP(xdata, label) \ + do { \ + if (xdata && dict_get(xdata, GLUSTERFS_INTERNAL_FOP_KEY)) \ + goto label; \ + } while (0) + +#define DID_REACH_LIMIT(lim, prev_size, cur_size) \ + ((cur_size) >= (lim) && (prev_size) < (lim)) + +#define QUOTA_SAFE_INCREMENT(lock, var) \ + do { \ + LOCK(lock); \ + var++; \ + UNLOCK(lock); \ + } while (0) + +#define QUOTA_SAFE_DECREMENT(lock, var) \ + do { \ + LOCK(lock); \ + var--; \ + UNLOCK(lock); \ + } while (0) + +#define QUOTA_ALLOC_OR_GOTO(var, type, label) \ + do { \ + var = GF_CALLOC(sizeof(type), 1, gf_quota_mt_##type); \ + if (!var) { \ + gf_msg("", GF_LOG_ERROR, ENOMEM, Q_MSG_ENOMEM, "out of memory"); \ + ret = -1; \ + goto label; \ + } \ + } while (0); + +#define QUOTA_STACK_WIND_TAIL(frame, params...) \ + do { \ + quota_local_t *_local = NULL; \ + \ + if (frame) { \ + _local = frame->local; \ + frame->local = NULL; \ + } \ + \ + STACK_WIND_TAIL(frame, params); \ + \ + if (_local) \ + quota_local_cleanup(_local); \ + } while (0) + +#define QUOTA_STACK_UNWIND(fop, frame, params...) \ + do { \ + quota_local_t *_local = NULL; \ + if (frame) { \ + _local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + quota_local_cleanup(_local); \ + } while (0) + +#define QUOTA_FREE_CONTRIBUTION_NODE(_contribution) \ + do { \ + list_del(&_contribution->contri_list); \ + GF_FREE(_contribution); \ + } while (0) + +#define GET_CONTRI_KEY(var, _vol_name, _gfid, _ret) \ + do { \ + char _gfid_unparsed[40]; \ + if (_gfid != NULL) { \ + gf_uuid_unparse(_gfid, _gfid_unparsed); \ + _ret = gf_asprintf(var, QUOTA_XATTR_PREFIX "%s.%s." CONTRIBUTION, \ + _vol_name, _gfid_unparsed); \ + } else { \ + _ret = gf_asprintf(var, QUOTA_XATTR_PREFIX "%s.." CONTRIBUTION, \ + _vol_name); \ + } \ + } while (0) + +#define GET_CONTRI_KEY_OR_GOTO(var, _vol_name, _gfid, label) \ + do { \ + GET_CONTRI_KEY(var, _vol_name, _gfid, ret); \ + if (ret == -1) \ + goto label; \ + } while (0) + +#define GET_DIRTY_KEY_OR_GOTO(var, _vol_name, label) \ + do { \ + ret = gf_asprintf(var, QUOTA_XATTR_PREFIX "%s." DIRTY, _vol_name); \ + if (ret == -1) \ + goto label; \ + } while (0) + +#define QUOTA_REG_OR_LNK_FILE(ia_type) (IA_ISREG(ia_type) || IA_ISLNK(ia_type)) struct quota_dentry { - char *name; - uuid_t par; - struct list_head next; + char *name; + uuid_t par; + struct list_head next; }; typedef struct quota_dentry quota_dentry_t; struct quota_inode_ctx { - int64_t size; - int64_t hard_lim; - int64_t soft_lim; - int64_t file_count; - int64_t dir_count; - int64_t object_hard_lim; - int64_t object_soft_lim; - struct iatt buf; - struct list_head parents; - struct timeval tv; - struct timeval prev_log; - gf_boolean_t ancestry_built; - gf_lock_t lock; + int64_t size; + int64_t hard_lim; + int64_t soft_lim; + int64_t file_count; + int64_t dir_count; + int64_t object_hard_lim; + int64_t object_soft_lim; + struct iatt buf; + struct list_head parents; + struct timeval tv; + struct timeval prev_log; + gf_boolean_t ancestry_built; + gf_lock_t lock; }; typedef struct quota_inode_ctx quota_inode_ctx_t; -typedef void -(*quota_ancestry_built_t) (struct list_head *parents, inode_t *inode, - int32_t op_ret, int32_t op_errno, void *data); +typedef void (*quota_ancestry_built_t)(struct list_head *parents, + inode_t *inode, int32_t op_ret, + int32_t op_errno, void *data); -typedef void -(*quota_fop_continue_t) (call_frame_t *frame); +typedef void (*quota_fop_continue_t)(call_frame_t *frame); struct quota_local { - gf_lock_t lock; - uint32_t link_count; - loc_t loc; - loc_t oldloc; - loc_t newloc; - loc_t validate_loc; - int64_t delta; - int8_t object_delta; - int32_t op_ret; - int32_t op_errno; - int64_t size; - char just_validated; - fop_lookup_cbk_t validate_cbk; - quota_fop_continue_t fop_continue_cbk; - inode_t *inode; - uuid_t common_ancestor; /* Used by quota_rename */ - call_stub_t *stub; - struct iobref *iobref; - quota_limits_t limit; - quota_limits_t object_limit; - int64_t space_available; - quota_ancestry_built_t ancestry_cbk; - void *ancestry_data; - dict_t *xdata; - dict_t *validate_xdata; - int32_t quotad_conn_retry; - xlator_t *this; - call_frame_t *par_frame; + gf_lock_t lock; + uint32_t link_count; + loc_t loc; + loc_t oldloc; + loc_t newloc; + loc_t validate_loc; + int64_t delta; + int8_t object_delta; + int32_t op_ret; + int32_t op_errno; + int64_t size; + char just_validated; + fop_lookup_cbk_t validate_cbk; + quota_fop_continue_t fop_continue_cbk; + inode_t *inode; + uuid_t common_ancestor; /* Used by quota_rename */ + call_stub_t *stub; + struct iobref *iobref; + quota_limits_t limit; + quota_limits_t object_limit; + int64_t space_available; + quota_ancestry_built_t ancestry_cbk; + void *ancestry_data; + dict_t *xdata; + dict_t *validate_xdata; + int32_t quotad_conn_retry; + xlator_t *this; + call_frame_t *par_frame; }; -typedef struct quota_local quota_local_t; +typedef struct quota_local quota_local_t; struct quota_priv { - uint32_t soft_timeout; - uint32_t hard_timeout; - uint32_t log_timeout; - double default_soft_lim; - gf_boolean_t is_quota_on; - gf_boolean_t consider_statfs; - gf_lock_t lock; - rpc_clnt_prog_t *quota_enforcer; - struct rpcsvc_program *quotad_aggregator; - struct rpc_clnt *rpc_clnt; - rpcsvc_t *rpcsvc; - inode_table_t *itable; - char *volume_uuid; - uint64_t validation_count; - int32_t quotad_conn_status; + uint32_t soft_timeout; + uint32_t hard_timeout; + uint32_t log_timeout; + double default_soft_lim; + gf_boolean_t is_quota_on; + gf_boolean_t consider_statfs; + gf_lock_t lock; + rpc_clnt_prog_t *quota_enforcer; + struct rpcsvc_program *quotad_aggregator; + struct rpc_clnt *rpc_clnt; + rpcsvc_t *rpcsvc; + inode_table_t *itable; + char *volume_uuid; + uint64_t validation_count; + int32_t quotad_conn_status; }; -typedef struct quota_priv quota_priv_t; +typedef struct quota_priv quota_priv_t; int -quota_enforcer_lookup (call_frame_t *frame, xlator_t *this, dict_t *xdata, - fop_lookup_cbk_t cbk); +quota_enforcer_lookup(call_frame_t *frame, xlator_t *this, dict_t *xdata, + fop_lookup_cbk_t cbk); void -_quota_enforcer_lookup (void *data); +_quota_enforcer_lookup(void *data); struct rpc_clnt * -quota_enforcer_init (xlator_t *this, dict_t *options); +quota_enforcer_init(xlator_t *this, dict_t *options); void -quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode, - int64_t delta); +quota_log_usage(xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode, + int64_t delta); int -quota_build_ancestry (inode_t *inode, quota_ancestry_built_t ancestry_cbk, - void *data); +quota_build_ancestry(inode_t *inode, quota_ancestry_built_t ancestry_cbk, + void *data); void -quota_get_limit_dir (call_frame_t *frame, inode_t *cur_inode, xlator_t *this); +quota_get_limit_dir(call_frame_t *frame, inode_t *cur_inode, xlator_t *this); int32_t -quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this); +quota_check_limit(call_frame_t *frame, inode_t *inode, xlator_t *this); inode_t * -do_quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, - quota_dentry_t *dentry, gf_boolean_t force); +do_quota_check_limit(call_frame_t *frame, inode_t *inode, xlator_t *this, + quota_dentry_t *dentry, gf_boolean_t force); int -quota_fill_inodectx (xlator_t *this, inode_t *inode, dict_t *dict, - loc_t *loc, struct iatt *buf, int32_t *op_errno); +quota_fill_inodectx(xlator_t *this, inode_t *inode, dict_t *dict, loc_t *loc, + struct iatt *buf, int32_t *op_errno); int32_t -quota_check_size_limit (call_frame_t *frame, quota_inode_ctx_t *ctx, - quota_priv_t *priv, inode_t *_inode, xlator_t *this, - int32_t *op_errno, int just_validated, int64_t delta, - quota_local_t *local, gf_boolean_t *skip_check); +quota_check_size_limit(call_frame_t *frame, quota_inode_ctx_t *ctx, + quota_priv_t *priv, inode_t *_inode, xlator_t *this, + int32_t *op_errno, int just_validated, int64_t delta, + quota_local_t *local, gf_boolean_t *skip_check); int32_t -quota_check_object_limit (call_frame_t *frame, quota_inode_ctx_t *ctx, - quota_priv_t *priv, inode_t *_inode, xlator_t *this, - int32_t *op_errno, int just_validated, - quota_local_t *local, gf_boolean_t *skip_check); +quota_check_object_limit(call_frame_t *frame, quota_inode_ctx_t *ctx, + quota_priv_t *priv, inode_t *_inode, xlator_t *this, + int32_t *op_errno, int just_validated, + quota_local_t *local, gf_boolean_t *skip_check); #endif diff --git a/xlators/features/quota/src/quotad-aggregator.h b/xlators/features/quota/src/quotad-aggregator.h index 5ddea5b3c46..02a0094102f 100644 --- a/xlators/features/quota/src/quotad-aggregator.h +++ b/xlators/features/quota/src/quotad-aggregator.h @@ -17,21 +17,20 @@ #include "inode.h" typedef struct { - void *pool; - xlator_t *this; - xlator_t *active_subvol; - inode_table_t *itable; - loc_t loc; - dict_t *xdata; + void *pool; + xlator_t *this; + xlator_t *active_subvol; + inode_table_t *itable; + loc_t loc; + dict_t *xdata; } quotad_aggregator_state_t; -typedef int (*quotad_aggregator_lookup_cbk_t) (xlator_t *this, - call_frame_t *frame, - void *rsp); +typedef int (*quotad_aggregator_lookup_cbk_t)(xlator_t *this, + call_frame_t *frame, void *rsp); int -qd_nameless_lookup (xlator_t *this, call_frame_t *frame, gfs3_lookup_req *req, - dict_t *xdata, quotad_aggregator_lookup_cbk_t lookup_cbk); +qd_nameless_lookup(xlator_t *this, call_frame_t *frame, gfs3_lookup_req *req, + dict_t *xdata, quotad_aggregator_lookup_cbk_t lookup_cbk); int -quotad_aggregator_init (xlator_t *this); +quotad_aggregator_init(xlator_t *this); #endif diff --git a/xlators/features/quota/src/quotad-helpers.h b/xlators/features/quota/src/quotad-helpers.h index a10fb7fa82a..bcb39fe845e 100644 --- a/xlators/features/quota/src/quotad-helpers.h +++ b/xlators/features/quota/src/quotad-helpers.h @@ -16,9 +16,9 @@ #include "quotad-aggregator.h" void -quotad_aggregator_free_state (quotad_aggregator_state_t *state); +quotad_aggregator_free_state(quotad_aggregator_state_t *state); call_frame_t * -quotad_aggregator_get_frame_from_req (rpcsvc_request_t *req); +quotad_aggregator_get_frame_from_req(rpcsvc_request_t *req); #endif diff --git a/xlators/features/read-only/src/read-only-common.h b/xlators/features/read-only/src/read-only-common.h index ec629bd5660..32719da28f1 100644 --- a/xlators/features/read-only/src/read-only-common.h +++ b/xlators/features/read-only/src/read-only-common.h @@ -11,107 +11,111 @@ #include "defaults.h" gf_boolean_t -is_readonly_or_worm_enabled (call_frame_t *frame, xlator_t *this); +is_readonly_or_worm_enabled(call_frame_t *frame, xlator_t *this); int32_t -ro_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); +ro_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc, + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); int32_t -ro_fxattrop (call_frame_t *frame, xlator_t *this, - fd_t *fd, gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); +ro_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd, + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata); int32_t -ro_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); +ro_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 -ro_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); +ro_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 -ro_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata); +ro_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 -ro_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, - fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata); +ro_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 -ro_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int cmd, - struct gf_flock *flock, dict_t *xdata); +ro_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int cmd, + struct gf_flock *flock, dict_t *xdata); int32_t -ro_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid, dict_t *xdata); +ro_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, + int32_t valid, dict_t *xdata); int32_t -ro_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iatt *stbuf, int32_t valid, dict_t *xdata); - +ro_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, + int32_t valid, dict_t *xdata); int32_t -ro_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata); +ro_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, + dict_t *xdata); int32_t -ro_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata); +ro_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + dict_t *xdata); int -ro_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, mode_t umask, dict_t *xdata); +ro_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata); int -ro_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - mode_t umask, dict_t *xdata); +ro_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); int32_t -ro_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, - dict_t *xdata); - -int -ro_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, +ro_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, dict_t *xdata); +int +ro_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, + dict_t *xdata); int -ro_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc, mode_t umask, dict_t *xdata); +ro_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath, + loc_t *loc, mode_t umask, dict_t *xdata); int32_t -ro_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata); +ro_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); int32_t -ro_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata); +ro_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata); int32_t -ro_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); +ro_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); int32_t -ro_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd, dict_t *xdata); +ro_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, dict_t *xdata); int32_t -ro_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, - int32_t flags, dict_t *xdata); +ro_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, + int32_t flags, dict_t *xdata); int32_t -ro_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata); +ro_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, + dict_t *xdata); int32_t -ro_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, - int32_t count, off_t off, uint32_t flags, struct iobref *iobref, dict_t *xdata); +ro_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, + int32_t count, off_t off, uint32_t flags, struct iobref *iobref, + dict_t *xdata); int32_t -ro_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, - int32_t flags, dict_t *xdata); +ro_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, + int32_t flags, dict_t *xdata); int32_t -ro_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata); +ro_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc, + const char *name, dict_t *xdata); int32_t -ro_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, - off_t offset, size_t len, dict_t *xdata); +ro_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata); diff --git a/xlators/features/read-only/src/read-only-mem-types.h b/xlators/features/read-only/src/read-only-mem-types.h index 940700a017d..4baaeb41216 100644 --- a/xlators/features/read-only/src/read-only-mem-types.h +++ b/xlators/features/read-only/src/read-only-mem-types.h @@ -14,7 +14,7 @@ #include "mem-types.h" enum gf_read_only_mem_types_ { - gf_read_only_mt_priv_t = gf_common_mt_end + 1, - gf_read_only_mt_end + gf_read_only_mt_priv_t = gf_common_mt_end + 1, + gf_read_only_mt_end }; #endif diff --git a/xlators/features/read-only/src/read-only.h b/xlators/features/read-only/src/read-only.h index aae625f5eaf..d74053a2a8f 100644 --- a/xlators/features/read-only/src/read-only.h +++ b/xlators/features/read-only/src/read-only.h @@ -14,25 +14,23 @@ #include "read-only-mem-types.h" #include "xlator.h" - typedef struct { - uint8_t worm : 1; - uint8_t retain : 1; - uint8_t legal_hold :1; - uint8_t ret_mode : 1; - uint64_t ret_period; - uint64_t auto_commit_period; + uint8_t worm : 1; + uint8_t retain : 1; + uint8_t legal_hold : 1; + uint8_t ret_mode : 1; + uint64_t ret_period; + uint64_t auto_commit_period; } worm_reten_state_t; - typedef struct { - gf_boolean_t readonly_or_worm_enabled; - gf_boolean_t worm_file; - gf_boolean_t worm_files_deletable; - uint64_t reten_period; - uint64_t com_period; - char *reten_mode; - time_t start_time; + gf_boolean_t readonly_or_worm_enabled; + gf_boolean_t worm_file; + gf_boolean_t worm_files_deletable; + uint64_t reten_period; + uint64_t com_period; + char *reten_mode; + time_t start_time; } read_only_priv_t; #endif diff --git a/xlators/features/read-only/src/worm-helper.h b/xlators/features/read-only/src/worm-helper.h index 745df8294c3..b42f8d2b40c 100644 --- a/xlators/features/read-only/src/worm-helper.h +++ b/xlators/features/read-only/src/worm-helper.h @@ -8,30 +8,37 @@ cases as published by the Free Software Foundation. */ -gf_boolean_t gf_worm_write_disabled (struct iatt *stbuf); +gf_boolean_t +gf_worm_write_disabled(struct iatt *stbuf); -int32_t worm_init_state (xlator_t *this, gf_boolean_t fop_with_fd, - void *file_ptr); +int32_t +worm_init_state(xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr); -int32_t worm_set_state (xlator_t *this, gf_boolean_t fop_with_fd, - void *file_ptr, worm_reten_state_t *retention_state, - struct iatt *stbuf); +int32_t +worm_set_state(xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr, + worm_reten_state_t *retention_state, struct iatt *stbuf); -int32_t worm_get_state (xlator_t *this, gf_boolean_t fop_with_fd, - void *file_ptr, worm_reten_state_t *reten_state); +int32_t +worm_get_state(xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr, + worm_reten_state_t *reten_state); -void gf_worm_state_lookup (xlator_t *this, gf_boolean_t fop_with_fd, - void *file_ptr, worm_reten_state_t *reten_state, - struct iatt *stbuf); +void +gf_worm_state_lookup(xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr, + worm_reten_state_t *reten_state, struct iatt *stbuf); -void gf_worm_serialize_state (worm_reten_state_t *reten_state, char *val); +void +gf_worm_serialize_state(worm_reten_state_t *reten_state, char *val); -void gf_worm_deserialize_state (char *val, worm_reten_state_t *reten_state); +void +gf_worm_deserialize_state(char *val, worm_reten_state_t *reten_state); -int32_t gf_worm_set_xattr (xlator_t *this, worm_reten_state_t *reten_state, - gf_boolean_t fop_with_fd, void *file_ptr); +int32_t +gf_worm_set_xattr(xlator_t *this, worm_reten_state_t *reten_state, + gf_boolean_t fop_with_fd, void *file_ptr); -int gf_worm_state_transition (xlator_t *this, gf_boolean_t fop_with_fd, - void *file_ptr, glusterfs_fop_t op); +int +gf_worm_state_transition(xlator_t *this, gf_boolean_t fop_with_fd, + void *file_ptr, glusterfs_fop_t op); -int32_t is_wormfile (xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr); +int32_t +is_wormfile(xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr); diff --git a/xlators/features/sdfs/src/sdfs-messages.h b/xlators/features/sdfs/src/sdfs-messages.h index 6c7a9d90667..cf866c8512a 100644 --- a/xlators/features/sdfs/src/sdfs-messages.h +++ b/xlators/features/sdfs/src/sdfs-messages.h @@ -39,16 +39,14 @@ * holes. */ -#define GLFS_SDFS_BASE GLFS_MSGID_COMP_SDFS -#define GLFS_SDFS_NUM_MESSAGES 2 -#define GLFS_MSGID_END (GLFS_SDFS_BASE + \ - GLFS_SDFS_NUM_MESSAGES + 1) +#define GLFS_SDFS_BASE GLFS_MSGID_COMP_SDFS +#define GLFS_SDFS_NUM_MESSAGES 2 +#define GLFS_MSGID_END (GLFS_SDFS_BASE + GLFS_SDFS_NUM_MESSAGES + 1) /* Messaged with message IDs */ -#define glfs_msg_start_x GLFS_DFS_BASE, "Invalid: Start of messages" +#define glfs_msg_start_x GLFS_DFS_BASE, "Invalid: Start of messages" /*------------*/ - -#define SDFS_MSG_ENTRYLK_ERROR (GLFS_SDFS_BASE + 1) +#define SDFS_MSG_ENTRYLK_ERROR (GLFS_SDFS_BASE + 1) /*! * @messageid * @diagnosis @@ -56,7 +54,7 @@ * */ -#define SDFS_MSG_MKDIR_ERROR (GLFS_SDFS_BASE + 2) +#define SDFS_MSG_MKDIR_ERROR (GLFS_SDFS_BASE + 2) /*! * @messageid * @diagnosis diff --git a/xlators/features/sdfs/src/sdfs.h b/xlators/features/sdfs/src/sdfs.h index d28257eda5e..986d7c2731c 100644 --- a/xlators/features/sdfs/src/sdfs.h +++ b/xlators/features/sdfs/src/sdfs.h @@ -13,37 +13,37 @@ #include "sdfs-messages.h" #include "atomic.h" -#define SDFS_LOCK_COUNT_MAX 2 +#define SDFS_LOCK_COUNT_MAX 2 -typedef struct{ - loc_t parent_loc; - char *basename; - int locked[SDFS_LOCK_COUNT_MAX]; +typedef struct { + loc_t parent_loc; + char *basename; + int locked[SDFS_LOCK_COUNT_MAX]; } sdfs_entry_lock_t; typedef struct { - sdfs_entry_lock_t entrylk[SDFS_LOCK_COUNT_MAX]; - int lock_count; + sdfs_entry_lock_t entrylk[SDFS_LOCK_COUNT_MAX]; + int lock_count; } sdfs_lock_t; struct sdfs_local { - call_frame_t *main_frame; - loc_t loc; - loc_t parent_loc; - call_stub_t *stub; - sdfs_lock_t *lock; - int op_ret; - int op_errno; - gf_atomic_t call_cnt; + call_frame_t *main_frame; + loc_t loc; + loc_t parent_loc; + call_stub_t *stub; + sdfs_lock_t *lock; + int op_ret; + int op_errno; + gf_atomic_t call_cnt; }; typedef struct sdfs_local sdfs_local_t; -#define SDFS_STACK_DESTROY(frame) do { \ - sdfs_local_t *__local = NULL; \ - __local = frame->local; \ - frame->local = NULL; \ - gf_client_unref (frame->root->client); \ - STACK_DESTROY (frame->root); \ - sdfs_local_cleanup (__local); \ - } while (0) - +#define SDFS_STACK_DESTROY(frame) \ + do { \ + sdfs_local_t *__local = NULL; \ + __local = frame->local; \ + frame->local = NULL; \ + gf_client_unref(frame->root->client); \ + STACK_DESTROY(frame->root); \ + sdfs_local_cleanup(__local); \ + } while (0) diff --git a/xlators/features/selinux/src/selinux-mem-types.h b/xlators/features/selinux/src/selinux-mem-types.h index f9f356dd39a..a8c544fba52 100644 --- a/xlators/features/selinux/src/selinux-mem-types.h +++ b/xlators/features/selinux/src/selinux-mem-types.h @@ -13,8 +13,7 @@ #include "mem-types.h" enum gf_selinux_mem_types_ { - gf_selinux_mt_selinux_priv_t = gf_common_mt_end + 1, - gf_selinux_mt_end + gf_selinux_mt_selinux_priv_t = gf_common_mt_end + 1, + gf_selinux_mt_end }; #endif - diff --git a/xlators/features/selinux/src/selinux-messages.h b/xlators/features/selinux/src/selinux-messages.h index 3a1663433ab..1f5739d8dc7 100644 --- a/xlators/features/selinux/src/selinux-messages.h +++ b/xlators/features/selinux/src/selinux-messages.h @@ -23,13 +23,8 @@ * glfs-message-id.h. */ -GLFS_MSGID(SL, - SL_MSG_INVALID_VOLFILE, - SL_MSG_ENOMEM, - SL_MSG_MEM_ACCT_INIT_FAILED, - SL_MSG_SELINUX_GLUSTER_XATTR_MISSING, - SL_MSG_SELINUX_XATTR_MISSING -); +GLFS_MSGID(SL, SL_MSG_INVALID_VOLFILE, SL_MSG_ENOMEM, + SL_MSG_MEM_ACCT_INIT_FAILED, SL_MSG_SELINUX_GLUSTER_XATTR_MISSING, + SL_MSG_SELINUX_XATTR_MISSING); #endif /*_SELINUX_MESSAGES_H */ - diff --git a/xlators/features/selinux/src/selinux.h b/xlators/features/selinux/src/selinux.h index 2ff57b5080a..787bff348f0 100644 --- a/xlators/features/selinux/src/selinux.h +++ b/xlators/features/selinux/src/selinux.h @@ -16,7 +16,7 @@ #define SELINUX_GLUSTER_XATTR "trusted.glusterfs.selinux" struct selinux_priv { - gf_boolean_t selinux_enabled; + gf_boolean_t selinux_enabled; }; typedef struct selinux_priv selinux_priv_t; diff --git a/xlators/features/shard/src/shard-mem-types.h b/xlators/features/shard/src/shard-mem-types.h index fea66aa7dcb..39a57ba6fd0 100644 --- a/xlators/features/shard/src/shard-mem-types.h +++ b/xlators/features/shard/src/shard-mem-types.h @@ -13,12 +13,12 @@ #include "mem-types.h" enum gf_shard_mem_types_ { - gf_shard_mt_priv_t = gf_common_mt_end + 1, - gf_shard_mt_inode_list, - gf_shard_mt_inode_ctx_t, - gf_shard_mt_iovec, - gf_shard_mt_int64_t, - gf_shard_mt_uint64_t, - gf_shard_mt_end + gf_shard_mt_priv_t = gf_common_mt_end + 1, + gf_shard_mt_inode_list, + gf_shard_mt_inode_ctx_t, + gf_shard_mt_iovec, + gf_shard_mt_int64_t, + gf_shard_mt_uint64_t, + gf_shard_mt_end }; #endif diff --git a/xlators/features/shard/src/shard-messages.h b/xlators/features/shard/src/shard-messages.h index 1f0378b20df..89a96709219 100644 --- a/xlators/features/shard/src/shard-messages.h +++ b/xlators/features/shard/src/shard-messages.h @@ -23,29 +23,17 @@ * glfs-message-id.h. */ -GLFS_MSGID(SHARD, - SHARD_MSG_BASE_FILE_LOOKUP_FAILED, - SHARD_MSG_DICT_OP_FAILED, - SHARD_MSG_DOT_SHARD_NODIR, - SHARD_MSG_FD_CTX_SET_FAILED, - SHARD_MSG_INODE_CTX_GET_FAILED, - SHARD_MSG_INODE_CTX_SET_FAILED, - SHARD_MSG_INODE_PATH_FAILED, - SHARD_MSG_INTERNAL_XATTR_MISSING, - SHARD_MSG_INVALID_VOLFILE, - SHARD_MSG_LOOKUP_SHARD_FAILED, - SHARD_MSG_MEM_ACCT_INIT_FAILED, - SHARD_MSG_NULL_THIS, - SHARD_MSG_SIZE_SET_FAILED, - SHARD_MSG_STAT_FAILED, - SHARD_MSG_TRUNCATE_LAST_SHARD_FAILED, - SHARD_MSG_UPDATE_FILE_SIZE_FAILED, - SHARD_MSG_FOP_NOT_SUPPORTED, - SHARD_MSG_INVALID_FOP, - SHARD_MSG_MEMALLOC_FAILED, - SHARD_MSG_FOP_FAILED, - SHARD_MSG_SHARDS_DELETION_FAILED, - SHARD_MSG_SHARD_DELETION_COMPLETED -); +GLFS_MSGID(SHARD, SHARD_MSG_BASE_FILE_LOOKUP_FAILED, SHARD_MSG_DICT_OP_FAILED, + SHARD_MSG_DOT_SHARD_NODIR, SHARD_MSG_FD_CTX_SET_FAILED, + SHARD_MSG_INODE_CTX_GET_FAILED, SHARD_MSG_INODE_CTX_SET_FAILED, + SHARD_MSG_INODE_PATH_FAILED, SHARD_MSG_INTERNAL_XATTR_MISSING, + SHARD_MSG_INVALID_VOLFILE, SHARD_MSG_LOOKUP_SHARD_FAILED, + SHARD_MSG_MEM_ACCT_INIT_FAILED, SHARD_MSG_NULL_THIS, + SHARD_MSG_SIZE_SET_FAILED, SHARD_MSG_STAT_FAILED, + SHARD_MSG_TRUNCATE_LAST_SHARD_FAILED, + SHARD_MSG_UPDATE_FILE_SIZE_FAILED, SHARD_MSG_FOP_NOT_SUPPORTED, + SHARD_MSG_INVALID_FOP, SHARD_MSG_MEMALLOC_FAILED, + SHARD_MSG_FOP_FAILED, SHARD_MSG_SHARDS_DELETION_FAILED, + SHARD_MSG_SHARD_DELETION_COMPLETED); #endif /* !_SHARD_MESSAGES_H_ */ diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h index 7a263f4c37b..f877591faee 100644 --- a/xlators/features/shard/src/shard.h +++ b/xlators/features/shard/src/shard.h @@ -8,7 +8,6 @@ cases as published by the Free Software Foundation. */ - #ifndef __SHARD_H__ #define __SHARD_H__ @@ -19,324 +18,329 @@ #define GF_SHARD_DIR ".shard" #define GF_SHARD_REMOVE_ME_DIR ".remove_me" -#define SHARD_MIN_BLOCK_SIZE (4 * GF_UNIT_MB) -#define SHARD_MAX_BLOCK_SIZE (4 * GF_UNIT_TB) +#define SHARD_MIN_BLOCK_SIZE (4 * GF_UNIT_MB) +#define SHARD_MAX_BLOCK_SIZE (4 * GF_UNIT_TB) #define SHARD_XATTR_PREFIX "trusted.glusterfs.shard." #define GF_XATTR_SHARD_BLOCK_SIZE "trusted.glusterfs.shard.block-size" /** * Bit masks for the valid flag, which is used while updating ctx -**/ -#define SHARD_MASK_BLOCK_SIZE (1 << 0) -#define SHARD_MASK_PROT (1 << 1) -#define SHARD_MASK_NLINK (1 << 2) -#define SHARD_MASK_UID (1 << 3) -#define SHARD_MASK_GID (1 << 4) -#define SHARD_MASK_SIZE (1 << 6) -#define SHARD_MASK_BLOCKS (1 << 7) -#define SHARD_MASK_TIMES (1 << 8) -#define SHARD_MASK_OTHERS (1 << 9) -#define SHARD_MASK_REFRESH_RESET (1 << 10) - -#define SHARD_INODE_WRITE_MASK (SHARD_MASK_SIZE | SHARD_MASK_BLOCKS \ - | SHARD_MASK_TIMES) - -#define SHARD_LOOKUP_MASK (SHARD_MASK_PROT | SHARD_MASK_NLINK | SHARD_MASK_UID \ - | SHARD_MASK_GID | SHARD_MASK_TIMES \ - | SHARD_MASK_OTHERS) - -#define SHARD_ALL_MASK (SHARD_MASK_BLOCK_SIZE | SHARD_MASK_PROT \ - | SHARD_MASK_NLINK | SHARD_MASK_UID | SHARD_MASK_GID \ - | SHARD_MASK_SIZE | SHARD_MASK_BLOCKS \ - | SHARD_MASK_TIMES | SHARD_MASK_OTHERS) - + **/ +#define SHARD_MASK_BLOCK_SIZE (1 << 0) +#define SHARD_MASK_PROT (1 << 1) +#define SHARD_MASK_NLINK (1 << 2) +#define SHARD_MASK_UID (1 << 3) +#define SHARD_MASK_GID (1 << 4) +#define SHARD_MASK_SIZE (1 << 6) +#define SHARD_MASK_BLOCKS (1 << 7) +#define SHARD_MASK_TIMES (1 << 8) +#define SHARD_MASK_OTHERS (1 << 9) +#define SHARD_MASK_REFRESH_RESET (1 << 10) + +#define SHARD_INODE_WRITE_MASK \ + (SHARD_MASK_SIZE | SHARD_MASK_BLOCKS | SHARD_MASK_TIMES) + +#define SHARD_LOOKUP_MASK \ + (SHARD_MASK_PROT | SHARD_MASK_NLINK | SHARD_MASK_UID | SHARD_MASK_GID | \ + SHARD_MASK_TIMES | SHARD_MASK_OTHERS) + +#define SHARD_ALL_MASK \ + (SHARD_MASK_BLOCK_SIZE | SHARD_MASK_PROT | SHARD_MASK_NLINK | \ + SHARD_MASK_UID | SHARD_MASK_GID | SHARD_MASK_SIZE | SHARD_MASK_BLOCKS | \ + SHARD_MASK_TIMES | SHARD_MASK_OTHERS) #define get_lowest_block(off, shard_size) ((off) / (shard_size)) -#define get_highest_block(off, len, shard_size) \ - (((((off)+(len)) == 0)?0:((off)+(len)-1)) / (shard_size)) +#define get_highest_block(off, len, shard_size) \ + (((((off) + (len)) == 0) ? 0 : ((off) + (len)-1)) / (shard_size)) int -shard_unlock_inodelk (call_frame_t *frame, xlator_t *this); +shard_unlock_inodelk(call_frame_t *frame, xlator_t *this); int -shard_unlock_entrylk (call_frame_t *frame, xlator_t *this); - -#define SHARD_ENTRY_FOP_CHECK(loc, op_errno, label) do { \ - if ((loc->name && !strcmp (GF_SHARD_DIR, loc->name)) && \ - (((loc->parent) && \ - __is_root_gfid (loc->parent->gfid)) || \ - __is_root_gfid (loc->pargfid))) { \ - op_errno = EPERM; \ - goto label; \ - } \ - \ - if ((loc->parent && \ - __is_shard_dir (loc->parent->gfid)) || \ - __is_shard_dir (loc->pargfid)) { \ - op_errno = EPERM; \ - goto label; \ - } \ -} while (0) - -#define SHARD_INODE_OP_CHECK(gfid, err, label) do { \ - if (__is_shard_dir(gfid)) { \ - err = EPERM; \ - goto label; \ - } \ -} while (0) - -#define SHARD_STACK_UNWIND(fop, frame, params ...) do { \ - shard_local_t *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - if (__local && __local->int_inodelk.acquired_lock) \ - shard_unlock_inodelk (frame, frame->this); \ - if (__local && __local->int_entrylk.acquired_lock) \ - shard_unlock_entrylk (frame, frame->this); \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - shard_local_wipe (__local); \ - mem_put (__local); \ - } \ -} while (0) - -#define SHARD_STACK_DESTROY(frame) \ - do { \ - shard_local_t *__local = NULL; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - if (__local) { \ - shard_local_wipe (__local); \ - mem_put (__local); \ - } \ - } while (0); - - -#define SHARD_INODE_CREATE_INIT(this, block_size, xattr_req, loc, size, \ - block_count, label) do { \ - int __ret = -1; \ - int64_t *__size_attr = NULL; \ - uint64_t *__bs = 0; \ - \ - __bs = GF_MALLOC (sizeof (uint64_t), gf_shard_mt_uint64_t); \ - if (!__bs) \ - goto label; \ - *__bs = hton64 (block_size); \ - __ret = dict_set_bin (xattr_req, GF_XATTR_SHARD_BLOCK_SIZE, __bs, \ - sizeof (*__bs)); \ - if (__ret) { \ - gf_msg (this->name, GF_LOG_WARNING, 0, \ - SHARD_MSG_DICT_OP_FAILED, "Failed to set key: %s " \ - "on path %s", GF_XATTR_SHARD_BLOCK_SIZE, (loc)->path);\ - GF_FREE (__bs); \ - goto label; \ - } \ - \ - __ret = shard_set_size_attrs (size, block_count, &__size_attr); \ - if (__ret) \ - goto label; \ - \ - __ret = dict_set_bin (xattr_req, GF_XATTR_SHARD_FILE_SIZE, \ - __size_attr, 8 * 4); \ - if (__ret) { \ - gf_msg (this->name, GF_LOG_WARNING, 0, \ - SHARD_MSG_DICT_OP_FAILED, "Failed to set key: %s " \ - "on path %s", GF_XATTR_SHARD_FILE_SIZE, (loc)->path); \ - GF_FREE (__size_attr); \ - goto label; \ - } \ -} while (0) - - -#define SHARD_MD_READ_FOP_INIT_REQ_DICT(this, dict, gfid, local, label) do { \ - int __ret = -1; \ - \ - __ret = dict_set_uint64 (dict, GF_XATTR_SHARD_FILE_SIZE, 8 * 4); \ - if (__ret) { \ - local->op_ret = -1; \ - local->op_errno = ENOMEM; \ - gf_msg (this->name, GF_LOG_WARNING, 0, \ - SHARD_MSG_DICT_OP_FAILED, "Failed to set dict value:"\ - " key:%s for %s.", GF_XATTR_SHARD_FILE_SIZE, \ - uuid_utoa (gfid)); \ - goto label; \ - } \ -} while (0) - -#define SHARD_SET_ROOT_FS_ID(frame, local) do { \ - if (!local->is_set_fsid) { \ - local->uid = frame->root->uid; \ - local->gid = frame->root->gid; \ - frame->root->uid = 0; \ - frame->root->gid = 0; \ - local->is_set_fsid = _gf_true; \ - } \ -} while (0) - -#define SHARD_UNSET_ROOT_FS_ID(frame, local) do { \ - if (local->is_set_fsid) { \ - frame->root->uid = local->uid; \ - frame->root->gid = local->gid; \ - local->is_set_fsid = _gf_false; \ - } \ -} while (0) - -#define SHARD_TIME_UPDATE(ctx_sec, ctx_nsec, new_sec, new_nsec) do { \ - if (ctx_sec == new_sec) \ - ctx_nsec = new_nsec = max (new_nsec, ctx_nsec); \ - else if (ctx_sec > new_sec) { \ - new_sec = ctx_sec; \ - new_nsec = ctx_nsec; \ - } else { \ - ctx_sec = new_sec; \ - ctx_nsec = new_nsec; \ - } \ - } while (0) +shard_unlock_entrylk(call_frame_t *frame, xlator_t *this); + +#define SHARD_ENTRY_FOP_CHECK(loc, op_errno, label) \ + do { \ + if ((loc->name && !strcmp(GF_SHARD_DIR, loc->name)) && \ + (((loc->parent) && __is_root_gfid(loc->parent->gfid)) || \ + __is_root_gfid(loc->pargfid))) { \ + op_errno = EPERM; \ + goto label; \ + } \ + \ + if ((loc->parent && __is_shard_dir(loc->parent->gfid)) || \ + __is_shard_dir(loc->pargfid)) { \ + op_errno = EPERM; \ + goto label; \ + } \ + } while (0) + +#define SHARD_INODE_OP_CHECK(gfid, err, label) \ + do { \ + if (__is_shard_dir(gfid)) { \ + err = EPERM; \ + goto label; \ + } \ + } while (0) + +#define SHARD_STACK_UNWIND(fop, frame, params...) \ + do { \ + shard_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + if (__local && __local->int_inodelk.acquired_lock) \ + shard_unlock_inodelk(frame, frame->this); \ + if (__local && __local->int_entrylk.acquired_lock) \ + shard_unlock_entrylk(frame, frame->this); \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + shard_local_wipe(__local); \ + mem_put(__local); \ + } \ + } while (0) + +#define SHARD_STACK_DESTROY(frame) \ + do { \ + shard_local_t *__local = NULL; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + if (__local) { \ + shard_local_wipe(__local); \ + mem_put(__local); \ + } \ + } while (0); + +#define SHARD_INODE_CREATE_INIT(this, block_size, xattr_req, loc, size, \ + block_count, label) \ + do { \ + int __ret = -1; \ + int64_t *__size_attr = NULL; \ + uint64_t *__bs = 0; \ + \ + __bs = GF_MALLOC(sizeof(uint64_t), gf_shard_mt_uint64_t); \ + if (!__bs) \ + goto label; \ + *__bs = hton64(block_size); \ + __ret = dict_set_bin(xattr_req, GF_XATTR_SHARD_BLOCK_SIZE, __bs, \ + sizeof(*__bs)); \ + if (__ret) { \ + gf_msg(this->name, GF_LOG_WARNING, 0, SHARD_MSG_DICT_OP_FAILED, \ + "Failed to set key: %s " \ + "on path %s", \ + GF_XATTR_SHARD_BLOCK_SIZE, (loc)->path); \ + GF_FREE(__bs); \ + goto label; \ + } \ + \ + __ret = shard_set_size_attrs(size, block_count, &__size_attr); \ + if (__ret) \ + goto label; \ + \ + __ret = dict_set_bin(xattr_req, GF_XATTR_SHARD_FILE_SIZE, __size_attr, \ + 8 * 4); \ + if (__ret) { \ + gf_msg(this->name, GF_LOG_WARNING, 0, SHARD_MSG_DICT_OP_FAILED, \ + "Failed to set key: %s " \ + "on path %s", \ + GF_XATTR_SHARD_FILE_SIZE, (loc)->path); \ + GF_FREE(__size_attr); \ + goto label; \ + } \ + } while (0) + +#define SHARD_MD_READ_FOP_INIT_REQ_DICT(this, dict, gfid, local, label) \ + do { \ + int __ret = -1; \ + \ + __ret = dict_set_uint64(dict, GF_XATTR_SHARD_FILE_SIZE, 8 * 4); \ + if (__ret) { \ + local->op_ret = -1; \ + local->op_errno = ENOMEM; \ + gf_msg(this->name, GF_LOG_WARNING, 0, SHARD_MSG_DICT_OP_FAILED, \ + "Failed to set dict value:" \ + " key:%s for %s.", \ + GF_XATTR_SHARD_FILE_SIZE, uuid_utoa(gfid)); \ + goto label; \ + } \ + } while (0) + +#define SHARD_SET_ROOT_FS_ID(frame, local) \ + do { \ + if (!local->is_set_fsid) { \ + local->uid = frame->root->uid; \ + local->gid = frame->root->gid; \ + frame->root->uid = 0; \ + frame->root->gid = 0; \ + local->is_set_fsid = _gf_true; \ + } \ + } while (0) + +#define SHARD_UNSET_ROOT_FS_ID(frame, local) \ + do { \ + if (local->is_set_fsid) { \ + frame->root->uid = local->uid; \ + frame->root->gid = local->gid; \ + local->is_set_fsid = _gf_false; \ + } \ + } while (0) + +#define SHARD_TIME_UPDATE(ctx_sec, ctx_nsec, new_sec, new_nsec) \ + do { \ + if (ctx_sec == new_sec) \ + ctx_nsec = new_nsec = max(new_nsec, ctx_nsec); \ + else if (ctx_sec > new_sec) { \ + new_sec = ctx_sec; \ + new_nsec = ctx_nsec; \ + } else { \ + ctx_sec = new_sec; \ + ctx_nsec = new_nsec; \ + } \ + } while (0) typedef enum { - SHARD_FIRST_LOOKUP_PENDING = 0, - SHARD_FIRST_LOOKUP_IN_PROGRESS, - SHARD_FIRST_LOOKUP_DONE, + SHARD_FIRST_LOOKUP_PENDING = 0, + SHARD_FIRST_LOOKUP_IN_PROGRESS, + SHARD_FIRST_LOOKUP_DONE, } shard_first_lookup_state_t; /* rm = "remove me" */ typedef struct shard_priv { - uint64_t block_size; - uuid_t dot_shard_gfid; - uuid_t dot_shard_rm_gfid; - inode_t *dot_shard_inode; - inode_t *dot_shard_rm_inode; - gf_lock_t lock; - int inode_count; - struct list_head ilist_head; - uint32_t deletion_rate; - shard_first_lookup_state_t first_lookup; - uint64_t lru_limit; + uint64_t block_size; + uuid_t dot_shard_gfid; + uuid_t dot_shard_rm_gfid; + inode_t *dot_shard_inode; + inode_t *dot_shard_rm_inode; + gf_lock_t lock; + int inode_count; + struct list_head ilist_head; + uint32_t deletion_rate; + shard_first_lookup_state_t first_lookup; + uint64_t lru_limit; } shard_priv_t; typedef struct { - loc_t loc; - char *domain; - struct gf_flock flock; - gf_boolean_t acquired_lock; + loc_t loc; + char *domain; + struct gf_flock flock; + gf_boolean_t acquired_lock; } shard_inodelk_t; typedef struct { - loc_t loc; - char *domain; - char *basename; - entrylk_cmd cmd; - entrylk_type type; - gf_boolean_t acquired_lock; + loc_t loc; + char *domain; + char *basename; + entrylk_cmd cmd; + entrylk_type type; + gf_boolean_t acquired_lock; } shard_entrylk_t; -typedef int32_t (*shard_post_fop_handler_t) (call_frame_t *frame, - xlator_t *this); -typedef int32_t (*shard_post_resolve_fop_handler_t) (call_frame_t *frame, - xlator_t *this); -typedef int32_t (*shard_post_lookup_shards_fop_handler_t) (call_frame_t *frame, - xlator_t *this); +typedef int32_t (*shard_post_fop_handler_t)(call_frame_t *frame, + xlator_t *this); +typedef int32_t (*shard_post_resolve_fop_handler_t)(call_frame_t *frame, + xlator_t *this); +typedef int32_t (*shard_post_lookup_shards_fop_handler_t)(call_frame_t *frame, + xlator_t *this); -typedef int32_t (*shard_post_mknod_fop_handler_t) (call_frame_t *frame, - xlator_t *this); +typedef int32_t (*shard_post_mknod_fop_handler_t)(call_frame_t *frame, + xlator_t *this); -typedef int32_t (*shard_post_update_size_fop_handler_t) (call_frame_t *frame, - xlator_t *this); +typedef int32_t (*shard_post_update_size_fop_handler_t)(call_frame_t *frame, + xlator_t *this); typedef struct shard_local { - int op_ret; - int op_errno; - int first_block; - int last_block; - int num_blocks; - int call_count; - int eexist_count; - int create_count; - int xflag; - int count; - uint32_t flags; - uint32_t uid; - uint32_t gid; - uint64_t block_size; - uint64_t dst_block_size; - int32_t datasync; - off_t offset; - size_t total_size; - size_t written_size; - size_t hole_size; - size_t req_size; - size_t readdir_size; - int64_t delta_size; - int delta_blocks; - loc_t loc; - loc_t dot_shard_loc; - loc_t dot_shard_rm_loc; - loc_t loc2; - loc_t tmp_loc; - fd_t *fd; - dict_t *xattr_req; - dict_t *xattr_rsp; - inode_t **inode_list; - glusterfs_fop_t fop; - struct iatt prebuf; - struct iatt postbuf; - struct iatt preoldparent; - struct iatt postoldparent; - struct iatt prenewparent; - struct iatt postnewparent; - struct iovec *vector; - struct iobref *iobref; - struct iobuf *iobuf; - gf_dirent_t entries_head; - gf_boolean_t is_set_fsid; - gf_boolean_t list_inited; - shard_post_fop_handler_t handler; - shard_post_lookup_shards_fop_handler_t pls_fop_handler; - shard_post_resolve_fop_handler_t post_res_handler; - shard_post_mknod_fop_handler_t post_mknod_handler; - shard_post_update_size_fop_handler_t post_update_size_handler; - shard_inodelk_t int_inodelk; - shard_entrylk_t int_entrylk; - inode_t *resolver_base_inode; - gf_boolean_t first_lookup_done; - syncbarrier_t barrier; - gf_boolean_t lookup_shards_barriered; - gf_boolean_t unlink_shards_barriered; - gf_boolean_t resolve_not; - loc_t newloc; - call_frame_t *main_frame; - call_frame_t *inodelk_frame; - call_frame_t *entrylk_frame; - uint32_t deletion_rate; - gf_boolean_t cleanup_required; - uuid_t base_gfid; + int op_ret; + int op_errno; + int first_block; + int last_block; + int num_blocks; + int call_count; + int eexist_count; + int create_count; + int xflag; + int count; + uint32_t flags; + uint32_t uid; + uint32_t gid; + uint64_t block_size; + uint64_t dst_block_size; + int32_t datasync; + off_t offset; + size_t total_size; + size_t written_size; + size_t hole_size; + size_t req_size; + size_t readdir_size; + int64_t delta_size; + int delta_blocks; + loc_t loc; + loc_t dot_shard_loc; + loc_t dot_shard_rm_loc; + loc_t loc2; + loc_t tmp_loc; + fd_t *fd; + dict_t *xattr_req; + dict_t *xattr_rsp; + inode_t **inode_list; + glusterfs_fop_t fop; + struct iatt prebuf; + struct iatt postbuf; + struct iatt preoldparent; + struct iatt postoldparent; + struct iatt prenewparent; + struct iatt postnewparent; + struct iovec *vector; + struct iobref *iobref; + struct iobuf *iobuf; + gf_dirent_t entries_head; + gf_boolean_t is_set_fsid; + gf_boolean_t list_inited; + shard_post_fop_handler_t handler; + shard_post_lookup_shards_fop_handler_t pls_fop_handler; + shard_post_resolve_fop_handler_t post_res_handler; + shard_post_mknod_fop_handler_t post_mknod_handler; + shard_post_update_size_fop_handler_t post_update_size_handler; + shard_inodelk_t int_inodelk; + shard_entrylk_t int_entrylk; + inode_t *resolver_base_inode; + gf_boolean_t first_lookup_done; + syncbarrier_t barrier; + gf_boolean_t lookup_shards_barriered; + gf_boolean_t unlink_shards_barriered; + gf_boolean_t resolve_not; + loc_t newloc; + call_frame_t *main_frame; + call_frame_t *inodelk_frame; + call_frame_t *entrylk_frame; + uint32_t deletion_rate; + gf_boolean_t cleanup_required; + uuid_t base_gfid; } shard_local_t; typedef struct shard_inode_ctx { - uint64_t block_size; /* The block size with which this inode is - sharded */ - struct iatt stat; - gf_boolean_t refresh; - /* The following members of inode ctx will be applicable only to the - * individual shards' ctx and never the base file ctx. - */ - struct list_head ilist; - uuid_t base_gfid; - int block_num; - gf_boolean_t refreshed; - struct list_head to_fsync_list; - int fsync_needed; - inode_t *inode; - int fsync_count; - inode_t *base_inode; + uint64_t block_size; /* The block size with which this inode is + sharded */ + struct iatt stat; + gf_boolean_t refresh; + /* The following members of inode ctx will be applicable only to the + * individual shards' ctx and never the base file ctx. + */ + struct list_head ilist; + uuid_t base_gfid; + int block_num; + gf_boolean_t refreshed; + struct list_head to_fsync_list; + int fsync_needed; + inode_t *inode; + int fsync_count; + inode_t *base_inode; } shard_inode_ctx_t; typedef enum { - SHARD_INTERNAL_DIR_DOT_SHARD = 1, - SHARD_INTERNAL_DIR_DOT_SHARD_REMOVE_ME, + SHARD_INTERNAL_DIR_DOT_SHARD = 1, + SHARD_INTERNAL_DIR_DOT_SHARD_REMOVE_ME, } shard_internal_dir_type_t; #endif /* __SHARD_H__ */ diff --git a/xlators/features/snapview-client/src/snapview-client-mem-types.h b/xlators/features/snapview-client/src/snapview-client-mem-types.h index 1a0158d950e..aac0d571c41 100644 --- a/xlators/features/snapview-client/src/snapview-client-mem-types.h +++ b/xlators/features/snapview-client/src/snapview-client-mem-types.h @@ -14,11 +14,11 @@ #include "mem-types.h" enum svc_mem_types { - gf_svc_mt_svc_private_t = gf_common_mt_end + 1, - gf_svc_mt_svc_local_t, - gf_svc_mt_svc_inode_t, - gf_svc_mt_svc_fd_t, - gf_svc_mt_end + gf_svc_mt_svc_private_t = gf_common_mt_end + 1, + gf_svc_mt_svc_local_t, + gf_svc_mt_svc_inode_t, + gf_svc_mt_svc_fd_t, + gf_svc_mt_end }; #endif diff --git a/xlators/features/snapview-client/src/snapview-client.h b/xlators/features/snapview-client/src/snapview-client.h index 169974af532..ccce7bebca6 100644 --- a/xlators/features/snapview-client/src/snapview-client.h +++ b/xlators/features/snapview-client/src/snapview-client.h @@ -1,11 +1,11 @@ - /* - Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com> - This file is part of GlusterFS. +/* + Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #ifndef __SNAP_VIEW_CLIENT_H__ #define __SNAP_VIEW_CLIENT_H__ @@ -18,85 +18,82 @@ #include "snapview-client-mem-types.h" struct __svc_local { - loc_t loc; - xlator_t *subvolume; - fd_t *fd; - void *cookie; - dict_t *xdata; - uint16_t revalidate; + loc_t loc; + xlator_t *subvolume; + fd_t *fd; + void *cookie; + dict_t *xdata; + uint16_t revalidate; }; typedef struct __svc_local svc_local_t; -#define SVC_STACK_UNWIND(fop, frame, params ...) do { \ - svc_local_t *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - svc_local_free (__local); \ - } while (0) +#define SVC_STACK_UNWIND(fop, frame, params...) \ + do { \ + svc_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + svc_local_free(__local); \ + } while (0) -#define SVC_ENTRY_POINT_SET(this, xdata, op_ret, op_errno, new_xdata, \ - priv, ret, label) \ - do { \ - if (!xdata) { \ - xdata = new_xdata = dict_new (); \ - if (!new_xdata) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "failed to allocate new dict"); \ - op_ret = -1; \ - op_errno = ENOMEM; \ - goto label; \ - } \ - } \ - ret = dict_set_str (xdata, "entry-point", "true"); \ - if (ret) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "failed to set dict"); \ - op_ret = -1; \ - op_errno = ENOMEM; \ - goto label; \ - } \ - } while (0); +#define SVC_ENTRY_POINT_SET(this, xdata, op_ret, op_errno, new_xdata, priv, \ + ret, label) \ + do { \ + if (!xdata) { \ + xdata = new_xdata = dict_new(); \ + if (!new_xdata) { \ + gf_log(this->name, GF_LOG_ERROR, \ + "failed to allocate new dict"); \ + op_ret = -1; \ + op_errno = ENOMEM; \ + goto label; \ + } \ + } \ + ret = dict_set_str(xdata, "entry-point", "true"); \ + if (ret) { \ + gf_log(this->name, GF_LOG_ERROR, "failed to set dict"); \ + op_ret = -1; \ + op_errno = ENOMEM; \ + goto label; \ + } \ + } while (0); -#define SVC_GET_SUBVOL_FROM_CTX(this, op_ret, op_errno, inode_type, ret, \ - inode, subvolume, label) \ - do { \ - ret = svc_inode_ctx_get (this, inode, &inode_type); \ - if (ret < 0) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "inode context not found for gfid %s", \ - uuid_utoa (inode->gfid)); \ - op_ret = -1; \ - op_errno = EINVAL; \ - goto label; \ - } \ - \ - subvolume = svc_get_subvolume (this, inode_type); \ - } while (0); +#define SVC_GET_SUBVOL_FROM_CTX(this, op_ret, op_errno, inode_type, ret, \ + inode, subvolume, label) \ + do { \ + ret = svc_inode_ctx_get(this, inode, &inode_type); \ + if (ret < 0) { \ + gf_log(this->name, GF_LOG_ERROR, \ + "inode context not found for gfid %s", \ + uuid_utoa(inode->gfid)); \ + op_ret = -1; \ + op_errno = EINVAL; \ + goto label; \ + } \ + \ + subvolume = svc_get_subvolume(this, inode_type); \ + } while (0); struct svc_private { - char *path; - char *special_dir; /* needed for samba */ - gf_boolean_t show_entry_point; + char *path; + char *special_dir; /* needed for samba */ + gf_boolean_t show_entry_point; }; typedef struct svc_private svc_private_t; struct svc_fd { - off_t last_offset; - gf_boolean_t entry_point_handled; - gf_boolean_t special_dir; + off_t last_offset; + gf_boolean_t entry_point_handled; + gf_boolean_t special_dir; }; typedef struct svc_fd svc_fd_t; -typedef enum { - NORMAL_INODE = 1, - VIRTUAL_INODE -} inode_type_t; +typedef enum { NORMAL_INODE = 1, VIRTUAL_INODE } inode_type_t; int -gf_svc_special_dir_revalidate_lookup (call_frame_t *frame, xlator_t *this, - dict_t *xdata); +gf_svc_special_dir_revalidate_lookup(call_frame_t *frame, xlator_t *this, + dict_t *xdata); #endif /* __SNAP_VIEW_CLIENT_H__ */ diff --git a/xlators/features/snapview-server/src/snapview-server-mem-types.h b/xlators/features/snapview-server/src/snapview-server-mem-types.h index a8035165000..504c7969bdc 100644 --- a/xlators/features/snapview-server/src/snapview-server-mem-types.h +++ b/xlators/features/snapview-server/src/snapview-server-mem-types.h @@ -14,13 +14,12 @@ #include "mem-types.h" enum snapview_mem_types { - gf_svs_mt_priv_t = gf_common_mt_end + 1, - gf_svs_mt_svs_inode_t, - gf_svs_mt_dirents_t, - gf_svs_mt_svs_fd_t, - gf_svs_mt_snaplist_t, - gf_svs_mt_end + gf_svs_mt_priv_t = gf_common_mt_end + 1, + gf_svs_mt_svs_inode_t, + gf_svs_mt_dirents_t, + gf_svs_mt_svs_fd_t, + gf_svs_mt_snaplist_t, + gf_svs_mt_end }; #endif - diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h index d024a77011b..e07d3bcad0c 100644 --- a/xlators/features/snapview-server/src/snapview-server.h +++ b/xlators/features/snapview-server/src/snapview-server.h @@ -34,219 +34,216 @@ #include "protocol-common.h" #include "xdr-generic.h" - #define DEFAULT_SVD_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" -#define SNAP_VIEW_MAX_GLFS_T 256 -#define SNAP_VIEW_MAX_GLFS_FDS 1024 -#define SNAP_VIEW_MAX_GLFS_OBJ_HANDLES 1024 - -#define SVS_STACK_DESTROY(_frame) \ - do { \ - ((call_frame_t *)_frame)->local = NULL; \ - STACK_DESTROY (((call_frame_t *)_frame)->root); \ - } while (0) - -#define SVS_CHECK_VALID_SNAPSHOT_HANDLE(fs, this) \ - do { \ - svs_private_t *_private = NULL; \ - _private = this->private; \ - int i = 0; \ - gf_boolean_t found = _gf_false; \ - glfs_t *tmp_fs = NULL; \ - LOCK (&_private->snaplist_lock); \ - { \ - for (i = 0; i < _private->num_snaps; i++) { \ - tmp_fs = _private->dirents[i].fs; \ - gf_log (this->name, GF_LOG_DEBUG, \ - "dirent->fs: %p", tmp_fs); \ - if (tmp_fs && fs && (tmp_fs == fs)) { \ - found = _gf_true; \ - break; \ - } \ - } \ - } \ - UNLOCK (&_private->snaplist_lock); \ - \ - if (!found) { \ - gf_log (this->name, GF_LOG_WARNING, "failed to" \ - " find the fs instance %p", fs); \ - fs = NULL; \ - } \ - } while (0) - -#define SVS_GET_INODE_CTX_INFO(inode_ctx, fs, object, this, loc, ret, \ - op_errno, label) \ - do { \ - fs = inode_ctx->fs; \ - object = inode_ctx->object; \ - SVS_CHECK_VALID_SNAPSHOT_HANDLE (fs, this); \ - if (!fs) \ - object = NULL; \ - \ - if (!fs || !object) { \ - int32_t tmp = -1; \ - char tmp_uuid[64]; \ - \ - tmp = svs_get_handle (this, loc, inode_ctx, \ - &op_errno); \ - if (tmp) { \ - gf_log (this->name, GF_LOG_ERROR, \ - "failed to get the handle for %s " \ - "(gfid: %s)", loc->path, \ - uuid_utoa_r (loc->inode->gfid, \ - tmp_uuid)); \ - ret = -1; \ - goto label; \ - } \ - \ - fs = inode_ctx->fs; \ - object = inode_ctx->object; \ - } \ - } while(0); - -#define SVS_STRDUP(dst, src) \ - do { \ - if (dst && strcmp (src, dst)) { \ - GF_FREE (dst); \ - dst = NULL; \ - } \ - \ - if (!dst) \ - dst = gf_strdup (src); \ - } while (0) +#define SNAP_VIEW_MAX_GLFS_T 256 +#define SNAP_VIEW_MAX_GLFS_FDS 1024 +#define SNAP_VIEW_MAX_GLFS_OBJ_HANDLES 1024 + +#define SVS_STACK_DESTROY(_frame) \ + do { \ + ((call_frame_t *)_frame)->local = NULL; \ + STACK_DESTROY(((call_frame_t *)_frame)->root); \ + } while (0) + +#define SVS_CHECK_VALID_SNAPSHOT_HANDLE(fs, this) \ + do { \ + svs_private_t *_private = NULL; \ + _private = this->private; \ + int i = 0; \ + gf_boolean_t found = _gf_false; \ + glfs_t *tmp_fs = NULL; \ + LOCK(&_private->snaplist_lock); \ + { \ + for (i = 0; i < _private->num_snaps; i++) { \ + tmp_fs = _private->dirents[i].fs; \ + gf_log(this->name, GF_LOG_DEBUG, "dirent->fs: %p", tmp_fs); \ + if (tmp_fs && fs && (tmp_fs == fs)) { \ + found = _gf_true; \ + break; \ + } \ + } \ + } \ + UNLOCK(&_private->snaplist_lock); \ + \ + if (!found) { \ + gf_log(this->name, GF_LOG_WARNING, \ + "failed to" \ + " find the fs instance %p", \ + fs); \ + fs = NULL; \ + } \ + } while (0) + +#define SVS_GET_INODE_CTX_INFO(inode_ctx, fs, object, this, loc, ret, \ + op_errno, label) \ + do { \ + fs = inode_ctx->fs; \ + object = inode_ctx->object; \ + SVS_CHECK_VALID_SNAPSHOT_HANDLE(fs, this); \ + if (!fs) \ + object = NULL; \ + \ + if (!fs || !object) { \ + int32_t tmp = -1; \ + char tmp_uuid[64]; \ + \ + tmp = svs_get_handle(this, loc, inode_ctx, &op_errno); \ + if (tmp) { \ + gf_log(this->name, GF_LOG_ERROR, \ + "failed to get the handle for %s " \ + "(gfid: %s)", \ + loc->path, uuid_utoa_r(loc->inode->gfid, tmp_uuid)); \ + ret = -1; \ + goto label; \ + } \ + \ + fs = inode_ctx->fs; \ + object = inode_ctx->object; \ + } \ + } while (0); + +#define SVS_STRDUP(dst, src) \ + do { \ + if (dst && strcmp(src, dst)) { \ + GF_FREE(dst); \ + dst = NULL; \ + } \ + \ + if (!dst) \ + dst = gf_strdup(src); \ + } while (0) int -svs_mgmt_submit_request (void *req, call_frame_t *frame, - glusterfs_ctx_t *ctx, - rpc_clnt_prog_t *prog, int procnum, - fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); +svs_mgmt_submit_request(void *req, call_frame_t *frame, glusterfs_ctx_t *ctx, + rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, + xdrproc_t xdrproc); int -svs_get_snapshot_list (xlator_t *this); +svs_get_snapshot_list(xlator_t *this); int -mgmt_get_snapinfo_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe); +mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count, + void *myframe); typedef enum { - SNAP_VIEW_ENTRY_POINT_INODE = 0, - SNAP_VIEW_SNAPSHOT_INODE, - SNAP_VIEW_VIRTUAL_INODE + SNAP_VIEW_ENTRY_POINT_INODE = 0, + SNAP_VIEW_SNAPSHOT_INODE, + SNAP_VIEW_VIRTUAL_INODE } inode_type_t; struct svs_inode { - glfs_t *fs; - glfs_object_t *object; - inode_type_t type; - - /* used only for entry point directory where gfid of the directory - from where the entry point was entered is saved. - */ - uuid_t pargfid; - - /* This is used to generate gfid for all sub files/dirs under this - * snapshot - */ - char *snapname; - struct iatt buf; + glfs_t *fs; + glfs_object_t *object; + inode_type_t type; + + /* used only for entry point directory where gfid of the directory + from where the entry point was entered is saved. + */ + uuid_t pargfid; + + /* This is used to generate gfid for all sub files/dirs under this + * snapshot + */ + char *snapname; + struct iatt buf; }; typedef struct svs_inode svs_inode_t; struct svs_fd { - glfs_fd_t *fd; + glfs_fd_t *fd; }; typedef struct svs_fd svs_fd_t; struct snap_dirent { - char name[NAME_MAX]; - char uuid[UUID_CANONICAL_FORM_LEN + 1]; - char snap_volname[NAME_MAX]; - glfs_t *fs; + char name[NAME_MAX]; + char uuid[UUID_CANONICAL_FORM_LEN + 1]; + char snap_volname[NAME_MAX]; + glfs_t *fs; }; typedef struct snap_dirent snap_dirent_t; struct svs_private { - snap_dirent_t *dirents; - int num_snaps; - char *volname; - struct list_head snaplist; - gf_lock_t snaplist_lock; - struct rpc_clnt *rpc; + snap_dirent_t *dirents; + int num_snaps; + char *volname; + struct list_head snaplist; + gf_lock_t snaplist_lock; + struct rpc_clnt *rpc; }; typedef struct svs_private svs_private_t; int -__svs_inode_ctx_set (xlator_t *this, inode_t *inode, svs_inode_t *svs_inode); +__svs_inode_ctx_set(xlator_t *this, inode_t *inode, svs_inode_t *svs_inode); svs_inode_t * -__svs_inode_ctx_get (xlator_t *this, inode_t *inode); +__svs_inode_ctx_get(xlator_t *this, inode_t *inode); svs_inode_t * -svs_inode_ctx_get (xlator_t *this, inode_t *inode); +svs_inode_ctx_get(xlator_t *this, inode_t *inode); int32_t -svs_inode_ctx_set (xlator_t *this, inode_t *inode, svs_inode_t *svs_inode); +svs_inode_ctx_set(xlator_t *this, inode_t *inode, svs_inode_t *svs_inode); svs_inode_t * -svs_inode_ctx_get_or_new (xlator_t *this, inode_t *inode); +svs_inode_ctx_get_or_new(xlator_t *this, inode_t *inode); int -__svs_fd_ctx_set (xlator_t *this, fd_t *fd, svs_fd_t *svs_fd); +__svs_fd_ctx_set(xlator_t *this, fd_t *fd, svs_fd_t *svs_fd); svs_fd_t * -__svs_fd_ctx_get (xlator_t *this, fd_t *fd); +__svs_fd_ctx_get(xlator_t *this, fd_t *fd); svs_fd_t * -svs_fd_ctx_get (xlator_t *this, fd_t *fd); +svs_fd_ctx_get(xlator_t *this, fd_t *fd); int32_t -svs_fd_ctx_set (xlator_t *this, fd_t *fd, svs_fd_t *svs_fd); +svs_fd_ctx_set(xlator_t *this, fd_t *fd, svs_fd_t *svs_fd); svs_fd_t * -__svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd); +__svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd); svs_fd_t * -svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd); +svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd); int -svs_uuid_generate (xlator_t *this, uuid_t gfid, char *snapname, - uuid_t origin_gfid); +svs_uuid_generate(xlator_t *this, uuid_t gfid, char *snapname, + uuid_t origin_gfid); void -svs_fill_ino_from_gfid (struct iatt *buf); +svs_fill_ino_from_gfid(struct iatt *buf); void -svs_iatt_fill (uuid_t gfid, struct iatt *buf); +svs_iatt_fill(uuid_t gfid, struct iatt *buf); snap_dirent_t * -svs_get_latest_snap_entry (xlator_t *this); +svs_get_latest_snap_entry(xlator_t *this); glfs_t * -svs_get_latest_snapshot (xlator_t *this); +svs_get_latest_snapshot(xlator_t *this); glfs_t * -svs_initialise_snapshot_volume (xlator_t *this, const char *name, - int32_t *op_errno); +svs_initialise_snapshot_volume(xlator_t *this, const char *name, + int32_t *op_errno); glfs_t * -__svs_initialise_snapshot_volume (xlator_t *this, const char *name, - int32_t *op_errno); +__svs_initialise_snapshot_volume(xlator_t *this, const char *name, + int32_t *op_errno); snap_dirent_t * -__svs_get_snap_dirent (xlator_t *this, const char *name); +__svs_get_snap_dirent(xlator_t *this, const char *name); int -svs_mgmt_init (xlator_t *this); +svs_mgmt_init(xlator_t *this); int32_t -svs_get_handle (xlator_t *this, loc_t *loc, svs_inode_t *inode_ctx, - int32_t *op_errno); +svs_get_handle(xlator_t *this, loc_t *loc, svs_inode_t *inode_ctx, + int32_t *op_errno); glfs_t * -svs_inode_glfs_mapping (xlator_t *this, inode_t *inode); +svs_inode_glfs_mapping(xlator_t *this, inode_t *inode); glfs_t * -svs_inode_ctx_glfs_mapping (xlator_t *this, svs_inode_t *inode_ctx); +svs_inode_ctx_glfs_mapping(xlator_t *this, svs_inode_t *inode_ctx); #endif /* __SNAP_VIEW_H__ */ diff --git a/xlators/features/thin-arbiter/src/thin-arbiter-mem-types.h b/xlators/features/thin-arbiter/src/thin-arbiter-mem-types.h index d7288192d32..79b5ce0eee3 100644 --- a/xlators/features/thin-arbiter/src/thin-arbiter-mem-types.h +++ b/xlators/features/thin-arbiter/src/thin-arbiter-mem-types.h @@ -12,8 +12,8 @@ #include "mem-types.h" typedef enum gf_ta_mem_types_ { - gf_ta_mt_local_t = gf_common_mt_end + 1, - gf_ta_mt_char, - gf_ta_mt_end + gf_ta_mt_local_t = gf_common_mt_end + 1, + gf_ta_mt_char, + gf_ta_mt_end } gf_ta_mem_types_t; #endif diff --git a/xlators/features/thin-arbiter/src/thin-arbiter-messages.h b/xlators/features/thin-arbiter/src/thin-arbiter-messages.h index 524e4d3aef8..f49b3eedadf 100644 --- a/xlators/features/thin-arbiter/src/thin-arbiter-messages.h +++ b/xlators/features/thin-arbiter/src/thin-arbiter-messages.h @@ -23,8 +23,6 @@ * glfs-message-id.h. */ -GLFS_MSGID(TA, - TA_MSG_INVALID_FOP -); +GLFS_MSGID(TA, TA_MSG_INVALID_FOP); #endif /* !_TA_MESSAGES_H_ */ diff --git a/xlators/features/thin-arbiter/src/thin-arbiter.h b/xlators/features/thin-arbiter/src/thin-arbiter.h index 996f4441fdd..af3d4b1af92 100644 --- a/xlators/features/thin-arbiter/src/thin-arbiter.h +++ b/xlators/features/thin-arbiter/src/thin-arbiter.h @@ -21,43 +21,39 @@ #define THIN_ARBITER_SOURCE_XATTR "trusted.ta.source" #define THIN_ARBITER_SOURCE_SIZE 2 -#define TA_FAILED_FOP(fop, frame, op_errno) \ - do { \ - default_##fop##_failure_cbk(frame, op_errno); \ +#define TA_FAILED_FOP(fop, frame, op_errno) \ + do { \ + default_##fop##_failure_cbk(frame, op_errno); \ } while (0) -#define TA_STACK_UNWIND(fop, frame, op_ret, op_errno, params ...)\ - do { \ - ta_fop_t *__local = NULL; \ - int32_t __op_ret = 0; \ - int32_t __op_errno = 0; \ - \ - __local = frame->local; \ - __op_ret = op_ret; \ - __op_errno = op_errno; \ - if (__local) { \ - ta_release_fop (__local); \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, __op_ret, \ - __op_errno, params); \ - \ +#define TA_STACK_UNWIND(fop, frame, op_ret, op_errno, params...) \ + do { \ + ta_fop_t *__local = NULL; \ + int32_t __op_ret = 0; \ + int32_t __op_errno = 0; \ + \ + __local = frame->local; \ + __op_ret = op_ret; \ + __op_errno = op_errno; \ + if (__local) { \ + ta_release_fop(__local); \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, __op_ret, __op_errno, params); \ + \ } while (0) struct _ta_fop; typedef struct _ta_fop ta_fop_t; struct _ta_fop { - gf_xattrop_flags_t xattrop_flags; - loc_t loc; - fd_t *fd; - dict_t *dict; - dict_t *brick_xattr; - int32_t on_disk[2]; - int32_t idx; + gf_xattrop_flags_t xattrop_flags; + loc_t loc; + fd_t *fd; + dict_t *dict; + dict_t *brick_xattr; + int32_t on_disk[2]; + int32_t idx; }; - - - #endif /* _THIN_ARBITER_H */ diff --git a/xlators/features/trash/src/trash-mem-types.h b/xlators/features/trash/src/trash-mem-types.h index b7cad3ce3a9..133f2edf99b 100644 --- a/xlators/features/trash/src/trash-mem-types.h +++ b/xlators/features/trash/src/trash-mem-types.h @@ -13,11 +13,10 @@ #include "mem-types.h" enum gf_trash_mem_types_ { - gf_trash_mt_trash_private_t = gf_common_mt_end + 1, - gf_trash_mt_char, - gf_trash_mt_uuid, - gf_trash_mt_trash_elim_path, - gf_trash_mt_end + gf_trash_mt_trash_private_t = gf_common_mt_end + 1, + gf_trash_mt_char, + gf_trash_mt_uuid, + gf_trash_mt_trash_elim_path, + gf_trash_mt_end }; #endif - diff --git a/xlators/features/trash/src/trash.h b/xlators/features/trash/src/trash.h index 7dd83afc09a..675f9f97350 100644 --- a/xlators/features/trash/src/trash.h +++ b/xlators/features/trash/src/trash.h @@ -21,7 +21,7 @@ #include <libgen.h> #ifndef GF_BLOCK_READV_SIZE -#define GF_BLOCK_READV_SIZE (128 * GF_UNIT_KB) +#define GF_BLOCK_READV_SIZE (128 * GF_UNIT_KB) #endif #ifndef GF_DEFAULT_MAX_FILE_SIZE @@ -29,66 +29,69 @@ #endif struct trash_struct { - fd_t *fd; /* for the fd of existing file */ - fd_t *newfd; /* for the newly created file */ - loc_t loc; /* to store the location of the existing file */ - loc_t newloc; /* to store the location for the new file */ - size_t fsize; /* for keeping the size of existing file */ - off_t cur_offset; /* current offset for read and write ops */ - off_t fop_offset; /* original offset received with the fop */ - pid_t pid; - char origpath[PATH_MAX]; - char newpath[PATH_MAX]; - int32_t loop_count; - gf_boolean_t is_set_pid; - struct iatt preparent; - struct iatt postparent; - gf_boolean_t ctr_link_count_req; + fd_t *fd; /* for the fd of existing file */ + fd_t *newfd; /* for the newly created file */ + loc_t loc; /* to store the location of the existing file */ + loc_t newloc; /* to store the location for the new file */ + size_t fsize; /* for keeping the size of existing file */ + off_t cur_offset; /* current offset for read and write ops */ + off_t fop_offset; /* original offset received with the fop */ + pid_t pid; + char origpath[PATH_MAX]; + char newpath[PATH_MAX]; + int32_t loop_count; + gf_boolean_t is_set_pid; + struct iatt preparent; + struct iatt postparent; + gf_boolean_t ctr_link_count_req; }; typedef struct trash_struct trash_local_t; struct _trash_elim_path { - struct _trash_elim_path *next; - char *path; + struct _trash_elim_path *next; + char *path; }; typedef struct _trash_elim_path trash_elim_path; struct trash_priv { - char *oldtrash_dir; - char *newtrash_dir; - char *brick_path; - trash_elim_path *eliminate; - size_t max_trash_file_size; - gf_boolean_t state; - gf_boolean_t internal; - inode_t *trash_inode; - inode_table_t *trash_itable; + char *oldtrash_dir; + char *newtrash_dir; + char *brick_path; + trash_elim_path *eliminate; + size_t max_trash_file_size; + gf_boolean_t state; + gf_boolean_t internal; + inode_t *trash_inode; + inode_table_t *trash_itable; }; typedef struct trash_priv trash_private_t; -#define TRASH_SET_PID(frame, local) do { \ - GF_ASSERT (!local->is_set_pid); \ - if (!local->is_set_pid) { \ - local->pid = frame->root->pid; \ - frame->root->pid = GF_SERVER_PID_TRASH; \ - local->is_set_pid = _gf_true; \ - } \ -} while (0) +#define TRASH_SET_PID(frame, local) \ + do { \ + GF_ASSERT(!local->is_set_pid); \ + if (!local->is_set_pid) { \ + local->pid = frame->root->pid; \ + frame->root->pid = GF_SERVER_PID_TRASH; \ + local->is_set_pid = _gf_true; \ + } \ + } while (0) -#define TRASH_UNSET_PID(frame, local) do { \ - GF_ASSERT (local->is_set_pid); \ - if (local->is_set_pid) { \ - frame->root->pid = local->pid; \ - local->is_set_pid = _gf_false; \ - } \ -} while (0) +#define TRASH_UNSET_PID(frame, local) \ + do { \ + GF_ASSERT(local->is_set_pid); \ + if (local->is_set_pid) { \ + frame->root->pid = local->pid; \ + local->is_set_pid = _gf_false; \ + } \ + } while (0) -#define TRASH_STACK_UNWIND(op, frame, params ...) do { \ - trash_local_t *__local = NULL; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_UNWIND_STRICT (op, frame, params); \ - trash_local_wipe (__local); \ - } while (0) +#define TRASH_STACK_UNWIND(op, frame, params...) \ + do { \ + trash_local_t *__local = NULL; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_UNWIND_STRICT(op, frame, params); \ + trash_local_wipe(__local); \ + } while (0) #endif /* __TRASH_H__ */ diff --git a/xlators/features/upcall/src/upcall-cache-invalidation.h b/xlators/features/upcall/src/upcall-cache-invalidation.h index 62b458fa295..e509a89acd5 100644 --- a/xlators/features/upcall/src/upcall-cache-invalidation.h +++ b/xlators/features/upcall/src/upcall-cache-invalidation.h @@ -16,7 +16,9 @@ #define CACHE_INVALIDATION_TIMEOUT "60" /* xlator options */ -gf_boolean_t is_cache_invalidation_enabled(xlator_t *this); -int32_t get_cache_invalidation_timeout(xlator_t *this); +gf_boolean_t +is_cache_invalidation_enabled(xlator_t *this); +int32_t +get_cache_invalidation_timeout(xlator_t *this); #endif /* __UPCALL_CACHE_INVALIDATION_H__ */ diff --git a/xlators/features/upcall/src/upcall-mem-types.h b/xlators/features/upcall/src/upcall-mem-types.h index 55793ec65ca..079677ff79c 100644 --- a/xlators/features/upcall/src/upcall-mem-types.h +++ b/xlators/features/upcall/src/upcall-mem-types.h @@ -14,11 +14,10 @@ #include "mem-types.h" enum gf_upcall_mem_types_ { - gf_upcall_mt_conf_t = gf_common_mt_end + 1, - gf_upcall_mt_private_t, - gf_upcall_mt_upcall_inode_ctx_t, - gf_upcall_mt_upcall_client_entry_t, - gf_upcall_mt_end + gf_upcall_mt_conf_t = gf_common_mt_end + 1, + gf_upcall_mt_private_t, + gf_upcall_mt_upcall_inode_ctx_t, + gf_upcall_mt_upcall_client_entry_t, + gf_upcall_mt_end }; #endif - diff --git a/xlators/features/upcall/src/upcall-messages.h b/xlators/features/upcall/src/upcall-messages.h index b60a3ed7371..db5cac1e07d 100644 --- a/xlators/features/upcall/src/upcall-messages.h +++ b/xlators/features/upcall/src/upcall-messages.h @@ -23,10 +23,7 @@ * glfs-message-id.h. */ -GLFS_MSGID(UPCALL, - UPCALL_MSG_NO_MEMORY, - UPCALL_MSG_INTERNAL_ERROR, - UPCALL_MSG_NOTIFY_FAILED -); +GLFS_MSGID(UPCALL, UPCALL_MSG_NO_MEMORY, UPCALL_MSG_INTERNAL_ERROR, + UPCALL_MSG_NOTIFY_FAILED); #endif /* !_UPCALL_MESSAGES_H_ */ diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h index 3e0d96cd001..3797e62aac3 100644 --- a/xlators/features/upcall/src/upcall.h +++ b/xlators/features/upcall/src/upcall.h @@ -17,123 +17,143 @@ #include "upcall-cache-invalidation.h" #include "upcall-utils.h" -#define EXIT_IF_UPCALL_OFF(this, label) do { \ - if (!is_upcall_enabled(this)) \ - goto label; \ -} while (0) - -#define UPCALL_STACK_UNWIND(fop, frame, params ...) do { \ - upcall_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - if (frame) { \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - upcall_local_wipe (__xl, __local); \ -} while (0) - -#define UPCALL_STACK_DESTROY(frame) do { \ - upcall_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - upcall_local_wipe (__xl, __local); \ -} while (0) +#define EXIT_IF_UPCALL_OFF(this, label) \ + do { \ + if (!is_upcall_enabled(this)) \ + goto label; \ + } while (0) + +#define UPCALL_STACK_UNWIND(fop, frame, params...) \ + do { \ + upcall_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + if (frame) { \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + upcall_local_wipe(__xl, __local); \ + } while (0) + +#define UPCALL_STACK_DESTROY(frame) \ + do { \ + upcall_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + upcall_local_wipe(__xl, __local); \ + } while (0) struct _upcall_private { - gf_boolean_t cache_invalidation_enabled; - int32_t cache_invalidation_timeout; - struct list_head inode_ctx_list; - gf_lock_t inode_ctx_lk; - gf_boolean_t reaper_init_done; - pthread_t reaper_thr; - int32_t fini; - dict_t *xattrs; /* list of xattrs registered by clients - for receiving invalidation */ + gf_boolean_t cache_invalidation_enabled; + int32_t cache_invalidation_timeout; + struct list_head inode_ctx_list; + gf_lock_t inode_ctx_lk; + gf_boolean_t reaper_init_done; + pthread_t reaper_thr; + int32_t fini; + dict_t *xattrs; /* list of xattrs registered by clients + for receiving invalidation */ }; typedef struct _upcall_private upcall_private_t; struct _upcall_client { - struct list_head client_list; - /* strdup to store client_uid, strdup. Free it explicitly */ - char *client_uid; - time_t access_time; /* time last accessed */ - /* the amount of time which client can cache this entry */ - uint32_t expire_time_attr; + struct list_head client_list; + /* strdup to store client_uid, strdup. Free it explicitly */ + char *client_uid; + time_t access_time; /* time last accessed */ + /* the amount of time which client can cache this entry */ + uint32_t expire_time_attr; }; typedef struct _upcall_client upcall_client_t; /* Upcall entries are maintained in inode_ctx */ struct _upcall_inode_ctx { - struct list_head inode_ctx_list; - struct list_head client_list; - pthread_mutex_t client_list_lock; /* mutex for clients list - of this upcall entry */ - int destroy; - uuid_t gfid; /* gfid of the entry */ + struct list_head inode_ctx_list; + struct list_head client_list; + pthread_mutex_t client_list_lock; /* mutex for clients list + of this upcall entry */ + int destroy; + uuid_t gfid; /* gfid of the entry */ }; typedef struct _upcall_inode_ctx upcall_inode_ctx_t; struct upcall_local { - /* XXX: need to check if we can store - * pointers in 'local' which may get freed - * in future by other thread - */ - inode_t *inode; - loc_t rename_oldloc; - loc_t loc; /* required for stat in *xattr_cbk */ - fd_t *fd; /* required for fstat in *xattr_cbk */ - dict_t *xattr; + /* XXX: need to check if we can store + * pointers in 'local' which may get freed + * in future by other thread + */ + inode_t *inode; + loc_t rename_oldloc; + loc_t loc; /* required for stat in *xattr_cbk */ + fd_t *fd; /* required for fstat in *xattr_cbk */ + dict_t *xattr; }; typedef struct upcall_local upcall_local_t; -void upcall_local_wipe (xlator_t *this, upcall_local_t *local); -upcall_local_t *upcall_local_init (call_frame_t *frame, xlator_t *this, - loc_t *loc, fd_t *fd, inode_t *inode, - dict_t *xattr); - -upcall_client_t *add_upcall_client (call_frame_t *frame, client_t *client, - upcall_inode_ctx_t *up_inode_ctx); -upcall_client_t *__add_upcall_client (call_frame_t *frame, client_t *client, - upcall_inode_ctx_t *up_inode_ctx); -upcall_client_t *__get_upcall_client (call_frame_t *frame, client_t *client, - upcall_inode_ctx_t *up_inode_ctx); -int __upcall_cleanup_client_entry (upcall_client_t *up_client); -int upcall_cleanup_expired_clients (xlator_t *this, - upcall_inode_ctx_t *up_inode_ctx); - -int __upcall_inode_ctx_set (inode_t *inode, xlator_t *this); -upcall_inode_ctx_t *__upcall_inode_ctx_get (inode_t *inode, xlator_t *this); -upcall_inode_ctx_t *upcall_inode_ctx_get (inode_t *inode, xlator_t *this); -int upcall_cleanup_inode_ctx (xlator_t *this, inode_t *inode); -void upcall_cache_forget (xlator_t *this, inode_t *inode, - upcall_inode_ctx_t *up_inode_ctx); - -void *upcall_reaper_thread (void *data); -int upcall_reaper_thread_init (xlator_t *this); +void +upcall_local_wipe(xlator_t *this, upcall_local_t *local); +upcall_local_t * +upcall_local_init(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + inode_t *inode, dict_t *xattr); + +upcall_client_t * +add_upcall_client(call_frame_t *frame, client_t *client, + upcall_inode_ctx_t *up_inode_ctx); +upcall_client_t * +__add_upcall_client(call_frame_t *frame, client_t *client, + upcall_inode_ctx_t *up_inode_ctx); +upcall_client_t * +__get_upcall_client(call_frame_t *frame, client_t *client, + upcall_inode_ctx_t *up_inode_ctx); +int +__upcall_cleanup_client_entry(upcall_client_t *up_client); +int +upcall_cleanup_expired_clients(xlator_t *this, + upcall_inode_ctx_t *up_inode_ctx); + +int +__upcall_inode_ctx_set(inode_t *inode, xlator_t *this); +upcall_inode_ctx_t * +__upcall_inode_ctx_get(inode_t *inode, xlator_t *this); +upcall_inode_ctx_t * +upcall_inode_ctx_get(inode_t *inode, xlator_t *this); +int +upcall_cleanup_inode_ctx(xlator_t *this, inode_t *inode); +void +upcall_cache_forget(xlator_t *this, inode_t *inode, + upcall_inode_ctx_t *up_inode_ctx); + +void * +upcall_reaper_thread(void *data); +int +upcall_reaper_thread_init(xlator_t *this); /* Xlator options */ -gf_boolean_t is_upcall_enabled (xlator_t *this); +gf_boolean_t +is_upcall_enabled(xlator_t *this); /* Cache invalidation specific */ -void upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, - client_t *client, inode_t *inode, - uint32_t flags, struct iatt *stbuf, - struct iatt *p_stbuf, - struct iatt *oldp_stbuf, dict_t *xattr); -void upcall_client_cache_invalidate (xlator_t *xl, uuid_t gfid, - upcall_client_t *up_client_entry, - uint32_t flags, struct iatt *stbuf, - struct iatt *p_stbuf, - struct iatt *oldp_stbuf, dict_t *xattr); - -int up_filter_xattr (dict_t *xattr, dict_t *regd_xattrs); - -int up_compare_afr_xattr (dict_t *d, char *k, data_t *v, void *tmp); - -gf_boolean_t up_invalidate_needed (dict_t *xattrs); +void +upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client, + inode_t *inode, uint32_t flags, struct iatt *stbuf, + struct iatt *p_stbuf, struct iatt *oldp_stbuf, + dict_t *xattr); +void +upcall_client_cache_invalidate(xlator_t *xl, uuid_t gfid, + upcall_client_t *up_client_entry, uint32_t flags, + struct iatt *stbuf, struct iatt *p_stbuf, + struct iatt *oldp_stbuf, dict_t *xattr); + +int +up_filter_xattr(dict_t *xattr, dict_t *regd_xattrs); + +int +up_compare_afr_xattr(dict_t *d, char *k, data_t *v, void *tmp); + +gf_boolean_t +up_invalidate_needed(dict_t *xattrs); #endif /* __UPCALL_H__ */ diff --git a/xlators/features/utime/src/utime-helpers.h b/xlators/features/utime/src/utime-helpers.h index f526aecb063..4efe75619eb 100644 --- a/xlators/features/utime/src/utime-helpers.h +++ b/xlators/features/utime/src/utime-helpers.h @@ -17,7 +17,7 @@ #include <time.h> void -gl_timespec_get (struct timespec *ts); +gl_timespec_get(struct timespec *ts); void utime_update_attribute_flags(call_frame_t *frame, glusterfs_fop_t fop); diff --git a/xlators/lib/src/libxlator.h b/xlators/lib/src/libxlator.h index 0825ddb0f70..80224f9df38 100644 --- a/xlators/lib/src/libxlator.h +++ b/xlators/lib/src/libxlator.h @@ -10,7 +10,6 @@ #ifndef _LIBXLATOR_H #define _LIBXLATOR_H - #include "xlator.h" #include "logging.h" #include "defaults.h" @@ -18,29 +17,26 @@ #include "compat.h" #include "compat-errno.h" - #define MARKER_XATTR_PREFIX "trusted.glusterfs" -#define XTIME "xtime" -#define VOLUME_MARK "volume-mark" +#define XTIME "xtime" +#define VOLUME_MARK "volume-mark" #define GF_XATTR_MARKER_KEY MARKER_XATTR_PREFIX "." VOLUME_MARK #define UUID_SIZE 36 -#define MARKER_UUID_TYPE 1 -#define MARKER_XTIME_TYPE 2 - -typedef int32_t (*xlator_specf_unwind_t) (call_frame_t *frame, - int op_ret, int op_errno, - dict_t *dict, dict_t *xdata); +#define MARKER_UUID_TYPE 1 +#define MARKER_XTIME_TYPE 2 +typedef int32_t (*xlator_specf_unwind_t)(call_frame_t *frame, int op_ret, + int op_errno, dict_t *dict, + dict_t *xdata); struct volume_mark { - uint8_t major; - uint8_t minor; - uint8_t uuid[16]; - uint8_t retval; - uint32_t sec; - uint32_t usec; -}__attribute__ ((__packed__)); - + uint8_t major; + uint8_t minor; + uint8_t uuid[16]; + uint8_t retval; + uint32_t sec; + uint32_t usec; +} __attribute__((__packed__)); /* * The enumerated type here @@ -92,58 +88,58 @@ struct volume_mark { */ typedef enum { - MCNT_FOUND, - MCNT_NOTFOUND, - MCNT_ENODATA, - MCNT_ENOTCONN, - MCNT_ENOENT, - MCNT_EOTHER, - MCNT_MAX + MCNT_FOUND, + MCNT_NOTFOUND, + MCNT_ENODATA, + MCNT_ENOTCONN, + MCNT_ENOENT, + MCNT_EOTHER, + MCNT_MAX } marker_result_idx_t; extern int marker_xtime_default_gauge[]; extern int marker_uuid_default_gauge[]; struct marker_str { - struct volume_mark *volmark; - data_t *data; - - uint32_t host_timebuf[2]; - uint32_t net_timebuf[2]; - int32_t call_count; - int gauge[MCNT_MAX]; - int count[MCNT_MAX]; - - xlator_specf_unwind_t xl_specf_unwind; - void *xl_local; - char *vol_uuid; - uint8_t retval; + struct volume_mark *volmark; + data_t *data; + + uint32_t host_timebuf[2]; + uint32_t net_timebuf[2]; + int32_t call_count; + int gauge[MCNT_MAX]; + int count[MCNT_MAX]; + + xlator_specf_unwind_t xl_specf_unwind; + void *xl_local; + char *vol_uuid; + uint8_t retval; }; typedef struct marker_str xl_marker_local_t; int32_t -cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *dict, dict_t *xdata); +cluster_markerxtime_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *dict, dict_t *xdata); int32_t -cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, dict_t *dict, dict_t *xdata); +cluster_markeruuid_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, dict_t *dict, dict_t *xdata); int -cluster_handle_marker_getxattr (call_frame_t *frame, loc_t *loc, - const char *name, char *vol_uuid, - xlator_specf_unwind_t unwind, - int (*populate_args) (call_frame_t *frame, - int type, int *gauge, - xlator_t **subvols)); +cluster_handle_marker_getxattr(call_frame_t *frame, loc_t *loc, + const char *name, char *vol_uuid, + xlator_specf_unwind_t unwind, + int (*populate_args)(call_frame_t *frame, + int type, int *gauge, + xlator_t **subvols)); int -match_uuid_local (const char *name, char *uuid); +match_uuid_local(const char *name, char *uuid); int -gf_get_min_stime (xlator_t *this, dict_t *dst, char *key, data_t *value); +gf_get_min_stime(xlator_t *this, dict_t *dst, char *key, data_t *value); int -gf_get_max_stime (xlator_t *this, dict_t *dst, char *key, data_t *value); +gf_get_max_stime(xlator_t *this, dict_t *dst, char *key, data_t *value); #endif /* !_LIBXLATOR_H */ diff --git a/xlators/meta/src/meta-hooks.h b/xlators/meta/src/meta-hooks.h index bcf3643d223..2ee006f7876 100644 --- a/xlators/meta/src/meta-hooks.h +++ b/xlators/meta/src/meta-hooks.h @@ -12,7 +12,9 @@ #define __META_HOOKS_H #include "xlator.h" -#define DECLARE_HOOK(name) int meta_##name##_hook (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) +#define DECLARE_HOOK(name) \ + int meta_##name##_hook(call_frame_t *frame, xlator_t *this, loc_t *loc, \ + dict_t *xdata) DECLARE_HOOK(root_dir); DECLARE_HOOK(graphs_dir); diff --git a/xlators/meta/src/meta-mem-types.h b/xlators/meta/src/meta-mem-types.h index e8a31856e71..0fdfea4fac6 100644 --- a/xlators/meta/src/meta-mem-types.h +++ b/xlators/meta/src/meta-mem-types.h @@ -14,13 +14,12 @@ #include "mem-types.h" enum gf_meta_mem_types_ { - gf_meta_mt_priv_t = gf_common_mt_end + 1, - gf_meta_mt_fd_t, - gf_meta_mt_fd_data_t, - gf_meta_mt_strfd_t, - gf_meta_mt_dirents_t, - gf_meta_mt_local_t, - gf_meta_mt_end + gf_meta_mt_priv_t = gf_common_mt_end + 1, + gf_meta_mt_fd_t, + gf_meta_mt_fd_data_t, + gf_meta_mt_strfd_t, + gf_meta_mt_dirents_t, + gf_meta_mt_local_t, + gf_meta_mt_end }; #endif - diff --git a/xlators/meta/src/meta.h b/xlators/meta/src/meta.h index d9c56c656ad..10609a9ec05 100644 --- a/xlators/meta/src/meta.h +++ b/xlators/meta/src/meta.h @@ -16,106 +16,125 @@ #define META_ROOT_GFID "ba926388-bb9c-4eec-ad60-79dba4cc083a" -#define IS_META_ROOT_GFID(g) (strcmp (uuid_utoa(g), META_ROOT_GFID) == 0) +#define IS_META_ROOT_GFID(g) (strcmp(uuid_utoa(g), META_ROOT_GFID) == 0) -typedef int (*meta_hook_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata); +typedef int (*meta_hook_t)(call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata); typedef struct { - dict_t *xdata; + dict_t *xdata; } meta_local_t; typedef struct { - char *meta_dir_name; + char *meta_dir_name; } meta_priv_t; struct meta_dirent { - const char *name; - ia_type_t type; - meta_hook_t hook; + const char *name; + ia_type_t type; + meta_hook_t hook; }; -#define DOT_DOTDOT { .name = ".", .type = IA_IFDIR }, { .name = "..", .type = IA_IFDIR } +#define DOT_DOTDOT \ + {.name = ".", .type = IA_IFDIR}, { .name = "..", .type = IA_IFDIR } struct meta_ops { - struct meta_dirent *fixed_dirents; - int (*dir_fill) (xlator_t *this, inode_t *dir, struct meta_dirent **entries); - int (*file_fill) (xlator_t *this, inode_t *file, strfd_t *strfd); - int (*iatt_fill) (xlator_t *this, inode_t *inode, struct iatt *iatt); - int (*link_fill) (xlator_t *this, inode_t *inode, strfd_t *strfd); - int (*file_write) (xlator_t *this, fd_t *fd, struct iovec *iov, int count); - struct xlator_fops fops; - struct xlator_cbks cbks; + struct meta_dirent *fixed_dirents; + int (*dir_fill)(xlator_t *this, inode_t *dir, struct meta_dirent **entries); + int (*file_fill)(xlator_t *this, inode_t *file, strfd_t *strfd); + int (*iatt_fill)(xlator_t *this, inode_t *inode, struct iatt *iatt); + int (*link_fill)(xlator_t *this, inode_t *inode, strfd_t *strfd); + int (*file_write)(xlator_t *this, fd_t *fd, struct iovec *iov, int count); + struct xlator_fops fops; + struct xlator_cbks cbks; }; typedef struct { - char *data; - struct meta_dirent *dirents; - size_t size; + char *data; + struct meta_dirent *dirents; + size_t size; } meta_fd_t; +#define COUNT(arr) (sizeof(arr) / sizeof(arr[0])) -#define COUNT(arr) (sizeof(arr)/sizeof(arr[0])) - -#define META_HOOK(loc) (__is_root_gfid (loc->pargfid) && !strcmp (loc->name, META_PRIV(THIS)->meta_dir_name)) +#define META_HOOK(loc) \ + (__is_root_gfid(loc->pargfid) && \ + !strcmp(loc->name, META_PRIV(THIS)->meta_dir_name)) #define META_PRIV(t) ((meta_priv_t *)(t->private)) -#define META_STACK_UNWIND(fop, frame, params ...) \ - do { \ - meta_local_t *__local = NULL; \ - xlator_t *__this = NULL; \ - if (frame) { \ - __local = frame->local; \ - __this = frame->this; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - meta_local_cleanup (__local, __this); \ - } \ - } while (0) - - -#define META_FOP(i, fop, fr, t, params ...) { \ - struct xlator_fops *_fops = NULL; \ - \ - _fops = meta_fops_get (i, t); \ - \ - _fops->fop (fr, t, params); \ - } while (0) - - -void meta_iatt_fill (struct iatt *iatt, inode_t *inode, ia_type_t type); - -int meta_inode_discover (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata); - -int meta_ops_set (inode_t *inode, xlator_t *this, struct meta_ops *ops); - -struct xlator_fops *meta_fops_get (inode_t *inode, xlator_t *this); -struct xlator_cbks *meta_cbks_get (inode_t *inode, xlator_t *this); -struct meta_ops *meta_ops_get (inode_t *inode, xlator_t *this); - -int meta_ctx_set (inode_t *inode, xlator_t *this, void *ctx); - -void *meta_ctx_get (inode_t *inode, xlator_t *this); - - -void meta_local_cleanup (meta_local_t *local, xlator_t *this); - -struct xlator_fops *meta_defaults_init (struct xlator_fops *fops); - -meta_fd_t *meta_fd_get (fd_t *fd, xlator_t *this); - -int meta_fd_release (fd_t *fd, xlator_t *this); - -dict_t *meta_direct_io_mode (dict_t *xdata, call_frame_t *frame); - -meta_local_t *meta_local (call_frame_t *frame); - -int meta_file_fill (xlator_t *this, fd_t *fd); - -int meta_dir_fill (xlator_t *this, fd_t *fd); - -int fixed_dirents_len (struct meta_dirent *dirents); +#define META_STACK_UNWIND(fop, frame, params...) \ + do { \ + meta_local_t *__local = NULL; \ + xlator_t *__this = NULL; \ + if (frame) { \ + __local = frame->local; \ + __this = frame->this; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + meta_local_cleanup(__local, __this); \ + } \ + } while (0) + +#define META_FOP(i, fop, fr, t, params...) \ + { \ + struct xlator_fops *_fops = NULL; \ + \ + _fops = meta_fops_get(i, t); \ + \ + _fops->fop(fr, t, params); \ + } \ + while (0) + +void +meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type); + +int +meta_inode_discover(call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata); + +int +meta_ops_set(inode_t *inode, xlator_t *this, struct meta_ops *ops); + +struct xlator_fops * +meta_fops_get(inode_t *inode, xlator_t *this); +struct xlator_cbks * +meta_cbks_get(inode_t *inode, xlator_t *this); +struct meta_ops * +meta_ops_get(inode_t *inode, xlator_t *this); + +int +meta_ctx_set(inode_t *inode, xlator_t *this, void *ctx); + +void * +meta_ctx_get(inode_t *inode, xlator_t *this); + +void +meta_local_cleanup(meta_local_t *local, xlator_t *this); + +struct xlator_fops * +meta_defaults_init(struct xlator_fops *fops); + +meta_fd_t * +meta_fd_get(fd_t *fd, xlator_t *this); + +int +meta_fd_release(fd_t *fd, xlator_t *this); + +dict_t * +meta_direct_io_mode(dict_t *xdata, call_frame_t *frame); + +meta_local_t * +meta_local(call_frame_t *frame); + +int +meta_file_fill(xlator_t *this, fd_t *fd); + +int +meta_dir_fill(xlator_t *this, fd_t *fd); + +int +fixed_dirents_len(struct meta_dirent *dirents); #endif /* __META_H__ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h index 7f276fb0b5c..1bff084a9a8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h @@ -16,25 +16,25 @@ #define bitd_svc_name "bitd" void -glusterd_bitdsvc_build (glusterd_svc_t *svc); +glusterd_bitdsvc_build(glusterd_svc_t *svc); int -glusterd_bitdsvc_init (glusterd_svc_t *svc); +glusterd_bitdsvc_init(glusterd_svc_t *svc); int -glusterd_bitdsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_bitdsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_bitdsvc_start (glusterd_svc_t *svc, int flags); +glusterd_bitdsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_bitdsvc_stop (glusterd_svc_t *svc, int sig); +glusterd_bitdsvc_stop(glusterd_svc_t *svc, int sig); int -glusterd_bitdsvc_reconfigure (); +glusterd_bitdsvc_reconfigure(); void -glusterd_bitdsvc_build_volfile_path (char *server, char *workdir, - char *volfile, size_t len); +glusterd_bitdsvc_build_volfile_path(char *server, char *workdir, char *volfile, + size_t len); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-helper.h b/xlators/mgmt/glusterd/src/glusterd-conn-helper.h index 80468d6de75..6f500309175 100644 --- a/xlators/mgmt/glusterd/src/glusterd-conn-helper.h +++ b/xlators/mgmt/glusterd/src/glusterd-conn-helper.h @@ -16,6 +16,6 @@ #include "glusterd-conn-mgmt.h" glusterd_svc_t * -glusterd_conn_get_svc_object (glusterd_conn_t *conn); +glusterd_conn_get_svc_object(glusterd_conn_t *conn); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.h index 5820419dbf5..602c0ba7b84 100644 --- a/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.h +++ b/xlators/mgmt/glusterd/src/glusterd-conn-mgmt.h @@ -15,37 +15,37 @@ typedef struct glusterd_conn_ glusterd_conn_t; -typedef int (*glusterd_conn_notify_t) - (glusterd_conn_t *conn, rpc_clnt_event_t event); +typedef int (*glusterd_conn_notify_t)(glusterd_conn_t *conn, + rpc_clnt_event_t event); struct glusterd_conn_ { - struct rpc_clnt *rpc; - char sockpath[PATH_MAX]; - int frame_timeout; - /* Existing daemons tend to specialize their respective - * notify implementations, so ... */ - glusterd_conn_notify_t notify; + struct rpc_clnt *rpc; + char sockpath[PATH_MAX]; + int frame_timeout; + /* Existing daemons tend to specialize their respective + * notify implementations, so ... */ + glusterd_conn_notify_t notify; }; int -glusterd_conn_init (glusterd_conn_t *conn, char *sockpath, - int frame_timeout, glusterd_conn_notify_t notify); +glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, int frame_timeout, + glusterd_conn_notify_t notify); int -glusterd_conn_term (glusterd_conn_t *conn); +glusterd_conn_term(glusterd_conn_t *conn); int -glusterd_conn_connect (glusterd_conn_t *conn); +glusterd_conn_connect(glusterd_conn_t *conn); int -glusterd_conn_disconnect (glusterd_conn_t *conn); +glusterd_conn_disconnect(glusterd_conn_t *conn); int -glusterd_conn_common_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, void *data); +glusterd_conn_common_notify(struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t event, void *data); int32_t -glusterd_conn_build_socket_filepath (char *rundir, uuid_t uuid, - char *socketpath, int len); +glusterd_conn_build_socket_filepath(char *rundir, uuid_t uuid, char *socketpath, + int len); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-errno.h b/xlators/mgmt/glusterd/src/glusterd-errno.h index bfb56b56240..7e1575b57af 100644 --- a/xlators/mgmt/glusterd/src/glusterd-errno.h +++ b/xlators/mgmt/glusterd/src/glusterd-errno.h @@ -11,23 +11,23 @@ #define _GLUSTERD_ERRNO_H enum glusterd_op_errno { - EG_INTRNL = 30800, /* Internal Error */ - EG_OPNOTSUP = 30801, /* Gluster Op Not Supported */ - EG_ANOTRANS = 30802, /* Another Transaction in Progress */ - EG_BRCKDWN = 30803, /* One or more brick is down */ - EG_NODEDWN = 30804, /* One or more node is down */ - EG_HRDLMT = 30805, /* Hard Limit is reached */ - EG_NOVOL = 30806, /* Volume does not exist */ - EG_NOSNAP = 30807, /* Snap does not exist */ - EG_RBALRUN = 30808, /* Rebalance is running */ - EG_VOLRUN = 30809, /* Volume is running */ - EG_VOLSTP = 30810, /* Volume is not running */ - EG_VOLEXST = 30811, /* Volume exists */ - EG_SNAPEXST = 30812, /* Snapshot exists */ - EG_ISSNAP = 30813, /* Volume is a snap volume */ - EG_GEOREPRUN = 30814, /* Geo-Replication is running */ - EG_NOTTHINP = 30815, /* Bricks are not thinly provisioned */ - EG_NOGANESHA = 30816, /* obsolete ganesha is not enabled */ + EG_INTRNL = 30800, /* Internal Error */ + EG_OPNOTSUP = 30801, /* Gluster Op Not Supported */ + EG_ANOTRANS = 30802, /* Another Transaction in Progress */ + EG_BRCKDWN = 30803, /* One or more brick is down */ + EG_NODEDWN = 30804, /* One or more node is down */ + EG_HRDLMT = 30805, /* Hard Limit is reached */ + EG_NOVOL = 30806, /* Volume does not exist */ + EG_NOSNAP = 30807, /* Snap does not exist */ + EG_RBALRUN = 30808, /* Rebalance is running */ + EG_VOLRUN = 30809, /* Volume is running */ + EG_VOLSTP = 30810, /* Volume is not running */ + EG_VOLEXST = 30811, /* Volume exists */ + EG_SNAPEXST = 30812, /* Snapshot exists */ + EG_ISSNAP = 30813, /* Volume is a snap volume */ + EG_GEOREPRUN = 30814, /* Geo-Replication is running */ + EG_NOTTHINP = 30815, /* Bricks are not thinly provisioned */ + EG_NOGANESHA = 30816, /* obsolete ganesha is not enabled */ }; #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.h b/xlators/mgmt/glusterd/src/glusterd-geo-rep.h index 8d08bcda50e..5f5fe344406 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.h +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.h @@ -11,7 +11,7 @@ #define _GLUSTERD_GEO_REP_H_ #ifndef GSYNC_CONF_TEMPLATE -#define GSYNC_CONF_TEMPLATE GEOREP"/gsyncd_template.conf" +#define GSYNC_CONF_TEMPLATE GEOREP "/gsyncd_template.conf" #endif /* <slave host>::<slave volume> */ @@ -20,34 +20,33 @@ /* slave info format: * <master host uuid>:ssh://{<slave_user>@}<slave host>::<slave volume> \ * :<slave volume uuid> */ -#define VOLINFO_SLAVE_URL_MAX (LOGIN_NAME_MAX + (2*GF_UUID_BUF_SIZE) \ - + SLAVE_URL_INFO_MAX + 10) +#define VOLINFO_SLAVE_URL_MAX \ + (LOGIN_NAME_MAX + (2 * GF_UUID_BUF_SIZE) + SLAVE_URL_INFO_MAX + 10) typedef struct glusterd_gsync_status_temp { - dict_t *rsp_dict; - glusterd_volinfo_t *volinfo; - char *node; + dict_t *rsp_dict; + glusterd_volinfo_t *volinfo; + char *node; } glusterd_gsync_status_temp_t; typedef struct gsync_status_param { - int is_active; - glusterd_volinfo_t *volinfo; + int is_active; + glusterd_volinfo_t *volinfo; } gsync_status_param_t; int -gsync_status (char *master, char *slave, char *conf_path, - int *status, gf_boolean_t *is_template_in_use); +gsync_status(char *master, char *slave, char *conf_path, int *status, + gf_boolean_t *is_template_in_use); void -glusterd_check_geo_rep_configured (glusterd_volinfo_t *volinfo, - gf_boolean_t *flag); +glusterd_check_geo_rep_configured(glusterd_volinfo_t *volinfo, + gf_boolean_t *flag); int -_get_slave_status (dict_t *dict, char *key, data_t *value, void *data); +_get_slave_status(dict_t *dict, char *key, data_t *value, void *data); int -glusterd_check_geo_rep_running (gsync_status_param_t *param, char **op_errstr); +glusterd_check_geo_rep_running(gsync_status_param_t *param, char **op_errstr); int -glusterd_get_gsync_status_mst (glusterd_volinfo_t *volinfo, dict_t *rsp_dict, - char *node); +glusterd_get_gsync_status_mst(glusterd_volinfo_t *volinfo, dict_t *rsp_dict, + char *node); #endif - diff --git a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.h b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.h index 34a0e62a85a..3aca218a65d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.h +++ b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.h @@ -14,38 +14,38 @@ #include "glusterd.h" void -glusterd_svc_build_gfproxyd_rundir (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_gfproxyd_rundir(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_gfproxyd_socket_filepath (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_gfproxyd_socket_filepath(glusterd_volinfo_t *volinfo, + char *path, int path_len); void -glusterd_svc_build_gfproxyd_pidfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_gfproxyd_pidfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_gfproxyd_volfile_path (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_gfproxyd_volfile_path(glusterd_volinfo_t *volinfo, + char *path, int path_len); void -glusterd_svc_build_gfproxyd_logdir (char *logdir, char *volname, size_t len); +glusterd_svc_build_gfproxyd_logdir(char *logdir, char *volname, size_t len); void -glusterd_svc_build_gfproxyd_logfile (char *logfile, char *logdir, size_t len); +glusterd_svc_build_gfproxyd_logfile(char *logfile, char *logdir, size_t len); int -glusterd_svc_check_gfproxyd_volfile_identical (char *svc_name, +glusterd_svc_check_gfproxyd_volfile_identical(char *svc_name, + glusterd_volinfo_t *volinfo, + gf_boolean_t *identical); +int +glusterd_svc_check_gfproxyd_topology_identical(char *svc_name, glusterd_volinfo_t *volinfo, gf_boolean_t *identical); int -glusterd_svc_check_gfproxyd_topology_identical (char *svc_name, - glusterd_volinfo_t *volinfo, - gf_boolean_t *identical); -int -glusterd_is_gfproxyd_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_gfproxyd_enabled(glusterd_volinfo_t *volinfo); glusterd_volinfo_t * -glusterd_gfproxyd_volinfo_from_svc (glusterd_svc_t *svc); +glusterd_gfproxyd_volinfo_from_svc(glusterd_svc_t *svc); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.h b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.h index a4af632a5b0..db1c8b1e7b0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.h @@ -16,32 +16,32 @@ #define gfproxyd_svc_name "gfproxyd" struct glusterd_gfproxydsvc_ { - glusterd_svc_t svc; - int port; - gf_store_handle_t *handle; + glusterd_svc_t svc; + int port; + gf_store_handle_t *handle; }; typedef struct glusterd_gfproxydsvc_ glusterd_gfproxydsvc_t; void -glusterd_gfproxydsvc_build (glusterd_svc_t *svc); +glusterd_gfproxydsvc_build(glusterd_svc_t *svc); int -glusterd_gfproxydsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_gfproxydsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_gfproxydsvc_start (glusterd_svc_t *svc, int flags); +glusterd_gfproxydsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_gfproxydsvc_stop (glusterd_svc_t *svc, int sig); +glusterd_gfproxydsvc_stop(glusterd_svc_t *svc, int sig); int -glusterd_gfproxydsvc_reconfigure (); +glusterd_gfproxydsvc_reconfigure(); void -glusterd_gfproxydsvc_build_volfile_path (char *server, char *workdir, - char *volfile, size_t len); +glusterd_gfproxydsvc_build_volfile_path(char *server, char *workdir, + char *volfile, size_t len); int -glusterd_gfproxydsvc_restart (); +glusterd_gfproxydsvc_restart(); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.h b/xlators/mgmt/glusterd/src/glusterd-hooks.h index 752e459f89c..3813c18e989 100644 --- a/xlators/mgmt/glusterd/src/glusterd-hooks.h +++ b/xlators/mgmt/glusterd/src/glusterd-hooks.h @@ -12,79 +12,77 @@ #include <fnmatch.h> -#define GLUSTERD_GET_HOOKS_DIR(path, version, priv) \ - do { \ - int32_t len; \ - len = snprintf (path, PATH_MAX, "%s/hooks/%d", priv->workdir,\ - version); \ - if (len < 0) { \ - path[0] = 0; \ - } \ - } while (0) +#define GLUSTERD_GET_HOOKS_DIR(path, version, priv) \ + do { \ + int32_t len; \ + len = snprintf(path, PATH_MAX, "%s/hooks/%d", priv->workdir, version); \ + if (len < 0) { \ + path[0] = 0; \ + } \ + } while (0) -#define GLUSTERD_HOOK_VER 1 +#define GLUSTERD_HOOK_VER 1 -#define GD_HOOKS_SPECIFIC_KEY "user.*" +#define GD_HOOKS_SPECIFIC_KEY "user.*" typedef enum glusterd_commit_hook_type { - GD_COMMIT_HOOK_NONE = 0, - GD_COMMIT_HOOK_PRE, - GD_COMMIT_HOOK_POST, - GD_COMMIT_HOOK_MAX + GD_COMMIT_HOOK_NONE = 0, + GD_COMMIT_HOOK_PRE, + GD_COMMIT_HOOK_POST, + GD_COMMIT_HOOK_MAX } glusterd_commit_hook_type_t; typedef struct hooks_private { - struct cds_list_head list; - int waitcount; //debug purposes - pthread_mutex_t mutex; - pthread_cond_t cond; - pthread_t worker; + struct cds_list_head list; + int waitcount; // debug purposes + pthread_mutex_t mutex; + pthread_cond_t cond; + pthread_t worker; } glusterd_hooks_private_t; typedef struct hooks_stub { - struct cds_list_head all_hooks; - char *scriptdir; - glusterd_op_t op; - dict_t *op_ctx; + struct cds_list_head all_hooks; + char *scriptdir; + glusterd_op_t op; + dict_t *op_ctx; } glusterd_hooks_stub_t; - static inline gf_boolean_t -is_key_glusterd_hooks_friendly (char *key) +is_key_glusterd_hooks_friendly(char *key) { - gf_boolean_t is_friendly = _gf_false; + gf_boolean_t is_friendly = _gf_false; - /* This is very specific to hooks friendly behavior */ - if (fnmatch (GD_HOOKS_SPECIFIC_KEY, key, FNM_NOESCAPE) == 0) { - gf_msg_debug (THIS->name, 0, "user namespace key %s", key); - is_friendly = _gf_true; - } + /* This is very specific to hooks friendly behavior */ + if (fnmatch(GD_HOOKS_SPECIFIC_KEY, key, FNM_NOESCAPE) == 0) { + gf_msg_debug(THIS->name, 0, "user namespace key %s", key); + is_friendly = _gf_true; + } - return is_friendly; + return is_friendly; } int -glusterd_hooks_create_hooks_directory (char *basedir); +glusterd_hooks_create_hooks_directory(char *basedir); char * -glusterd_hooks_get_hooks_cmd_subdir (glusterd_op_t op); +glusterd_hooks_get_hooks_cmd_subdir(glusterd_op_t op); int -glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx, - glusterd_commit_hook_type_t type); +glusterd_hooks_run_hooks(char *hooks_path, glusterd_op_t op, dict_t *op_ctx, + glusterd_commit_hook_type_t type); int -glusterd_hooks_spawn_worker (xlator_t *this); +glusterd_hooks_spawn_worker(xlator_t *this); int -glusterd_hooks_stub_init (glusterd_hooks_stub_t **stub, char *scriptdir, - glusterd_op_t op, dict_t *op_ctx); +glusterd_hooks_stub_init(glusterd_hooks_stub_t **stub, char *scriptdir, + glusterd_op_t op, dict_t *op_ctx); void -glusterd_hooks_stub_cleanup (glusterd_hooks_stub_t *stub); +glusterd_hooks_stub_cleanup(glusterd_hooks_stub_t *stub); int -glusterd_hooks_post_stub_enqueue (char *scriptdir, glusterd_op_t op, - dict_t *op_ctx); +glusterd_hooks_post_stub_enqueue(char *scriptdir, glusterd_op_t op, + dict_t *op_ctx); int -glusterd_hooks_priv_init (glusterd_hooks_private_t **new); +glusterd_hooks_priv_init(glusterd_hooks_private_t **new); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.h b/xlators/mgmt/glusterd/src/glusterd-locks.h index 226d5c6bd7f..8878a30d0bf 100644 --- a/xlators/mgmt/glusterd/src/glusterd-locks.h +++ b/xlators/mgmt/glusterd/src/glusterd-locks.h @@ -11,49 +11,49 @@ #define _GLUSTERD_LOCKS_H_ typedef struct glusterd_mgmt_v3_lock_object_ { - uuid_t lock_owner; + uuid_t lock_owner; } glusterd_mgmt_v3_lock_obj; typedef struct glusterd_mgmt_v3_lock_timer_ { - gf_timer_t *timer; - xlator_t *xl; + gf_timer_t *timer; + xlator_t *xl; } glusterd_mgmt_v3_lock_timer; typedef struct glusterd_mgmt_v3_lock_valid_entities { - char *type; /* Entity type like vol, snap */ - gf_boolean_t default_value; /* The default value that * - * determines if the locks * - * should be held for that * - * entity */ + char *type; /* Entity type like vol, snap */ + gf_boolean_t default_value; /* The default value that * + * determines if the locks * + * should be held for that * + * entity */ } glusterd_valid_entities; int32_t -glusterd_mgmt_v3_lock_init (); +glusterd_mgmt_v3_lock_init(); void -glusterd_mgmt_v3_lock_fini (); +glusterd_mgmt_v3_lock_fini(); int32_t -glusterd_mgmt_v3_lock_timer_init (); +glusterd_mgmt_v3_lock_timer_init(); void -glusterd_mgmt_v3_lock_timer_fini (); +glusterd_mgmt_v3_lock_timer_fini(); int32_t -glusterd_get_mgmt_v3_lock_owner (char *volname, uuid_t *uuid); +glusterd_get_mgmt_v3_lock_owner(char *volname, uuid_t *uuid); int32_t -glusterd_mgmt_v3_lock (const char *key, uuid_t uuid, uint32_t *op_errno, - char *type); +glusterd_mgmt_v3_lock(const char *key, uuid_t uuid, uint32_t *op_errno, + char *type); int32_t -glusterd_mgmt_v3_unlock (const char *key, uuid_t uuid, char *type); +glusterd_mgmt_v3_unlock(const char *key, uuid_t uuid, char *type); int32_t -glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno); +glusterd_multiple_mgmt_v3_lock(dict_t *dict, uuid_t uuid, uint32_t *op_errno); int32_t -glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid); +glusterd_multiple_mgmt_v3_unlock(dict_t *dict, uuid_t uuid); void gd_mgmt_v3_unlock_timer_cbk(void *data); diff --git a/xlators/mgmt/glusterd/src/glusterd-mem-types.h b/xlators/mgmt/glusterd/src/glusterd-mem-types.h index 33aac2f3dc8..210d0f8658c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mem-types.h +++ b/xlators/mgmt/glusterd/src/glusterd-mem-types.h @@ -14,65 +14,64 @@ #include "mem-types.h" typedef enum gf_gld_mem_types_ { - gf_gld_mt_dir_entry_t = gf_common_mt_end + 1, - gf_gld_mt_volfile_ctx = gf_common_mt_end + 2, - gf_gld_mt_glusterd_state_t = gf_common_mt_end + 3, - gf_gld_mt_glusterd_conf_t = gf_common_mt_end + 4, - gf_gld_mt_locker = gf_common_mt_end + 5, - gf_gld_mt_string = gf_common_mt_end + 6, - gf_gld_mt_lock_table = gf_common_mt_end + 7, - gf_gld_mt_char = gf_common_mt_end + 8, - gf_gld_mt_glusterd_connection_t = gf_common_mt_end + 9, - gf_gld_mt_resolve_comp = gf_common_mt_end + 10, - gf_gld_mt_peerinfo_t = gf_common_mt_end + 11, - gf_gld_mt_friend_sm_event_t = gf_common_mt_end + 12, - gf_gld_mt_friend_req_ctx_t = gf_common_mt_end + 13, - gf_gld_mt_friend_update_ctx_t = gf_common_mt_end + 14, - gf_gld_mt_op_sm_event_t = gf_common_mt_end + 15, - gf_gld_mt_op_lock_ctx_t = gf_common_mt_end + 16, - gf_gld_mt_op_stage_ctx_t = gf_common_mt_end + 17, - gf_gld_mt_op_commit_ctx_t = gf_common_mt_end + 18, - gf_gld_mt_mop_stage_req_t = gf_common_mt_end + 19, - gf_gld_mt_probe_ctx_t = gf_common_mt_end + 20, - gf_gld_mt_create_volume_ctx_t = gf_common_mt_end + 21, - gf_gld_mt_start_volume_ctx_t = gf_common_mt_end + 22, - gf_gld_mt_stop_volume_ctx_t = gf_common_mt_end + 23, - gf_gld_mt_delete_volume_ctx_t = gf_common_mt_end + 24, - gf_gld_mt_glusterd_volinfo_t = gf_common_mt_end + 25, - gf_gld_mt_glusterd_brickinfo_t = gf_common_mt_end + 26, - gf_gld_mt_peer_hostname_t = gf_common_mt_end + 27, - gf_gld_mt_ifreq = gf_common_mt_end + 28, - gf_gld_mt_store_handle_t = gf_common_mt_end + 29, - gf_gld_mt_store_iter_t = gf_common_mt_end + 30, - gf_gld_mt_defrag_info = gf_common_mt_end + 31, - gf_gld_mt_log_filename_ctx_t = gf_common_mt_end + 32, - gf_gld_mt_log_locate_ctx_t = gf_common_mt_end + 33, - gf_gld_mt_log_rotate_ctx_t = gf_common_mt_end + 34, - gf_gld_mt_peerctx_t = gf_common_mt_end + 35, - gf_gld_mt_sm_tr_log_t = gf_common_mt_end + 36, - gf_gld_mt_pending_node_t = gf_common_mt_end + 37, - gf_gld_mt_brick_rsp_ctx_t = gf_common_mt_end + 38, - gf_gld_mt_mop_brick_req_t = gf_common_mt_end + 39, - gf_gld_mt_op_allack_ctx_t = gf_common_mt_end + 40, - gf_gld_mt_linearr = gf_common_mt_end + 41, - gf_gld_mt_linebuf = gf_common_mt_end + 42, - gf_gld_mt_mount_pattern = gf_common_mt_end + 43, - gf_gld_mt_mount_comp_container = gf_common_mt_end + 44, - gf_gld_mt_mount_component = gf_common_mt_end + 45, - gf_gld_mt_mount_spec = gf_common_mt_end + 46, - gf_gld_mt_georep_meet_spec = gf_common_mt_end + 47, - gf_gld_mt_nodesrv_t = gf_common_mt_end + 48, - gf_gld_mt_charptr = gf_common_mt_end + 49, - gf_gld_mt_hooks_stub_t = gf_common_mt_end + 50, - gf_gld_mt_hooks_priv_t = gf_common_mt_end + 51, - gf_gld_mt_mop_commit_req_t = gf_common_mt_end + 52, - gf_gld_mt_int = gf_common_mt_end + 53, - gf_gld_mt_snap_t = gf_common_mt_end + 54, - gf_gld_mt_missed_snapinfo_t = gf_common_mt_end + 55, - gf_gld_mt_snap_create_args_t = gf_common_mt_end + 56, - gf_gld_mt_local_peers_t = gf_common_mt_end + 57, - gf_gld_mt_glusterd_brick_proc_t = gf_common_mt_end + 58, - gf_gld_mt_end = gf_common_mt_end + 59, + gf_gld_mt_dir_entry_t = gf_common_mt_end + 1, + gf_gld_mt_volfile_ctx = gf_common_mt_end + 2, + gf_gld_mt_glusterd_state_t = gf_common_mt_end + 3, + gf_gld_mt_glusterd_conf_t = gf_common_mt_end + 4, + gf_gld_mt_locker = gf_common_mt_end + 5, + gf_gld_mt_string = gf_common_mt_end + 6, + gf_gld_mt_lock_table = gf_common_mt_end + 7, + gf_gld_mt_char = gf_common_mt_end + 8, + gf_gld_mt_glusterd_connection_t = gf_common_mt_end + 9, + gf_gld_mt_resolve_comp = gf_common_mt_end + 10, + gf_gld_mt_peerinfo_t = gf_common_mt_end + 11, + gf_gld_mt_friend_sm_event_t = gf_common_mt_end + 12, + gf_gld_mt_friend_req_ctx_t = gf_common_mt_end + 13, + gf_gld_mt_friend_update_ctx_t = gf_common_mt_end + 14, + gf_gld_mt_op_sm_event_t = gf_common_mt_end + 15, + gf_gld_mt_op_lock_ctx_t = gf_common_mt_end + 16, + gf_gld_mt_op_stage_ctx_t = gf_common_mt_end + 17, + gf_gld_mt_op_commit_ctx_t = gf_common_mt_end + 18, + gf_gld_mt_mop_stage_req_t = gf_common_mt_end + 19, + gf_gld_mt_probe_ctx_t = gf_common_mt_end + 20, + gf_gld_mt_create_volume_ctx_t = gf_common_mt_end + 21, + gf_gld_mt_start_volume_ctx_t = gf_common_mt_end + 22, + gf_gld_mt_stop_volume_ctx_t = gf_common_mt_end + 23, + gf_gld_mt_delete_volume_ctx_t = gf_common_mt_end + 24, + gf_gld_mt_glusterd_volinfo_t = gf_common_mt_end + 25, + gf_gld_mt_glusterd_brickinfo_t = gf_common_mt_end + 26, + gf_gld_mt_peer_hostname_t = gf_common_mt_end + 27, + gf_gld_mt_ifreq = gf_common_mt_end + 28, + gf_gld_mt_store_handle_t = gf_common_mt_end + 29, + gf_gld_mt_store_iter_t = gf_common_mt_end + 30, + gf_gld_mt_defrag_info = gf_common_mt_end + 31, + gf_gld_mt_log_filename_ctx_t = gf_common_mt_end + 32, + gf_gld_mt_log_locate_ctx_t = gf_common_mt_end + 33, + gf_gld_mt_log_rotate_ctx_t = gf_common_mt_end + 34, + gf_gld_mt_peerctx_t = gf_common_mt_end + 35, + gf_gld_mt_sm_tr_log_t = gf_common_mt_end + 36, + gf_gld_mt_pending_node_t = gf_common_mt_end + 37, + gf_gld_mt_brick_rsp_ctx_t = gf_common_mt_end + 38, + gf_gld_mt_mop_brick_req_t = gf_common_mt_end + 39, + gf_gld_mt_op_allack_ctx_t = gf_common_mt_end + 40, + gf_gld_mt_linearr = gf_common_mt_end + 41, + gf_gld_mt_linebuf = gf_common_mt_end + 42, + gf_gld_mt_mount_pattern = gf_common_mt_end + 43, + gf_gld_mt_mount_comp_container = gf_common_mt_end + 44, + gf_gld_mt_mount_component = gf_common_mt_end + 45, + gf_gld_mt_mount_spec = gf_common_mt_end + 46, + gf_gld_mt_georep_meet_spec = gf_common_mt_end + 47, + gf_gld_mt_nodesrv_t = gf_common_mt_end + 48, + gf_gld_mt_charptr = gf_common_mt_end + 49, + gf_gld_mt_hooks_stub_t = gf_common_mt_end + 50, + gf_gld_mt_hooks_priv_t = gf_common_mt_end + 51, + gf_gld_mt_mop_commit_req_t = gf_common_mt_end + 52, + gf_gld_mt_int = gf_common_mt_end + 53, + gf_gld_mt_snap_t = gf_common_mt_end + 54, + gf_gld_mt_missed_snapinfo_t = gf_common_mt_end + 55, + gf_gld_mt_snap_create_args_t = gf_common_mt_end + 56, + gf_gld_mt_local_peers_t = gf_common_mt_end + 57, + gf_gld_mt_glusterd_brick_proc_t = gf_common_mt_end + 58, + gf_gld_mt_end = gf_common_mt_end + 59, } gf_gld_mem_types_t; #endif - diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h index 29b97570630..41fedf9e288 100644 --- a/xlators/mgmt/glusterd/src/glusterd-messages.h +++ b/xlators/mgmt/glusterd/src/glusterd-messages.h @@ -23,621 +23,281 @@ * glfs-message-id.h. */ -GLFS_MSGID(GLUSTERD, - GD_MSG_SERVER_QUORUM_NOT_MET, - GD_MSG_SERVER_QUORUM_LOST_STOPPING_BRICKS, - GD_MSG_SERVER_QUORUM_MET_STARTING_BRICKS, - GD_MSG_PEER_DISCONNECTED, - GD_MSG_BRICK_DISCONNECTED, - GD_MSG_NODE_DISCONNECTED, - GD_MSG_REBALANCE_DISCONNECTED, - GD_MSG_VOL_CLEANUP_FAIL, - GD_MSG_VOL_VERS_MISMATCH, - GD_MSG_CKSUM_VERS_MISMATCH, - GD_MSG_QUOTA_CONFIG_VERS_MISMATCH, - GD_MSG_QUOTA_CONFIG_CKSUM_MISMATCH, - GD_MSG_BRICK_STOP_FAIL, - GD_MSG_SVC_KILL_FAIL, - GD_MSG_PID_KILL_FAIL, - GD_MSG_REBAL_NO_SOCK_FILE, - GD_MSG_UNIX_OP_BUILD_FAIL, - GD_MSG_RPC_CREATE_FAIL, - GD_MSG_FAIL_DEFAULT_OPT_SET, - GD_MSG_CLUSTER_UNLOCK_FAILED, - GD_MSG_NO_MEMORY, - GD_MSG_UNSUPPORTED_VERSION, - GD_MSG_COMMAND_NOT_FOUND, - GD_MSG_SNAPSHOT_OP_FAILED, - GD_MSG_INVALID_ENTRY, - GD_MSG_VOL_NOT_FOUND, - GD_MSG_REG_COMPILE_FAILED, - GD_MSG_FILE_OP_FAILED, - GD_MSG_SNAP_CREATION_FAIL, - GD_MSG_VOL_OP_FAILED, - GD_MSG_CREATE_DIR_FAILED, - GD_MSG_DIR_OP_FAILED, - GD_MSG_VOL_STOP_FAILED, - GD_MSG_NO_CLI_RESP, - GD_MSG_LOCK_INIT_FAILED, - GD_MSG_SNAP_LIST_GET_FAIL, - GD_MSG_UNOUNT_FAILED, - GD_MSG_LOCK_DESTROY_FAILED, - GD_MSG_SNAP_CLEANUP_FAIL, - GD_MSG_SNAP_ACTIVATE_FAIL, - GD_MSG_SNAP_DEACTIVATE_FAIL, - GD_MSG_SNAP_RESTORE_FAIL, - GD_MSG_SNAP_REMOVE_FAIL, - GD_MSG_SNAP_CONFIG_FAIL, - GD_MSG_SNAP_STATUS_FAIL, - GD_MSG_SNAP_INIT_FAIL, - GD_MSG_VOLINFO_SET_FAIL, - GD_MSG_VOLINFO_GET_FAIL, - GD_MSG_BRICK_CREATION_FAIL, - GD_MSG_BRICK_GET_INFO_FAIL, - GD_MSG_BRICK_NEW_INFO_FAIL, - GD_MSG_LVS_FAIL, - GD_MSG_SETXATTR_FAIL, - GD_MSG_UMOUNTING_SNAP_BRICK, - GD_MSG_OP_UNSUPPORTED, - GD_MSG_SNAP_NOT_FOUND, - GD_MSG_FS_LABEL_UPDATE_FAIL, - GD_MSG_LVM_MOUNT_FAILED, - GD_MSG_DICT_SET_FAILED, - GD_MSG_CANONICALIZE_FAIL, - GD_MSG_DICT_GET_FAILED, - GD_MSG_SNAP_INFO_FAIL, - GD_MSG_SNAP_VOL_CONFIG_FAIL, - GD_MSG_SNAP_OBJECT_STORE_FAIL, - GD_MSG_DICT_UNSERIALIZE_FAIL, - GD_MSG_SNAP_RESTORE_REVERT_FAIL, - GD_MSG_SNAP_LIST_SET_FAIL, - GD_MSG_VOLFILE_CREATE_FAIL, - GD_MSG_VOLINFO_REMOVE_FAIL, - GD_MSG_VOL_DELETE_FAIL, - GD_MSG_SNAPSHOT_PENDING, - GD_MSG_BRICK_PATH_UNMOUNTED, - GD_MSG_BRICK_ADD_FAIL, - GD_MSG_BRICK_SET_INFO_FAIL, - GD_MSG_LVCREATE_FAIL, - GD_MSG_VG_GET_FAIL, - GD_MSG_TPOOL_GET_FAIL, - GD_MSG_LVM_REMOVE_FAILED, - GD_MSG_MISSEDSNAP_INFO_SET_FAIL, - GD_MSG_BRK_MOUNTOPTS_FAIL, - GD_MSG_MISSED_SNAP_LIST_STORE_FAIL, - GD_MSG_INVALID_MISSED_SNAP_ENTRY, - GD_MSG_MISSED_SNAP_GET_FAIL, - GD_MSG_MISSED_SNAP_CREATE_FAIL, - GD_MSG_DUP_ENTRY, - GD_MSG_MISSED_SNAP_STATUS_DONE, - GD_MSG_NO_EXEC_PERMS, - GD_MSG_GLOBAL_OP_VERSION_SET_FAIL, - GD_MSG_HARD_LIMIT_SET_FAIL, - GD_MSG_OP_SUCCESS, - GD_MSG_STORE_FAIL, - GD_MSG_GLOBAL_OP_VERSION_GET_FAIL, - GD_MSG_GEOREP_GET_FAILED, - GD_MSG_GLUSTERD_UMOUNT_FAIL, - GD_MSG_QUORUM_CHECK_FAIL, - GD_MSG_QUORUM_COUNT_IGNORED, - GD_MSG_SNAP_MOUNT_FAIL, - GD_MSG_RSP_DICT_USE_FAIL, - GD_MSG_SNAP_IMPORT_FAIL, - GD_MSG_SNAP_CONFLICT, - GD_MSG_MISSED_SNAP_DELETE, - GD_MSG_QUOTA_CONFIG_IMPORT_FAIL, - GD_MSG_SNAPDIR_CREATE_FAIL, - GD_MSG_MISSED_SNAP_PRESENT, - GD_MSG_UUID_NULL, - GD_MSG_TSTAMP_SET_FAIL, - GD_MSG_RESP_AGGR_FAIL, - GD_MSG_DICT_EMPTY, - GD_MSG_DICT_CREATE_FAIL, - GD_MSG_SNAPD_STOP_FAIL, - GD_MSG_SOFT_LIMIT_REACHED, - GD_MSG_SNAPD_START_FAIL, - GD_MSG_SNAPD_CREATE_FAIL, - GD_MSG_SNAPD_INIT_FAIL, - GD_MSG_MGMTV3_OP_FAIL, - GD_MSG_MGMTV3_PAYLOAD_BUILD_FAIL, - GD_MSG_MGMTV3_UNLOCK_FAIL, - GD_MSG_MGMTV3_LOCK_GET_FAIL, - GD_MSG_MGMTV3_LOCKDOWN_FAIL, - GD_MSG_POST_VALIDATION_FAIL, - GD_MSG_PRE_VALIDATION_FAIL, - GD_MSG_COMMIT_OP_FAIL, - GD_MSG_PEER_LIST_CREATE_FAIL, - GD_MSG_BRICK_OP_FAIL, - GD_MSG_OPINFO_SET_FAIL, - GD_MSG_OP_EVENT_UNLOCK_FAIL, - GD_MSG_MGMTV3_OP_RESP_FAIL, - GD_MSG_PEER_NOT_FOUND, - GD_MSG_REQ_DECODE_FAIL, - GD_MSG_DICT_SERL_LENGTH_GET_FAIL, - GD_MSG_ALREADY_STOPPED, - GD_MSG_PRE_VALD_RESP_FAIL, - GD_MSG_SVC_GET_FAIL, - GD_MSG_VOLFILE_NOT_FOUND, - GD_MSG_OP_EVENT_LOCK_FAIL, - GD_MSG_NON_STRIPE_VOL, - GD_MSG_SNAPD_OBJ_GET_FAIL, - GD_MSG_QUOTA_DISABLED, - GD_MSG_CACHE_MINMAX_SIZE_INVALID, - GD_MSG_QUOTA_GET_STAT_FAIL, - GD_MSG_SUBVOLUMES_EXCEED, - GD_MSG_BRICK_ADD, - GD_MSG_BRICK_REMOVE, - GD_MSG_CREATE_KEY_FAIL, - GD_MSG_MULTIPLE_LOCK_ACQUIRE_FAIL, - GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL, - GD_MSG_RESP_FROM_UNKNOWN_PEER, - GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL, - GD_MSG_GFID_VALIDATE_SET_FAIL, - GD_MSG_PEER_LOCK_FAIL, - GD_MSG_PEER_UNLOCK_FAIL, - GD_MSG_MGMT_OP_FAIL, - GD_MSG_TRANS_OPINFO_CLEAR_FAIL, - GD_MSG_GLUSTERD_LOCK_FAIL, - GD_MSG_TRANS_OPINFO_SET_FAIL, - GD_MSG_TRANS_IDGEN_FAIL, - GD_MSG_RPC_FAILURE, - GD_MSG_OP_VERS_ADJUST_FAIL, - GD_MSG_SNAP_DEVICE_NAME_GET_FAIL, - GD_MSG_SNAP_STATUS_NOT_PENDING, - GD_MSG_MGMT_PGM_SET_FAIL, - GD_MSG_EVENT_INJECT_FAIL, - GD_MSG_VERS_INFO, - GD_MSG_VOL_INFO_REQ_RECVD, - GD_MSG_VERS_GET_FAIL, - GD_MSG_EVENT_NEW_GET_FAIL, - GD_MSG_RPC_LAYER_ERROR, - GD_MSG_NO_HANDSHAKE_ACK, - GD_MSG_OP_VERSION_MISMATCH, - GD_MSG_HANDSHAKE_REQ_REJECTED, - GD_MSG_UNKNOWN_MODE, - GD_MSG_DEFRAG_STATUS_UPDATED, - GD_MSG_NO_FLAG_SET, - GD_MSG_VERSION_UNSUPPORTED, - GD_MSG_UUID_SET_FAIL, - GD_MSG_MOUNT_REQ_FAIL, - GD_MSG_GLUSTERD_GLOBAL_INFO_STORE_FAIL, - GD_MSG_OP_VERS_STORE_FAIL, - GD_MSG_SNAP_AUTOMIC_UPDATE_FAIL, - GD_MSG_SNAPINFO_WRITE_FAIL, - GD_MSG_SNAPINFO_CREATE_FAIL, - GD_MSG_SNAPD_INFO_STORE_FAIL, - GD_MSG_BRK_MNTPATH_MOUNT_FAIL, - GD_MSG_BRK_MNTPATH_GET_FAIL, - GD_MSG_SNAP_BRK_MNT_RECREATE_FAIL, - GD_MSG_SNAP_RESOLVE_BRICK_FAIL, - GD_MSG_RESOLVE_BRICK_FAIL, - GD_MSG_BRK_MNT_RECREATE_FAIL, - GD_MSG_TMP_FILE_UNLINK_FAIL, - GD_MSG_VOL_VALS_WRITE_FAIL, - GD_MSG_STORE_HANDLE_GET_FAIL, - GD_MSG_STORE_HANDLE_WRITE_FAIL, - GD_MSG_MISSED_SNAP_LIST_STORE_HANDLE_GET_FAIL, - GD_MSG_MISSED_SNAP_LIST_EMPTY, - GD_MSG_SNAP_VOL_RETRIEVE_FAIL, - GD_MSG_SNAPSHOT_UPDATE_FAIL, - GD_MSG_SNAPD_PORT_STORE_FAIL, - GD_MSG_CKSUM_STORE_FAIL, - GD_MSG_STORE_HANDLE_CREATE_FAIL, - GD_MSG_HANDLE_NULL, - GD_MSG_VOL_RESTORE_FAIL, - GD_MSG_NAME_TOO_LONG, - GD_MSG_UUID_PARSE_FAIL, - GD_MSG_UNKNOWN_KEY, - GD_MSG_STORE_ITER_DESTROY_FAIL, - GD_MSG_STORE_ITER_GET_FAIL, - GD_MSG_VOLINFO_UPDATE_FAIL, - GD_MSG_PARSE_BRICKINFO_FAIL, - GD_MSG_VERS_STORE_FAIL, - GD_MSG_HEADER_ADD_FAIL, - GD_MSG_QUOTA_CONF_WRITE_FAIL, - GD_MSG_QUOTA_CONF_CORRUPT, - GD_MSG_FORK_FAIL, - GD_MSG_CKSUM_COMPUTE_FAIL, - GD_MSG_VERS_CKSUM_STORE_FAIL, - GD_MSG_GETXATTR_FAIL, - GD_MSG_CONVERSION_FAILED, - GD_MSG_VOL_NOT_DISTRIBUTE, - GD_MSG_VOL_STOPPED, - GD_MSG_OPCTX_GET_FAIL, - GD_MSG_TASKID_GEN_FAIL, - GD_MSG_REBALANCE_ID_MISSING, - GD_MSG_NO_REBALANCE_PFX_IN_VOLNAME, - GD_MSG_DEFRAG_STATUS_UPDATE_FAIL, - GD_MSG_UUID_GEN_STORE_FAIL, - GD_MSG_UUID_STORE_FAIL, - GD_MSG_NO_INIT, - GD_MSG_MODULE_NOT_INSTALLED, - GD_MSG_MODULE_NOT_WORKING, - GD_MSG_WRITE_ACCESS_GRANT_FAIL, - GD_MSG_DIRPATH_TOO_LONG, - GD_MSG_LOGGROUP_INVALID, - GD_MSG_DIR_PERM_LIBERAL, - GD_MSG_DIR_PERM_STRICT, - GD_MSG_MOUNT_SPEC_INSTALL_FAIL, - GD_MSG_GLUSTERD_SOCK_LISTENER_START_FAIL, - GD_MSG_DIR_NOT_FOUND, - GD_MSG_FAILED_INIT_SHDSVC, - GD_MSG_FAILED_INIT_NFSSVC, - GD_MSG_FAILED_INIT_QUOTASVC, - GD_MSG_RPC_INIT_FAIL, - GD_MSG_RPCSVC_REG_NOTIFY_RETURNED, - GD_MSG_RPC_TRANSPORT_COUNT_GET_FAIL, - GD_MSG_RPC_LISTENER_CREATE_FAIL, - GD_MSG_OP_VERS_RESTORE_FAIL, - GD_MSG_SELF_HEALD_DISABLED, - GD_MSG_PRIV_NULL, - GD_MSG_GSYNC_VALIDATION_FAIL, - GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL, - GD_MSG_OP_NOT_PERMITTED_AC_REQD, - GD_MSG_OP_NOT_PERMITTED, - GD_MSG_REBALANCE_START_FAIL, - GD_MSG_NFS_RECONF_FAIL, - GD_MSG_REMOVE_BRICK_ID_SET_FAIL, - GD_MSG_BRICK_MOUNTDIR_GET_FAIL, - GD_MSG_BRICK_NOT_FOUND, - GD_MSG_BRKPATH_TOO_LONG, - GD_MSG_CLRLOCKS_CLNT_UMOUNT_FAIL, - GD_MSG_CLRLOCKS_CLNT_MOUNT_FAIL, - GD_MSG_CLRLOCKS_MOUNTDIR_CREATE_FAIL, - GD_MSG_BRK_PORT_NUM_GET_FAIL, - GD_MSG_BRK_STATEDUMP_FAIL, - GD_MSG_VOL_GRAPH_CHANGE_NOTIFY_FAIL, - GD_MSG_INVALID_VG, - GD_MSG_GLUSTERD_OP_FAILED, - GD_MSG_HOSTNAME_ADD_TO_PEERLIST_FAIL, - GD_MSG_STALE_PEERINFO_REMOVE_FAIL, - GD_MSG_TRANS_ID_GET_FAIL, - GD_MSG_RES_DECODE_FAIL, - GD_MSG_VOL_ALREADY_EXIST, - GD_MSG_BAD_BRKORDER, - GD_MSG_BAD_BRKORDER_CHECK_FAIL, - GD_MSG_BRICK_SELECT_FAIL, - GD_MSG_NO_LOCK_RESP_FROM_PEER, - GD_MSG_MGMTV3_LOCK_FROM_UUID_REJCT, - GD_MSG_STAGE_FROM_UUID_REJCT, - GD_MSG_UNLOCK_FROM_UUID_REJCT, - GD_MSG_MGMTV3_UNLOCK_FROM_UUID_REJCT, - GD_MSG_COMMIT_FROM_UUID_REJCT, - GD_MSG_VOL_NOT_STARTED, - GD_MSG_VOL_NOT_REPLICA, - GD_MSG_VOL_NOT_DISPERSE, - GD_MSG_OLD_REMOVE_BRICK_EXISTS, - GD_MSG_USE_THE_FORCE, - GD_MSG_OIP, - GD_MSG_OIP_RETRY_LATER, - GD_MSG_GSYNC_RESTART_FAIL, - GD_MSG_LOCK_FROM_UUID_REJCT, - GD_MSG_BRICK_OP_PAYLOAD_BUILD_FAIL, - GD_MSG_HOSTNAME_RESOLVE_FAIL, - GD_MSG_COUNT_VALIDATE_FAILED, - GD_MSG_SPAWNING_CHILD_FAILED, - GD_MSG_READ_CHILD_DATA_FAILED, - GD_MSG_DEFAULT_TEMP_CONFIG, - GD_MSG_PIDFILE_CREATE_FAILED, - GD_MSG_GSYNCD_SPAWN_FAILED, - GD_MSG_SUBOP_NOT_FOUND, - GD_MSG_RESERVED_OPTION, - GD_MSG_GLUSTERD_PRIV_NOT_FOUND, - GD_MSG_SLAVEINFO_FETCH_ERROR, - GD_MSG_VALIDATE_FAILED, - GD_MSG_INVOKE_ERROR, - GD_MSG_SESSION_CREATE_ERROR, - GD_MSG_STOP_FORCE, - GD_MSG_GET_CONFIG_INFO_FAILED, - GD_MSG_STAT_FILE_READ_FAILED, - GD_MSG_CONF_PATH_ASSIGN_FAILED, - GD_MSG_SESSION_INACTIVE, - GD_MSG_PIDFILE_NOT_FOUND, - GD_MSG_PEER_CMD_ERROR, - GD_MSG_SRC_FILE_ERROR, - GD_MSG_GET_STATEFILE_NAME_FAILED, - GD_MSG_STATUS_NULL, - GD_MSG_STATUSFILE_CREATE_FAILED, - GD_MSG_SLAVE_URL_INVALID, - GD_MSG_INVALID_SLAVE, - GD_MSG_READ_ERROR, - GD_MSG_ARG_FETCH_ERROR, - GD_MSG_REG_FILE_MISSING, - GD_MSG_STATEFILE_NAME_NOT_FOUND, - GD_MSG_GEO_REP_START_FAILED, - GD_MSG_GSYNCD_ERROR, - GD_MSG_UPDATE_STATEFILE_FAILED, - GD_MSG_STATUS_UPDATE_FAILED, - GD_MSG_GSYNCD_OP_SET_FAILED, - GD_MSG_BUFFER_EMPTY, - GD_MSG_CONFIG_INFO, - GD_MSG_FETCH_CONFIG_VAL_FAILED, - GD_MSG_GSYNCD_PARSE_ERROR, - GD_MSG_SESSION_ALREADY_EXIST, - GD_MSG_FORCE_CREATE_SESSION, - GD_MSG_GET_KEY_FAILED, - GD_MSG_SESSION_DEL_FAILED, - GD_MSG_CMD_EXEC_FAIL, - GD_MSG_STRDUP_FAILED, - GD_MSG_UNABLE_TO_END, - GD_MSG_PAUSE_FAILED, - GD_MSG_NORMALIZE_URL_FAIL, - GD_MSG_MODULE_ERROR, - GD_MSG_SLAVEINFO_STORE_ERROR, - GD_MSG_MARKER_START_FAIL, - GD_MSG_RESUME_FAILED, - GD_MSG_GLUSTERFS_START_FAIL, - GD_MSG_GLUSTERFS_STOP_FAIL, - GD_MSG_RBOP_STATE_STORE_FAIL, - GD_MSG_PUMP_XLATOR_DISABLED, - GD_MSG_ABORT_OP_FAIL, - GD_MSG_PAUSE_OP_FAIL, - GD_MSG_GLUSTER_SERVICE_START_FAIL, - GD_MSG_HANDSHAKE_FAILED, - GD_MSG_CLI_REQ_EMPTY, - GD_MSG_PEER_ADD_FAIL, - GD_MSG_SYNC_FROM_LOCALHOST_UNALLOWED, - GD_MSG_UUIDS_SAME_RETRY, - GD_MSG_TSP_ALREADY_FORMED, - GD_MSG_VOLS_ALREADY_PRESENT, - GD_MSG_REQ_CTX_CREATE_FAIL, - GD_MSG_PEER_INFO_UPDATE_FAIL, - GD_MSG_PEERINFO_CREATE_FAIL, - GD_MSG_REQ_FROM_UNKNOWN_PEER, - GD_MSG_STATUS_REPLY_STRING_CREATE_FAIL, - GD_MSG_TOKENIZE_FAIL, - GD_MSG_LAZY_UMOUNT_FAIL, - GD_MSG_NFS_SERVER_START_FAIL, - GD_MSG_GLUSTER_SERVICES_STOP_FAIL, - GD_MSG_BRK_CLEANUP_FAIL, - GD_MSG_RB_ALREADY_STARTED, - GD_MSG_RB_BRICKINFO_GET_FAIL, - GD_MSG_BAD_FORMAT, - GD_MSG_RB_CMD_FAIL, - GD_MSG_RB_NOT_STARTED_OR_PAUSED, - GD_MSG_RB_NOT_STARTED, - GD_MSG_RB_PAUSED_ALREADY, - GD_MSG_NO_FREE_PORTS, - GD_MSG_EVENT_STATE_TRANSITION_FAIL, - GD_MSG_HANDLER_RETURNED, - GD_MSG_SNAP_COMPARE_CONFLICT, - GD_MSG_PEER_DETACH_CLEANUP_FAIL, - GD_MSG_STALE_VOL_REMOVE_FAIL, - GD_MSG_AC_ERROR, - GD_MSG_LOCK_FAIL, - GD_MSG_MGMTV3_LOCK_REQ_SEND_FAIL, - GD_MSG_GLUSTERD_UNLOCK_FAIL, - GD_MSG_RBOP_START_FAIL, - GD_MSG_UNKNOWN_RESPONSE, - GD_MSG_COMMIT_REQ_SEND_FAIL, - GD_MSG_OPCTX_UPDATE_FAIL, - GD_MSG_OPCTX_NULL, - GD_MSG_DICT_COPY_FAIL, - GD_MSG_SHD_STATUS_SET_FAIL, - GD_MSG_REPLICA_INDEX_GET_FAIL, - GD_MSG_NFS_SERVER_NOT_RUNNING, - GD_MSG_STAGE_REQ_SEND_FAIL, - GD_MSG_LOCK_REQ_SEND_FAIL, - GD_MSG_VOLNAMES_GET_FAIL, - GD_MSG_NO_TASK_ID, - GD_MSG_ADD_REMOVE_BRICK_FAIL, - GD_MSG_SVC_RESTART_FAIL, - GD_MSG_VOL_SET_FAIL, - GD_MSG_QUOTAD_NOT_RUNNING, - GD_MSG_XLATOR_COUNT_GET_FAIL, - GD_MSG_TRANS_OPINFO_GET_FAIL, - GD_MSG_TRANS_ID_INVALID, - GD_MSG_NO_OPTIONS_GIVEN, - GD_MSG_SNAPD_NOT_RUNNING, - GD_MSG_ADD_ADDRESS_TO_PEER_FAIL, - GD_MSG_PEER_ADDRESS_GET_FAIL, - GD_MSG_GETADDRINFO_FAIL, - GD_MSG_PEERINFO_DELETE_FAIL, - GD_MSG_KEY_NULL, - GD_MSG_SPAWN_SVCS_FAIL, - GD_MSG_DICT_ITER_FAIL, - GD_MSG_TASK_STATUS_UPDATE_FAIL, - GD_MSG_VOL_ID_MISMATCH, - GD_MSG_STR_TO_BOOL_FAIL, - GD_MSG_RB_MNT_BRICKS_MISMATCH, - GD_MSG_RB_SRC_BRICKS_MISMATCH, - GD_MSG_MNTENTRY_GET_FAIL, - GD_MSG_INODE_SIZE_GET_FAIL, - GD_MSG_NO_STATEFILE_ENTRY, - GD_MSG_PMAP_UNSET_FAIL, - GD_MSG_GLOBAL_OPT_IMPORT_FAIL, - GD_MSD_BRICK_DISCONNECT_FAIL, - GD_MSG_SNAP_DETAILS_IMPORT_FAIL, - GD_MSG_BRICKINFO_CREATE_FAIL, - GD_MSG_QUOTA_CKSUM_VER_STORE_FAIL, - GD_MSG_CKSUM_GET_FAIL, - GD_MSG_BRICKPATH_ROOT_GET_FAIL, - GD_MSG_HOSTNAME_TO_UUID_FAIL, - GD_MSG_REPLY_SUBMIT_FAIL, - GD_MSG_SERIALIZE_MSG_FAIL, - GD_MSG_ENCODE_FAIL, - GD_MSG_RB_DST_BRICKS_MISMATCH, - GD_MSG_XLATOR_VOLOPT_DYNLOAD_ERROR, - GD_MSG_VOLNAME_NOTFOUND_IN_DICT, - GD_MSG_FLAGS_NOTFOUND_IN_DICT, - GD_MSG_HOSTNAME_NOTFOUND_IN_DICT, - GD_MSG_PORT_NOTFOUND_IN_DICT, - GD_MSG_CMDSTR_NOTFOUND_IN_DICT, - GD_MSG_SNAP_OBJ_NEW_FAIL, - GD_MSG_SNAP_BACKEND_MAKE_FAIL, - GD_MSG_SNAP_CLONE_FAILED, - GD_MSG_SNAP_CLONE_PREVAL_FAILED, - GD_MSG_SNAP_CLONE_POSTVAL_FAILED, - GD_MSG_VOLINFO_STORE_FAIL, - GD_MSG_NEW_FRIEND_SM_EVENT_GET_FAIL, - GD_MSG_VOL_TYPE_CHANGING_INFO, - GD_MSG_BRKPATH_MNTPNT_MISMATCH, - GD_MSG_TASKS_COUNT_MISMATCH, - GD_MSG_WRONG_OPTS_SETTING, - GD_MSG_PATH_ALREADY_PART_OF_VOL, - GD_MSG_BRICK_VALIDATE_FAIL, - GD_MSG_READIN_FILE_FAILED, - GD_MSG_IMPORT_PRDICT_DICT, - GD_MSG_VOL_OPTS_IMPORT_FAIL, - GD_MSG_BRICK_IMPORT_FAIL, - GD_MSG_VOLINFO_IMPORT_FAIL, - GD_MSG_BRICK_ID_GEN_FAILED, - GD_MSG_GET_STATUS_DATA_FAIL, - GD_MSG_BITROT_NOT_RUNNING, - GD_MSG_SCRUBBER_NOT_RUNNING, - GD_MSG_SRC_BRICK_PORT_UNAVAIL, - GD_MSG_BITD_INIT_FAIL, - GD_MSG_SCRUB_INIT_FAIL, - GD_MSG_VAR_RUN_DIR_INIT_FAIL, - GD_MSG_VAR_RUN_DIR_FIND_FAIL, - GD_MSG_SCRUBSVC_RECONF_FAIL, - GD_MSG_BITDSVC_RECONF_FAIL, - GD_MSG_NFS_GNS_START_FAIL, - GD_MSG_NFS_GNS_SETUP_FAIL, - GD_MSG_UNRECOGNIZED_SVC_MNGR, - GD_MSG_NFS_GNS_OP_HANDLE_FAIL, - GD_MSG_EXPORT_FILE_CREATE_FAIL, - GD_MSG_NFS_GNS_HOST_FOUND, - GD_MSG_REBALANCE_CMD_IN_TIER_VOL, - GD_MSG_INCOMPATIBLE_VALUE, - GD_MSG_GENERATED_UUID, - GD_MSG_FILE_DESC_LIMIT_SET, - GD_MSG_CURR_WORK_DIR_INFO, - GD_MSG_STRIPE_COUNT_CHANGE_INFO, - GD_MSG_REPLICA_COUNT_CHANGE_INFO, - GD_MSG_ADD_BRICK_REQ_RECVD, - GD_MSG_VOL_ALREADY_TIER, - GD_MSG_REM_BRICK_REQ_RECVD, - GD_MSG_VOL_NOT_TIER, - GD_MSG_LOG_ROTATE_REQ_RECVD, - GD_MSG_CLI_REQ_RECVD, - GD_MSG_GET_VOL_REQ_RCVD, - GD_MSG_VOL_SYNC_REQ_RCVD, - GD_MSG_PROBE_RCVD, - GD_MSG_UNFRIEND_REQ_RCVD, - GD_MSG_FRIEND_UPDATE_RCVD, - GD_MSG_RESPONSE_INFO, - GD_MSG_VOL_PROFILE_REQ_RCVD, - GD_MSG_GETWD_REQ_RCVD, - GD_MSG_MOUNT_REQ_RCVD, - GD_MSG_UMOUNT_REQ_RCVD, - GD_MSG_CONNECT_RETURNED, - GD_MSG_STATUS_VOL_REQ_RCVD, - GD_MSG_CLRCLK_VOL_REQ_RCVD, - GD_MSG_BARRIER_VOL_REQ_RCVD, - GD_MSG_UUID_RECEIVED, - GD_MSG_REPLACE_BRK_COMMIT_FORCE_REQ_RCVD, - GD_MSG_BRK_PORT_NO_ADD_INDO, - GD_MSG_REPLACE_BRK_REQ_RCVD, - GD_MSG_ADD_OP_ARGS_FAIL, - GD_MSG_POST_HOOK_STUB_INIT_FAIL, - GD_MSG_HOOK_STUB_NULL, - GD_MSG_SPAWN_THREADS_FAIL, - GD_MSG_STALE_VOL_DELETE_INFO, - GD_MSG_PROBE_REQ_RESP_RCVD, - GD_MSG_HOST_PRESENT_ALREADY, - GD_MSG_OP_VERS_INFO, - GD_MSG_OP_VERS_SET_INFO, - GD_MSG_NEW_NODE_STATE_CREATION, - GD_MSG_ALREADY_MOUNTED, - GD_MSG_SHARED_STRG_VOL_OPT_VALIDATE_FAIL, - GD_MSG_NFS_GNS_STOP_FAIL, - GD_MSG_NFS_GNS_RESET_FAIL, - GD_MSG_SHARED_STRG_SET_FAIL, - GD_MSG_VOL_TRANSPORT_TYPE_CHANGE, - GD_MSG_PEER_COUNT_GET_FAIL, - GD_MSG_INSUFFICIENT_UP_NODES, - GD_MSG_OP_STAGE_STATS_VOL_FAIL, - GD_MSG_VOL_ID_SET_FAIL, - GD_MSG_OP_STAGE_RESET_VOL_FAIL, - GD_MSG_OP_STAGE_BITROT_FAIL, - GD_MSG_OP_STAGE_QUOTA_FAIL, - GD_MSG_OP_STAGE_DELETE_VOL_FAIL, - GD_MSG_HANDLE_HEAL_CMD_FAIL, - GD_MSG_CLRCLK_SND_CMD_FAIL, - GD_MSG_DISPERSE_CLUSTER_FOUND, - GD_MSG_HEAL_VOL_REQ_RCVD, - GD_MSG_STATEDUMP_VOL_REQ_RCVD, - GD_MSG_THINPOOLS_FOR_THINLVS, - GD_MSG_OP_STAGE_CREATE_VOL_FAIL, - GD_MSG_OP_STAGE_START_VOL_FAIL, - GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL, - GD_MSG_TASK_ID_INFO, - GD_MSG_DEREGISTER_SUCCESS, - GD_MSG_STATEDUMP_OPTS_RCVD, - GD_MSG_STATEDUMP_INFO, - GD_MSG_RECOVERING_CORRUPT_CONF, - GD_MSG_RETRIEVED_UUID, - GD_MSG_XLATOR_CREATE_FAIL, - GD_MSG_GRAPH_ENTRY_ADD_FAIL, - GD_MSG_ERROR_ENCOUNTERED, - GD_MSG_FILTER_RUN_FAILED, - GD_MSG_DEFAULT_OPT_INFO, - GD_MSG_MARKER_STATUS_GET_FAIL, - GD_MSG_MARKER_DISABLE_FAIL, - GD_MSG_GRAPH_FEATURE_ADD_FAIL, - GD_MSG_XLATOR_SET_OPT_FAIL, - GD_MSG_BUILD_GRAPH_FAILED, - GD_MSG_XML_TEXT_WRITE_FAIL, - GD_MSG_XML_DOC_START_FAIL, - GD_MSG_XML_ELE_CREATE_FAIL, - GD_MSG_VOLUME_INCONSISTENCY, - GD_MSG_XLATOR_LINK_FAIL, - GD_MSG_REMOTE_HOST_GET_FAIL, - GD_MSG_GRAPH_SET_OPT_FAIL, - GD_MSG_ROOT_SQUASH_ENABLED, - GD_MSG_ROOT_SQUASH_FAILED, - GD_MSG_LOCK_OWNER_MISMATCH, - GD_MSG_LOCK_NOT_HELD, - GD_MSG_LOCK_ALREADY_HELD, - GD_MSG_SVC_START_SUCCESS, - GD_MSG_SVC_STOP_SUCCESS, - GD_MSG_PARAM_NULL, - GD_MSG_SVC_STOP_FAIL, - GD_MSG_SHARED_STORAGE_DOES_NOT_EXIST, - GD_MSG_SNAP_PAUSE_TIER_FAIL, - GD_MSG_SNAP_RESUME_TIER_FAIL, - GD_MSG_FILE_NOT_FOUND, - GD_MSG_RETRY_WITH_NEW_PORT, - GD_MSG_REMOTE_VOL_UUID_FAIL, - GD_MSG_SLAVE_VOL_PARSE_FAIL, - GD_MSG_DICT_GET_SUCCESS, - GD_MSG_PMAP_REGISTRY_REMOVE_FAIL, - GD_MSG_MNTBROKER_LABEL_NULL, - GD_MSG_MNTBROKER_LABEL_MISS, - GD_MSG_MNTBROKER_SPEC_MISMATCH, - GD_MSG_SYSCALL_FAIL, - GD_MSG_DAEMON_STATE_REQ_RCVD, - GD_MSG_BRICK_CLEANUP_SUCCESS, - GD_MSG_STATE_STR_GET_FAILED, - GD_MSG_RESET_BRICK_COMMIT_FORCE_REQ_RCVD, - GD_MSG_RESET_BRICK_CMD_FAIL, - GD_MSG_TIERD_STOP_FAIL, - GD_MSG_TIERD_CREATE_FAIL, - GD_MSG_TIERD_START_FAIL, - GD_MSG_TIERD_OBJ_GET_FAIL, - GD_MSG_TIERD_NOT_RUNNING, - GD_MSG_TIERD_INIT_FAIL, - GD_MSG_BRICK_MX_SET_FAIL, - GD_MSG_NO_SIG_TO_PID_ZERO, - GD_MSG_TIER_WATERMARK_RESET_FAIL, - GD_MSG_CLIENTS_GET_STATE_FAILED, - GD_MSG_GNFS_XLATOR_NOT_INSTALLED, - GD_MSG_PIDFILE_UNLINKING, - GD_MSG_VOL_SET_VALIDATION_INFO, - GD_MSG_NO_MUX_LIMIT, - GD_MSG_BRICKPROC_REM_BRICK_FAILED, - GD_MSG_BRICKPROC_ADD_BRICK_FAILED, - GD_MSG_BRICKPROC_NEW_FAILED, - GD_MSG_STATVFS_FAILED, - GD_MSG_GARBAGE_ARGS, - GD_MSG_LOCALTIME_LOGGING_VOL_OPT_VALIDATE_FAIL, - GD_MSG_LOCALTIME_LOGGING_ENABLE, - GD_MSG_LOCALTIME_LOGGING_DISABLE, - GD_MSG_PORTS_EXHAUSTED, - GD_MSG_CHANGELOG_GET_FAIL, - GD_MSG_MANAGER_FUNCTION_FAILED, - GD_MSG_DAEMON_LOG_LEVEL_VOL_OPT_VALIDATE_FAIL -); +GLFS_MSGID( + GLUSTERD, GD_MSG_SERVER_QUORUM_NOT_MET, + GD_MSG_SERVER_QUORUM_LOST_STOPPING_BRICKS, + GD_MSG_SERVER_QUORUM_MET_STARTING_BRICKS, GD_MSG_PEER_DISCONNECTED, + GD_MSG_BRICK_DISCONNECTED, GD_MSG_NODE_DISCONNECTED, + GD_MSG_REBALANCE_DISCONNECTED, GD_MSG_VOL_CLEANUP_FAIL, + GD_MSG_VOL_VERS_MISMATCH, GD_MSG_CKSUM_VERS_MISMATCH, + GD_MSG_QUOTA_CONFIG_VERS_MISMATCH, GD_MSG_QUOTA_CONFIG_CKSUM_MISMATCH, + GD_MSG_BRICK_STOP_FAIL, GD_MSG_SVC_KILL_FAIL, GD_MSG_PID_KILL_FAIL, + GD_MSG_REBAL_NO_SOCK_FILE, GD_MSG_UNIX_OP_BUILD_FAIL, + GD_MSG_RPC_CREATE_FAIL, GD_MSG_FAIL_DEFAULT_OPT_SET, + GD_MSG_CLUSTER_UNLOCK_FAILED, GD_MSG_NO_MEMORY, GD_MSG_UNSUPPORTED_VERSION, + GD_MSG_COMMAND_NOT_FOUND, GD_MSG_SNAPSHOT_OP_FAILED, GD_MSG_INVALID_ENTRY, + GD_MSG_VOL_NOT_FOUND, GD_MSG_REG_COMPILE_FAILED, GD_MSG_FILE_OP_FAILED, + GD_MSG_SNAP_CREATION_FAIL, GD_MSG_VOL_OP_FAILED, GD_MSG_CREATE_DIR_FAILED, + GD_MSG_DIR_OP_FAILED, GD_MSG_VOL_STOP_FAILED, GD_MSG_NO_CLI_RESP, + GD_MSG_LOCK_INIT_FAILED, GD_MSG_SNAP_LIST_GET_FAIL, GD_MSG_UNOUNT_FAILED, + GD_MSG_LOCK_DESTROY_FAILED, GD_MSG_SNAP_CLEANUP_FAIL, + GD_MSG_SNAP_ACTIVATE_FAIL, GD_MSG_SNAP_DEACTIVATE_FAIL, + GD_MSG_SNAP_RESTORE_FAIL, GD_MSG_SNAP_REMOVE_FAIL, GD_MSG_SNAP_CONFIG_FAIL, + GD_MSG_SNAP_STATUS_FAIL, GD_MSG_SNAP_INIT_FAIL, GD_MSG_VOLINFO_SET_FAIL, + GD_MSG_VOLINFO_GET_FAIL, GD_MSG_BRICK_CREATION_FAIL, + GD_MSG_BRICK_GET_INFO_FAIL, GD_MSG_BRICK_NEW_INFO_FAIL, GD_MSG_LVS_FAIL, + GD_MSG_SETXATTR_FAIL, GD_MSG_UMOUNTING_SNAP_BRICK, GD_MSG_OP_UNSUPPORTED, + GD_MSG_SNAP_NOT_FOUND, GD_MSG_FS_LABEL_UPDATE_FAIL, GD_MSG_LVM_MOUNT_FAILED, + GD_MSG_DICT_SET_FAILED, GD_MSG_CANONICALIZE_FAIL, GD_MSG_DICT_GET_FAILED, + GD_MSG_SNAP_INFO_FAIL, GD_MSG_SNAP_VOL_CONFIG_FAIL, + GD_MSG_SNAP_OBJECT_STORE_FAIL, GD_MSG_DICT_UNSERIALIZE_FAIL, + GD_MSG_SNAP_RESTORE_REVERT_FAIL, GD_MSG_SNAP_LIST_SET_FAIL, + GD_MSG_VOLFILE_CREATE_FAIL, GD_MSG_VOLINFO_REMOVE_FAIL, + GD_MSG_VOL_DELETE_FAIL, GD_MSG_SNAPSHOT_PENDING, + GD_MSG_BRICK_PATH_UNMOUNTED, GD_MSG_BRICK_ADD_FAIL, + GD_MSG_BRICK_SET_INFO_FAIL, GD_MSG_LVCREATE_FAIL, GD_MSG_VG_GET_FAIL, + GD_MSG_TPOOL_GET_FAIL, GD_MSG_LVM_REMOVE_FAILED, + GD_MSG_MISSEDSNAP_INFO_SET_FAIL, GD_MSG_BRK_MOUNTOPTS_FAIL, + GD_MSG_MISSED_SNAP_LIST_STORE_FAIL, GD_MSG_INVALID_MISSED_SNAP_ENTRY, + GD_MSG_MISSED_SNAP_GET_FAIL, GD_MSG_MISSED_SNAP_CREATE_FAIL, + GD_MSG_DUP_ENTRY, GD_MSG_MISSED_SNAP_STATUS_DONE, GD_MSG_NO_EXEC_PERMS, + GD_MSG_GLOBAL_OP_VERSION_SET_FAIL, GD_MSG_HARD_LIMIT_SET_FAIL, + GD_MSG_OP_SUCCESS, GD_MSG_STORE_FAIL, GD_MSG_GLOBAL_OP_VERSION_GET_FAIL, + GD_MSG_GEOREP_GET_FAILED, GD_MSG_GLUSTERD_UMOUNT_FAIL, + GD_MSG_QUORUM_CHECK_FAIL, GD_MSG_QUORUM_COUNT_IGNORED, + GD_MSG_SNAP_MOUNT_FAIL, GD_MSG_RSP_DICT_USE_FAIL, GD_MSG_SNAP_IMPORT_FAIL, + GD_MSG_SNAP_CONFLICT, GD_MSG_MISSED_SNAP_DELETE, + GD_MSG_QUOTA_CONFIG_IMPORT_FAIL, GD_MSG_SNAPDIR_CREATE_FAIL, + GD_MSG_MISSED_SNAP_PRESENT, GD_MSG_UUID_NULL, GD_MSG_TSTAMP_SET_FAIL, + GD_MSG_RESP_AGGR_FAIL, GD_MSG_DICT_EMPTY, GD_MSG_DICT_CREATE_FAIL, + GD_MSG_SNAPD_STOP_FAIL, GD_MSG_SOFT_LIMIT_REACHED, GD_MSG_SNAPD_START_FAIL, + GD_MSG_SNAPD_CREATE_FAIL, GD_MSG_SNAPD_INIT_FAIL, GD_MSG_MGMTV3_OP_FAIL, + GD_MSG_MGMTV3_PAYLOAD_BUILD_FAIL, GD_MSG_MGMTV3_UNLOCK_FAIL, + GD_MSG_MGMTV3_LOCK_GET_FAIL, GD_MSG_MGMTV3_LOCKDOWN_FAIL, + GD_MSG_POST_VALIDATION_FAIL, GD_MSG_PRE_VALIDATION_FAIL, + GD_MSG_COMMIT_OP_FAIL, GD_MSG_PEER_LIST_CREATE_FAIL, GD_MSG_BRICK_OP_FAIL, + GD_MSG_OPINFO_SET_FAIL, GD_MSG_OP_EVENT_UNLOCK_FAIL, + GD_MSG_MGMTV3_OP_RESP_FAIL, GD_MSG_PEER_NOT_FOUND, GD_MSG_REQ_DECODE_FAIL, + GD_MSG_DICT_SERL_LENGTH_GET_FAIL, GD_MSG_ALREADY_STOPPED, + GD_MSG_PRE_VALD_RESP_FAIL, GD_MSG_SVC_GET_FAIL, GD_MSG_VOLFILE_NOT_FOUND, + GD_MSG_OP_EVENT_LOCK_FAIL, GD_MSG_NON_STRIPE_VOL, GD_MSG_SNAPD_OBJ_GET_FAIL, + GD_MSG_QUOTA_DISABLED, GD_MSG_CACHE_MINMAX_SIZE_INVALID, + GD_MSG_QUOTA_GET_STAT_FAIL, GD_MSG_SUBVOLUMES_EXCEED, GD_MSG_BRICK_ADD, + GD_MSG_BRICK_REMOVE, GD_MSG_CREATE_KEY_FAIL, + GD_MSG_MULTIPLE_LOCK_ACQUIRE_FAIL, GD_MSG_MULTIPLE_LOCK_RELEASE_FAIL, + GD_MSG_RESP_FROM_UNKNOWN_PEER, GD_MSG_BRICK_MOUNDIRS_AGGR_FAIL, + GD_MSG_GFID_VALIDATE_SET_FAIL, GD_MSG_PEER_LOCK_FAIL, + GD_MSG_PEER_UNLOCK_FAIL, GD_MSG_MGMT_OP_FAIL, + GD_MSG_TRANS_OPINFO_CLEAR_FAIL, GD_MSG_GLUSTERD_LOCK_FAIL, + GD_MSG_TRANS_OPINFO_SET_FAIL, GD_MSG_TRANS_IDGEN_FAIL, GD_MSG_RPC_FAILURE, + GD_MSG_OP_VERS_ADJUST_FAIL, GD_MSG_SNAP_DEVICE_NAME_GET_FAIL, + GD_MSG_SNAP_STATUS_NOT_PENDING, GD_MSG_MGMT_PGM_SET_FAIL, + GD_MSG_EVENT_INJECT_FAIL, GD_MSG_VERS_INFO, GD_MSG_VOL_INFO_REQ_RECVD, + GD_MSG_VERS_GET_FAIL, GD_MSG_EVENT_NEW_GET_FAIL, GD_MSG_RPC_LAYER_ERROR, + GD_MSG_NO_HANDSHAKE_ACK, GD_MSG_OP_VERSION_MISMATCH, + GD_MSG_HANDSHAKE_REQ_REJECTED, GD_MSG_UNKNOWN_MODE, + GD_MSG_DEFRAG_STATUS_UPDATED, GD_MSG_NO_FLAG_SET, + GD_MSG_VERSION_UNSUPPORTED, GD_MSG_UUID_SET_FAIL, GD_MSG_MOUNT_REQ_FAIL, + GD_MSG_GLUSTERD_GLOBAL_INFO_STORE_FAIL, GD_MSG_OP_VERS_STORE_FAIL, + GD_MSG_SNAP_AUTOMIC_UPDATE_FAIL, GD_MSG_SNAPINFO_WRITE_FAIL, + GD_MSG_SNAPINFO_CREATE_FAIL, GD_MSG_SNAPD_INFO_STORE_FAIL, + GD_MSG_BRK_MNTPATH_MOUNT_FAIL, GD_MSG_BRK_MNTPATH_GET_FAIL, + GD_MSG_SNAP_BRK_MNT_RECREATE_FAIL, GD_MSG_SNAP_RESOLVE_BRICK_FAIL, + GD_MSG_RESOLVE_BRICK_FAIL, GD_MSG_BRK_MNT_RECREATE_FAIL, + GD_MSG_TMP_FILE_UNLINK_FAIL, GD_MSG_VOL_VALS_WRITE_FAIL, + GD_MSG_STORE_HANDLE_GET_FAIL, GD_MSG_STORE_HANDLE_WRITE_FAIL, + GD_MSG_MISSED_SNAP_LIST_STORE_HANDLE_GET_FAIL, + GD_MSG_MISSED_SNAP_LIST_EMPTY, GD_MSG_SNAP_VOL_RETRIEVE_FAIL, + GD_MSG_SNAPSHOT_UPDATE_FAIL, GD_MSG_SNAPD_PORT_STORE_FAIL, + GD_MSG_CKSUM_STORE_FAIL, GD_MSG_STORE_HANDLE_CREATE_FAIL, + GD_MSG_HANDLE_NULL, GD_MSG_VOL_RESTORE_FAIL, GD_MSG_NAME_TOO_LONG, + GD_MSG_UUID_PARSE_FAIL, GD_MSG_UNKNOWN_KEY, GD_MSG_STORE_ITER_DESTROY_FAIL, + GD_MSG_STORE_ITER_GET_FAIL, GD_MSG_VOLINFO_UPDATE_FAIL, + GD_MSG_PARSE_BRICKINFO_FAIL, GD_MSG_VERS_STORE_FAIL, GD_MSG_HEADER_ADD_FAIL, + GD_MSG_QUOTA_CONF_WRITE_FAIL, GD_MSG_QUOTA_CONF_CORRUPT, GD_MSG_FORK_FAIL, + GD_MSG_CKSUM_COMPUTE_FAIL, GD_MSG_VERS_CKSUM_STORE_FAIL, + GD_MSG_GETXATTR_FAIL, GD_MSG_CONVERSION_FAILED, GD_MSG_VOL_NOT_DISTRIBUTE, + GD_MSG_VOL_STOPPED, GD_MSG_OPCTX_GET_FAIL, GD_MSG_TASKID_GEN_FAIL, + GD_MSG_REBALANCE_ID_MISSING, GD_MSG_NO_REBALANCE_PFX_IN_VOLNAME, + GD_MSG_DEFRAG_STATUS_UPDATE_FAIL, GD_MSG_UUID_GEN_STORE_FAIL, + GD_MSG_UUID_STORE_FAIL, GD_MSG_NO_INIT, GD_MSG_MODULE_NOT_INSTALLED, + GD_MSG_MODULE_NOT_WORKING, GD_MSG_WRITE_ACCESS_GRANT_FAIL, + GD_MSG_DIRPATH_TOO_LONG, GD_MSG_LOGGROUP_INVALID, GD_MSG_DIR_PERM_LIBERAL, + GD_MSG_DIR_PERM_STRICT, GD_MSG_MOUNT_SPEC_INSTALL_FAIL, + GD_MSG_GLUSTERD_SOCK_LISTENER_START_FAIL, GD_MSG_DIR_NOT_FOUND, + GD_MSG_FAILED_INIT_SHDSVC, GD_MSG_FAILED_INIT_NFSSVC, + GD_MSG_FAILED_INIT_QUOTASVC, GD_MSG_RPC_INIT_FAIL, + GD_MSG_RPCSVC_REG_NOTIFY_RETURNED, GD_MSG_RPC_TRANSPORT_COUNT_GET_FAIL, + GD_MSG_RPC_LISTENER_CREATE_FAIL, GD_MSG_OP_VERS_RESTORE_FAIL, + GD_MSG_SELF_HEALD_DISABLED, GD_MSG_PRIV_NULL, GD_MSG_GSYNC_VALIDATION_FAIL, + GD_MSG_SLAVE_CONFPATH_DETAILS_FETCH_FAIL, GD_MSG_OP_NOT_PERMITTED_AC_REQD, + GD_MSG_OP_NOT_PERMITTED, GD_MSG_REBALANCE_START_FAIL, + GD_MSG_NFS_RECONF_FAIL, GD_MSG_REMOVE_BRICK_ID_SET_FAIL, + GD_MSG_BRICK_MOUNTDIR_GET_FAIL, GD_MSG_BRICK_NOT_FOUND, + GD_MSG_BRKPATH_TOO_LONG, GD_MSG_CLRLOCKS_CLNT_UMOUNT_FAIL, + GD_MSG_CLRLOCKS_CLNT_MOUNT_FAIL, GD_MSG_CLRLOCKS_MOUNTDIR_CREATE_FAIL, + GD_MSG_BRK_PORT_NUM_GET_FAIL, GD_MSG_BRK_STATEDUMP_FAIL, + GD_MSG_VOL_GRAPH_CHANGE_NOTIFY_FAIL, GD_MSG_INVALID_VG, + GD_MSG_GLUSTERD_OP_FAILED, GD_MSG_HOSTNAME_ADD_TO_PEERLIST_FAIL, + GD_MSG_STALE_PEERINFO_REMOVE_FAIL, GD_MSG_TRANS_ID_GET_FAIL, + GD_MSG_RES_DECODE_FAIL, GD_MSG_VOL_ALREADY_EXIST, GD_MSG_BAD_BRKORDER, + GD_MSG_BAD_BRKORDER_CHECK_FAIL, GD_MSG_BRICK_SELECT_FAIL, + GD_MSG_NO_LOCK_RESP_FROM_PEER, GD_MSG_MGMTV3_LOCK_FROM_UUID_REJCT, + GD_MSG_STAGE_FROM_UUID_REJCT, GD_MSG_UNLOCK_FROM_UUID_REJCT, + GD_MSG_MGMTV3_UNLOCK_FROM_UUID_REJCT, GD_MSG_COMMIT_FROM_UUID_REJCT, + GD_MSG_VOL_NOT_STARTED, GD_MSG_VOL_NOT_REPLICA, GD_MSG_VOL_NOT_DISPERSE, + GD_MSG_OLD_REMOVE_BRICK_EXISTS, GD_MSG_USE_THE_FORCE, GD_MSG_OIP, + GD_MSG_OIP_RETRY_LATER, GD_MSG_GSYNC_RESTART_FAIL, + GD_MSG_LOCK_FROM_UUID_REJCT, GD_MSG_BRICK_OP_PAYLOAD_BUILD_FAIL, + GD_MSG_HOSTNAME_RESOLVE_FAIL, GD_MSG_COUNT_VALIDATE_FAILED, + GD_MSG_SPAWNING_CHILD_FAILED, GD_MSG_READ_CHILD_DATA_FAILED, + GD_MSG_DEFAULT_TEMP_CONFIG, GD_MSG_PIDFILE_CREATE_FAILED, + GD_MSG_GSYNCD_SPAWN_FAILED, GD_MSG_SUBOP_NOT_FOUND, GD_MSG_RESERVED_OPTION, + GD_MSG_GLUSTERD_PRIV_NOT_FOUND, GD_MSG_SLAVEINFO_FETCH_ERROR, + GD_MSG_VALIDATE_FAILED, GD_MSG_INVOKE_ERROR, GD_MSG_SESSION_CREATE_ERROR, + GD_MSG_STOP_FORCE, GD_MSG_GET_CONFIG_INFO_FAILED, + GD_MSG_STAT_FILE_READ_FAILED, GD_MSG_CONF_PATH_ASSIGN_FAILED, + GD_MSG_SESSION_INACTIVE, GD_MSG_PIDFILE_NOT_FOUND, GD_MSG_PEER_CMD_ERROR, + GD_MSG_SRC_FILE_ERROR, GD_MSG_GET_STATEFILE_NAME_FAILED, GD_MSG_STATUS_NULL, + GD_MSG_STATUSFILE_CREATE_FAILED, GD_MSG_SLAVE_URL_INVALID, + GD_MSG_INVALID_SLAVE, GD_MSG_READ_ERROR, GD_MSG_ARG_FETCH_ERROR, + GD_MSG_REG_FILE_MISSING, GD_MSG_STATEFILE_NAME_NOT_FOUND, + GD_MSG_GEO_REP_START_FAILED, GD_MSG_GSYNCD_ERROR, + GD_MSG_UPDATE_STATEFILE_FAILED, GD_MSG_STATUS_UPDATE_FAILED, + GD_MSG_GSYNCD_OP_SET_FAILED, GD_MSG_BUFFER_EMPTY, GD_MSG_CONFIG_INFO, + GD_MSG_FETCH_CONFIG_VAL_FAILED, GD_MSG_GSYNCD_PARSE_ERROR, + GD_MSG_SESSION_ALREADY_EXIST, GD_MSG_FORCE_CREATE_SESSION, + GD_MSG_GET_KEY_FAILED, GD_MSG_SESSION_DEL_FAILED, GD_MSG_CMD_EXEC_FAIL, + GD_MSG_STRDUP_FAILED, GD_MSG_UNABLE_TO_END, GD_MSG_PAUSE_FAILED, + GD_MSG_NORMALIZE_URL_FAIL, GD_MSG_MODULE_ERROR, + GD_MSG_SLAVEINFO_STORE_ERROR, GD_MSG_MARKER_START_FAIL, + GD_MSG_RESUME_FAILED, GD_MSG_GLUSTERFS_START_FAIL, + GD_MSG_GLUSTERFS_STOP_FAIL, GD_MSG_RBOP_STATE_STORE_FAIL, + GD_MSG_PUMP_XLATOR_DISABLED, GD_MSG_ABORT_OP_FAIL, GD_MSG_PAUSE_OP_FAIL, + GD_MSG_GLUSTER_SERVICE_START_FAIL, GD_MSG_HANDSHAKE_FAILED, + GD_MSG_CLI_REQ_EMPTY, GD_MSG_PEER_ADD_FAIL, + GD_MSG_SYNC_FROM_LOCALHOST_UNALLOWED, GD_MSG_UUIDS_SAME_RETRY, + GD_MSG_TSP_ALREADY_FORMED, GD_MSG_VOLS_ALREADY_PRESENT, + GD_MSG_REQ_CTX_CREATE_FAIL, GD_MSG_PEER_INFO_UPDATE_FAIL, + GD_MSG_PEERINFO_CREATE_FAIL, GD_MSG_REQ_FROM_UNKNOWN_PEER, + GD_MSG_STATUS_REPLY_STRING_CREATE_FAIL, GD_MSG_TOKENIZE_FAIL, + GD_MSG_LAZY_UMOUNT_FAIL, GD_MSG_NFS_SERVER_START_FAIL, + GD_MSG_GLUSTER_SERVICES_STOP_FAIL, GD_MSG_BRK_CLEANUP_FAIL, + GD_MSG_RB_ALREADY_STARTED, GD_MSG_RB_BRICKINFO_GET_FAIL, GD_MSG_BAD_FORMAT, + GD_MSG_RB_CMD_FAIL, GD_MSG_RB_NOT_STARTED_OR_PAUSED, GD_MSG_RB_NOT_STARTED, + GD_MSG_RB_PAUSED_ALREADY, GD_MSG_NO_FREE_PORTS, + GD_MSG_EVENT_STATE_TRANSITION_FAIL, GD_MSG_HANDLER_RETURNED, + GD_MSG_SNAP_COMPARE_CONFLICT, GD_MSG_PEER_DETACH_CLEANUP_FAIL, + GD_MSG_STALE_VOL_REMOVE_FAIL, GD_MSG_AC_ERROR, GD_MSG_LOCK_FAIL, + GD_MSG_MGMTV3_LOCK_REQ_SEND_FAIL, GD_MSG_GLUSTERD_UNLOCK_FAIL, + GD_MSG_RBOP_START_FAIL, GD_MSG_UNKNOWN_RESPONSE, + GD_MSG_COMMIT_REQ_SEND_FAIL, GD_MSG_OPCTX_UPDATE_FAIL, GD_MSG_OPCTX_NULL, + GD_MSG_DICT_COPY_FAIL, GD_MSG_SHD_STATUS_SET_FAIL, + GD_MSG_REPLICA_INDEX_GET_FAIL, GD_MSG_NFS_SERVER_NOT_RUNNING, + GD_MSG_STAGE_REQ_SEND_FAIL, GD_MSG_LOCK_REQ_SEND_FAIL, + GD_MSG_VOLNAMES_GET_FAIL, GD_MSG_NO_TASK_ID, GD_MSG_ADD_REMOVE_BRICK_FAIL, + GD_MSG_SVC_RESTART_FAIL, GD_MSG_VOL_SET_FAIL, GD_MSG_QUOTAD_NOT_RUNNING, + GD_MSG_XLATOR_COUNT_GET_FAIL, GD_MSG_TRANS_OPINFO_GET_FAIL, + GD_MSG_TRANS_ID_INVALID, GD_MSG_NO_OPTIONS_GIVEN, GD_MSG_SNAPD_NOT_RUNNING, + GD_MSG_ADD_ADDRESS_TO_PEER_FAIL, GD_MSG_PEER_ADDRESS_GET_FAIL, + GD_MSG_GETADDRINFO_FAIL, GD_MSG_PEERINFO_DELETE_FAIL, GD_MSG_KEY_NULL, + GD_MSG_SPAWN_SVCS_FAIL, GD_MSG_DICT_ITER_FAIL, + GD_MSG_TASK_STATUS_UPDATE_FAIL, GD_MSG_VOL_ID_MISMATCH, + GD_MSG_STR_TO_BOOL_FAIL, GD_MSG_RB_MNT_BRICKS_MISMATCH, + GD_MSG_RB_SRC_BRICKS_MISMATCH, GD_MSG_MNTENTRY_GET_FAIL, + GD_MSG_INODE_SIZE_GET_FAIL, GD_MSG_NO_STATEFILE_ENTRY, + GD_MSG_PMAP_UNSET_FAIL, GD_MSG_GLOBAL_OPT_IMPORT_FAIL, + GD_MSD_BRICK_DISCONNECT_FAIL, GD_MSG_SNAP_DETAILS_IMPORT_FAIL, + GD_MSG_BRICKINFO_CREATE_FAIL, GD_MSG_QUOTA_CKSUM_VER_STORE_FAIL, + GD_MSG_CKSUM_GET_FAIL, GD_MSG_BRICKPATH_ROOT_GET_FAIL, + GD_MSG_HOSTNAME_TO_UUID_FAIL, GD_MSG_REPLY_SUBMIT_FAIL, + GD_MSG_SERIALIZE_MSG_FAIL, GD_MSG_ENCODE_FAIL, + GD_MSG_RB_DST_BRICKS_MISMATCH, GD_MSG_XLATOR_VOLOPT_DYNLOAD_ERROR, + GD_MSG_VOLNAME_NOTFOUND_IN_DICT, GD_MSG_FLAGS_NOTFOUND_IN_DICT, + GD_MSG_HOSTNAME_NOTFOUND_IN_DICT, GD_MSG_PORT_NOTFOUND_IN_DICT, + GD_MSG_CMDSTR_NOTFOUND_IN_DICT, GD_MSG_SNAP_OBJ_NEW_FAIL, + GD_MSG_SNAP_BACKEND_MAKE_FAIL, GD_MSG_SNAP_CLONE_FAILED, + GD_MSG_SNAP_CLONE_PREVAL_FAILED, GD_MSG_SNAP_CLONE_POSTVAL_FAILED, + GD_MSG_VOLINFO_STORE_FAIL, GD_MSG_NEW_FRIEND_SM_EVENT_GET_FAIL, + GD_MSG_VOL_TYPE_CHANGING_INFO, GD_MSG_BRKPATH_MNTPNT_MISMATCH, + GD_MSG_TASKS_COUNT_MISMATCH, GD_MSG_WRONG_OPTS_SETTING, + GD_MSG_PATH_ALREADY_PART_OF_VOL, GD_MSG_BRICK_VALIDATE_FAIL, + GD_MSG_READIN_FILE_FAILED, GD_MSG_IMPORT_PRDICT_DICT, + GD_MSG_VOL_OPTS_IMPORT_FAIL, GD_MSG_BRICK_IMPORT_FAIL, + GD_MSG_VOLINFO_IMPORT_FAIL, GD_MSG_BRICK_ID_GEN_FAILED, + GD_MSG_GET_STATUS_DATA_FAIL, GD_MSG_BITROT_NOT_RUNNING, + GD_MSG_SCRUBBER_NOT_RUNNING, GD_MSG_SRC_BRICK_PORT_UNAVAIL, + GD_MSG_BITD_INIT_FAIL, GD_MSG_SCRUB_INIT_FAIL, GD_MSG_VAR_RUN_DIR_INIT_FAIL, + GD_MSG_VAR_RUN_DIR_FIND_FAIL, GD_MSG_SCRUBSVC_RECONF_FAIL, + GD_MSG_BITDSVC_RECONF_FAIL, GD_MSG_NFS_GNS_START_FAIL, + GD_MSG_NFS_GNS_SETUP_FAIL, GD_MSG_UNRECOGNIZED_SVC_MNGR, + GD_MSG_NFS_GNS_OP_HANDLE_FAIL, GD_MSG_EXPORT_FILE_CREATE_FAIL, + GD_MSG_NFS_GNS_HOST_FOUND, GD_MSG_REBALANCE_CMD_IN_TIER_VOL, + GD_MSG_INCOMPATIBLE_VALUE, GD_MSG_GENERATED_UUID, + GD_MSG_FILE_DESC_LIMIT_SET, GD_MSG_CURR_WORK_DIR_INFO, + GD_MSG_STRIPE_COUNT_CHANGE_INFO, GD_MSG_REPLICA_COUNT_CHANGE_INFO, + GD_MSG_ADD_BRICK_REQ_RECVD, GD_MSG_VOL_ALREADY_TIER, + GD_MSG_REM_BRICK_REQ_RECVD, GD_MSG_VOL_NOT_TIER, + GD_MSG_LOG_ROTATE_REQ_RECVD, GD_MSG_CLI_REQ_RECVD, GD_MSG_GET_VOL_REQ_RCVD, + GD_MSG_VOL_SYNC_REQ_RCVD, GD_MSG_PROBE_RCVD, GD_MSG_UNFRIEND_REQ_RCVD, + GD_MSG_FRIEND_UPDATE_RCVD, GD_MSG_RESPONSE_INFO, + GD_MSG_VOL_PROFILE_REQ_RCVD, GD_MSG_GETWD_REQ_RCVD, GD_MSG_MOUNT_REQ_RCVD, + GD_MSG_UMOUNT_REQ_RCVD, GD_MSG_CONNECT_RETURNED, GD_MSG_STATUS_VOL_REQ_RCVD, + GD_MSG_CLRCLK_VOL_REQ_RCVD, GD_MSG_BARRIER_VOL_REQ_RCVD, + GD_MSG_UUID_RECEIVED, GD_MSG_REPLACE_BRK_COMMIT_FORCE_REQ_RCVD, + GD_MSG_BRK_PORT_NO_ADD_INDO, GD_MSG_REPLACE_BRK_REQ_RCVD, + GD_MSG_ADD_OP_ARGS_FAIL, GD_MSG_POST_HOOK_STUB_INIT_FAIL, + GD_MSG_HOOK_STUB_NULL, GD_MSG_SPAWN_THREADS_FAIL, + GD_MSG_STALE_VOL_DELETE_INFO, GD_MSG_PROBE_REQ_RESP_RCVD, + GD_MSG_HOST_PRESENT_ALREADY, GD_MSG_OP_VERS_INFO, GD_MSG_OP_VERS_SET_INFO, + GD_MSG_NEW_NODE_STATE_CREATION, GD_MSG_ALREADY_MOUNTED, + GD_MSG_SHARED_STRG_VOL_OPT_VALIDATE_FAIL, GD_MSG_NFS_GNS_STOP_FAIL, + GD_MSG_NFS_GNS_RESET_FAIL, GD_MSG_SHARED_STRG_SET_FAIL, + GD_MSG_VOL_TRANSPORT_TYPE_CHANGE, GD_MSG_PEER_COUNT_GET_FAIL, + GD_MSG_INSUFFICIENT_UP_NODES, GD_MSG_OP_STAGE_STATS_VOL_FAIL, + GD_MSG_VOL_ID_SET_FAIL, GD_MSG_OP_STAGE_RESET_VOL_FAIL, + GD_MSG_OP_STAGE_BITROT_FAIL, GD_MSG_OP_STAGE_QUOTA_FAIL, + GD_MSG_OP_STAGE_DELETE_VOL_FAIL, GD_MSG_HANDLE_HEAL_CMD_FAIL, + GD_MSG_CLRCLK_SND_CMD_FAIL, GD_MSG_DISPERSE_CLUSTER_FOUND, + GD_MSG_HEAL_VOL_REQ_RCVD, GD_MSG_STATEDUMP_VOL_REQ_RCVD, + GD_MSG_THINPOOLS_FOR_THINLVS, GD_MSG_OP_STAGE_CREATE_VOL_FAIL, + GD_MSG_OP_STAGE_START_VOL_FAIL, GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL, + GD_MSG_TASK_ID_INFO, GD_MSG_DEREGISTER_SUCCESS, GD_MSG_STATEDUMP_OPTS_RCVD, + GD_MSG_STATEDUMP_INFO, GD_MSG_RECOVERING_CORRUPT_CONF, + GD_MSG_RETRIEVED_UUID, GD_MSG_XLATOR_CREATE_FAIL, + GD_MSG_GRAPH_ENTRY_ADD_FAIL, GD_MSG_ERROR_ENCOUNTERED, + GD_MSG_FILTER_RUN_FAILED, GD_MSG_DEFAULT_OPT_INFO, + GD_MSG_MARKER_STATUS_GET_FAIL, GD_MSG_MARKER_DISABLE_FAIL, + GD_MSG_GRAPH_FEATURE_ADD_FAIL, GD_MSG_XLATOR_SET_OPT_FAIL, + GD_MSG_BUILD_GRAPH_FAILED, GD_MSG_XML_TEXT_WRITE_FAIL, + GD_MSG_XML_DOC_START_FAIL, GD_MSG_XML_ELE_CREATE_FAIL, + GD_MSG_VOLUME_INCONSISTENCY, GD_MSG_XLATOR_LINK_FAIL, + GD_MSG_REMOTE_HOST_GET_FAIL, GD_MSG_GRAPH_SET_OPT_FAIL, + GD_MSG_ROOT_SQUASH_ENABLED, GD_MSG_ROOT_SQUASH_FAILED, + GD_MSG_LOCK_OWNER_MISMATCH, GD_MSG_LOCK_NOT_HELD, GD_MSG_LOCK_ALREADY_HELD, + GD_MSG_SVC_START_SUCCESS, GD_MSG_SVC_STOP_SUCCESS, GD_MSG_PARAM_NULL, + GD_MSG_SVC_STOP_FAIL, GD_MSG_SHARED_STORAGE_DOES_NOT_EXIST, + GD_MSG_SNAP_PAUSE_TIER_FAIL, GD_MSG_SNAP_RESUME_TIER_FAIL, + GD_MSG_FILE_NOT_FOUND, GD_MSG_RETRY_WITH_NEW_PORT, + GD_MSG_REMOTE_VOL_UUID_FAIL, GD_MSG_SLAVE_VOL_PARSE_FAIL, + GD_MSG_DICT_GET_SUCCESS, GD_MSG_PMAP_REGISTRY_REMOVE_FAIL, + GD_MSG_MNTBROKER_LABEL_NULL, GD_MSG_MNTBROKER_LABEL_MISS, + GD_MSG_MNTBROKER_SPEC_MISMATCH, GD_MSG_SYSCALL_FAIL, + GD_MSG_DAEMON_STATE_REQ_RCVD, GD_MSG_BRICK_CLEANUP_SUCCESS, + GD_MSG_STATE_STR_GET_FAILED, GD_MSG_RESET_BRICK_COMMIT_FORCE_REQ_RCVD, + GD_MSG_RESET_BRICK_CMD_FAIL, GD_MSG_TIERD_STOP_FAIL, + GD_MSG_TIERD_CREATE_FAIL, GD_MSG_TIERD_START_FAIL, + GD_MSG_TIERD_OBJ_GET_FAIL, GD_MSG_TIERD_NOT_RUNNING, GD_MSG_TIERD_INIT_FAIL, + GD_MSG_BRICK_MX_SET_FAIL, GD_MSG_NO_SIG_TO_PID_ZERO, + GD_MSG_TIER_WATERMARK_RESET_FAIL, GD_MSG_CLIENTS_GET_STATE_FAILED, + GD_MSG_GNFS_XLATOR_NOT_INSTALLED, GD_MSG_PIDFILE_UNLINKING, + GD_MSG_VOL_SET_VALIDATION_INFO, GD_MSG_NO_MUX_LIMIT, + GD_MSG_BRICKPROC_REM_BRICK_FAILED, GD_MSG_BRICKPROC_ADD_BRICK_FAILED, + GD_MSG_BRICKPROC_NEW_FAILED, GD_MSG_STATVFS_FAILED, GD_MSG_GARBAGE_ARGS, + GD_MSG_LOCALTIME_LOGGING_VOL_OPT_VALIDATE_FAIL, + GD_MSG_LOCALTIME_LOGGING_ENABLE, GD_MSG_LOCALTIME_LOGGING_DISABLE, + GD_MSG_PORTS_EXHAUSTED, GD_MSG_CHANGELOG_GET_FAIL, + GD_MSG_MANAGER_FUNCTION_FAILED, + GD_MSG_DAEMON_LOG_LEVEL_VOL_OPT_VALIDATE_FAIL); #endif /* !_GLUSTERD_MESSAGES_H_ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-mgmt.h index 2215f178327..9b57f4cb833 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.h +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.h @@ -10,74 +10,73 @@ #ifndef _GLUSTERD_MGMT_H_ #define _GLUSTERD_MGMT_H_ -void gd_mgmt_v3_collate_errors (struct syncargs *args, int op_ret, int op_errno, - char *op_errstr, int op_code, uuid_t peerid, - u_char *uuid); +void +gd_mgmt_v3_collate_errors(struct syncargs *args, int op_ret, int op_errno, + char *op_errstr, int op_code, uuid_t peerid, + u_char *uuid); int32_t -gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict, - char **op_errstr, dict_t *rsp_dict, - uint32_t *op_errno); +gd_mgmt_v3_pre_validate_fn(glusterd_op_t op, dict_t *dict, char **op_errstr, + dict_t *rsp_dict, uint32_t *op_errno); int32_t -gd_mgmt_v3_brick_op_fn (glusterd_op_t op, dict_t *dict, - char **op_errstr, dict_t *rsp_dict); +gd_mgmt_v3_brick_op_fn(glusterd_op_t op, dict_t *dict, char **op_errstr, + dict_t *rsp_dict); int32_t -gd_mgmt_v3_commit_fn (glusterd_op_t op, dict_t *dict, - char **op_errstr, uint32_t *op_errno, - dict_t *rsp_dict); +gd_mgmt_v3_commit_fn(glusterd_op_t op, dict_t *dict, char **op_errstr, + uint32_t *op_errno, dict_t *rsp_dict); int32_t -gd_mgmt_v3_post_validate_fn (glusterd_op_t op, int32_t op_ret, dict_t *dict, +gd_mgmt_v3_post_validate_fn(glusterd_op_t op, int32_t op_ret, dict_t *dict, char **op_errstr, dict_t *rsp_dict); int32_t -glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op, +glusterd_mgmt_v3_initiate_all_phases(rpcsvc_request_t *req, glusterd_op_t op, dict_t *dict); int32_t -glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, +glusterd_mgmt_v3_initiate_snap_phases(rpcsvc_request_t *req, glusterd_op_t op, dict_t *dict); int -glusterd_snap_pre_validate_use_rsp_dict (dict_t *dst, dict_t *src); +glusterd_snap_pre_validate_use_rsp_dict(dict_t *dst, dict_t *src); int32_t -glusterd_set_barrier_value (dict_t *dict, char *option); +glusterd_set_barrier_value(dict_t *dict, char *option); int -glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict, - char **op_errstr, uint32_t *op_errno, - gf_boolean_t *is_acquired, - uint32_t txn_generation); +glusterd_mgmt_v3_initiate_lockdown(glusterd_op_t op, dict_t *dict, + char **op_errstr, uint32_t *op_errno, + gf_boolean_t *is_acquired, + uint32_t txn_generation); int -glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict, - glusterd_op_t op); +glusterd_mgmt_v3_build_payload(dict_t **req, char **op_errstr, dict_t *dict, + glusterd_op_t op); int -glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict, - char **op_errstr, uint32_t *op_errno, - uint32_t txn_generation); +glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict, + char **op_errstr, uint32_t *op_errno, + uint32_t txn_generation); int -glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, - char **op_errstr, uint32_t *op_errno, - uint32_t txn_generation); +glusterd_mgmt_v3_commit(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, + char **op_errstr, uint32_t *op_errno, + uint32_t txn_generation); int -glusterd_mgmt_v3_release_peer_locks (glusterd_op_t op, dict_t *dict, - int32_t op_ret, char **op_errstr, - gf_boolean_t is_acquired, - uint32_t txn_generation); +glusterd_mgmt_v3_release_peer_locks(glusterd_op_t op, dict_t *dict, + int32_t op_ret, char **op_errstr, + gf_boolean_t is_acquired, + uint32_t txn_generation); int32_t -glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid); +glusterd_multiple_mgmt_v3_unlock(dict_t *dict, uuid_t uuid); int -glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); +glusterd_reset_brick_prevalidate(dict_t *dict, char **op_errstr, + dict_t *rsp_dict); int -glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict); +glusterd_op_reset_brick(dict_t *dict, dict_t *rsp_dict); #endif /* _GLUSTERD_MGMT_H_ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h index 83267c203ca..319e05188b4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h +++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h @@ -9,34 +9,31 @@ */ #define MB_HIVE "mb_hive" -typedef enum { - SET_SUB = 1, - SET_SUPER, - SET_EQUAL, - SET_INTERSECT -} gf_setrel_t; +typedef enum { SET_SUB = 1, SET_SUPER, SET_EQUAL, SET_INTERSECT } gf_setrel_t; struct gf_mount_pattern { - char **components; - gf_setrel_t condition; - gf_boolean_t negative; + char **components; + gf_setrel_t condition; + gf_boolean_t negative; }; typedef struct gf_mount_pattern gf_mount_pattern_t; struct gf_mount_spec { - struct cds_list_head speclist; - char *label; - gf_mount_pattern_t *patterns; - size_t len; + struct cds_list_head speclist; + char *label; + gf_mount_pattern_t *patterns; + size_t len; }; typedef struct gf_mount_spec gf_mount_spec_t; +int +parse_mount_pattern_desc(gf_mount_spec_t *mspec, char *pdesc); -int parse_mount_pattern_desc (gf_mount_spec_t *mspec, char *pdesc); +int +make_georep_mountspec(gf_mount_spec_t *mspec, const char *volname, char *user); +int +make_ghadoop_mountspec(gf_mount_spec_t *mspec, const char *volname, char *user, + char *server); -int make_georep_mountspec (gf_mount_spec_t *mspec, const char *volname, - char *user); -int make_ghadoop_mountspec (gf_mount_spec_t *mspec, const char *volname, - char *user, char *server); - -int glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno); +int +glusterd_do_mount(char *label, dict_t *argdict, char **path, int *op_errno); diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h index 6330b71ba7d..47e89830f55 100644 --- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h @@ -14,12 +14,12 @@ #include "glusterd-svc-mgmt.h" void -glusterd_nfssvc_build (glusterd_svc_t *svc); +glusterd_nfssvc_build(glusterd_svc_t *svc); int -glusterd_nfssvc_init (glusterd_svc_t *svc); +glusterd_nfssvc_init(glusterd_svc_t *svc); int -glusterd_nfssvc_reconfigure (); +glusterd_nfssvc_reconfigure(); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index 92a604b680c..4fcaff1c8ba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -10,7 +10,6 @@ #ifndef _GLUSTERD_OP_SM_H_ #define _GLUSTERD_OP_SM_H_ - #include <pthread.h> #include "compat-uuid.h" @@ -23,292 +22,293 @@ #include "protocol-common.h" #include "glusterd-hooks.h" -#define GD_OP_PROTECTED (0x02) -#define GD_OP_UNPROTECTED (0x04) +#define GD_OP_PROTECTED (0x02) +#define GD_OP_UNPROTECTED (0x04) typedef enum glusterd_op_sm_state_ { - GD_OP_STATE_DEFAULT = 0, - GD_OP_STATE_LOCK_SENT, - GD_OP_STATE_LOCKED, - GD_OP_STATE_STAGE_OP_SENT, - GD_OP_STATE_STAGED, - GD_OP_STATE_COMMIT_OP_SENT, - GD_OP_STATE_COMMITED, - GD_OP_STATE_UNLOCK_SENT, - GD_OP_STATE_STAGE_OP_FAILED, - GD_OP_STATE_COMMIT_OP_FAILED, - GD_OP_STATE_BRICK_OP_SENT, - GD_OP_STATE_BRICK_OP_FAILED, - GD_OP_STATE_BRICK_COMMITTED, - GD_OP_STATE_BRICK_COMMIT_FAILED, - GD_OP_STATE_ACK_DRAIN, - GD_OP_STATE_MAX, + GD_OP_STATE_DEFAULT = 0, + GD_OP_STATE_LOCK_SENT, + GD_OP_STATE_LOCKED, + GD_OP_STATE_STAGE_OP_SENT, + GD_OP_STATE_STAGED, + GD_OP_STATE_COMMIT_OP_SENT, + GD_OP_STATE_COMMITED, + GD_OP_STATE_UNLOCK_SENT, + GD_OP_STATE_STAGE_OP_FAILED, + GD_OP_STATE_COMMIT_OP_FAILED, + GD_OP_STATE_BRICK_OP_SENT, + GD_OP_STATE_BRICK_OP_FAILED, + GD_OP_STATE_BRICK_COMMITTED, + GD_OP_STATE_BRICK_COMMIT_FAILED, + GD_OP_STATE_ACK_DRAIN, + GD_OP_STATE_MAX, } glusterd_op_sm_state_t; typedef enum glusterd_op_sm_event_type_ { - GD_OP_EVENT_NONE = 0, - GD_OP_EVENT_START_LOCK, - GD_OP_EVENT_LOCK, - GD_OP_EVENT_RCVD_ACC, - GD_OP_EVENT_ALL_ACC, - GD_OP_EVENT_STAGE_ACC, - GD_OP_EVENT_COMMIT_ACC, - GD_OP_EVENT_RCVD_RJT, - GD_OP_EVENT_STAGE_OP, - GD_OP_EVENT_COMMIT_OP, - GD_OP_EVENT_UNLOCK, - GD_OP_EVENT_START_UNLOCK, - GD_OP_EVENT_ALL_ACK, - GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP, - GD_OP_EVENT_MAX + GD_OP_EVENT_NONE = 0, + GD_OP_EVENT_START_LOCK, + GD_OP_EVENT_LOCK, + GD_OP_EVENT_RCVD_ACC, + GD_OP_EVENT_ALL_ACC, + GD_OP_EVENT_STAGE_ACC, + GD_OP_EVENT_COMMIT_ACC, + GD_OP_EVENT_RCVD_RJT, + GD_OP_EVENT_STAGE_OP, + GD_OP_EVENT_COMMIT_OP, + GD_OP_EVENT_UNLOCK, + GD_OP_EVENT_START_UNLOCK, + GD_OP_EVENT_ALL_ACK, + GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP, + GD_OP_EVENT_MAX } glusterd_op_sm_event_type_t; - struct glusterd_op_sm_event_ { - struct cds_list_head list; - void *ctx; - glusterd_op_sm_event_type_t event; - uuid_t txn_id; + struct cds_list_head list; + void *ctx; + glusterd_op_sm_event_type_t event; + uuid_t txn_id; }; typedef struct glusterd_op_sm_event_ glusterd_op_sm_event_t; -typedef int (*glusterd_op_sm_ac_fn) (glusterd_op_sm_event_t *, void *); +typedef int (*glusterd_op_sm_ac_fn)(glusterd_op_sm_event_t *, void *); typedef struct glusterd_op_sm_ { - glusterd_op_sm_state_t next_state; - glusterd_op_sm_ac_fn handler; + glusterd_op_sm_state_t next_state; + glusterd_op_sm_ac_fn handler; } glusterd_op_sm_t; typedef struct glusterd_op_sm_state_info_ { - glusterd_op_sm_state_t state; - struct timeval time; + glusterd_op_sm_state_t state; + struct timeval time; } glusterd_op_sm_state_info_t; struct glusterd_op_info_ { - glusterd_op_sm_state_info_t state; - int32_t pending_count; - int32_t brick_pending_count; - int32_t op_count; - /* op is an enum, glusterd_op_t or glusterd_op_sm_state_info_t */ - int op; - struct cds_list_head op_peers; - void *op_ctx; - rpcsvc_request_t *req; - int32_t op_ret; - int32_t op_errno; - char *op_errstr; - struct cds_list_head pending_bricks; - uint32_t txn_generation; - gf_boolean_t skip_locking; + glusterd_op_sm_state_info_t state; + int32_t pending_count; + int32_t brick_pending_count; + int32_t op_count; + /* op is an enum, glusterd_op_t or glusterd_op_sm_state_info_t */ + int op; + struct cds_list_head op_peers; + void *op_ctx; + rpcsvc_request_t *req; + int32_t op_ret; + int32_t op_errno; + char *op_errstr; + struct cds_list_head pending_bricks; + uint32_t txn_generation; + gf_boolean_t skip_locking; }; typedef struct glusterd_op_info_ glusterd_op_info_t; struct glusterd_op_log_filename_ctx_ { - char volume_name[GD_VOLUME_NAME_MAX]; - char brick[GD_VOLUME_NAME_MAX]; - char path[PATH_MAX]; + char volume_name[GD_VOLUME_NAME_MAX]; + char brick[GD_VOLUME_NAME_MAX]; + char path[PATH_MAX]; }; typedef struct glusterd_op_log_filename_ctx_ glusterd_op_log_filename_ctx_t; struct glusterd_op_lock_ctx_ { - uuid_t uuid; - dict_t *dict; - rpcsvc_request_t *req; + uuid_t uuid; + dict_t *dict; + rpcsvc_request_t *req; }; typedef struct glusterd_op_lock_ctx_ glusterd_op_lock_ctx_t; struct glusterd_req_ctx_ { - rpcsvc_request_t *req; - u_char uuid[16]; - int op; - dict_t *dict; + rpcsvc_request_t *req; + u_char uuid[16]; + int op; + dict_t *dict; }; typedef struct glusterd_req_ctx_ glusterd_req_ctx_t; typedef struct glusterd_op_brick_rsp_ctx_ { - int op_ret; - char *op_errstr; - dict_t *rsp_dict; - glusterd_req_ctx_t *commit_ctx; - glusterd_pending_node_t *pending_node; + int op_ret; + char *op_errstr; + dict_t *rsp_dict; + glusterd_req_ctx_t *commit_ctx; + glusterd_pending_node_t *pending_node; } glusterd_op_brick_rsp_ctx_t; typedef struct glusterd_pr_brick_rsp_conv_t { - int count; - dict_t *dict; + int count; + dict_t *dict; } glusterd_pr_brick_rsp_conv_t; typedef struct glusterd_heal_rsp_conv_ { - dict_t *dict; - glusterd_volinfo_t *volinfo; - xlator_t *this; + dict_t *dict; + glusterd_volinfo_t *volinfo; + xlator_t *this; } glusterd_heal_rsp_conv_t; typedef struct glusterd_status_rsp_conv_ { - int count; - int brick_index_max; - int other_count; - dict_t *dict; + int count; + int brick_index_max; + int other_count; + dict_t *dict; } glusterd_status_rsp_conv_t; - typedef struct glusterd_txn_opinfo_object_ { - glusterd_op_info_t opinfo; + glusterd_op_info_t opinfo; } glusterd_txn_opinfo_obj; typedef enum cli_cmd_type_ { - PER_HEAL_XL, - ALL_HEAL_XL, - } cli_cmd_type; + PER_HEAL_XL, + ALL_HEAL_XL, +} cli_cmd_type; typedef struct glusterd_all_volume_options { - char *option; - char *dflt_val; + char *option; + char *dflt_val; } glusterd_all_vol_opts; int -glusterd_op_commit_hook (glusterd_op_t op, dict_t *op_ctx, - glusterd_commit_hook_type_t type); +glusterd_op_commit_hook(glusterd_op_t op, dict_t *op_ctx, + glusterd_commit_hook_type_t type); int -glusterd_op_sm_new_event (glusterd_op_sm_event_type_t event_type, - glusterd_op_sm_event_t **new_event); +glusterd_op_sm_new_event(glusterd_op_sm_event_type_t event_type, + glusterd_op_sm_event_t **new_event); int -glusterd_op_sm_inject_event (glusterd_op_sm_event_type_t event_type, - uuid_t *txn_id, void *ctx); +glusterd_op_sm_inject_event(glusterd_op_sm_event_type_t event_type, + uuid_t *txn_id, void *ctx); int -glusterd_op_sm_init (); +glusterd_op_sm_init(); int -glusterd_op_sm (); +glusterd_op_sm(); int32_t -glusterd_op_set_ctx (void *ctx); +glusterd_op_set_ctx(void *ctx); int32_t -glusterd_op_set_op (glusterd_op_t op); +glusterd_op_set_op(glusterd_op_t op); int -glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx); +glusterd_op_build_payload(dict_t **req, char **op_errstr, dict_t *op_ctx); int32_t -glusterd_op_stage_validate (glusterd_op_t op, dict_t *req, char **op_errstr, - dict_t *rsp_dict); +glusterd_op_stage_validate(glusterd_op_t op, dict_t *req, char **op_errstr, + dict_t *rsp_dict); int32_t -glusterd_op_commit_perform (glusterd_op_t op, dict_t *req, char **op_errstr, - dict_t* dict); +glusterd_op_commit_perform(glusterd_op_t op, dict_t *req, char **op_errstr, + dict_t *dict); int32_t -glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx, - char *err_str, size_t err_len); +glusterd_op_txn_begin(rpcsvc_request_t *req, glusterd_op_t op, void *ctx, + char *err_str, size_t err_len); int32_t -glusterd_op_txn_complete (); +glusterd_op_txn_complete(); void * -glusterd_op_get_ctx (); +glusterd_op_get_ctx(); int32_t -glusterd_op_set_req (rpcsvc_request_t *req); +glusterd_op_set_req(rpcsvc_request_t *req); int32_t -glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, - int32_t op_errno, rpcsvc_request_t *req, - void *ctx, char *op_errstr); +glusterd_op_send_cli_response(glusterd_op_t op, int32_t op_ret, + int32_t op_errno, rpcsvc_request_t *req, + void *ctx, char *op_errstr); int32_t -glusterd_op_get_op (); +glusterd_op_get_op(); int32_t -glusterd_op_clear_op (); +glusterd_op_clear_op(); int32_t -glusterd_op_free_ctx (glusterd_op_t op, void *ctx); +glusterd_op_free_ctx(glusterd_op_t op, void *ctx); int glusterd_check_option_exists(char *optstring, char **completion); int -set_xlator_option (dict_t *dict, char *key, char *value); +set_xlator_option(dict_t *dict, char *key, char *value); -char* -glusterd_op_sm_state_name_get (int state); +char * +glusterd_op_sm_state_name_get(int state); -char* -glusterd_op_sm_event_name_get (int event); +char * +glusterd_op_sm_event_name_get(int event); int32_t -glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr, - struct cds_list_head *selected, dict_t *rsp_dict); +glusterd_op_bricks_select(glusterd_op_t op, dict_t *dict, char **op_errstr, + struct cds_list_head *selected, dict_t *rsp_dict); int -glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickinfo, - gd1_mgmt_brick_op_req **req, dict_t *dict); +glusterd_brick_op_build_payload(glusterd_op_t op, + glusterd_brickinfo_t *brickinfo, + gd1_mgmt_brick_op_req **req, dict_t *dict); int -glusterd_node_op_build_payload (glusterd_op_t op, gd1_mgmt_brick_op_req **req, +glusterd_node_op_build_payload(glusterd_op_t op, gd1_mgmt_brick_op_req **req, dict_t *dict); int32_t -glusterd_handle_brick_rsp (void *pending_entry, glusterd_op_t op, - dict_t *rsp_dict, dict_t *ctx_dict, char **op_errstr, - gd_node_type type); +glusterd_handle_brick_rsp(void *pending_entry, glusterd_op_t op, + dict_t *rsp_dict, dict_t *ctx_dict, char **op_errstr, + gd_node_type type); -dict_t* -glusterd_op_init_commit_rsp_dict (glusterd_op_t op); +dict_t * +glusterd_op_init_commit_rsp_dict(glusterd_op_t op); void -glusterd_op_modify_op_ctx (glusterd_op_t op, void *op_ctx); +glusterd_op_modify_op_ctx(glusterd_op_t op, void *op_ctx); void -glusterd_op_perform_detach_tier (glusterd_volinfo_t *volinfo); +glusterd_op_perform_detach_tier(glusterd_volinfo_t *volinfo); int -glusterd_set_detach_bricks (dict_t *dict, glusterd_volinfo_t *volinfo); +glusterd_set_detach_bricks(dict_t *dict, glusterd_volinfo_t *volinfo); int32_t -glusterd_volume_stats_read_perf (char *brick_path, int32_t blk_size, - int32_t blk_count, double *throughput, double *time); +glusterd_volume_stats_read_perf(char *brick_path, int32_t blk_size, + int32_t blk_count, double *throughput, + double *time); int32_t -glusterd_volume_stats_write_perf (char *brick_path, int32_t blk_size, - int32_t blk_count, double *throughput, double *time); +glusterd_volume_stats_write_perf(char *brick_path, int32_t blk_size, + int32_t blk_count, double *throughput, + double *time); gf_boolean_t -glusterd_is_volume_started (glusterd_volinfo_t *volinfo); +glusterd_is_volume_started(glusterd_volinfo_t *volinfo); int -glusterd_start_bricks (glusterd_volinfo_t *volinfo); +glusterd_start_bricks(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_are_all_volumes_stopped (); +glusterd_are_all_volumes_stopped(); int -glusterd_stop_bricks (glusterd_volinfo_t *volinfo); +glusterd_stop_bricks(glusterd_volinfo_t *volinfo); int -glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict, - dict_t *op_ctx); +glusterd_defrag_volume_node_rsp(dict_t *req_dict, dict_t *rsp_dict, + dict_t *op_ctx); #ifdef HAVE_BD_XLATOR int -glusterd_is_valid_vg (glusterd_brickinfo_t *brick, int check_tag, char *msg); +glusterd_is_valid_vg(glusterd_brickinfo_t *brick, int check_tag, char *msg); #endif int32_t -glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo); +glusterd_get_txn_opinfo(uuid_t *txn_id, glusterd_op_info_t *opinfo); int32_t -glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo); +glusterd_set_txn_opinfo(uuid_t *txn_id, glusterd_op_info_t *opinfo); int32_t -glusterd_clear_txn_opinfo (uuid_t *txn_id); +glusterd_clear_txn_opinfo(uuid_t *txn_id); int32_t -glusterd_generate_txn_id (dict_t *dict, uuid_t **txn_id); +glusterd_generate_txn_id(dict_t *dict, uuid_t **txn_id); void -glusterd_set_opinfo (char *errstr, int32_t op_errno, int32_t op_ret); +glusterd_set_opinfo(char *errstr, int32_t op_errno, int32_t op_ret); int -glusterd_dict_set_volid (dict_t *dict, char *volname, char **op_errstr); +glusterd_dict_set_volid(dict_t *dict, char *volname, char **op_errstr); int32_t -glusterd_tier_op (xlator_t *this, void *data); +glusterd_tier_op(xlator_t *this, void *data); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h index b03b136d3ca..47cbf6ee13d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h @@ -8,86 +8,84 @@ cases as published by the Free Software Foundation. */ - #ifndef _GLUSTERD_PEER_UTILS_H #define _GLUSTERD_PEER_UTILS_H #include "glusterd.h" int32_t -glusterd_peerinfo_cleanup (glusterd_peerinfo_t *peerinfo); +glusterd_peerinfo_cleanup(glusterd_peerinfo_t *peerinfo); glusterd_peerinfo_t * -glusterd_peerinfo_find_by_hostname (const char *hoststr); +glusterd_peerinfo_find_by_hostname(const char *hoststr); int -glusterd_hostname_to_uuid (char *hostname, uuid_t uuid); +glusterd_hostname_to_uuid(char *hostname, uuid_t uuid); glusterd_peerinfo_t * -glusterd_peerinfo_find_by_uuid (uuid_t uuid); +glusterd_peerinfo_find_by_uuid(uuid_t uuid); glusterd_peerinfo_t * -glusterd_peerinfo_find (uuid_t uuid, const char *hostname); +glusterd_peerinfo_find(uuid_t uuid, const char *hostname); glusterd_peerinfo_t * -glusterd_peerinfo_new (glusterd_friend_sm_state_t state, uuid_t *uuid, - const char *hostname, int port); +glusterd_peerinfo_new(glusterd_friend_sm_state_t state, uuid_t *uuid, + const char *hostname, int port); gf_boolean_t -glusterd_chk_peers_connected_befriended (uuid_t skip_uuid); +glusterd_chk_peers_connected_befriended(uuid_t skip_uuid); char * -glusterd_uuid_to_hostname (uuid_t uuid); +glusterd_uuid_to_hostname(uuid_t uuid); -char* -gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo); +char * +gd_peer_uuid_str(glusterd_peerinfo_t *peerinfo); gf_boolean_t -glusterd_are_all_peers_up (); +glusterd_are_all_peers_up(); gf_boolean_t -glusterd_are_vol_all_peers_up (glusterd_volinfo_t *volinfo, - struct cds_list_head *peers, - char **down_peerstr); +glusterd_are_vol_all_peers_up(glusterd_volinfo_t *volinfo, + struct cds_list_head *peers, char **down_peerstr); int32_t -glusterd_peer_hostname_new (const char *hostname, - glusterd_peer_hostname_t **name); +glusterd_peer_hostname_new(const char *hostname, + glusterd_peer_hostname_t **name); void -glusterd_peer_hostname_free (glusterd_peer_hostname_t *name); +glusterd_peer_hostname_free(glusterd_peer_hostname_t *name); gf_boolean_t -gd_peer_has_address (glusterd_peerinfo_t *peerinfo, const char *address); +gd_peer_has_address(glusterd_peerinfo_t *peerinfo, const char *address); int -gd_add_address_to_peer (glusterd_peerinfo_t *peerinfo, const char *address); +gd_add_address_to_peer(glusterd_peerinfo_t *peerinfo, const char *address); int -gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict, - const char *prefix); +gd_add_friend_to_dict(glusterd_peerinfo_t *friend, dict_t *dict, + const char *prefix); glusterd_peerinfo_t * -gd_peerinfo_find_from_hostname (const char *hoststr); +gd_peerinfo_find_from_hostname(const char *hoststr); glusterd_peerinfo_t * -gd_peerinfo_find_from_addrinfo (const struct addrinfo *addr); +gd_peerinfo_find_from_addrinfo(const struct addrinfo *addr); int -gd_update_peerinfo_from_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict, - const char *prefix); +gd_update_peerinfo_from_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict, + const char *prefix); glusterd_peerinfo_t * -gd_peerinfo_from_dict (dict_t *dict, const char *prefix); +gd_peerinfo_from_dict(dict_t *dict, const char *prefix); int -gd_add_peer_hostnames_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict, - const char *prefix); +gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict, + const char *prefix); int -gd_add_peer_detail_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *friends, - int count); +gd_add_peer_detail_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *friends, + int count); glusterd_peerinfo_t * -glusterd_peerinfo_find_by_generation (uint32_t generation); +glusterd_peerinfo_find_by_generation(uint32_t generation); int -glusterd_get_peers_count (); +glusterd_get_peers_count(); #endif /* _GLUSTERD_PEER_UTILS_H */ diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.h b/xlators/mgmt/glusterd/src/glusterd-pmap.h index 04004c2b2af..8a3ebac48a0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.h +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.h @@ -20,31 +20,38 @@ #include "byte-order.h" #include "rpcsvc.h" - struct pmap_port_status { - gf_pmap_port_type_t type; - char *brickname; - void *xprt; + gf_pmap_port_type_t type; + char *brickname; + void *xprt; }; struct pmap_registry { - int base_port; - int max_port; - int last_alloc; - struct pmap_port_status ports[GF_PORT_MAX + 1]; + int base_port; + int max_port; + int last_alloc; + struct pmap_port_status ports[GF_PORT_MAX + 1]; }; -int pmap_assign_port (xlator_t *this, int port, const char *path); -int pmap_mark_port_leased (xlator_t *this, int port); -int pmap_registry_alloc (xlator_t *this); -int pmap_registry_bind (xlator_t *this, int port, const char *brickname, - gf_pmap_port_type_t type, void *xprt); -int pmap_registry_extend (xlator_t *this, int port, const char *brickname); -int pmap_registry_remove (xlator_t *this, int port, const char *brickname, - gf_pmap_port_type_t type, void *xprt, - gf_boolean_t brick_disconnect); -int pmap_registry_search (xlator_t *this, const char *brickname, - gf_pmap_port_type_t type, gf_boolean_t destroy); -struct pmap_registry *pmap_registry_get (xlator_t *this); +int +pmap_assign_port(xlator_t *this, int port, const char *path); +int +pmap_mark_port_leased(xlator_t *this, int port); +int +pmap_registry_alloc(xlator_t *this); +int +pmap_registry_bind(xlator_t *this, int port, const char *brickname, + gf_pmap_port_type_t type, void *xprt); +int +pmap_registry_extend(xlator_t *this, int port, const char *brickname); +int +pmap_registry_remove(xlator_t *this, int port, const char *brickname, + gf_pmap_port_type_t type, void *xprt, + gf_boolean_t brick_disconnect); +int +pmap_registry_search(xlator_t *this, const char *brickname, + gf_pmap_port_type_t type, gf_boolean_t destroy); +struct pmap_registry * +pmap_registry_get(xlator_t *this); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.h index f5235171816..36ad5ae6731 100644 --- a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.h +++ b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.h @@ -14,31 +14,31 @@ typedef struct glusterd_proc_ glusterd_proc_t; enum proc_flags { - PROC_NONE = 0, - PROC_START, - PROC_START_NO_WAIT, - PROC_STOP, - PROC_STOP_FORCE + PROC_NONE = 0, + PROC_START, + PROC_START_NO_WAIT, + PROC_STOP, + PROC_STOP_FORCE }; struct glusterd_proc_ { - char name[PATH_MAX]; - char pidfile[PATH_MAX]; - char logdir[PATH_MAX]; - char logfile[PATH_MAX]; - char volfile[PATH_MAX]; - char volfileserver[PATH_MAX]; - char volfileid[256]; + char name[PATH_MAX]; + char pidfile[PATH_MAX]; + char logdir[PATH_MAX]; + char logfile[PATH_MAX]; + char volfile[PATH_MAX]; + char volfileserver[PATH_MAX]; + char volfileid[256]; }; int -glusterd_proc_init (glusterd_proc_t *proc, char *name, char *pidfile, - char *logdir, char *logfile, char *volfile, char *volfileid, - char *volfileserver); +glusterd_proc_init(glusterd_proc_t *proc, char *name, char *pidfile, + char *logdir, char *logfile, char *volfile, char *volfileid, + char *volfileserver); int -glusterd_proc_stop (glusterd_proc_t *proc, int sig, int flags); +glusterd_proc_stop(glusterd_proc_t *proc, int sig, int flags); int -glusterd_proc_is_running (glusterd_proc_t *proc); +glusterd_proc_is_running(glusterd_proc_t *proc); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.h b/xlators/mgmt/glusterd/src/glusterd-quota.h index 9efff41b436..ab2092a9c6a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.h +++ b/xlators/mgmt/glusterd/src/glusterd-quota.h @@ -11,7 +11,7 @@ #define _GLUSTERD_QUOTA_ int -glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, - char *gfid_str, int opcode, char **op_errstr); +glusterd_store_quota_config(glusterd_volinfo_t *volinfo, char *path, + char *gfid_str, int opcode, char **op_errstr); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.h b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.h index 91da50dc36d..e8d9bbee964 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.h @@ -14,18 +14,18 @@ #include "glusterd-svc-mgmt.h" void -glusterd_quotadsvc_build (glusterd_svc_t *svc); +glusterd_quotadsvc_build(glusterd_svc_t *svc); int -glusterd_quotadsvc_init (glusterd_svc_t *svc); +glusterd_quotadsvc_init(glusterd_svc_t *svc); int -glusterd_quotadsvc_start (glusterd_svc_t *svc, int flags); +glusterd_quotadsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_quotadsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_quotadsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_quotadsvc_reconfigure (); +glusterd_quotadsvc_reconfigure(); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-rcu.h b/xlators/mgmt/glusterd/src/glusterd-rcu.h index 15beac5a745..32ac3bbfd4e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rcu.h +++ b/xlators/mgmt/glusterd/src/glusterd-rcu.h @@ -29,8 +29,8 @@ * Use this in place of struct rcu_head when embedding into another struct */ typedef struct glusterd_rcu_head_ { - struct rcu_head head; - xlator_t *this; + struct rcu_head head; + xlator_t *this; } gd_rcu_head; #endif /* _GLUSTERD_RCU_H */ diff --git a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.h b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.h index dbdcf43529c..514b1de96a0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.h @@ -15,31 +15,31 @@ typedef struct glusterd_scrubsvc_ glusterd_scrubsvc_t; -struct glusterd_scrubsvc_{ - glusterd_svc_t svc; - gf_store_handle_t *handle; +struct glusterd_scrubsvc_ { + glusterd_svc_t svc; + gf_store_handle_t *handle; }; void -glusterd_scrubsvc_build (glusterd_svc_t *svc); +glusterd_scrubsvc_build(glusterd_svc_t *svc); int -glusterd_scrubsvc_init (glusterd_svc_t *svc); +glusterd_scrubsvc_init(glusterd_svc_t *svc); int -glusterd_scrubsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_scrubsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_scrubsvc_start (glusterd_svc_t *svc, int flags); +glusterd_scrubsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_scrubsvc_stop (glusterd_svc_t *svc, int sig); +glusterd_scrubsvc_stop(glusterd_svc_t *svc, int sig); int -glusterd_scrubsvc_reconfigure (); +glusterd_scrubsvc_reconfigure(); void -glusterd_scrubsvc_build_volfile_path (char *server, char *workdir, - char *volfile, size_t len); +glusterd_scrubsvc_build_volfile_path(char *server, char *workdir, char *volfile, + size_t len); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.h b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h index ea6a8bd6158..e11bf1a9206 100644 --- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.h +++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h @@ -11,36 +11,36 @@ #define _GLUSTERD_SERVER_QUORUM_H int -glusterd_validate_quorum (xlator_t *this, glusterd_op_t op, dict_t *dict, - char **op_errstr); +glusterd_validate_quorum(xlator_t *this, glusterd_op_t op, dict_t *dict, + char **op_errstr); gf_boolean_t -glusterd_is_quorum_changed (dict_t *options, char *option, char *value); +glusterd_is_quorum_changed(dict_t *options, char *option, char *value); int -glusterd_do_quorum_action (); +glusterd_do_quorum_action(); int -glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count, - int *quorum_count); +glusterd_get_quorum_cluster_counts(xlator_t *this, int *active_count, + int *quorum_count); gf_boolean_t -glusterd_is_quorum_option (char *option); +glusterd_is_quorum_option(char *option); gf_boolean_t -glusterd_is_volume_in_server_quorum (glusterd_volinfo_t *volinfo); +glusterd_is_volume_in_server_quorum(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_is_any_volume_in_server_quorum (xlator_t *this); +glusterd_is_any_volume_in_server_quorum(xlator_t *this); gf_boolean_t -does_gd_meet_server_quorum (xlator_t *this); +does_gd_meet_server_quorum(xlator_t *this); int -check_quorum_for_brick_start (glusterd_volinfo_t *volinfo, - gf_boolean_t node_quorum); +check_quorum_for_brick_start(glusterd_volinfo_t *volinfo, + gf_boolean_t node_quorum); gf_boolean_t -does_quorum_meet (int active_count, int quorum_count); +does_quorum_meet(int active_count, int quorum_count); #endif /* _GLUSTERD_SERVER_QUORUM_H */ diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.h b/xlators/mgmt/glusterd/src/glusterd-shd-svc.h index 38a3fd1afd1..775a9d44a2c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.h @@ -14,17 +14,17 @@ #include "glusterd-svc-mgmt.h" void -glusterd_shdsvc_build (glusterd_svc_t *svc); +glusterd_shdsvc_build(glusterd_svc_t *svc); int -glusterd_shdsvc_init (glusterd_svc_t *svc); +glusterd_shdsvc_init(glusterd_svc_t *svc); int -glusterd_shdsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_shdsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_shdsvc_start (glusterd_svc_t *svc, int flags); +glusterd_shdsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_shdsvc_reconfigure (); +glusterd_shdsvc_reconfigure(); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h index 640468830d5..051e83c675d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-sm.h @@ -26,196 +26,194 @@ #include "glusterd-rcu.h" typedef enum gd_quorum_contribution_ { - QUORUM_NONE, - QUORUM_WAITING, - QUORUM_DOWN, - QUORUM_UP + QUORUM_NONE, + QUORUM_WAITING, + QUORUM_DOWN, + QUORUM_UP } gd_quorum_contrib_t; typedef enum glusterd_friend_sm_state_ { - GD_FRIEND_STATE_DEFAULT = 0, - GD_FRIEND_STATE_REQ_SENT, - GD_FRIEND_STATE_REQ_RCVD, - GD_FRIEND_STATE_BEFRIENDED, - GD_FRIEND_STATE_REQ_ACCEPTED, - GD_FRIEND_STATE_REQ_SENT_RCVD, - GD_FRIEND_STATE_REJECTED, - GD_FRIEND_STATE_UNFRIEND_SENT, - GD_FRIEND_STATE_PROBE_RCVD, - GD_FRIEND_STATE_CONNECTED_RCVD, - GD_FRIEND_STATE_CONNECTED_ACCEPTED, - GD_FRIEND_STATE_MAX + GD_FRIEND_STATE_DEFAULT = 0, + GD_FRIEND_STATE_REQ_SENT, + GD_FRIEND_STATE_REQ_RCVD, + GD_FRIEND_STATE_BEFRIENDED, + GD_FRIEND_STATE_REQ_ACCEPTED, + GD_FRIEND_STATE_REQ_SENT_RCVD, + GD_FRIEND_STATE_REJECTED, + GD_FRIEND_STATE_UNFRIEND_SENT, + GD_FRIEND_STATE_PROBE_RCVD, + GD_FRIEND_STATE_CONNECTED_RCVD, + GD_FRIEND_STATE_CONNECTED_ACCEPTED, + GD_FRIEND_STATE_MAX } glusterd_friend_sm_state_t; typedef struct glusterd_peer_state_info_ { - glusterd_friend_sm_state_t state; - struct timeval transition_time; -}glusterd_peer_state_info_t; + glusterd_friend_sm_state_t state; + struct timeval transition_time; +} glusterd_peer_state_info_t; typedef struct glusterd_peer_hostname_ { - char *hostname; - struct cds_list_head hostname_list; + char *hostname; + struct cds_list_head hostname_list; } glusterd_peer_hostname_t; typedef struct glusterd_sm_transition_ { - int old_state; - int event; - int new_state; - time_t time; + int old_state; + int event; + int new_state; + time_t time; } glusterd_sm_transition_t; typedef struct glusterd_sm_tr_log_ { - glusterd_sm_transition_t *transitions; - size_t current; - size_t size; - size_t count; - char* (*state_name_get) (int); - char* (*event_name_get) (int); + glusterd_sm_transition_t *transitions; + size_t current; + size_t size; + size_t count; + char *(*state_name_get)(int); + char *(*event_name_get)(int); } glusterd_sm_tr_log_t; struct glusterd_peerinfo_ { - uuid_t uuid; - char uuid_str[50]; /* Retrieve this using - * gd_peer_uuid_str () - */ - glusterd_peer_state_info_t state; - char *hostname; - struct cds_list_head hostnames; - int port; - struct cds_list_head uuid_list; - struct cds_list_head op_peers_list; - struct rpc_clnt *rpc; - rpc_clnt_prog_t *mgmt; - rpc_clnt_prog_t *peer; - rpc_clnt_prog_t *mgmt_v3; - int connected; - gf_store_handle_t *shandle; - glusterd_sm_tr_log_t sm_log; - gf_boolean_t quorum_action; - gd_quorum_contrib_t quorum_contrib; - gf_boolean_t locked; - gf_boolean_t detaching; - /* Members required for proper cleanup using RCU */ - gd_rcu_head rcu_head; - pthread_mutex_t delete_lock; - uint32_t generation; + uuid_t uuid; + char uuid_str[50]; /* Retrieve this using + * gd_peer_uuid_str () + */ + glusterd_peer_state_info_t state; + char *hostname; + struct cds_list_head hostnames; + int port; + struct cds_list_head uuid_list; + struct cds_list_head op_peers_list; + struct rpc_clnt *rpc; + rpc_clnt_prog_t *mgmt; + rpc_clnt_prog_t *peer; + rpc_clnt_prog_t *mgmt_v3; + int connected; + gf_store_handle_t *shandle; + glusterd_sm_tr_log_t sm_log; + gf_boolean_t quorum_action; + gd_quorum_contrib_t quorum_contrib; + gf_boolean_t locked; + gf_boolean_t detaching; + /* Members required for proper cleanup using RCU */ + gd_rcu_head rcu_head; + pthread_mutex_t delete_lock; + uint32_t generation; }; typedef struct glusterd_peerinfo_ glusterd_peerinfo_t; typedef struct glusterd_local_peers_ { - glusterd_peerinfo_t *peerinfo; - struct cds_list_head op_peers_list; + glusterd_peerinfo_t *peerinfo; + struct cds_list_head op_peers_list; } glusterd_local_peers_t; typedef enum glusterd_ev_gen_mode_ { - GD_MODE_OFF, - GD_MODE_ON, - GD_MODE_SWITCH_ON + GD_MODE_OFF, + GD_MODE_ON, + GD_MODE_SWITCH_ON } glusterd_ev_gen_mode_t; typedef struct glusterd_peer_ctx_args_ { - rpcsvc_request_t *req; - glusterd_ev_gen_mode_t mode; - dict_t *dict; + rpcsvc_request_t *req; + glusterd_ev_gen_mode_t mode; + dict_t *dict; } glusterd_peerctx_args_t; typedef struct glusterd_peer_ctx_ { - glusterd_peerctx_args_t args; - uuid_t peerid; - char *peername; - uint32_t peerinfo_gen; - char *errstr; + glusterd_peerctx_args_t args; + uuid_t peerid; + char *peername; + uint32_t peerinfo_gen; + char *errstr; } glusterd_peerctx_t; typedef enum glusterd_friend_sm_event_type_ { - GD_FRIEND_EVENT_NONE = 0, - GD_FRIEND_EVENT_PROBE, - GD_FRIEND_EVENT_INIT_FRIEND_REQ, - GD_FRIEND_EVENT_RCVD_ACC, - GD_FRIEND_EVENT_LOCAL_ACC, - GD_FRIEND_EVENT_RCVD_RJT, - GD_FRIEND_EVENT_LOCAL_RJT, - GD_FRIEND_EVENT_RCVD_FRIEND_REQ, - GD_FRIEND_EVENT_INIT_REMOVE_FRIEND, - GD_FRIEND_EVENT_RCVD_REMOVE_FRIEND, - GD_FRIEND_EVENT_REMOVE_FRIEND, - GD_FRIEND_EVENT_CONNECTED, - GD_FRIEND_EVENT_NEW_NAME, - GD_FRIEND_EVENT_MAX + GD_FRIEND_EVENT_NONE = 0, + GD_FRIEND_EVENT_PROBE, + GD_FRIEND_EVENT_INIT_FRIEND_REQ, + GD_FRIEND_EVENT_RCVD_ACC, + GD_FRIEND_EVENT_LOCAL_ACC, + GD_FRIEND_EVENT_RCVD_RJT, + GD_FRIEND_EVENT_LOCAL_RJT, + GD_FRIEND_EVENT_RCVD_FRIEND_REQ, + GD_FRIEND_EVENT_INIT_REMOVE_FRIEND, + GD_FRIEND_EVENT_RCVD_REMOVE_FRIEND, + GD_FRIEND_EVENT_REMOVE_FRIEND, + GD_FRIEND_EVENT_CONNECTED, + GD_FRIEND_EVENT_NEW_NAME, + GD_FRIEND_EVENT_MAX } glusterd_friend_sm_event_type_t; - typedef enum glusterd_friend_update_op_ { - GD_FRIEND_UPDATE_NONE = 0, - GD_FRIEND_UPDATE_ADD, - GD_FRIEND_UPDATE_DEL, + GD_FRIEND_UPDATE_NONE = 0, + GD_FRIEND_UPDATE_ADD, + GD_FRIEND_UPDATE_DEL, } glusterd_friend_update_op_t; - struct glusterd_friend_sm_event_ { - struct cds_list_head list; - uuid_t peerid; - char *peername; - void *ctx; - glusterd_friend_sm_event_type_t event; + struct cds_list_head list; + uuid_t peerid; + char *peername; + void *ctx; + glusterd_friend_sm_event_type_t event; }; typedef struct glusterd_friend_sm_event_ glusterd_friend_sm_event_t; -typedef int (*glusterd_friend_sm_ac_fn) (glusterd_friend_sm_event_t *, void *); +typedef int (*glusterd_friend_sm_ac_fn)(glusterd_friend_sm_event_t *, void *); typedef struct glusterd_sm_ { - glusterd_friend_sm_state_t next_state; - glusterd_friend_sm_ac_fn handler; + glusterd_friend_sm_state_t next_state; + glusterd_friend_sm_ac_fn handler; } glusterd_sm_t; typedef struct glusterd_friend_req_ctx_ { - uuid_t uuid; - char *hostname; - rpcsvc_request_t *req; - int port; - dict_t *vols; + uuid_t uuid; + char *hostname; + rpcsvc_request_t *req; + int port; + dict_t *vols; } glusterd_friend_req_ctx_t; typedef struct glusterd_friend_update_ctx_ { - uuid_t uuid; - char *hostname; - int op; + uuid_t uuid; + char *hostname; + int op; } glusterd_friend_update_ctx_t; typedef struct glusterd_probe_ctx_ { - char *hostname; - rpcsvc_request_t *req; - int port; - dict_t *dict; + char *hostname; + rpcsvc_request_t *req; + int port; + dict_t *dict; } glusterd_probe_ctx_t; int -glusterd_friend_sm_new_event (glusterd_friend_sm_event_type_t event_type, - glusterd_friend_sm_event_t **new_event); +glusterd_friend_sm_new_event(glusterd_friend_sm_event_type_t event_type, + glusterd_friend_sm_event_t **new_event); int -glusterd_friend_sm_inject_event (glusterd_friend_sm_event_t *event); +glusterd_friend_sm_inject_event(glusterd_friend_sm_event_t *event); int -glusterd_friend_sm_init (); +glusterd_friend_sm_init(); int -glusterd_friend_sm (); +glusterd_friend_sm(); void -glusterd_destroy_probe_ctx (glusterd_probe_ctx_t *ctx); +glusterd_destroy_probe_ctx(glusterd_probe_ctx_t *ctx); void -glusterd_destroy_friend_req_ctx (glusterd_friend_req_ctx_t *ctx); +glusterd_destroy_friend_req_ctx(glusterd_friend_req_ctx_t *ctx); -char* -glusterd_friend_sm_state_name_get (int state); +char * +glusterd_friend_sm_state_name_get(int state); -char* -glusterd_friend_sm_event_name_get (int event); +char * +glusterd_friend_sm_event_name_get(int event); int -glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid); +glusterd_broadcast_friend_delete(char *hostname, uuid_t uuid); void -glusterd_destroy_friend_update_ctx (glusterd_friend_update_ctx_t *ctx); +glusterd_destroy_friend_update_ctx(glusterd_friend_update_ctx_t *ctx); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.h b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.h index 4c452b91658..3e23c2ce942 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.h +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.h @@ -14,19 +14,19 @@ #include "glusterd.h" void -glusterd_svc_build_snapd_rundir (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_snapd_rundir(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_snapd_socket_filepath (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_snapd_socket_filepath(glusterd_volinfo_t *volinfo, + char *path, int path_len); void -glusterd_svc_build_snapd_pidfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_snapd_pidfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_snapd_volfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_snapd_volfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.h b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.h index 40dae848f58..c95e4cc7661 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.h @@ -15,28 +15,28 @@ typedef struct glusterd_snapdsvc_ glusterd_snapdsvc_t; -struct glusterd_snapdsvc_{ - glusterd_svc_t svc; - int port; - gf_store_handle_t *handle; +struct glusterd_snapdsvc_ { + glusterd_svc_t svc; + int port; + gf_store_handle_t *handle; }; void -glusterd_snapdsvc_build (glusterd_svc_t *svc); +glusterd_snapdsvc_build(glusterd_svc_t *svc); int -glusterd_snapdsvc_init (void *data); +glusterd_snapdsvc_init(void *data); int -glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_snapdsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags); +glusterd_snapdsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_snapdsvc_restart (); +glusterd_snapdsvc_restart(); int -glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event); +glusterd_snapdsvc_rpc_notify(glusterd_conn_t *conn, rpc_clnt_event_t event); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h index d619f1d3106..19fedecee8d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h @@ -11,154 +11,149 @@ #define _GLUSTERD_SNAP_UTILS_H int32_t -glusterd_snap_volinfo_find (char *volname, glusterd_snap_t *snap, - glusterd_volinfo_t **volinfo); +glusterd_snap_volinfo_find(char *volname, glusterd_snap_t *snap, + glusterd_volinfo_t **volinfo); int32_t -glusterd_snap_volinfo_find_from_parent_volname (char *origin_volname, - glusterd_snap_t *snap, - glusterd_volinfo_t **volinfo); +glusterd_snap_volinfo_find_from_parent_volname(char *origin_volname, + glusterd_snap_t *snap, + glusterd_volinfo_t **volinfo); int -glusterd_snap_volinfo_find_by_volume_id (uuid_t volume_id, - glusterd_volinfo_t **volinfo); +glusterd_snap_volinfo_find_by_volume_id(uuid_t volume_id, + glusterd_volinfo_t **volinfo); int32_t -glusterd_add_snapd_to_dict (glusterd_volinfo_t *volinfo, - dict_t *dict, int32_t count); +glusterd_add_snapd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict, + int32_t count); int -glusterd_compare_snap_time (struct cds_list_head *, struct cds_list_head *); +glusterd_compare_snap_time(struct cds_list_head *, struct cds_list_head *); int -glusterd_compare_snap_vol_time (struct cds_list_head *, struct cds_list_head *); +glusterd_compare_snap_vol_time(struct cds_list_head *, struct cds_list_head *); int32_t -glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict, - glusterd_volinfo_t *new_volinfo, - glusterd_volinfo_t *snap_volinfo, - int32_t volcount); +glusterd_snap_volinfo_restore(dict_t *dict, dict_t *rsp_dict, + glusterd_volinfo_t *new_volinfo, + glusterd_volinfo_t *snap_volinfo, + int32_t volcount); int32_t -glusterd_snapobject_delete (glusterd_snap_t *snap); +glusterd_snapobject_delete(glusterd_snap_t *snap); int32_t -glusterd_cleanup_snaps_for_volume (glusterd_volinfo_t *volinfo); +glusterd_cleanup_snaps_for_volume(glusterd_volinfo_t *volinfo); int32_t -glusterd_missed_snapinfo_new (glusterd_missed_snap_info **missed_snapinfo); +glusterd_missed_snapinfo_new(glusterd_missed_snap_info **missed_snapinfo); int32_t -glusterd_missed_snap_op_new (glusterd_snap_op_t **snap_op); +glusterd_missed_snap_op_new(glusterd_snap_op_t **snap_op); int32_t -glusterd_add_missed_snaps_to_dict (dict_t *rsp_dict, - glusterd_volinfo_t *snap_vol, - glusterd_brickinfo_t *brickinfo, - int32_t brick_number, int32_t op); +glusterd_add_missed_snaps_to_dict(dict_t *rsp_dict, + glusterd_volinfo_t *snap_vol, + glusterd_brickinfo_t *brickinfo, + int32_t brick_number, int32_t op); int32_t -glusterd_add_missed_snaps_to_export_dict (dict_t *peer_data); +glusterd_add_missed_snaps_to_export_dict(dict_t *peer_data); int32_t -glusterd_import_friend_missed_snap_list (dict_t *peer_data); +glusterd_import_friend_missed_snap_list(dict_t *peer_data); int -gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict, - glusterd_volinfo_t *orig_vol, - glusterd_volinfo_t *snap_vol, - int32_t volcount); +gd_restore_snap_volume(dict_t *dict, dict_t *rsp_dict, + glusterd_volinfo_t *orig_vol, + glusterd_volinfo_t *snap_vol, int32_t volcount); int32_t -glusterd_mount_lvm_snapshot (glusterd_brickinfo_t *brickinfo, - char *brick_mount_path); +glusterd_mount_lvm_snapshot(glusterd_brickinfo_t *brickinfo, + char *brick_mount_path); int32_t -glusterd_umount (const char *path); +glusterd_umount(const char *path); int32_t -glusterd_snap_unmount (xlator_t *this, glusterd_volinfo_t *volinfo); +glusterd_snap_unmount(xlator_t *this, glusterd_volinfo_t *volinfo); int32_t -glusterd_add_snapshots_to_export_dict (dict_t *peer_data); +glusterd_add_snapshots_to_export_dict(dict_t *peer_data); int32_t -glusterd_compare_friend_snapshots (dict_t *peer_data, char *peername, - uuid_t peerid); +glusterd_compare_friend_snapshots(dict_t *peer_data, char *peername, + uuid_t peerid); int32_t -glusterd_store_create_snap_dir (glusterd_snap_t *snap); +glusterd_store_create_snap_dir(glusterd_snap_t *snap); int32_t -glusterd_copy_file (const char *source, const char *destination); +glusterd_copy_file(const char *source, const char *destination); int32_t -glusterd_copy_folder (const char *source, const char *destination); +glusterd_copy_folder(const char *source, const char *destination); int32_t -glusterd_get_geo_rep_session (char *slave_key, char *origin_volname, - dict_t *gsync_slaves_dict, char *session, - char *slave); +glusterd_get_geo_rep_session(char *slave_key, char *origin_volname, + dict_t *gsync_slaves_dict, char *session, + char *slave); int32_t -glusterd_restore_geo_rep_files (glusterd_volinfo_t *snap_vol); +glusterd_restore_geo_rep_files(glusterd_volinfo_t *snap_vol); int32_t -glusterd_copy_quota_files (glusterd_volinfo_t *src_vol, - glusterd_volinfo_t *dest_vol, - gf_boolean_t *conf_present); +glusterd_copy_quota_files(glusterd_volinfo_t *src_vol, + glusterd_volinfo_t *dest_vol, + gf_boolean_t *conf_present); int -glusterd_snap_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_snap_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -gd_add_vol_snap_details_to_dict (dict_t *dict, char *prefix, - glusterd_volinfo_t *volinfo); +gd_add_vol_snap_details_to_dict(dict_t *dict, char *prefix, + glusterd_volinfo_t *volinfo); int -gd_add_brick_snap_details_to_dict (dict_t *dict, char *prefix, - glusterd_brickinfo_t *brickinfo); +gd_add_brick_snap_details_to_dict(dict_t *dict, char *prefix, + glusterd_brickinfo_t *brickinfo); int -gd_import_new_brick_snap_details (dict_t *dict, char *prefix, - glusterd_brickinfo_t *brickinfo); +gd_import_new_brick_snap_details(dict_t *dict, char *prefix, + glusterd_brickinfo_t *brickinfo); int -gd_import_volume_snap_details (dict_t *dict, glusterd_volinfo_t *volinfo, - char *prefix, char *volname); +gd_import_volume_snap_details(dict_t *dict, glusterd_volinfo_t *volinfo, + char *prefix, char *volname); int32_t -glusterd_snap_quorum_check (dict_t *dict, gf_boolean_t snap_volume, - char **op_errstr, uint32_t *op_errno); +glusterd_snap_quorum_check(dict_t *dict, gf_boolean_t snap_volume, + char **op_errstr, uint32_t *op_errno); int32_t -glusterd_snap_brick_create (glusterd_volinfo_t *snap_volinfo, - glusterd_brickinfo_t *brickinfo, - int32_t brick_count, int32_t clone); +glusterd_snap_brick_create(glusterd_volinfo_t *snap_volinfo, + glusterd_brickinfo_t *brickinfo, int32_t brick_count, + int32_t clone); int -glusterd_snapshot_restore_cleanup (dict_t *rsp_dict, - char *volname, - glusterd_snap_t *snap); +glusterd_snapshot_restore_cleanup(dict_t *rsp_dict, char *volname, + glusterd_snap_t *snap); void -glusterd_get_snapd_dir (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_get_snapd_dir(glusterd_volinfo_t *volinfo, char *path, int path_len); int -glusterd_is_snapd_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_snapd_enabled(glusterd_volinfo_t *volinfo); int32_t -glusterd_check_and_set_config_limit (glusterd_conf_t *priv); +glusterd_check_and_set_config_limit(glusterd_conf_t *priv); int32_t -glusterd_is_snap_soft_limit_reached (glusterd_volinfo_t *volinfo, - dict_t *dict); +glusterd_is_snap_soft_limit_reached(glusterd_volinfo_t *volinfo, dict_t *dict); void -gd_get_snap_conf_values_if_present (dict_t *opts, uint64_t *sys_hard_limit, - uint64_t *sys_soft_limit); +gd_get_snap_conf_values_if_present(dict_t *opts, uint64_t *sys_hard_limit, + uint64_t *sys_soft_limit); int -glusterd_get_snap_status_str (glusterd_snap_t *snapinfo, char *snap_status_str); +glusterd_get_snap_status_str(glusterd_snap_t *snapinfo, char *snap_status_str); #endif - diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.h b/xlators/mgmt/glusterd/src/glusterd-statedump.h index 3ac8659f293..7d7fc1a7fa3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-statedump.h +++ b/xlators/mgmt/glusterd/src/glusterd-statedump.h @@ -14,5 +14,5 @@ #include "xlator.h" int -glusterd_dump_priv (xlator_t *this); +glusterd_dump_priv(xlator_t *this); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h index d809f2c7963..5db77703482 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.h +++ b/xlators/mgmt/glusterd/src/glusterd-store.h @@ -22,187 +22,185 @@ #include "glusterd.h" #include "rpcsvc.h" -typedef enum glusterd_store_ver_ac_{ - GLUSTERD_VOLINFO_VER_AC_NONE = 0, - GLUSTERD_VOLINFO_VER_AC_INCREMENT = 1, - GLUSTERD_VOLINFO_VER_AC_DECREMENT = 2, +typedef enum glusterd_store_ver_ac_ { + GLUSTERD_VOLINFO_VER_AC_NONE = 0, + GLUSTERD_VOLINFO_VER_AC_INCREMENT = 1, + GLUSTERD_VOLINFO_VER_AC_DECREMENT = 2, } glusterd_volinfo_ver_ac_t; - -#define GLUSTERD_STORE_UUID_KEY "UUID" - -#define GLUSTERD_STORE_KEY_VOL_TYPE "type" -#define GLUSTERD_STORE_KEY_VOL_COUNT "count" -#define GLUSTERD_STORE_KEY_VOL_STATUS "status" -#define GLUSTERD_STORE_KEY_VOL_PORT "port" -#define GLUSTERD_STORE_KEY_VOL_SUB_COUNT "sub_count" -#define GLUSTERD_STORE_KEY_VOL_STRIPE_CNT "stripe_count" -#define GLUSTERD_STORE_KEY_VOL_REPLICA_CNT "replica_count" -#define GLUSTERD_STORE_KEY_VOL_DISPERSE_CNT "disperse_count" -#define GLUSTERD_STORE_KEY_VOL_REDUNDANCY_CNT "redundancy_count" -#define GLUSTERD_STORE_KEY_VOL_ARBITER_CNT "arbiter_count" -#define GLUSTERD_STORE_KEY_VOL_BRICK "brick" -#define GLUSTERD_STORE_KEY_VOL_VERSION "version" -#define GLUSTERD_STORE_KEY_VOL_TRANSPORT "transport-type" -#define GLUSTERD_STORE_KEY_VOL_ID "volume-id" -#define GLUSTERD_STORE_KEY_VOL_RESTORED_SNAP "restored_from_snap" -#define GLUSTERD_STORE_KEY_RB_STATUS "rb_status" -#define GLUSTERD_STORE_KEY_RB_SRC_BRICK "rb_src" -#define GLUSTERD_STORE_KEY_RB_DST_BRICK "rb_dst" -#define GLUSTERD_STORE_KEY_RB_DST_PORT "rb_port" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG "rebalance_status" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_STATUS "status" -#define GLUSTERD_STORE_KEY_DEFRAG_OP "rebalance_op" -#define GLUSTERD_STORE_KEY_USERNAME "username" -#define GLUSTERD_STORE_KEY_PASSWORD "password" -#define GLUSTERD_STORE_KEY_PARENT_VOLNAME "parent_volname" -#define GLUSTERD_STORE_KEY_VOL_OP_VERSION "op-version" +#define GLUSTERD_STORE_UUID_KEY "UUID" + +#define GLUSTERD_STORE_KEY_VOL_TYPE "type" +#define GLUSTERD_STORE_KEY_VOL_COUNT "count" +#define GLUSTERD_STORE_KEY_VOL_STATUS "status" +#define GLUSTERD_STORE_KEY_VOL_PORT "port" +#define GLUSTERD_STORE_KEY_VOL_SUB_COUNT "sub_count" +#define GLUSTERD_STORE_KEY_VOL_STRIPE_CNT "stripe_count" +#define GLUSTERD_STORE_KEY_VOL_REPLICA_CNT "replica_count" +#define GLUSTERD_STORE_KEY_VOL_DISPERSE_CNT "disperse_count" +#define GLUSTERD_STORE_KEY_VOL_REDUNDANCY_CNT "redundancy_count" +#define GLUSTERD_STORE_KEY_VOL_ARBITER_CNT "arbiter_count" +#define GLUSTERD_STORE_KEY_VOL_BRICK "brick" +#define GLUSTERD_STORE_KEY_VOL_VERSION "version" +#define GLUSTERD_STORE_KEY_VOL_TRANSPORT "transport-type" +#define GLUSTERD_STORE_KEY_VOL_ID "volume-id" +#define GLUSTERD_STORE_KEY_VOL_RESTORED_SNAP "restored_from_snap" +#define GLUSTERD_STORE_KEY_RB_STATUS "rb_status" +#define GLUSTERD_STORE_KEY_RB_SRC_BRICK "rb_src" +#define GLUSTERD_STORE_KEY_RB_DST_BRICK "rb_dst" +#define GLUSTERD_STORE_KEY_RB_DST_PORT "rb_port" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG "rebalance_status" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_STATUS "status" +#define GLUSTERD_STORE_KEY_DEFRAG_OP "rebalance_op" +#define GLUSTERD_STORE_KEY_USERNAME "username" +#define GLUSTERD_STORE_KEY_PASSWORD "password" +#define GLUSTERD_STORE_KEY_PARENT_VOLNAME "parent_volname" +#define GLUSTERD_STORE_KEY_VOL_OP_VERSION "op-version" #define GLUSTERD_STORE_KEY_VOL_CLIENT_OP_VERSION "client-op-version" -#define GLUSTERD_STORE_KEY_VOL_QUOTA_VERSION "quota-version" - -#define GLUSTERD_STORE_KEY_VOL_TIER_STATUS "tier_status" -#define GLUSTERD_STORE_KEY_TIER_DETACH_OP "tier_op" -#define GLUSTERD_STORE_KEY_COLD_TYPE "cold_type" -#define GLUSTERD_STORE_KEY_COLD_COUNT "cold_count" -#define GLUSTERD_STORE_KEY_COLD_REPLICA_COUNT "cold_replica_count" -#define GLUSTERD_STORE_KEY_COLD_DISPERSE_COUNT "cold_disperse_count" -#define GLUSTERD_STORE_KEY_COLD_REDUNDANCY_COUNT "cold_redundancy_count" -#define GLUSTERD_STORE_KEY_HOT_TYPE "hot_type" -#define GLUSTERD_STORE_KEY_HOT_COUNT "hot_count" -#define GLUSTERD_STORE_KEY_HOT_REPLICA_COUNT "hot_replica_count" - -#define GLUSTERD_STORE_KEY_SNAP_NAME "name" -#define GLUSTERD_STORE_KEY_SNAP_ID "snap-id" -#define GLUSTERD_STORE_KEY_SNAP_DESC "desc" -#define GLUSTERD_STORE_KEY_SNAP_TIMESTAMP "time-stamp" -#define GLUSTERD_STORE_KEY_SNAP_STATUS "status" -#define GLUSTERD_STORE_KEY_SNAP_RESTORED "snap-restored" -#define GLUSTERD_STORE_KEY_SNAP_MAX_HARD_LIMIT "snap-max-hard-limit" -#define GLUSTERD_STORE_KEY_SNAP_AUTO_DELETE "auto-delete" -#define GLUSTERD_STORE_KEY_SNAP_MAX_SOFT_LIMIT "snap-max-soft-limit" -#define GLUSTERD_STORE_KEY_SNAPD_PORT "snapd-port" -#define GLUSTERD_STORE_KEY_SNAP_ACTIVATE "snap-activate-on-create" - -#define GLUSTERD_STORE_KEY_BRICK_HOSTNAME "hostname" -#define GLUSTERD_STORE_KEY_BRICK_PATH "path" -#define GLUSTERD_STORE_KEY_BRICK_REAL_PATH "real_path" -#define GLUSTERD_STORE_KEY_BRICK_PORT "listen-port" -#define GLUSTERD_STORE_KEY_BRICK_RDMA_PORT "rdma.listen-port" +#define GLUSTERD_STORE_KEY_VOL_QUOTA_VERSION "quota-version" + +#define GLUSTERD_STORE_KEY_VOL_TIER_STATUS "tier_status" +#define GLUSTERD_STORE_KEY_TIER_DETACH_OP "tier_op" +#define GLUSTERD_STORE_KEY_COLD_TYPE "cold_type" +#define GLUSTERD_STORE_KEY_COLD_COUNT "cold_count" +#define GLUSTERD_STORE_KEY_COLD_REPLICA_COUNT "cold_replica_count" +#define GLUSTERD_STORE_KEY_COLD_DISPERSE_COUNT "cold_disperse_count" +#define GLUSTERD_STORE_KEY_COLD_REDUNDANCY_COUNT "cold_redundancy_count" +#define GLUSTERD_STORE_KEY_HOT_TYPE "hot_type" +#define GLUSTERD_STORE_KEY_HOT_COUNT "hot_count" +#define GLUSTERD_STORE_KEY_HOT_REPLICA_COUNT "hot_replica_count" + +#define GLUSTERD_STORE_KEY_SNAP_NAME "name" +#define GLUSTERD_STORE_KEY_SNAP_ID "snap-id" +#define GLUSTERD_STORE_KEY_SNAP_DESC "desc" +#define GLUSTERD_STORE_KEY_SNAP_TIMESTAMP "time-stamp" +#define GLUSTERD_STORE_KEY_SNAP_STATUS "status" +#define GLUSTERD_STORE_KEY_SNAP_RESTORED "snap-restored" +#define GLUSTERD_STORE_KEY_SNAP_MAX_HARD_LIMIT "snap-max-hard-limit" +#define GLUSTERD_STORE_KEY_SNAP_AUTO_DELETE "auto-delete" +#define GLUSTERD_STORE_KEY_SNAP_MAX_SOFT_LIMIT "snap-max-soft-limit" +#define GLUSTERD_STORE_KEY_SNAPD_PORT "snapd-port" +#define GLUSTERD_STORE_KEY_SNAP_ACTIVATE "snap-activate-on-create" + +#define GLUSTERD_STORE_KEY_BRICK_HOSTNAME "hostname" +#define GLUSTERD_STORE_KEY_BRICK_PATH "path" +#define GLUSTERD_STORE_KEY_BRICK_REAL_PATH "real_path" +#define GLUSTERD_STORE_KEY_BRICK_PORT "listen-port" +#define GLUSTERD_STORE_KEY_BRICK_RDMA_PORT "rdma.listen-port" #define GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED "decommissioned" -#define GLUSTERD_STORE_KEY_BRICK_VGNAME "vg" -#define GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH "device_path" -#define GLUSTERD_STORE_KEY_BRICK_MOUNT_DIR "mount_dir" -#define GLUSTERD_STORE_KEY_BRICK_SNAP_STATUS "snap-status" -#define GLUSTERD_STORE_KEY_BRICK_FSTYPE "fs-type" -#define GLUSTERD_STORE_KEY_BRICK_MNTOPTS "mnt-opts" -#define GLUSTERD_STORE_KEY_BRICK_ID "brick-id" -#define GLUSTERD_STORE_KEY_BRICK_FSID "brick-fsid" -#define GLUSTERD_STORE_KEY_BRICK_UUID "uuid" - -#define GLUSTERD_STORE_KEY_PEER_UUID "uuid" -#define GLUSTERD_STORE_KEY_PEER_HOSTNAME "hostname" -#define GLUSTERD_STORE_KEY_PEER_STATE "state" - -#define GLUSTERD_STORE_KEY_VOL_CAPS "caps" +#define GLUSTERD_STORE_KEY_BRICK_VGNAME "vg" +#define GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH "device_path" +#define GLUSTERD_STORE_KEY_BRICK_MOUNT_DIR "mount_dir" +#define GLUSTERD_STORE_KEY_BRICK_SNAP_STATUS "snap-status" +#define GLUSTERD_STORE_KEY_BRICK_FSTYPE "fs-type" +#define GLUSTERD_STORE_KEY_BRICK_MNTOPTS "mnt-opts" +#define GLUSTERD_STORE_KEY_BRICK_ID "brick-id" +#define GLUSTERD_STORE_KEY_BRICK_FSID "brick-fsid" +#define GLUSTERD_STORE_KEY_BRICK_UUID "uuid" + +#define GLUSTERD_STORE_KEY_PEER_UUID "uuid" +#define GLUSTERD_STORE_KEY_PEER_HOSTNAME "hostname" +#define GLUSTERD_STORE_KEY_PEER_STATE "state" + +#define GLUSTERD_STORE_KEY_VOL_CAPS "caps" #define GLUSTERD_STORE_KEY_VOL_DEFRAG_REB_FILES "rebalanced-files" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE "size" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED "scanned" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES "failures" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED "skipped" -#define GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME "run-time" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SIZE "size" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SCANNED "scanned" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_FAILURES "failures" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_SKIPPED "skipped" +#define GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME "run-time" -#define GLUSTERD_STORE_KEY_VOL_MIGRATED_FILES "migrated-files" -#define GLUSTERD_STORE_KEY_VOL_MIGRATED_SIZE "migration-size" -#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SCANNED "migration-scanned" -#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_FAILURES "migration-failures" -#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED "migration-skipped" -#define GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME "migration-run-time" +#define GLUSTERD_STORE_KEY_VOL_MIGRATED_FILES "migrated-files" +#define GLUSTERD_STORE_KEY_VOL_MIGRATED_SIZE "migration-size" +#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SCANNED "migration-scanned" +#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_FAILURES "migration-failures" +#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED "migration-skipped" +#define GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME "migration-run-time" int32_t -glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t ac); +glusterd_store_volinfo(glusterd_volinfo_t *volinfo, + glusterd_volinfo_ver_ac_t ac); int32_t -glusterd_store_delete_volume (glusterd_volinfo_t *volinfo); +glusterd_store_delete_volume(glusterd_volinfo_t *volinfo); int32_t -glusterd_store_delete_snap (glusterd_snap_t *snap); +glusterd_store_delete_snap(glusterd_snap_t *snap); int32_t -glusterd_retrieve_uuid (); +glusterd_retrieve_uuid(); int32_t -glusterd_store_peerinfo (glusterd_peerinfo_t *peerinfo); +glusterd_store_peerinfo(glusterd_peerinfo_t *peerinfo); int32_t -glusterd_store_delete_peerinfo (glusterd_peerinfo_t *peerinfo); +glusterd_store_delete_peerinfo(glusterd_peerinfo_t *peerinfo); int32_t -glusterd_store_delete_brick (glusterd_brickinfo_t *brickinfo, - char *delete_path); +glusterd_store_delete_brick(glusterd_brickinfo_t *brickinfo, char *delete_path); int32_t -glusterd_restore (); +glusterd_restore(); void -glusterd_perform_volinfo_version_action (glusterd_volinfo_t *volinfo, - glusterd_volinfo_ver_ac_t ac); +glusterd_perform_volinfo_version_action(glusterd_volinfo_t *volinfo, + glusterd_volinfo_ver_ac_t ac); gf_boolean_t -glusterd_store_is_valid_brickpath (char *volname, char *brick); +glusterd_store_is_valid_brickpath(char *volname, char *brick); int32_t -glusterd_store_perform_node_state_store (glusterd_volinfo_t *volinfo); +glusterd_store_perform_node_state_store(glusterd_volinfo_t *volinfo); int -glusterd_retrieve_op_version (xlator_t *this, int *op_version); +glusterd_retrieve_op_version(xlator_t *this, int *op_version); int -glusterd_store_global_info (xlator_t *this); +glusterd_store_global_info(xlator_t *this); int32_t -glusterd_store_retrieve_options (xlator_t *this); +glusterd_store_retrieve_options(xlator_t *this); int32_t -glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo); +glusterd_store_retrieve_bricks(glusterd_volinfo_t *volinfo); int32_t -glusterd_store_options (xlator_t *this, dict_t *opts); +glusterd_store_options(xlator_t *this, dict_t *opts); void -glusterd_replace_slash_with_hyphen (char *str); +glusterd_replace_slash_with_hyphen(char *str); int32_t -glusterd_store_perform_volume_store (glusterd_volinfo_t *volinfo); +glusterd_store_perform_volume_store(glusterd_volinfo_t *volinfo); int32_t -glusterd_store_create_quota_conf_sh_on_absence (glusterd_volinfo_t *volinfo); +glusterd_store_create_quota_conf_sh_on_absence(glusterd_volinfo_t *volinfo); int -glusterd_store_retrieve_quota_version (glusterd_volinfo_t *volinfo); +glusterd_store_retrieve_quota_version(glusterd_volinfo_t *volinfo); int -glusterd_store_save_quota_version_and_cksum (glusterd_volinfo_t *volinfo); +glusterd_store_save_quota_version_and_cksum(glusterd_volinfo_t *volinfo); int32_t -glusterd_store_snap (glusterd_snap_t *snap); +glusterd_store_snap(glusterd_snap_t *snap); int32_t -glusterd_store_update_missed_snaps (); +glusterd_store_update_missed_snaps(); -glusterd_volinfo_t* -glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap); +glusterd_volinfo_t * +glusterd_store_retrieve_volume(char *volname, glusterd_snap_t *snap); int -glusterd_restore_op_version (xlator_t *this); +glusterd_restore_op_version(xlator_t *this); int32_t -glusterd_quota_conf_write_header (int fd); +glusterd_quota_conf_write_header(int fd); int32_t -glusterd_quota_conf_write_gfid (int fd, void *buf, char type); +glusterd_quota_conf_write_gfid(int fd, void *buf, char type); int32_t -glusterd_recreate_vol_brick_mounts (xlator_t *this, - glusterd_volinfo_t *volinfo); +glusterd_recreate_vol_brick_mounts(xlator_t *this, glusterd_volinfo_t *volinfo); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.h b/xlators/mgmt/glusterd/src/glusterd-svc-helper.h index bbba5ce9ee4..cc98e788bbe 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.h +++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.h @@ -16,30 +16,30 @@ #include "glusterd-volgen.h" int -glusterd_svcs_reconfigure (); +glusterd_svcs_reconfigure(); int -glusterd_svcs_stop (); +glusterd_svcs_stop(); int -glusterd_svcs_manager (glusterd_volinfo_t *volinfo); +glusterd_svcs_manager(glusterd_volinfo_t *volinfo); int -glusterd_svc_check_volfile_identical (char *svc_name, +glusterd_svc_check_volfile_identical(char *svc_name, + glusterd_graph_builder_t builder, + gf_boolean_t *identical); +int +glusterd_svc_check_topology_identical(char *svc_name, glusterd_graph_builder_t builder, gf_boolean_t *identical); -int -glusterd_svc_check_topology_identical (char *svc_name, - glusterd_graph_builder_t builder, - gf_boolean_t *identical); int -glusterd_svc_check_tier_volfile_identical (char *svc_name, +glusterd_svc_check_tier_volfile_identical(char *svc_name, + glusterd_volinfo_t *volinfo, + gf_boolean_t *identical); +int +glusterd_svc_check_tier_topology_identical(char *svc_name, glusterd_volinfo_t *volinfo, gf_boolean_t *identical); -int -glusterd_svc_check_tier_topology_identical (char *svc_name, - glusterd_volinfo_t *volinfo, - gf_boolean_t *identical); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h index 8b70a62a4e3..3bf142b58d3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h +++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h @@ -17,59 +17,56 @@ struct glusterd_svc_; typedef struct glusterd_svc_ glusterd_svc_t; -typedef void (*glusterd_svc_build_t) (glusterd_svc_t *svc); +typedef void (*glusterd_svc_build_t)(glusterd_svc_t *svc); -typedef int (*glusterd_svc_manager_t) (glusterd_svc_t *svc, - void *data, int flags); -typedef int (*glusterd_svc_start_t) (glusterd_svc_t *svc, int flags); -typedef int (*glusterd_svc_stop_t) (glusterd_svc_t *svc, int sig); -typedef int (*glusterd_svc_reconfigure_t) (void *data); +typedef int (*glusterd_svc_manager_t)(glusterd_svc_t *svc, void *data, + int flags); +typedef int (*glusterd_svc_start_t)(glusterd_svc_t *svc, int flags); +typedef int (*glusterd_svc_stop_t)(glusterd_svc_t *svc, int sig); +typedef int (*glusterd_svc_reconfigure_t)(void *data); struct glusterd_svc_ { - char name[PATH_MAX]; - glusterd_conn_t conn; - glusterd_proc_t proc; - glusterd_svc_manager_t manager; - glusterd_svc_start_t start; - glusterd_svc_stop_t stop; - gf_boolean_t online; - gf_boolean_t inited; - glusterd_svc_reconfigure_t reconfigure; + char name[PATH_MAX]; + glusterd_conn_t conn; + glusterd_proc_t proc; + glusterd_svc_manager_t manager; + glusterd_svc_start_t start; + glusterd_svc_stop_t stop; + gf_boolean_t online; + gf_boolean_t inited; + glusterd_svc_reconfigure_t reconfigure; }; int -glusterd_svc_create_rundir (char *rundir); +glusterd_svc_create_rundir(char *rundir); int -glusterd_svc_init (glusterd_svc_t *svc, char *svc_name); +glusterd_svc_init(glusterd_svc_t *svc, char *svc_name); int -glusterd_svc_start (glusterd_svc_t *svc, int flags, dict_t *cmdline); +glusterd_svc_start(glusterd_svc_t *svc, int flags, dict_t *cmdline); int -glusterd_svc_stop (glusterd_svc_t *svc, int sig); +glusterd_svc_stop(glusterd_svc_t *svc, int sig); void -glusterd_svc_build_pidfile_path (char *server, char *workdir, - char *path, size_t len); +glusterd_svc_build_pidfile_path(char *server, char *workdir, char *path, + size_t len); void -glusterd_svc_build_volfile_path (char *server, char *workdir, - char *volfile, size_t len); +glusterd_svc_build_volfile_path(char *server, char *workdir, char *volfile, + size_t len); void -glusterd_svc_build_svcdir (char *server, char *workdir, - char *path, size_t len); +glusterd_svc_build_svcdir(char *server, char *workdir, char *path, size_t len); void -glusterd_svc_build_rundir (char *server, char *workdir, - char *path, size_t len); +glusterd_svc_build_rundir(char *server, char *workdir, char *path, size_t len); int -glusterd_svc_reconfigure (int (*create_volfile) ()); +glusterd_svc_reconfigure(int (*create_volfile)()); int -glusterd_svc_common_rpc_notify (glusterd_conn_t *conn, - rpc_clnt_event_t event); +glusterd_svc_common_rpc_notify(glusterd_conn_t *conn, rpc_clnt_event_t event); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h index e5f3aa6304c..37195ef0112 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.h +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h @@ -17,71 +17,77 @@ #define GD_SYNC_OPCODE_KEY "sync-mgmt-operation" /* gd_syncop_* */ -#define GD_SYNCOP(rpc, stb, cookie, cbk, req, prog, procnum, xdrproc) do { \ - int ret = 0; \ - struct synctask *task = NULL; \ - glusterd_conf_t *conf= THIS->private; \ +#define GD_SYNCOP(rpc, stb, cookie, cbk, req, prog, procnum, xdrproc) \ + do { \ + int ret = 0; \ + struct synctask *task = NULL; \ + glusterd_conf_t *conf = THIS->private; \ \ - task = synctask_get (); \ - stb->task = task; \ + task = synctask_get(); \ + stb->task = task; \ \ - /*This is to ensure that the brick_op_cbk is able to \ - * take the big lock*/ \ - synclock_unlock (&conf->big_lock); \ - ret = gd_syncop_submit_request (rpc, req, stb, cookie, \ - prog, procnum, cbk, \ - (xdrproc_t)xdrproc); \ - if (!ret) \ - synctask_yield (stb->task); \ - else \ - gf_asprintf (&stb->errstr, "%s failed. Check log file" \ - " for more details", (prog)->progname); \ - synclock_lock (&conf->big_lock); \ - } while (0) + /*This is to ensure that the brick_op_cbk is able to \ + * take the big lock*/ \ + synclock_unlock(&conf->big_lock); \ + ret = gd_syncop_submit_request(rpc, req, stb, cookie, prog, procnum, \ + cbk, (xdrproc_t)xdrproc); \ + if (!ret) \ + synctask_yield(stb->task); \ + else \ + gf_asprintf(&stb->errstr, \ + "%s failed. Check log file" \ + " for more details", \ + (prog)->progname); \ + synclock_lock(&conf->big_lock); \ + } while (0) -#define GD_ALLOC_COPY_UUID(dst_ptr, uuid, ret) do { \ - dst_ptr = GF_MALLOC (sizeof (*dst_ptr), gf_common_mt_uuid_t); \ +#define GD_ALLOC_COPY_UUID(dst_ptr, uuid, ret) \ + do { \ + dst_ptr = GF_MALLOC(sizeof(*dst_ptr), gf_common_mt_uuid_t); \ if (dst_ptr) { \ - gf_uuid_copy (*dst_ptr, uuid); \ - ret = 0; \ + gf_uuid_copy(*dst_ptr, uuid); \ + ret = 0; \ } else { \ - ret = -1; \ + ret = -1; \ } \ -} while (0) + } while (0) int32_t -gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe); +gd_syncop_brick_op_cbk(struct rpc_req *req, struct iovec *iov, int count, + void *myframe); -int gd_syncop_submit_request (struct rpc_clnt *rpc, void *req, void *local, - void *cookie, rpc_clnt_prog_t *prog, int procnum, - fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); -int gd_syncop_mgmt_lock (glusterd_peerinfo_t *peerinfo, struct syncargs *arg, - uuid_t my_uuid, uuid_t recv_uuid); +int +gd_syncop_submit_request(struct rpc_clnt *rpc, void *req, void *local, + void *cookie, rpc_clnt_prog_t *prog, int procnum, + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); +int +gd_syncop_mgmt_lock(glusterd_peerinfo_t *peerinfo, struct syncargs *arg, + uuid_t my_uuid, uuid_t recv_uuid); -int gd_syncop_mgmt_unlock (glusterd_peerinfo_t *peerinfo, struct syncargs *arg, - uuid_t my_uuid, uuid_t recv_uuid); +int +gd_syncop_mgmt_unlock(glusterd_peerinfo_t *peerinfo, struct syncargs *arg, + uuid_t my_uuid, uuid_t recv_uuid); -int gd_syncop_mgmt_stage_op (glusterd_peerinfo_t *peerinfo, - struct syncargs *arg, uuid_t my_uuid, - uuid_t recv_uuid, int op, dict_t *dict_out, - dict_t *op_ctx); +int +gd_syncop_mgmt_stage_op(glusterd_peerinfo_t *peerinfo, struct syncargs *arg, + uuid_t my_uuid, uuid_t recv_uuid, int op, + dict_t *dict_out, dict_t *op_ctx); -int gd_syncop_mgmt_commit_op (glusterd_peerinfo_t *peerinfo, - struct syncargs *arg, uuid_t my_uuid, - uuid_t recv_uuid, int op, dict_t *dict_out, - dict_t *op_ctx); +int +gd_syncop_mgmt_commit_op(glusterd_peerinfo_t *peerinfo, struct syncargs *arg, + uuid_t my_uuid, uuid_t recv_uuid, int op, + dict_t *dict_out, dict_t *op_ctx); void -gd_synctask_barrier_wait (struct syncargs *args, int count); +gd_synctask_barrier_wait(struct syncargs *args, int count); int -gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, - char **op_errstr); +gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, + char **op_errstr); int -glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp); +glusterd_syncop_aggr_rsp_dict(glusterd_op_t op, dict_t *aggr, dict_t *rsp); void -gd_syncargs_init (struct syncargs *args, dict_t *op_ctx); +gd_syncargs_init(struct syncargs *args, dict_t *op_ctx); #endif /* __RPC_SYNCOP_H */ diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.h b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.h index 1f0e33b989c..56b794df506 100644 --- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.h +++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.h @@ -14,24 +14,24 @@ #include "glusterd.h" void -glusterd_svc_build_tierd_rundir (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_tierd_rundir(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_tierd_socket_filepath (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_tierd_socket_filepath(glusterd_volinfo_t *volinfo, + char *path, int path_len); void -glusterd_svc_build_tierd_pidfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_tierd_pidfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_tierd_volfile_path (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_svc_build_tierd_volfile_path(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_svc_build_tierd_logdir (char *logdir, char *volname, size_t len); +glusterd_svc_build_tierd_logdir(char *logdir, char *volname, size_t len); void -glusterd_svc_build_tierd_logfile (char *logfile, char *logdir, size_t len); +glusterd_svc_build_tierd_logfile(char *logfile, char *logdir, size_t len); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.h b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.h index 2ff840d0f25..78d3d11b6a3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.h +++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.h @@ -13,30 +13,29 @@ #include "glusterd-svc-mgmt.h" - typedef struct glusterd_tierdsvc_ glusterd_tierdsvc_t; struct glusterd_tierdsvc_ { - glusterd_svc_t svc; - gf_store_handle_t *handle; + glusterd_svc_t svc; + gf_store_handle_t *handle; }; void -glusterd_tierdsvc_build (glusterd_svc_t *svc); +glusterd_tierdsvc_build(glusterd_svc_t *svc); int -glusterd_tierdsvc_init (void *data); +glusterd_tierdsvc_init(void *data); int -glusterd_tierdsvc_manager (glusterd_svc_t *svc, void *data, int flags); +glusterd_tierdsvc_manager(glusterd_svc_t *svc, void *data, int flags); int -glusterd_tierdsvc_start (glusterd_svc_t *svc, int flags); +glusterd_tierdsvc_start(glusterd_svc_t *svc, int flags); int -glusterd_tierdsvc_reconfigure (void *data); +glusterd_tierdsvc_reconfigure(void *data); int -glusterd_tierdsvc_restart (); +glusterd_tierdsvc_restart(); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 6f77ca6fbd6..4bdc048dd35 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -26,869 +26,851 @@ #include "glusterd-peer-utils.h" #define GLUSTERD_SOCK_DIR "/var/run/gluster" -#define GLUSTERD_ASSIGN_BRICKID_TO_BRICKINFO(brickinfo, volinfo, brickid) do {\ - sprintf (brickinfo->brick_id, "%s-client-%d",\ - volinfo->volname, brickid);\ -} while (0) +#define GLUSTERD_ASSIGN_BRICKID_TO_BRICKINFO(brickinfo, volinfo, brickid) \ + do { \ + sprintf(brickinfo->brick_id, "%s-client-%d", volinfo->volname, \ + brickid); \ + } while (0) #define ALL_VOLUME_OPTION_CHECK(volname, get_opt, key, ret, op_errstr, label) \ - do { \ - gf_boolean_t _all = !strcmp ("all", volname); \ - gf_boolean_t _is_valid_opt = _gf_false; \ - int32_t i = 0; \ + do { \ + gf_boolean_t _all = !strcmp("all", volname); \ + gf_boolean_t _is_valid_opt = _gf_false; \ + int32_t i = 0; \ \ - if (!get_opt && (!strcmp (key, "all") || \ - !strcmp (key, GLUSTERD_MAX_OP_VERSION_KEY))) {\ - ret = -1; \ - *op_errstr = gf_strdup ("Not a valid option to set"); \ - goto out; \ - } \ + if (!get_opt && (!strcmp(key, "all") || \ + !strcmp(key, GLUSTERD_MAX_OP_VERSION_KEY))) { \ + ret = -1; \ + *op_errstr = gf_strdup("Not a valid option to set"); \ + goto out; \ + } \ \ - for (i = 0; valid_all_vol_opts[i].option; i++) { \ - if (!strcmp (key, "all") || \ - !strcmp (key, valid_all_vol_opts[i].option)) { \ - _is_valid_opt = _gf_true; \ - break; \ - } \ - } \ + for (i = 0; valid_all_vol_opts[i].option; i++) { \ + if (!strcmp(key, "all") || \ + !strcmp(key, valid_all_vol_opts[i].option)) { \ + _is_valid_opt = _gf_true; \ + break; \ + } \ + } \ \ - if (_all && !_is_valid_opt) { \ - ret = -1; \ - *op_errstr = gf_strdup ("Not a valid option for all " \ - "volumes"); \ - goto label; \ - } else if (!_all && _is_valid_opt) { \ - ret = -1; \ - *op_errstr = gf_strdup ("Not a valid option for " \ - "single volume"); \ - goto label; \ - } \ - } while (0) \ - + if (_all && !_is_valid_opt) { \ + ret = -1; \ + *op_errstr = gf_strdup( \ + "Not a valid option for all " \ + "volumes"); \ + goto label; \ + } else if (!_all && _is_valid_opt) { \ + ret = -1; \ + *op_errstr = gf_strdup( \ + "Not a valid option for " \ + "single volume"); \ + goto label; \ + } \ + } while (0) struct glusterd_lock_ { - uuid_t owner; - time_t timestamp; + uuid_t owner; + time_t timestamp; }; typedef struct glusterd_dict_ctx_ { - dict_t *dict; - int opt_count; - char *key_name; - char *val_name; - char *prefix; + dict_t *dict; + int opt_count; + char *key_name; + char *val_name; + char *prefix; } glusterd_dict_ctx_t; -gf_boolean_t is_brick_mx_enabled (void); +gf_boolean_t +is_brick_mx_enabled(void); int -glusterd_compare_lines (const void *a, const void *b); +glusterd_compare_lines(const void *a, const void *b); -typedef int (*glusterd_condition_func) (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - void *ctx); +typedef int (*glusterd_condition_func)(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, + void *ctx); typedef struct glusterd_lock_ glusterd_lock_t; int32_t -glusterd_get_lock_owner (uuid_t *cur_owner); +glusterd_get_lock_owner(uuid_t *cur_owner); int32_t -glusterd_lock (uuid_t new_owner); +glusterd_lock(uuid_t new_owner); int32_t -glusterd_unlock (uuid_t owner); +glusterd_unlock(uuid_t owner); int32_t -glusterd_get_uuid (uuid_t *uuid); +glusterd_get_uuid(uuid_t *uuid); -char* -gd_get_shd_key (int type); +char * +gd_get_shd_key(int type); int -glusterd_submit_reply (rpcsvc_request_t *req, void *arg, - struct iovec *payload, int payloadcount, - struct iobref *iobref, xdrproc_t xdrproc); +glusterd_submit_reply(rpcsvc_request_t *req, void *arg, struct iovec *payload, + int payloadcount, struct iobref *iobref, + xdrproc_t xdrproc); int -glusterd_to_cli (rpcsvc_request_t *req, gf_cli_rsp *arg, struct iovec *payload, - int payloadcount, struct iobref *iobref, xdrproc_t xdrproc, - dict_t *dict); +glusterd_to_cli(rpcsvc_request_t *req, gf_cli_rsp *arg, struct iovec *payload, + int payloadcount, struct iobref *iobref, xdrproc_t xdrproc, + dict_t *dict); int -glusterd_submit_request (struct rpc_clnt *rpc, void *req, - call_frame_t *frame, rpc_clnt_prog_t *prog, - int procnum, struct iobref *iobref, - xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); +glusterd_submit_request(struct rpc_clnt *rpc, void *req, call_frame_t *frame, + rpc_clnt_prog_t *prog, int procnum, + struct iobref *iobref, xlator_t *this, + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); int32_t -glusterd_volinfo_new (glusterd_volinfo_t **volinfo); +glusterd_volinfo_new(glusterd_volinfo_t **volinfo); int32_t -glusterd_volinfo_dup (glusterd_volinfo_t *volinfo, - glusterd_volinfo_t **dup_volinfo, - gf_boolean_t set_userauth); +glusterd_volinfo_dup(glusterd_volinfo_t *volinfo, + glusterd_volinfo_t **dup_volinfo, + gf_boolean_t set_userauth); char * -glusterd_auth_get_username (glusterd_volinfo_t *volinfo); +glusterd_auth_get_username(glusterd_volinfo_t *volinfo); char * -glusterd_auth_get_password (glusterd_volinfo_t *volinfo); +glusterd_auth_get_password(glusterd_volinfo_t *volinfo); int32_t -glusterd_auth_set_username (glusterd_volinfo_t *volinfo, char *username); +glusterd_auth_set_username(glusterd_volinfo_t *volinfo, char *username); int32_t -glusterd_auth_set_password (glusterd_volinfo_t *volinfo, char *password); +glusterd_auth_set_password(glusterd_volinfo_t *volinfo, char *password); void -glusterd_auth_cleanup (glusterd_volinfo_t *volinfo); +glusterd_auth_cleanup(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_check_volume_exists (char *volname); +glusterd_check_volume_exists(char *volname); int32_t -glusterd_brickprocess_new (glusterd_brick_proc_t **brickprocess); +glusterd_brickprocess_new(glusterd_brick_proc_t **brickprocess); int32_t -glusterd_brickinfo_new (glusterd_brickinfo_t **brickinfo); +glusterd_brickinfo_new(glusterd_brickinfo_t **brickinfo); int32_t -glusterd_brickinfo_new_from_brick (char *brick, - glusterd_brickinfo_t **brickinfo, - gf_boolean_t construct_real_path, - char **op_errstr); +glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo, + gf_boolean_t construct_real_path, + char **op_errstr); int32_t -glusterd_volinfo_find (const char *volname, glusterd_volinfo_t **volinfo); +glusterd_volinfo_find(const char *volname, glusterd_volinfo_t **volinfo); int -glusterd_volinfo_find_by_volume_id (uuid_t volume_id, glusterd_volinfo_t **volinfo); +glusterd_volinfo_find_by_volume_id(uuid_t volume_id, + glusterd_volinfo_t **volinfo); int32_t glusterd_service_stop(const char *service, char *pidfile, int sig, gf_boolean_t force_kill); int32_t -glusterd_service_stop_nolock (const char *service, char *pidfile, int sig, - gf_boolean_t force_kill); +glusterd_service_stop_nolock(const char *service, char *pidfile, int sig, + gf_boolean_t force_kill); int -glusterd_get_next_available_brickid (glusterd_volinfo_t *volinfo); +glusterd_get_next_available_brickid(glusterd_volinfo_t *volinfo); int32_t -glusterd_resolve_brick (glusterd_brickinfo_t *brickinfo); +glusterd_resolve_brick(glusterd_brickinfo_t *brickinfo); int -glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo); +glusterd_brick_process_add_brick(glusterd_brickinfo_t *brickinfo); int -glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo, - int *last_brick); +glusterd_brick_process_remove_brick(glusterd_brickinfo_t *brickinfo, + int *last_brick); int -glusterd_brick_proc_for_port (int port, glusterd_brick_proc_t **brickprocess); +glusterd_brick_proc_for_port(int port, glusterd_brick_proc_t **brickprocess); int32_t -glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - gf_boolean_t wait); +glusterd_volume_start_glusterfs(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, + gf_boolean_t wait); int32_t -glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - gf_boolean_t del_brick); +glusterd_volume_stop_glusterfs(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, + gf_boolean_t del_brick); int -send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path, - glusterd_brickinfo_t *brick, - glusterd_brickinfo_t *other_brick, int op); +send_attach_req(xlator_t *this, struct rpc_clnt *rpc, char *path, + glusterd_brickinfo_t *brick, glusterd_brickinfo_t *other_brick, + int op); glusterd_volinfo_t * -glusterd_volinfo_ref (glusterd_volinfo_t *volinfo); +glusterd_volinfo_ref(glusterd_volinfo_t *volinfo); glusterd_volinfo_t * -glusterd_volinfo_unref (glusterd_volinfo_t *volinfo); +glusterd_volinfo_unref(glusterd_volinfo_t *volinfo); int32_t -glusterd_volinfo_delete (glusterd_volinfo_t *volinfo); +glusterd_volinfo_delete(glusterd_volinfo_t *volinfo); int32_t -glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo); +glusterd_brickinfo_delete(glusterd_brickinfo_t *brickinfo); gf_boolean_t -glusterd_is_cli_op_req (int32_t op); +glusterd_is_cli_op_req(int32_t op); int32_t -glusterd_volume_brickinfo_get_by_brick (char *brick, - glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t **brickinfo, - gf_boolean_t construct_real_path); +glusterd_volume_brickinfo_get_by_brick(char *brick, glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t **brickinfo, + gf_boolean_t construct_real_path); int32_t -glusterd_add_volumes_to_export_dict (dict_t **peer_data); +glusterd_add_volumes_to_export_dict(dict_t **peer_data); int32_t -glusterd_compare_friend_data (dict_t *peer_data, int32_t *status, - char *hostname); +glusterd_compare_friend_data(dict_t *peer_data, int32_t *status, + char *hostname); int -glusterd_compute_cksum (glusterd_volinfo_t *volinfo, - gf_boolean_t is_quota_conf); +glusterd_compute_cksum(glusterd_volinfo_t *volinfo, gf_boolean_t is_quota_conf); void -glusterd_set_socket_filepath (char *sock_filepath, char *sockpath, size_t len); +glusterd_set_socket_filepath(char *sock_filepath, char *sockpath, size_t len); -struct rpc_clnt* -glusterd_pending_node_get_rpc (glusterd_pending_node_t *pending_node); +struct rpc_clnt * +glusterd_pending_node_get_rpc(glusterd_pending_node_t *pending_node); void -glusterd_pending_node_put_rpc (glusterd_pending_node_t *pending_node); +glusterd_pending_node_put_rpc(glusterd_pending_node_t *pending_node); int -glusterd_remote_hostname_get (rpcsvc_request_t *req, - char *remote_host, int len); +glusterd_remote_hostname_get(rpcsvc_request_t *req, char *remote_host, int len); int32_t -glusterd_import_friend_volumes_synctask (void *opaque); +glusterd_import_friend_volumes_synctask(void *opaque); int32_t -glusterd_import_friend_volumes (dict_t *peer_data); +glusterd_import_friend_volumes(dict_t *peer_data); void -glusterd_set_volume_status (glusterd_volinfo_t *volinfo, - glusterd_volume_status status); +glusterd_set_volume_status(glusterd_volinfo_t *volinfo, + glusterd_volume_status status); int32_t -glusterd_volume_count_get (void); +glusterd_volume_count_get(void); int32_t -glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, - dict_t *dict, int32_t count, - char *prefix); +glusterd_add_volume_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict, + int32_t count, char *prefix); int -glusterd_get_brickinfo (xlator_t *this, const char *brickname, - int port, glusterd_brickinfo_t **brickinfo); +glusterd_get_brickinfo(xlator_t *this, const char *brickname, int port, + glusterd_brickinfo_t **brickinfo); void -glusterd_set_brick_status (glusterd_brickinfo_t *brickinfo, - gf_brick_status_t status); +glusterd_set_brick_status(glusterd_brickinfo_t *brickinfo, + gf_brick_status_t status); gf_boolean_t -glusterd_is_brick_started (glusterd_brickinfo_t *brickinfo); +glusterd_is_brick_started(glusterd_brickinfo_t *brickinfo); int -glusterd_friend_brick_belongs (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, void *uuid); +glusterd_friend_brick_belongs(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, void *uuid); int -glusterd_all_volume_cond_check (glusterd_condition_func func, int status, - void *ctx); +glusterd_all_volume_cond_check(glusterd_condition_func func, int status, + void *ctx); int -glusterd_brick_start (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - gf_boolean_t wait, - gf_boolean_t only_connect); +glusterd_brick_start(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, gf_boolean_t wait, + gf_boolean_t only_connect); int -glusterd_brick_stop (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - gf_boolean_t del_brick); +glusterd_brick_stop(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, gf_boolean_t del_brick); gf_boolean_t -glusterd_is_tier_daemon_running (glusterd_volinfo_t *volinfo); +glusterd_is_tier_daemon_running(glusterd_volinfo_t *volinfo); int32_t -glusterd_add_tierd_to_dict (glusterd_volinfo_t *volinfo, - dict_t *dict, int32_t count); +glusterd_add_tierd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict, + int32_t count); int -glusterd_op_tier_status (dict_t *dict, char **op_errstr, dict_t *rsp_dict, - glusterd_op_t op); +glusterd_op_tier_status(dict_t *dict, char **op_errstr, dict_t *rsp_dict, + glusterd_op_t op); int -glusterd_is_defrag_on (glusterd_volinfo_t *volinfo); +glusterd_is_defrag_on(glusterd_volinfo_t *volinfo); int32_t -glusterd_volinfo_bricks_delete (glusterd_volinfo_t *volinfo); +glusterd_volinfo_bricks_delete(glusterd_volinfo_t *volinfo); int -glusterd_new_brick_validate (char *brick, glusterd_brickinfo_t *brickinfo, - char *op_errstr, size_t len, char *op); +glusterd_new_brick_validate(char *brick, glusterd_brickinfo_t *brickinfo, + char *op_errstr, size_t len, char *op); int32_t -glusterd_volume_brickinfos_delete (glusterd_volinfo_t *volinfo); +glusterd_volume_brickinfos_delete(glusterd_volinfo_t *volinfo); int32_t -glusterd_volume_brickinfo_get (uuid_t uuid, char *hostname, char *path, - glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t **brickinfo); +glusterd_volume_brickinfo_get(uuid_t uuid, char *hostname, char *path, + glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t **brickinfo); int -glusterd_brickinfo_get (uuid_t uuid, char *hostname, char *path, +glusterd_brickinfo_get(uuid_t uuid, char *hostname, char *path, glusterd_brickinfo_t **brickinfo); - int -glusterd_rb_check_bricks (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *src_brick, - glusterd_brickinfo_t *dst_brick); +glusterd_rb_check_bricks(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *src_brick, + glusterd_brickinfo_t *dst_brick); int -glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid, - char **op_errstr, gf_boolean_t is_force); +glusterd_check_and_set_brick_xattr(char *host, char *path, uuid_t uuid, + char **op_errstr, gf_boolean_t is_force); int -glusterd_validate_and_create_brickpath (glusterd_brickinfo_t *brickinfo, - uuid_t volume_id, char **op_errstr, - gf_boolean_t is_force, - gf_boolean_t ignore_partition); +glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo, + uuid_t volume_id, char **op_errstr, + gf_boolean_t is_force, + gf_boolean_t ignore_partition); int -glusterd_sm_tr_log_transition_add (glusterd_sm_tr_log_t *log, - int old_state, int new_state, - int event); +glusterd_sm_tr_log_transition_add(glusterd_sm_tr_log_t *log, int old_state, + int new_state, int event); int -glusterd_sm_tr_log_init (glusterd_sm_tr_log_t *log, - char * (*state_name_get) (int), - char * (*event_name_get) (int), - size_t size); +glusterd_sm_tr_log_init(glusterd_sm_tr_log_t *log, char *(*state_name_get)(int), + char *(*event_name_get)(int), size_t size); void -glusterd_sm_tr_log_delete (glusterd_sm_tr_log_t *log); +glusterd_sm_tr_log_delete(glusterd_sm_tr_log_t *log); int -glusterd_sm_tr_log_add_to_dict (dict_t *dict, - glusterd_sm_tr_log_t *circular_log); +glusterd_sm_tr_log_add_to_dict(dict_t *dict, + glusterd_sm_tr_log_t *circular_log); int -glusterd_remove_pending_entry (struct cds_list_head *list, void *elem); +glusterd_remove_pending_entry(struct cds_list_head *list, void *elem); int -glusterd_clear_pending_nodes (struct cds_list_head *list); +glusterd_clear_pending_nodes(struct cds_list_head *list); int32_t -glusterd_brick_connect (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, char *socketpath); +glusterd_brick_connect(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, char *socketpath); int32_t -glusterd_brick_disconnect (glusterd_brickinfo_t *brickinfo); +glusterd_brick_disconnect(glusterd_brickinfo_t *brickinfo); int32_t -glusterd_delete_volume (glusterd_volinfo_t *volinfo); +glusterd_delete_volume(glusterd_volinfo_t *volinfo); int32_t -glusterd_delete_brick (glusterd_volinfo_t* volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_delete_brick(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); int32_t -glusterd_delete_all_bricks (glusterd_volinfo_t* volinfo); +glusterd_delete_all_bricks(glusterd_volinfo_t *volinfo); int -glusterd_spawn_daemons (void *opaque); +glusterd_spawn_daemons(void *opaque); int -glusterd_restart_gsyncds (glusterd_conf_t *conf); +glusterd_restart_gsyncds(glusterd_conf_t *conf); int -glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave, - char *path_list, char *conf_path, - char *glusterd_uuid_str, - char **op_errstr, gf_boolean_t is_pause); +glusterd_start_gsync(glusterd_volinfo_t *master_vol, char *slave, + char *path_list, char *conf_path, char *glusterd_uuid_str, + char **op_errstr, gf_boolean_t is_pause); int -glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, - char **pathlist); +glusterd_get_local_brickpaths(glusterd_volinfo_t *volinfo, char **pathlist); int32_t -glusterd_recreate_bricks (glusterd_conf_t *conf); +glusterd_recreate_bricks(glusterd_conf_t *conf); int32_t -glusterd_handle_upgrade_downgrade (dict_t *options, glusterd_conf_t *conf, - gf_boolean_t upgrade, - gf_boolean_t downgrade); +glusterd_handle_upgrade_downgrade(dict_t *options, glusterd_conf_t *conf, + gf_boolean_t upgrade, gf_boolean_t downgrade); int -glusterd_add_brick_detail_to_dict (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - dict_t *dict, int32_t count); +glusterd_add_brick_detail_to_dict(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, dict_t *dict, + int32_t count); int32_t -glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - dict_t *dict, int32_t count); +glusterd_add_brick_to_dict(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, dict_t *dict, + int32_t count); int32_t -glusterd_get_all_volnames (dict_t *dict); +glusterd_get_all_volnames(dict_t *dict); gf_boolean_t -glusterd_is_fuse_available (); +glusterd_is_fuse_available(); int -glusterd_brick_statedump (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - char *options, int option_cnt, char **op_errstr); +glusterd_brick_statedump(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, char *options, + int option_cnt, char **op_errstr); int -glusterd_brick_terminate (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - char *options, int option_cnt, char **op_errstr); +glusterd_brick_terminate(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, char *options, + int option_cnt, char **op_errstr); int -glusterd_nfs_statedump (char *options, int option_cnt, char **op_errstr); +glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr); int -glusterd_client_statedump (char *volname, char *options, int option_cnt, - char **op_errstr); +glusterd_client_statedump(char *volname, char *options, int option_cnt, + char **op_errstr); int -glusterd_quotad_statedump (char *options, int option_cnt, char **op_errstr); +glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr); gf_boolean_t -glusterd_is_volume_replicate (glusterd_volinfo_t *volinfo); +glusterd_is_volume_replicate(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_is_brick_decommissioned (glusterd_volinfo_t *volinfo, char *hostname, - char *path); +glusterd_is_brick_decommissioned(glusterd_volinfo_t *volinfo, char *hostname, + char *path); int -glusterd_friend_contains_vol_bricks (glusterd_volinfo_t *volinfo, - uuid_t friend_uuid); +glusterd_friend_contains_vol_bricks(glusterd_volinfo_t *volinfo, + uuid_t friend_uuid); int -glusterd_friend_contains_snap_bricks (glusterd_snap_t *snapinfo, +glusterd_friend_contains_snap_bricks(glusterd_snap_t *snapinfo, uuid_t friend_uuid); int -glusterd_friend_remove_cleanup_vols (uuid_t uuid); +glusterd_friend_remove_cleanup_vols(uuid_t uuid); int -glusterd_get_client_filepath (char *filepath, - glusterd_volinfo_t *volinfo, - gf_transport_type type); +glusterd_get_client_filepath(char *filepath, glusterd_volinfo_t *volinfo, + gf_transport_type type); int -glusterd_get_trusted_client_filepath (char *filepath, - glusterd_volinfo_t *volinfo, - gf_transport_type type); +glusterd_get_trusted_client_filepath(char *filepath, + glusterd_volinfo_t *volinfo, + gf_transport_type type); int -glusterd_restart_rebalance (glusterd_conf_t *conf); +glusterd_restart_rebalance(glusterd_conf_t *conf); int32_t -glusterd_create_sub_tier_volinfo (glusterd_volinfo_t *volinfo, - glusterd_volinfo_t **dup_volinfo, - gf_boolean_t is_hot_tier, - const char *new_name); +glusterd_create_sub_tier_volinfo(glusterd_volinfo_t *volinfo, + glusterd_volinfo_t **dup_volinfo, + gf_boolean_t is_hot_tier, + const char *new_name); int -glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo); +glusterd_restart_rebalance_for_volume(glusterd_volinfo_t *volinfo); void -glusterd_defrag_info_set (glusterd_volinfo_t *volinfo, dict_t *dict, int cmd, - int status, int op); +glusterd_defrag_info_set(glusterd_volinfo_t *volinfo, dict_t *dict, int cmd, + int status, int op); int32_t -glusterd_add_bricks_hname_path_to_dict (dict_t *dict, - glusterd_volinfo_t *volinfo); +glusterd_add_bricks_hname_path_to_dict(dict_t *dict, + glusterd_volinfo_t *volinfo); int -glusterd_add_node_to_dict (char *server, dict_t *dict, int count, - dict_t *vol_opts); +glusterd_add_node_to_dict(char *server, dict_t *dict, int count, + dict_t *vol_opts); int -glusterd_calc_dist_leaf_count (int rcount, int scount); +glusterd_calc_dist_leaf_count(int rcount, int scount); int -glusterd_get_dist_leaf_count (glusterd_volinfo_t *volinfo); +glusterd_get_dist_leaf_count(glusterd_volinfo_t *volinfo); -glusterd_brickinfo_t* -glusterd_get_brickinfo_by_position (glusterd_volinfo_t *volinfo, uint32_t pos); +glusterd_brickinfo_t * +glusterd_get_brickinfo_by_position(glusterd_volinfo_t *volinfo, uint32_t pos); gf_boolean_t -glusterd_is_local_brick (xlator_t *this, glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_is_local_brick(xlator_t *this, glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); int -glusterd_validate_volume_id (dict_t *op_dict, glusterd_volinfo_t *volinfo); +glusterd_validate_volume_id(dict_t *op_dict, glusterd_volinfo_t *volinfo); int -glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo, - dict_t *rsp_dict, int32_t cmd); +glusterd_defrag_volume_status_update(glusterd_volinfo_t *volinfo, + dict_t *rsp_dict, int32_t cmd); int -glusterd_check_files_identical (char *filename1, char *filename2, - gf_boolean_t *identical); +glusterd_check_files_identical(char *filename1, char *filename2, + gf_boolean_t *identical); int -glusterd_check_topology_identical (const char *filename1, - const char *filename2, - gf_boolean_t *identical); +glusterd_check_topology_identical(const char *filename1, const char *filename2, + gf_boolean_t *identical); void -glusterd_volinfo_reset_defrag_stats (glusterd_volinfo_t *volinfo); +glusterd_volinfo_reset_defrag_stats(glusterd_volinfo_t *volinfo); int -glusterd_volset_help (dict_t *dict, char **op_errstr); +glusterd_volset_help(dict_t *dict, char **op_errstr); int32_t -glusterd_sync_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_sync_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int32_t -glusterd_gsync_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict, char *op_errstr); +glusterd_gsync_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict, char *op_errstr); int32_t -glusterd_rb_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_rb_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_profile_volume_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_profile_volume_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_status_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_tier_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_tier_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_heal_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_sys_exec_output_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_sys_exec_output_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int32_t -glusterd_handle_node_rsp (dict_t *req_ctx, void *pending_entry, - glusterd_op_t op, dict_t *rsp_dict, dict_t *op_ctx, - char **op_errstr, gd_node_type type); +glusterd_handle_node_rsp(dict_t *req_ctx, void *pending_entry, glusterd_op_t op, + dict_t *rsp_dict, dict_t *op_ctx, char **op_errstr, + gd_node_type type); int -glusterd_max_opversion_use_rsp_dict (dict_t *dst, dict_t *src); +glusterd_max_opversion_use_rsp_dict(dict_t *dst, dict_t *src); int -glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_bitrot_scrub_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_volume_heal_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int32_t -glusterd_check_if_quota_trans_enabled (glusterd_volinfo_t *volinfo); +glusterd_check_if_quota_trans_enabled(glusterd_volinfo_t *volinfo); int -glusterd_volume_quota_copy_to_op_ctx_dict (dict_t *aggr, dict_t *rsp); +glusterd_volume_quota_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp); int -_profile_volume_add_brick_rsp (dict_t *this, char *key, data_t *value, - void *data); +_profile_volume_add_brick_rsp(dict_t *this, char *key, data_t *value, + void *data); int -glusterd_profile_volume_brick_rsp (void *pending_entry, - dict_t *rsp_dict, dict_t *op_ctx, - char **op_errstr, gd_node_type type); +glusterd_profile_volume_brick_rsp(void *pending_entry, dict_t *rsp_dict, + dict_t *op_ctx, char **op_errstr, + gd_node_type type); int32_t -glusterd_set_originator_uuid (dict_t *dict); +glusterd_set_originator_uuid(dict_t *dict); /* Should be used only when an operation is in progress, as that is the only * time a lock_owner is set */ gf_boolean_t -is_origin_glusterd (dict_t *dict); +is_origin_glusterd(dict_t *dict); int -glusterd_get_next_global_opt_version_str (dict_t *opts, char **version_str); +glusterd_get_next_global_opt_version_str(dict_t *opts, char **version_str); int -glusterd_generate_and_set_task_id (dict_t *dict, char *key, const int keylen); +glusterd_generate_and_set_task_id(dict_t *dict, char *key, const int keylen); int -glusterd_validate_and_set_gfid (dict_t *op_ctx, dict_t *req_dict, - char **op_errstr); +glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict, + char **op_errstr); int -glusterd_copy_uuid_to_dict (uuid_t uuid, dict_t *dict, char *key, - const int keylen); +glusterd_copy_uuid_to_dict(uuid_t uuid, dict_t *dict, char *key, + const int keylen); gf_boolean_t -glusterd_is_same_address (char *name1, char *name2); +glusterd_is_same_address(char *name1, char *name2); void -gd_update_volume_op_versions (glusterd_volinfo_t *volinfo); +gd_update_volume_op_versions(glusterd_volinfo_t *volinfo); int -op_version_check (xlator_t *this, int min_op_version, char *msg, int msglen); +op_version_check(xlator_t *this, int min_op_version, char *msg, int msglen); gf_boolean_t -gd_is_remove_brick_committed (glusterd_volinfo_t *volinfo); +gd_is_remove_brick_committed(glusterd_volinfo_t *volinfo); int -glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, - dict_t *dict, - glusterd_volinfo_t *volinfo, - char **errstr, gf_cli_defrag_type); +glusterd_remove_brick_validate_bricks(gf1_op_commands cmd, int32_t brick_count, + dict_t *dict, glusterd_volinfo_t *volinfo, + char **errstr, gf_cli_defrag_type); int -glusterd_get_slave_details_confpath (glusterd_volinfo_t *volinfo, - dict_t *dict, char **slave_url, - char **slave_host, char **slave_vol, - char **conf_path, char **op_errstr); +glusterd_get_slave_details_confpath(glusterd_volinfo_t *volinfo, dict_t *dict, + char **slave_url, char **slave_host, + char **slave_vol, char **conf_path, + char **op_errstr); int -glusterd_get_slave_info (char *slave, - char **slave_url, char **hostname, - char **slave_vol, char **op_errstr); +glusterd_get_slave_info(char *slave, char **slave_url, char **hostname, + char **slave_vol, char **op_errstr); int -glusterd_get_statefile_name (glusterd_volinfo_t *volinfo, char *slave, - char *conf_path, char **statefile, - gf_boolean_t *is_template_in_use); +glusterd_get_statefile_name(glusterd_volinfo_t *volinfo, char *slave, + char *conf_path, char **statefile, + gf_boolean_t *is_template_in_use); int -glusterd_gsync_read_frm_status (char *path, char *buf, size_t blen); +glusterd_gsync_read_frm_status(char *path, char *buf, size_t blen); int -glusterd_create_status_file (char *master, char *slave, char *slave_url, - char *slave_vol, char *status); +glusterd_create_status_file(char *master, char *slave, char *slave_url, + char *slave_vol, char *status); int -glusterd_check_restart_gsync_session (glusterd_volinfo_t *volinfo, char *slave, - dict_t *resp_dict, char *path_list, - char *conf_path, gf_boolean_t is_force); +glusterd_check_restart_gsync_session(glusterd_volinfo_t *volinfo, char *slave, + dict_t *resp_dict, char *path_list, + char *conf_path, gf_boolean_t is_force); int -glusterd_check_gsync_running_local (char *master, char *slave, - char *conf_path, - gf_boolean_t *is_run); +glusterd_check_gsync_running_local(char *master, char *slave, char *conf_path, + gf_boolean_t *is_run); gf_boolean_t -glusterd_is_status_tasks_op (glusterd_op_t op, dict_t *dict); +glusterd_is_status_tasks_op(glusterd_op_t op, dict_t *dict); gf_boolean_t -gd_should_i_start_rebalance (glusterd_volinfo_t *volinfo); +gd_should_i_start_rebalance(glusterd_volinfo_t *volinfo); int -glusterd_is_tierd_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_tierd_enabled(glusterd_volinfo_t *volinfo); int -glusterd_is_tierd_supposed_to_be_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_tierd_supposed_to_be_enabled(glusterd_volinfo_t *volinfo); int -glusterd_is_volume_quota_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_volume_quota_enabled(glusterd_volinfo_t *volinfo); int -glusterd_is_volume_inode_quota_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_volume_inode_quota_enabled(glusterd_volinfo_t *volinfo); int -glusterd_is_bitrot_enabled (glusterd_volinfo_t *volinfo); +glusterd_is_bitrot_enabled(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_all_volumes_with_quota_stopped (); +glusterd_all_volumes_with_quota_stopped(); void -glusterd_clean_up_quota_store (glusterd_volinfo_t *volinfo); +glusterd_clean_up_quota_store(glusterd_volinfo_t *volinfo); int -glusterd_remove_auxiliary_mount (char *volname); +glusterd_remove_auxiliary_mount(char *volname); gf_boolean_t -glusterd_status_has_tasks (int cmd); +glusterd_status_has_tasks(int cmd); int -gd_stop_rebalance_process (glusterd_volinfo_t *volinfo); +gd_stop_rebalance_process(glusterd_volinfo_t *volinfo); rpc_clnt_t * -glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc); +glusterd_rpc_clnt_unref(glusterd_conf_t *conf, rpc_clnt_t *rpc); int32_t glusterd_compare_volume_name(struct cds_list_head *, struct cds_list_head *); -char* -glusterd_get_brick_mount_device (char *brick_path); +char * +glusterd_get_brick_mount_device(char *brick_path); struct mntent * -glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen, - struct mntent *entry_ptr); +glusterd_get_mnt_entry_info(char *mnt_pt, char *buff, int buflen, + struct mntent *entry_ptr); int -glusterd_get_brick_root (char *path, char **mount_point); +glusterd_get_brick_root(char *path, char **mount_point); int32_t -glusterd_lvm_snapshot_remove (dict_t *rsp_dict, glusterd_volinfo_t *snap_vol); +glusterd_lvm_snapshot_remove(dict_t *rsp_dict, glusterd_volinfo_t *snap_vol); gf_boolean_t -gd_vol_is_geo_rep_active (glusterd_volinfo_t *volinfo); +gd_vol_is_geo_rep_active(glusterd_volinfo_t *volinfo); int32_t -glusterd_get_brick_mount_dir (char *brickpath, char *hostname, char *mount_dir); +glusterd_get_brick_mount_dir(char *brickpath, char *hostname, char *mount_dir); int32_t -glusterd_aggr_brick_mount_dirs (dict_t *aggr, dict_t *rsp_dict); +glusterd_aggr_brick_mount_dirs(dict_t *aggr, dict_t *rsp_dict); int32_t -glusterd_take_lvm_snapshot (glusterd_brickinfo_t *brickinfo, - char *origin_brick_path); +glusterd_take_lvm_snapshot(glusterd_brickinfo_t *brickinfo, + char *origin_brick_path); void -glusterd_launch_synctask (synctask_fn_t fn, void *opaque); +glusterd_launch_synctask(synctask_fn_t fn, void *opaque); int -glusterd_enable_default_options (glusterd_volinfo_t *volinfo, char *option); +glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option); int -glusterd_unlink_file (char *sock_file_path); +glusterd_unlink_file(char *sock_file_path); int32_t -glusterd_find_brick_mount_path (char *brick_path, char **brick_mount_path); +glusterd_find_brick_mount_path(char *brick_path, char **brick_mount_path); /* * Function to retrieve list of snap volnames and their uuids */ -int glusterd_snapshot_get_volnames_uuids (dict_t *dict, - char *volname, gf_getsnap_name_uuid_rsp *snap_info_rsp); +int +glusterd_snapshot_get_volnames_uuids(dict_t *dict, char *volname, + gf_getsnap_name_uuid_rsp *snap_info_rsp); int -glusterd_update_mntopts (char *brick_path, glusterd_brickinfo_t *brickinfo); +glusterd_update_mntopts(char *brick_path, glusterd_brickinfo_t *brickinfo); int -glusterd_update_fs_label (glusterd_brickinfo_t *brickinfo); +glusterd_update_fs_label(glusterd_brickinfo_t *brickinfo); int -glusterd_get_volopt_content (dict_t *dict, gf_boolean_t xml_out); +glusterd_get_volopt_content(dict_t *dict, gf_boolean_t xml_out); int -glusterd_get_global_max_op_version (rpcsvc_request_t *req, dict_t *ctx, - int count); +glusterd_get_global_max_op_version(rpcsvc_request_t *req, dict_t *ctx, + int count); int -glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *dict, - char **op_errstr); +glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *dict, + char **op_errstr); int -glusterd_get_default_val_for_volopt (dict_t *dict, gf_boolean_t all_opts, - char *key, char *orig_key, - glusterd_volinfo_t *volinfo, - char **err_str); +glusterd_get_default_val_for_volopt(dict_t *dict, gf_boolean_t all_opts, + char *key, char *orig_key, + glusterd_volinfo_t *volinfo, + char **err_str); int -glusterd_check_client_op_version_support (char *volname, uint32_t op_version, - char **op_errstr); +glusterd_check_client_op_version_support(char *volname, uint32_t op_version, + char **op_errstr); gf_boolean_t -glusterd_have_peers (); +glusterd_have_peers(); gf_boolean_t -glusterd_have_volumes (); +glusterd_have_volumes(); void -glusterd_get_rebalance_volfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_get_rebalance_volfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); void -glusterd_get_gfproxy_client_volfile (glusterd_volinfo_t *volinfo, - char *path, int path_len); +glusterd_get_gfproxy_client_volfile(glusterd_volinfo_t *volinfo, char *path, + int path_len); int32_t -glusterd_brickinfo_dup (glusterd_brickinfo_t *brickinfo, - glusterd_brickinfo_t *dup_brickinfo); +glusterd_brickinfo_dup(glusterd_brickinfo_t *brickinfo, + glusterd_brickinfo_t *dup_brickinfo); int -glusterd_vol_add_quota_conf_to_dict (glusterd_volinfo_t *volinfo, dict_t *load, - int vol_idx, char *prefix); +glusterd_vol_add_quota_conf_to_dict(glusterd_volinfo_t *volinfo, dict_t *load, + int vol_idx, char *prefix); int32_t -glusterd_import_volinfo (dict_t *peer_data, int count, - glusterd_volinfo_t **volinfo, - char *prefix); +glusterd_import_volinfo(dict_t *peer_data, int count, + glusterd_volinfo_t **volinfo, char *prefix); int -glusterd_import_quota_conf (dict_t *peer_data, int vol_idx, - glusterd_volinfo_t *new_volinfo, - char *prefix); +glusterd_import_quota_conf(dict_t *peer_data, int vol_idx, + glusterd_volinfo_t *new_volinfo, char *prefix); gf_boolean_t -glusterd_is_shd_compatible_volume (glusterd_volinfo_t *volinfo); +glusterd_is_shd_compatible_volume(glusterd_volinfo_t *volinfo); gf_boolean_t -glusterd_is_shd_compatible_type (int type); +glusterd_is_shd_compatible_type(int type); gf_boolean_t -glusterd_are_all_volumes_stopped (); +glusterd_are_all_volumes_stopped(); gf_boolean_t -glusterd_all_shd_compatible_volumes_stopped (); +glusterd_all_shd_compatible_volumes_stopped(); void -glusterd_nfs_pmap_deregister (); +glusterd_nfs_pmap_deregister(); gf_boolean_t -glusterd_is_volume_started (glusterd_volinfo_t *volinfo); +glusterd_is_volume_started(glusterd_volinfo_t *volinfo); int -glusterd_volume_get_type_str (glusterd_volinfo_t *volinfo, char **vol_type_str); +glusterd_volume_get_type_str(glusterd_volinfo_t *volinfo, char **vol_type_str); int -glusterd_volume_get_status_str (glusterd_volinfo_t *volinfo, char *status_str); +glusterd_volume_get_status_str(glusterd_volinfo_t *volinfo, char *status_str); int -glusterd_volume_get_transport_type_str (glusterd_volinfo_t *volinfo, - char *transport_type_str); +glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo, + char *transport_type_str); int -glusterd_volume_get_quorum_status_str (glusterd_volinfo_t *volinfo, - char *quorum_status_str); +glusterd_volume_get_quorum_status_str(glusterd_volinfo_t *volinfo, + char *quorum_status_str); int -glusterd_volume_get_rebalance_status_str (glusterd_volinfo_t *volinfo, - char *rebal_status_str); +glusterd_volume_get_rebalance_status_str(glusterd_volinfo_t *volinfo, + char *rebal_status_str); int -glusterd_volume_get_hot_tier_type_str (glusterd_volinfo_t *volinfo, - char **hot_tier_type_str); +glusterd_volume_get_hot_tier_type_str(glusterd_volinfo_t *volinfo, + char **hot_tier_type_str); int -glusterd_volume_get_cold_tier_type_str (glusterd_volinfo_t *volinfo, - char **cold_tier_type_str); +glusterd_volume_get_cold_tier_type_str(glusterd_volinfo_t *volinfo, + char **cold_tier_type_str); void -glusterd_list_add_order (struct cds_list_head *new, struct cds_list_head *head, +glusterd_list_add_order(struct cds_list_head *new, struct cds_list_head *head, int (*compare)(struct cds_list_head *, struct cds_list_head *)); int -glusterd_disallow_op_for_tier (glusterd_volinfo_t *volinfo, glusterd_op_t op, - int cmd); +glusterd_disallow_op_for_tier(glusterd_volinfo_t *volinfo, glusterd_op_t op, + int cmd); -struct rpc_clnt* -glusterd_defrag_rpc_get (glusterd_defrag_info_t *defrag); +struct rpc_clnt * +glusterd_defrag_rpc_get(glusterd_defrag_info_t *defrag); -struct rpc_clnt* -glusterd_defrag_rpc_put (glusterd_defrag_info_t *defrag); +struct rpc_clnt * +glusterd_defrag_rpc_put(glusterd_defrag_info_t *defrag); int32_t -glusterd_count_connected_peers (int32_t *count); +glusterd_count_connected_peers(int32_t *count); int -glusterd_volume_brick_for_each (glusterd_volinfo_t *volinfo, void *data, - int (*fn) (glusterd_volinfo_t *, glusterd_brickinfo_t *, - dict_t *mod_dict, void *)); +glusterd_volume_brick_for_each(glusterd_volinfo_t *volinfo, void *data, + int (*fn)(glusterd_volinfo_t *, + glusterd_brickinfo_t *, + dict_t *mod_dict, void *)); int -glusterd_get_dummy_client_filepath (char *filepath, - glusterd_volinfo_t *volinfo, - gf_transport_type type); +glusterd_get_dummy_client_filepath(char *filepath, glusterd_volinfo_t *volinfo, + gf_transport_type type); int -glusterd_handle_replicate_brick_ops (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - glusterd_op_t op); +glusterd_handle_replicate_brick_ops(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, + glusterd_op_t op); void -assign_brick_groups (glusterd_volinfo_t *volinfo); +assign_brick_groups(glusterd_volinfo_t *volinfo); -glusterd_brickinfo_t* -get_last_brick_of_brick_group (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_brickinfo_t * +get_last_brick_of_brick_group(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); int -glusterd_get_rb_dst_brickinfo (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t **brickinfo); +glusterd_get_rb_dst_brickinfo(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t **brickinfo); int -rb_update_dstbrick_port (glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict, - dict_t *req_dict); +rb_update_dstbrick_port(glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict, + dict_t *req_dict); int -glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo, - char *old_brick, char *new_brick, - dict_t *dict); +glusterd_op_perform_replace_brick(glusterd_volinfo_t *volinfo, char *old_brick, + char *new_brick, dict_t *dict); int32_t -glusterd_brick_unlink_socket_file (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_brick_unlink_socket_file(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); char * -gd_rb_op_to_str (char *op); +gd_rb_op_to_str(char *op); glusterd_op_t -gd_cli_to_gd_op (char *cli_op); +gd_cli_to_gd_op(char *cli_op); int -glusterd_get_dst_brick_info (char **dst_brick, char *volname, char **op_errstr, - glusterd_brickinfo_t **dst_brickinfo, char **host, - dict_t *dict, char **dup_dstbrick); +glusterd_get_dst_brick_info(char **dst_brick, char *volname, char **op_errstr, + glusterd_brickinfo_t **dst_brickinfo, char **host, + dict_t *dict, char **dup_dstbrick); int -glusterd_brick_op_prerequisites (dict_t *dict, - char **op, - glusterd_op_t *gd_op, char **volname, - glusterd_volinfo_t **volinfo, - char **src_brick, glusterd_brickinfo_t - **src_brickinfo, char *pidfile, - char **op_errstr, dict_t *rsp_dict); +glusterd_brick_op_prerequisites(dict_t *dict, char **op, glusterd_op_t *gd_op, + char **volname, glusterd_volinfo_t **volinfo, + char **src_brick, + glusterd_brickinfo_t **src_brickinfo, + char *pidfile, char **op_errstr, + dict_t *rsp_dict); int -glusterd_get_volinfo_from_brick (char *brick, glusterd_volinfo_t **volinfo); +glusterd_get_volinfo_from_brick(char *brick, glusterd_volinfo_t **volinfo); gf_boolean_t -glusterd_is_profile_on (glusterd_volinfo_t *volinfo); +glusterd_is_profile_on(glusterd_volinfo_t *volinfo); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h index 38a62393fd6..f9fc068931b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.h +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h @@ -20,24 +20,24 @@ /* volopt map key name definitions */ -#define VKEY_DIAG_CNT_FOP_HITS "diagnostics.count-fop-hits" +#define VKEY_DIAG_CNT_FOP_HITS "diagnostics.count-fop-hits" #define VKEY_DIAG_LAT_MEASUREMENT "diagnostics.latency-measurement" #define VKEY_FEATURES_LIMIT_USAGE "features.limit-usage" -#define VKEY_FEATURES_SOFT_LIMIT "features.soft-limit" -#define VKEY_MARKER_XTIME GEOREP".indexing" -#define VKEY_MARKER_XTIME_FORCE GEOREP".ignore-pid-check" -#define VKEY_CHANGELOG "changelog.changelog" -#define VKEY_FEATURES_QUOTA "features.quota" +#define VKEY_FEATURES_SOFT_LIMIT "features.soft-limit" +#define VKEY_MARKER_XTIME GEOREP ".indexing" +#define VKEY_MARKER_XTIME_FORCE GEOREP ".ignore-pid-check" +#define VKEY_CHANGELOG "changelog.changelog" +#define VKEY_FEATURES_QUOTA "features.quota" #define VKEY_FEATURES_INODE_QUOTA "features.inode-quota" -#define VKEY_FEATURES_TRASH "features.trash" -#define VKEY_FEATURES_BITROT "features.bitrot" -#define VKEY_FEATURES_SCRUB "features.scrub" -#define VKEY_FEATURES_SELINUX "features.selinux" -#define VKEY_PARALLEL_READDIR "performance.parallel-readdir" -#define VKEY_READDIR_AHEAD "performance.readdir-ahead" -#define VKEY_RDA_CACHE_LIMIT "performance.rda-cache-limit" -#define VKEY_RDA_REQUEST_SIZE "performance.rda-request-size" -#define VKEY_CONFIG_GFPROXY "config.gfproxyd" +#define VKEY_FEATURES_TRASH "features.trash" +#define VKEY_FEATURES_BITROT "features.bitrot" +#define VKEY_FEATURES_SCRUB "features.scrub" +#define VKEY_FEATURES_SELINUX "features.selinux" +#define VKEY_PARALLEL_READDIR "performance.parallel-readdir" +#define VKEY_READDIR_AHEAD "performance.readdir-ahead" +#define VKEY_RDA_CACHE_LIMIT "performance.rda-cache-limit" +#define VKEY_RDA_REQUEST_SIZE "performance.rda-request-size" +#define VKEY_CONFIG_GFPROXY "config.gfproxyd" #define AUTH_ALLOW_MAP_KEY "auth.allow" #define AUTH_REJECT_MAP_KEY "auth.reject" @@ -46,83 +46,82 @@ #define AUTH_REJECT_OPT_KEY "auth.addr.*.reject" #define NFS_DISABLE_OPT_KEY "nfs.*.disable" -#define SSL_OWN_CERT_OPT "ssl.own-cert" +#define SSL_OWN_CERT_OPT "ssl.own-cert" #define SSL_PRIVATE_KEY_OPT "ssl.private-key" -#define SSL_CA_LIST_OPT "ssl.ca-list" -#define SSL_CRL_PATH_OPT "ssl.crl-path" -#define SSL_CERT_DEPTH_OPT "ssl.certificate-depth" +#define SSL_CA_LIST_OPT "ssl.ca-list" +#define SSL_CRL_PATH_OPT "ssl.crl-path" +#define SSL_CERT_DEPTH_OPT "ssl.certificate-depth" #define SSL_CIPHER_LIST_OPT "ssl.cipher-list" -#define SSL_DH_PARAM_OPT "ssl.dh-param" -#define SSL_EC_CURVE_OPT "ssl.ec-curve" - +#define SSL_DH_PARAM_OPT "ssl.dh-param" +#define SSL_EC_CURVE_OPT "ssl.ec-curve" typedef enum { - GF_CLIENT_TRUSTED, - GF_CLIENT_OTHER, - GF_CLIENT_TRUSTED_PROXY, + GF_CLIENT_TRUSTED, + GF_CLIENT_OTHER, + GF_CLIENT_TRUSTED_PROXY, } glusterd_client_type_t; /* It indicates the type of volfile that the graph is built for */ typedef enum { - GF_REBALANCED = 1, - GF_QUOTAD, - GF_SNAPD, + GF_REBALANCED = 1, + GF_QUOTAD, + GF_SNAPD, } glusterd_graph_type_t; struct volgen_graph { - char **errstr; - glusterfs_graph_t graph; - glusterd_graph_type_t type; + char **errstr; + glusterfs_graph_t graph; + glusterd_graph_type_t type; }; typedef struct volgen_graph volgen_graph_t; -typedef int (*glusterd_graph_builder_t) (volgen_graph_t *graph, - dict_t *mod_dict); - -#define COMPLETE_OPTION(key, completion, ret) \ - do { \ - if (!strchr (key, '.')) { \ - ret = option_complete (key, &completion); \ - if (ret) { \ - gf_msg ("", GF_LOG_ERROR, ENOMEM, \ - GD_MSG_NO_MEMORY, "Out of memory"); \ - return _gf_false; \ - } \ - \ - if (!completion) { \ - gf_msg ("", GF_LOG_ERROR, 0, \ - GD_MSG_INVALID_ENTRY, \ - "option %s does not" \ - "exist", key); \ - return _gf_false; \ - } \ - } \ - \ - if (completion) \ - GF_FREE (completion); \ - } while (0); +typedef int (*glusterd_graph_builder_t)(volgen_graph_t *graph, + dict_t *mod_dict); + +#define COMPLETE_OPTION(key, completion, ret) \ + do { \ + if (!strchr(key, '.')) { \ + ret = option_complete(key, &completion); \ + if (ret) { \ + gf_msg("", GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY, \ + "Out of memory"); \ + return _gf_false; \ + } \ + \ + if (!completion) { \ + gf_msg("", GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, \ + "option %s does not" \ + "exist", \ + key); \ + return _gf_false; \ + } \ + } \ + \ + if (completion) \ + GF_FREE(completion); \ + } while (0); typedef enum gd_volopt_flags_ { - VOLOPT_FLAG_NONE, - VOLOPT_FLAG_FORCE = 0x01, /* option needs force to be reset */ - VOLOPT_FLAG_XLATOR_OPT = 0x02, /* option enables/disables xlators */ - VOLOPT_FLAG_CLIENT_OPT = 0x04, /* option affects clients */ - VOLOPT_FLAG_NEVER_RESET = 0x08, /* option which should not be reset */ + VOLOPT_FLAG_NONE, + VOLOPT_FLAG_FORCE = 0x01, /* option needs force to be reset */ + VOLOPT_FLAG_XLATOR_OPT = 0x02, /* option enables/disables xlators */ + VOLOPT_FLAG_CLIENT_OPT = 0x04, /* option affects clients */ + VOLOPT_FLAG_NEVER_RESET = 0x08, /* option which should not be reset */ } gd_volopt_flags_t; typedef enum { - GF_XLATOR_POSIX = 0, - GF_XLATOR_ACL, - GF_XLATOR_LOCKS, - GF_XLATOR_LEASES, - GF_XLATOR_UPCALL, - GF_XLATOR_IOT, - GF_XLATOR_INDEX, - GF_XLATOR_MARKER, - GF_XLATOR_IO_STATS, - GF_XLATOR_BD, - GF_XLATOR_SERVER, - GF_XLATOR_NONE, + GF_XLATOR_POSIX = 0, + GF_XLATOR_ACL, + GF_XLATOR_LOCKS, + GF_XLATOR_LEASES, + GF_XLATOR_UPCALL, + GF_XLATOR_IOT, + GF_XLATOR_INDEX, + GF_XLATOR_MARKER, + GF_XLATOR_IO_STATS, + GF_XLATOR_BD, + GF_XLATOR_SERVER, + GF_XLATOR_NONE, } glusterd_server_xlator_t; /* As of now debug xlators can be loaded only below fuse in the client @@ -131,189 +130,187 @@ typedef enum { * available. */ typedef enum { - GF_CLNT_XLATOR_FUSE = 0, - GF_CLNT_XLATOR_NONE, + GF_CLNT_XLATOR_FUSE = 0, + GF_CLNT_XLATOR_NONE, } glusterd_client_xlator_t; -typedef enum { DOC, NO_DOC, GLOBAL_DOC, GLOBAL_NO_DOC } option_type_t; +typedef enum { DOC, NO_DOC, GLOBAL_DOC, GLOBAL_NO_DOC } option_type_t; -typedef int (*vme_option_validation) (glusterd_volinfo_t *volinfo, dict_t *dict, - char *key, char *value, char **op_errstr); +typedef int (*vme_option_validation)(glusterd_volinfo_t *volinfo, dict_t *dict, + char *key, char *value, char **op_errstr); struct volopt_map_entry { - char *key; - char *voltype; - char *option; - char *value; - option_type_t type; - uint32_t flags; - uint32_t op_version; - char *description; - vme_option_validation validate_fn; - /* If client_option is true, the option affects clients. - * this is used to calculate client-op-version of volumes - */ - //gf_boolean_t client_option; + char *key; + char *voltype; + char *option; + char *value; + option_type_t type; + uint32_t flags; + uint32_t op_version; + char *description; + vme_option_validation validate_fn; + /* If client_option is true, the option affects clients. + * this is used to calculate client-op-version of volumes + */ + // gf_boolean_t client_option; }; -typedef -int (*brick_xlator_builder) (volgen_graph_t *graph, - glusterd_volinfo_t *volinfo, dict_t *set_dict, - glusterd_brickinfo_t *brickinfo); +typedef int (*brick_xlator_builder)(volgen_graph_t *graph, + glusterd_volinfo_t *volinfo, + dict_t *set_dict, + glusterd_brickinfo_t *brickinfo); struct volgen_brick_xlator { - /* function that builds a xlator */ - brick_xlator_builder builder; - /* debug key for a xlator that - * gets used for adding debug translators like trace, error-gen, - * delay-gen before this xlator */ - char *dbg_key; + /* function that builds a xlator */ + brick_xlator_builder builder; + /* debug key for a xlator that + * gets used for adding debug translators like trace, error-gen, + * delay-gen before this xlator */ + char *dbg_key; }; typedef struct volgen_brick_xlator volgen_brick_xlator_t; int -glusterd_snapdsvc_create_volfile (glusterd_volinfo_t *volinfo); +glusterd_snapdsvc_create_volfile(glusterd_volinfo_t *volinfo); int -glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph, - glusterd_volinfo_t *volinfo); +glusterd_snapdsvc_generate_volfile(volgen_graph_t *graph, + glusterd_volinfo_t *volinfo); int -glusterd_create_global_volfile (glusterd_graph_builder_t builder, - char *filepath, dict_t *mod_dict); +glusterd_create_global_volfile(glusterd_graph_builder_t builder, char *filepath, + dict_t *mod_dict); int -glusterd_create_rb_volfiles (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_create_rb_volfiles(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); int -glusterd_create_volfiles (glusterd_volinfo_t *volinfo); +glusterd_create_volfiles(glusterd_volinfo_t *volinfo); int -glusterd_create_volfiles_and_notify_services (glusterd_volinfo_t *volinfo); +glusterd_create_volfiles_and_notify_services(glusterd_volinfo_t *volinfo); int -glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo); +glusterd_generate_client_per_brick_volfile(glusterd_volinfo_t *volinfo); void -glusterd_get_nfs_filepath (char *filename); +glusterd_get_nfs_filepath(char *filename); void -glusterd_get_shd_filepath (char *filename); +glusterd_get_shd_filepath(char *filename); int -build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict); +build_shd_graph(volgen_graph_t *graph, dict_t *mod_dict); int -build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict); +build_nfs_graph(volgen_graph_t *graph, dict_t *mod_dict); int -build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict); +build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict); int -build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath, - dict_t *mod_dict); +build_rebalance_volfile(glusterd_volinfo_t *volinfo, char *filepath, + dict_t *mod_dict); int -build_bitd_graph (volgen_graph_t *graph, dict_t *mod_dict); +build_bitd_graph(volgen_graph_t *graph, dict_t *mod_dict); int -build_scrub_graph (volgen_graph_t *graph, dict_t *mod_dict); +build_scrub_graph(volgen_graph_t *graph, dict_t *mod_dict); int -glusterd_delete_volfile (glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_delete_volfile(glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo); int -glusterd_delete_snap_volfile (glusterd_volinfo_t *volinfo, - glusterd_volinfo_t *snap_volinfo, - glusterd_brickinfo_t *brickinfo); +glusterd_delete_snap_volfile(glusterd_volinfo_t *volinfo, + glusterd_volinfo_t *snap_volinfo, + glusterd_brickinfo_t *brickinfo); int -glusterd_volinfo_get (glusterd_volinfo_t *volinfo, char *key, char **value); +glusterd_volinfo_get(glusterd_volinfo_t *volinfo, char *key, char **value); int -glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key); +glusterd_volinfo_get_boolean(glusterd_volinfo_t *volinfo, char *key); int -glusterd_validate_globalopts (glusterd_volinfo_t *volinfo, dict_t *val_dict, - char **op_errstr); +glusterd_validate_globalopts(glusterd_volinfo_t *volinfo, dict_t *val_dict, + char **op_errstr); int -glusterd_validate_localopts (dict_t *val_dict, char **op_errstr); +glusterd_validate_localopts(dict_t *val_dict, char **op_errstr); gf_boolean_t -glusterd_check_globaloption (char *key); +glusterd_check_globaloption(char *key); gf_boolean_t -glusterd_check_voloption_flags (char *key, int32_t flags); +glusterd_check_voloption_flags(char *key, int32_t flags); gf_boolean_t -glusterd_is_valid_volfpath (char *volname, char *brick); +glusterd_is_valid_volfpath(char *volname, char *brick); int -generate_brick_volfiles (glusterd_volinfo_t *volinfo); +generate_brick_volfiles(glusterd_volinfo_t *volinfo); int -generate_snap_brick_volfiles (glusterd_volinfo_t *volinfo, - glusterd_volinfo_t *snap_volinfo); +generate_snap_brick_volfiles(glusterd_volinfo_t *volinfo, + glusterd_volinfo_t *snap_volinfo); int -generate_client_volfiles (glusterd_volinfo_t *volinfo, - glusterd_client_type_t client_type); +generate_client_volfiles(glusterd_volinfo_t *volinfo, + glusterd_client_type_t client_type); int -generate_snap_client_volfiles (glusterd_volinfo_t *actual_volinfo, - glusterd_volinfo_t *snap_volinfo, - glusterd_client_type_t client_type, - gf_boolean_t vol_restore); +generate_snap_client_volfiles(glusterd_volinfo_t *actual_volinfo, + glusterd_volinfo_t *snap_volinfo, + glusterd_client_type_t client_type, + gf_boolean_t vol_restore); int -_get_xlator_opt_key_from_vme ( struct volopt_map_entry *vme, char **key); +_get_xlator_opt_key_from_vme(struct volopt_map_entry *vme, char **key); void -_free_xlator_opt_key (char *key); - +_free_xlator_opt_key(char *key); #if (HAVE_LIB_XML) int -init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf); +init_sethelp_xml_doc(xmlTextWriterPtr *writer, xmlBufferPtr *buf); int -xml_add_volset_element (xmlTextWriterPtr writer, const char *name, - const char *def_val, const char *dscrpt); +xml_add_volset_element(xmlTextWriterPtr writer, const char *name, + const char *def_val, const char *dscrpt); int -end_sethelp_xml_doc (xmlTextWriterPtr writer); +end_sethelp_xml_doc(xmlTextWriterPtr writer); #endif /* HAVE_LIB_XML */ -char* -glusterd_get_trans_type_rb (gf_transport_type ttype); +char * +glusterd_get_trans_type_rb(gf_transport_type ttype); uint32_t -glusterd_get_op_version_for_key (char *key); +glusterd_get_op_version_for_key(char *key); gf_boolean_t -gd_is_client_option (char *key); +gd_is_client_option(char *key); gf_boolean_t -gd_is_xlator_option (char *key); +gd_is_xlator_option(char *key); gf_boolean_t -gd_is_boolean_option (char *key); - +gd_is_boolean_option(char *key); -char* -volgen_get_shd_key (int type); +char * +volgen_get_shd_key(int type); int -glusterd_volopt_validate (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, - char *value, char **op_errstr); +glusterd_volopt_validate(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, + char *value, char **op_errstr); gf_boolean_t -gd_is_self_heal_enabled (glusterd_volinfo_t *volinfo, dict_t *dict); +gd_is_self_heal_enabled(glusterd_volinfo_t *volinfo, dict_t *dict); int -generate_dummy_client_volfiles (glusterd_volinfo_t *volinfo); +generate_dummy_client_volfiles(glusterd_volinfo_t *volinfo); int -glusterd_generate_gfproxyd_volfile (glusterd_volinfo_t *volinfo); +glusterd_generate_gfproxyd_volfile(glusterd_volinfo_t *volinfo); int -glusterd_build_gfproxyd_volfile (glusterd_volinfo_t *volinfo, char *filename); +glusterd_build_gfproxyd_volfile(glusterd_volinfo_t *volinfo, char *filename); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 71ac45cd241..19cdee392f6 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -39,45 +39,50 @@ #include "events.h" #include "glusterd-gfproxyd-svc.h" -#define GLUSTERD_TR_LOG_SIZE 50 -#define GLUSTERD_QUORUM_TYPE_KEY "cluster.server-quorum-type" -#define GLUSTERD_QUORUM_RATIO_KEY "cluster.server-quorum-ratio" -#define GLUSTERD_GLOBAL_OPT_VERSION "global-option-version" -#define GLUSTERD_GLOBAL_OP_VERSION_KEY "cluster.op-version" -#define GLUSTERD_MAX_OP_VERSION_KEY "cluster.max-op-version" -#define GLUSTERD_COMMON_PEM_PUB_FILE "/geo-replication/common_secret.pem.pub" -#define GEO_CONF_MAX_OPT_VALS 6 -#define GLUSTERD_CREATE_HOOK_SCRIPT "/hooks/1/gsync-create/post/" \ - "S56glusterd-geo-rep-create-post.sh" -#define GLUSTERD_SHRD_STRG_HOOK_SCRIPT "/hooks/1/set/post/" \ - "S32gluster_enable_shared_storage.sh" -#define GLUSTER_SHARED_STORAGE "gluster_shared_storage" -#define GLUSTERD_SHARED_STORAGE_KEY "cluster.enable-shared-storage" -#define GLUSTERD_BRICK_MULTIPLEX_KEY "cluster.brick-multiplex" -#define GLUSTERD_BRICKMUX_LIMIT_KEY "cluster.max-bricks-per-process" -#define GLUSTERD_LOCALTIME_LOGGING_KEY "cluster.localtime-logging" -#define GLUSTERD_DAEMON_LOG_LEVEL_KEY "cluster.daemon-log-level" +#define GLUSTERD_TR_LOG_SIZE 50 +#define GLUSTERD_QUORUM_TYPE_KEY "cluster.server-quorum-type" +#define GLUSTERD_QUORUM_RATIO_KEY "cluster.server-quorum-ratio" +#define GLUSTERD_GLOBAL_OPT_VERSION "global-option-version" +#define GLUSTERD_GLOBAL_OP_VERSION_KEY "cluster.op-version" +#define GLUSTERD_MAX_OP_VERSION_KEY "cluster.max-op-version" +#define GLUSTERD_COMMON_PEM_PUB_FILE "/geo-replication/common_secret.pem.pub" +#define GEO_CONF_MAX_OPT_VALS 6 +#define GLUSTERD_CREATE_HOOK_SCRIPT \ + "/hooks/1/gsync-create/post/" \ + "S56glusterd-geo-rep-create-post.sh" +#define GLUSTERD_SHRD_STRG_HOOK_SCRIPT \ + "/hooks/1/set/post/" \ + "S32gluster_enable_shared_storage.sh" +#define GLUSTER_SHARED_STORAGE "gluster_shared_storage" +#define GLUSTERD_SHARED_STORAGE_KEY "cluster.enable-shared-storage" +#define GLUSTERD_BRICK_MULTIPLEX_KEY "cluster.brick-multiplex" +#define GLUSTERD_BRICKMUX_LIMIT_KEY "cluster.max-bricks-per-process" +#define GLUSTERD_LOCALTIME_LOGGING_KEY "cluster.localtime-logging" +#define GLUSTERD_DAEMON_LOG_LEVEL_KEY "cluster.daemon-log-level" #define GLUSTERD_SNAPS_MAX_HARD_LIMIT 256 #define GLUSTERD_SNAPS_DEF_SOFT_LIMIT_PERCENT 90 #define GLUSTERD_SNAPS_MAX_SOFT_LIMIT_PERCENT 100 #define GLUSTERD_SERVER_QUORUM "server" -#define STATUS_STRLEN 128 +#define STATUS_STRLEN 128 #define FMTSTR_CHECK_VOL_EXISTS "Volume %s does not exist" #define FMTSTR_RESOLVE_BRICK "Could not find peer on which brick %s:%s resides" -#define LOGSTR_FOUND_BRICK "Found brick %s:%s in volume %s" +#define LOGSTR_FOUND_BRICK "Found brick %s:%s in volume %s" #define LOGSTR_BUILD_PAYLOAD "Failed to build payload for operation 'Volume %s'" #define LOGSTR_STAGE_FAIL "Staging of operation 'Volume %s' failed on %s %s %s" #define LOGSTR_COMMIT_FAIL "Commit of operation 'Volume %s' failed on %s %s %s" -#define OPERRSTR_BUILD_PAYLOAD "Failed to build payload. Please check the log "\ - "file for more details." -#define OPERRSTR_STAGE_FAIL "Staging failed on %s. Please check the log file " \ - "for more details." -#define OPERRSTR_COMMIT_FAIL "Commit failed on %s. Please check the log file "\ - "for more details." +#define OPERRSTR_BUILD_PAYLOAD \ + "Failed to build payload. Please check the log " \ + "file for more details." +#define OPERRSTR_STAGE_FAIL \ + "Staging failed on %s. Please check the log file " \ + "for more details." +#define OPERRSTR_COMMIT_FAIL \ + "Commit failed on %s. Please check the log file " \ + "for more details." struct glusterd_volinfo_; typedef struct glusterd_volinfo_ glusterd_volinfo_t; @@ -88,57 +93,57 @@ typedef struct glusterd_snap_ glusterd_snap_t; * at the end of latest enum (just before the GD_OP_MAX enum) */ typedef enum glusterd_op_ { - GD_OP_NONE = 0, - GD_OP_CREATE_VOLUME, - GD_OP_START_BRICK, - GD_OP_STOP_BRICK, - GD_OP_DELETE_VOLUME, - GD_OP_START_VOLUME, - GD_OP_STOP_VOLUME, - GD_OP_DEFRAG_VOLUME, - GD_OP_ADD_BRICK, - GD_OP_REMOVE_BRICK, - GD_OP_REPLACE_BRICK, - GD_OP_SET_VOLUME, - GD_OP_RESET_VOLUME, - GD_OP_SYNC_VOLUME, - GD_OP_LOG_ROTATE, - GD_OP_GSYNC_SET, - GD_OP_PROFILE_VOLUME, - GD_OP_QUOTA, - GD_OP_STATUS_VOLUME, - GD_OP_REBALANCE, - GD_OP_HEAL_VOLUME, - GD_OP_STATEDUMP_VOLUME, - GD_OP_LIST_VOLUME, - GD_OP_CLEARLOCKS_VOLUME, - GD_OP_DEFRAG_BRICK_VOLUME, - GD_OP_COPY_FILE, - GD_OP_SYS_EXEC, - GD_OP_GSYNC_CREATE, - GD_OP_SNAP, - GD_OP_BARRIER, - GD_OP_GANESHA, /* obsolete */ - GD_OP_BITROT, - GD_OP_DETACH_TIER, - GD_OP_TIER_MIGRATE, - GD_OP_SCRUB_STATUS, - GD_OP_SCRUB_ONDEMAND, - GD_OP_RESET_BRICK, - GD_OP_MAX_OPVERSION, - GD_OP_TIER_START_STOP, - GD_OP_TIER_STATUS, - GD_OP_DETACH_TIER_STATUS, - GD_OP_DETACH_NOT_STARTED, - GD_OP_REMOVE_TIER_BRICK, - GD_OP_ADD_TIER_BRICK, - GD_OP_MAX, + GD_OP_NONE = 0, + GD_OP_CREATE_VOLUME, + GD_OP_START_BRICK, + GD_OP_STOP_BRICK, + GD_OP_DELETE_VOLUME, + GD_OP_START_VOLUME, + GD_OP_STOP_VOLUME, + GD_OP_DEFRAG_VOLUME, + GD_OP_ADD_BRICK, + GD_OP_REMOVE_BRICK, + GD_OP_REPLACE_BRICK, + GD_OP_SET_VOLUME, + GD_OP_RESET_VOLUME, + GD_OP_SYNC_VOLUME, + GD_OP_LOG_ROTATE, + GD_OP_GSYNC_SET, + GD_OP_PROFILE_VOLUME, + GD_OP_QUOTA, + GD_OP_STATUS_VOLUME, + GD_OP_REBALANCE, + GD_OP_HEAL_VOLUME, + GD_OP_STATEDUMP_VOLUME, + GD_OP_LIST_VOLUME, + GD_OP_CLEARLOCKS_VOLUME, + GD_OP_DEFRAG_BRICK_VOLUME, + GD_OP_COPY_FILE, + GD_OP_SYS_EXEC, + GD_OP_GSYNC_CREATE, + GD_OP_SNAP, + GD_OP_BARRIER, + GD_OP_GANESHA, /* obsolete */ + GD_OP_BITROT, + GD_OP_DETACH_TIER, + GD_OP_TIER_MIGRATE, + GD_OP_SCRUB_STATUS, + GD_OP_SCRUB_ONDEMAND, + GD_OP_RESET_BRICK, + GD_OP_MAX_OPVERSION, + GD_OP_TIER_START_STOP, + GD_OP_TIER_STATUS, + GD_OP_DETACH_TIER_STATUS, + GD_OP_DETACH_NOT_STARTED, + GD_OP_REMOVE_TIER_BRICK, + GD_OP_ADD_TIER_BRICK, + GD_OP_MAX, } glusterd_op_t; -extern const char * gd_op_list[]; +extern const char *gd_op_list[]; struct glusterd_volgen { - dict_t *dict; + dict_t *dict; }; /* Keeping all the paths required in glusterd would @@ -152,446 +157,443 @@ struct glusterd_volgen { #define VALID_GLUSTERD_PATHMAX (PATH_MAX - (256 + 64)) typedef struct { - struct _volfile_ctx *volfile; - pthread_mutex_t mutex; - struct cds_list_head peers; - gf_boolean_t verify_volfile_checksum; - gf_boolean_t trace; - uuid_t uuid; - char workdir[VALID_GLUSTERD_PATHMAX]; - char rundir[VALID_GLUSTERD_PATHMAX]; - rpcsvc_t *rpc; - glusterd_svc_t shd_svc; - glusterd_svc_t nfs_svc; - glusterd_svc_t bitd_svc; - glusterd_svc_t scrub_svc; - glusterd_svc_t quotad_svc; - struct pmap_registry *pmap; - struct cds_list_head volumes; - struct cds_list_head snapshots; /*List of snap volumes */ - struct cds_list_head brick_procs; /* List of brick processes */ - pthread_mutex_t xprt_lock; - struct list_head xprt_list; - pthread_mutex_t import_volumes; - gf_store_handle_t *handle; - gf_timer_t *timer; - glusterd_sm_tr_log_t op_sm_log; - struct rpc_clnt_program *gfs_mgmt; - dict_t *mgmt_v3_lock; /* Dict for saving - * mgmt_v3 locks */ - dict_t *glusterd_txn_opinfo; /* Dict for saving - * transaction opinfos */ - uuid_t global_txn_id; /* To be used in - * heterogeneous - * cluster with no - * transaction ids */ - - dict_t *mgmt_v3_lock_timer; - struct cds_list_head mount_specs; - pthread_t brick_thread; - void *hooks_priv; - - /* need for proper handshake_t */ - int op_version; /* Starts with 1 for 3.3.0 */ - xlator_t *xl; /* Should be set to 'THIS' before creating thread */ - gf_boolean_t pending_quorum_action; - dict_t *opts; - synclock_t big_lock; - gf_boolean_t restart_done; - rpcsvc_t *uds_rpc; /* RPCSVC for the unix domain socket */ - uint32_t base_port; - uint32_t max_port; - char *snap_bricks_directory; - gf_store_handle_t *missed_snaps_list_shandle; - struct cds_list_head missed_snaps_list; - int ping_timeout; - uint32_t generation; - int32_t workers; - uint32_t blockers; - uint32_t mgmt_v3_lock_timeout; - gf_boolean_t restart_bricks; + struct _volfile_ctx *volfile; + pthread_mutex_t mutex; + struct cds_list_head peers; + gf_boolean_t verify_volfile_checksum; + gf_boolean_t trace; + uuid_t uuid; + char workdir[VALID_GLUSTERD_PATHMAX]; + char rundir[VALID_GLUSTERD_PATHMAX]; + rpcsvc_t *rpc; + glusterd_svc_t shd_svc; + glusterd_svc_t nfs_svc; + glusterd_svc_t bitd_svc; + glusterd_svc_t scrub_svc; + glusterd_svc_t quotad_svc; + struct pmap_registry *pmap; + struct cds_list_head volumes; + struct cds_list_head snapshots; /*List of snap volumes */ + struct cds_list_head brick_procs; /* List of brick processes */ + pthread_mutex_t xprt_lock; + struct list_head xprt_list; + pthread_mutex_t import_volumes; + gf_store_handle_t *handle; + gf_timer_t *timer; + glusterd_sm_tr_log_t op_sm_log; + struct rpc_clnt_program *gfs_mgmt; + dict_t *mgmt_v3_lock; /* Dict for saving + * mgmt_v3 locks */ + dict_t *glusterd_txn_opinfo; /* Dict for saving + * transaction opinfos */ + uuid_t global_txn_id; /* To be used in + * heterogeneous + * cluster with no + * transaction ids */ + + dict_t *mgmt_v3_lock_timer; + struct cds_list_head mount_specs; + pthread_t brick_thread; + void *hooks_priv; + + /* need for proper handshake_t */ + int op_version; /* Starts with 1 for 3.3.0 */ + xlator_t *xl; /* Should be set to 'THIS' before creating thread */ + gf_boolean_t pending_quorum_action; + dict_t *opts; + synclock_t big_lock; + gf_boolean_t restart_done; + rpcsvc_t *uds_rpc; /* RPCSVC for the unix domain socket */ + uint32_t base_port; + uint32_t max_port; + char *snap_bricks_directory; + gf_store_handle_t *missed_snaps_list_shandle; + struct cds_list_head missed_snaps_list; + int ping_timeout; + uint32_t generation; + int32_t workers; + uint32_t blockers; + uint32_t mgmt_v3_lock_timeout; + gf_boolean_t restart_bricks; } glusterd_conf_t; - typedef enum gf_brick_status { - GF_BRICK_STOPPED, - GF_BRICK_STARTED, - GF_BRICK_STOPPING, - GF_BRICK_STARTING + GF_BRICK_STOPPED, + GF_BRICK_STARTED, + GF_BRICK_STOPPING, + GF_BRICK_STARTING } gf_brick_status_t; struct glusterd_brickinfo { - char hostname[NAME_MAX]; - char path[VALID_GLUSTERD_PATHMAX]; - char real_path[VALID_GLUSTERD_PATHMAX]; - char device_path[VALID_GLUSTERD_PATHMAX]; - char mount_dir[VALID_GLUSTERD_PATHMAX]; - char brick_id[1024];/*Client xlator name, AFR changelog name*/ - char fstype [NAME_MAX]; /* Brick file-system type */ - char mnt_opts [1024]; /* Brick mount options */ - struct cds_list_head brick_list; - uuid_t uuid; - int port; - int rdma_port; - char *logfile; - gf_store_handle_t *shandle; - gf_brick_status_t status; - struct rpc_clnt *rpc; - int decommissioned; - char vg[PATH_MAX]; /* FIXME: Use max size for length of vg */ - int caps; /* Capability */ - int32_t snap_status; - /* - * The group is used to identify which bricks are part of the same - * replica set during brick-volfile generation, so that JBR volfiles - * can "cross-connect" the bricks to one another. It is also used by - * AFR to load the arbiter xlator in the appropriate brick in case of - * a replica 3 volume with arbiter enabled. - */ - uint16_t group; - uuid_t jbr_uuid; - - /* Below are used for handling the case of multiple bricks sharing - the backend filesystem */ - uint64_t statfs_fsid; - uint32_t fs_share_count; - gf_boolean_t port_registered; - gf_boolean_t start_triggered; - pthread_mutex_t restart_mutex; + char hostname[NAME_MAX]; + char path[VALID_GLUSTERD_PATHMAX]; + char real_path[VALID_GLUSTERD_PATHMAX]; + char device_path[VALID_GLUSTERD_PATHMAX]; + char mount_dir[VALID_GLUSTERD_PATHMAX]; + char brick_id[1024]; /*Client xlator name, AFR changelog name*/ + char fstype[NAME_MAX]; /* Brick file-system type */ + char mnt_opts[1024]; /* Brick mount options */ + struct cds_list_head brick_list; + uuid_t uuid; + int port; + int rdma_port; + char *logfile; + gf_store_handle_t *shandle; + gf_brick_status_t status; + struct rpc_clnt *rpc; + int decommissioned; + char vg[PATH_MAX]; /* FIXME: Use max size for length of vg */ + int caps; /* Capability */ + int32_t snap_status; + /* + * The group is used to identify which bricks are part of the same + * replica set during brick-volfile generation, so that JBR volfiles + * can "cross-connect" the bricks to one another. It is also used by + * AFR to load the arbiter xlator in the appropriate brick in case of + * a replica 3 volume with arbiter enabled. + */ + uint16_t group; + uuid_t jbr_uuid; + + /* Below are used for handling the case of multiple bricks sharing + the backend filesystem */ + uint64_t statfs_fsid; + uint32_t fs_share_count; + gf_boolean_t port_registered; + gf_boolean_t start_triggered; + pthread_mutex_t restart_mutex; }; typedef struct glusterd_brickinfo glusterd_brickinfo_t; struct glusterd_brick_proc { - int port; - uint32_t brick_count; - struct cds_list_head brick_proc_list; - struct cds_list_head bricks; + int port; + uint32_t brick_count; + struct cds_list_head brick_proc_list; + struct cds_list_head bricks; }; typedef struct glusterd_brick_proc glusterd_brick_proc_t; struct glusterd_gfproxyd_info { - short port; - char *logfile; + short port; + char *logfile; }; struct gf_defrag_brickinfo_ { - char *name; - int files; - int size; + char *name; + int files; + int size; }; -typedef int (*defrag_cbk_fn_t) (glusterd_volinfo_t *volinfo, - gf_defrag_status_t status); +typedef int (*defrag_cbk_fn_t)(glusterd_volinfo_t *volinfo, + gf_defrag_status_t status); struct glusterd_defrag_info_ { - uint64_t total_files; - uint64_t total_data; - uint64_t num_files_lookedup; - uint64_t total_failures; - gf_lock_t lock; - int cmd; - pthread_t th; - gf_defrag_status_t defrag_status; - struct rpc_clnt *rpc; - uint32_t connected; - char mount[1024]; - struct gf_defrag_brickinfo_ *bricks; /* volinfo->brick_count */ - - defrag_cbk_fn_t cbk_fn; + uint64_t total_files; + uint64_t total_data; + uint64_t num_files_lookedup; + uint64_t total_failures; + gf_lock_t lock; + int cmd; + pthread_t th; + gf_defrag_status_t defrag_status; + struct rpc_clnt *rpc; + uint32_t connected; + char mount[1024]; + struct gf_defrag_brickinfo_ *bricks; /* volinfo->brick_count */ + + defrag_cbk_fn_t cbk_fn; }; - typedef struct glusterd_defrag_info_ glusterd_defrag_info_t; typedef enum gf_transport_type_ { - GF_TRANSPORT_TCP, //DEFAULT - GF_TRANSPORT_RDMA, - GF_TRANSPORT_BOTH_TCP_RDMA, + GF_TRANSPORT_TCP, // DEFAULT + GF_TRANSPORT_RDMA, + GF_TRANSPORT_BOTH_TCP_RDMA, } gf_transport_type; - typedef enum gf_rb_status_ { - GF_RB_STATUS_NONE, - GF_RB_STATUS_STARTED, - GF_RB_STATUS_PAUSED, + GF_RB_STATUS_NONE, + GF_RB_STATUS_STARTED, + GF_RB_STATUS_PAUSED, } gf_rb_status_t; struct _auth { - char *username; - char *password; + char *username; + char *password; }; typedef struct _auth auth_t; /* Capabilities of xlator */ -#define CAPS_BD 0x00000001 -#define CAPS_THIN 0x00000002 -#define CAPS_OFFLOAD_COPY 0x00000004 +#define CAPS_BD 0x00000001 +#define CAPS_THIN 0x00000002 +#define CAPS_OFFLOAD_COPY 0x00000004 #define CAPS_OFFLOAD_SNAPSHOT 0x00000008 -#define CAPS_OFFLOAD_ZERO 0x00000020 +#define CAPS_OFFLOAD_ZERO 0x00000020 struct glusterd_bitrot_scrub_ { - char *scrub_state; - char *scrub_impact; - char *scrub_freq; - uint64_t scrubbed_files; - uint64_t unsigned_files; - uint64_t last_scrub_time; - uint64_t scrub_duration; - uint64_t error_count; + char *scrub_state; + char *scrub_impact; + char *scrub_freq; + uint64_t scrubbed_files; + uint64_t unsigned_files; + uint64_t last_scrub_time; + uint64_t scrub_duration; + uint64_t error_count; }; typedef struct glusterd_bitrot_scrub_ glusterd_bitrot_scrub_t; struct glusterd_rebalance_ { - gf_defrag_status_t defrag_status; - uint64_t rebalance_files; - uint64_t rebalance_data; - uint64_t lookedup_files; - uint64_t skipped_files; - glusterd_defrag_info_t *defrag; - gf_cli_defrag_type defrag_cmd; - uint64_t rebalance_failures; - uuid_t rebalance_id; - double rebalance_time; - uint64_t time_left; - glusterd_op_t op; - dict_t *dict; /* Dict to store misc information - * like list of bricks being removed */ - uint32_t commit_hash; + gf_defrag_status_t defrag_status; + uint64_t rebalance_files; + uint64_t rebalance_data; + uint64_t lookedup_files; + uint64_t skipped_files; + glusterd_defrag_info_t *defrag; + gf_cli_defrag_type defrag_cmd; + uint64_t rebalance_failures; + uuid_t rebalance_id; + double rebalance_time; + uint64_t time_left; + glusterd_op_t op; + dict_t *dict; /* Dict to store misc information + * like list of bricks being removed */ + uint32_t commit_hash; }; typedef struct glusterd_rebalance_ glusterd_rebalance_t; struct glusterd_replace_brick_ { - glusterd_brickinfo_t *src_brick; - glusterd_brickinfo_t *dst_brick; + glusterd_brickinfo_t *src_brick; + glusterd_brickinfo_t *dst_brick; }; typedef struct glusterd_replace_brick_ glusterd_replace_brick_t; typedef enum gd_quorum_status_ { - NOT_APPLICABLE_QUORUM, //Does not follow quorum - MEETS_QUORUM, //Follows quorum and meets. - DOESNT_MEET_QUORUM, //Follows quorum and does not meet. + NOT_APPLICABLE_QUORUM, // Does not follow quorum + MEETS_QUORUM, // Follows quorum and meets. + DOESNT_MEET_QUORUM, // Follows quorum and does not meet. } gd_quorum_status_t; typedef struct tier_info_ { - int cold_type; - int cold_brick_count; - int cold_replica_count; - int cold_disperse_count; - int cold_dist_leaf_count; - int cold_redundancy_count; - int hot_type; - int hot_brick_count; - int hot_replica_count; - int promoted; - int demoted; - uint16_t cur_tier_hot; + int cold_type; + int cold_brick_count; + int cold_replica_count; + int cold_disperse_count; + int cold_dist_leaf_count; + int cold_redundancy_count; + int hot_type; + int hot_brick_count; + int hot_replica_count; + int promoted; + int demoted; + uint16_t cur_tier_hot; } gd_tier_info_t; struct glusterd_volinfo_ { - gf_lock_t lock; - gf_boolean_t is_snap_volume; - glusterd_snap_t *snapshot; - uuid_t restored_from_snap; - gd_tier_info_t tier_info; - gf_boolean_t is_tier_enabled; - char parent_volname[GD_VOLUME_NAME_MAX]; - /* In case of a snap volume - i.e (is_snap_volume == TRUE) this - field will contain the name of - the volume which is snapped. In - case of a non-snap volume, this - field will be initialized as N/A */ - char volname[NAME_MAX + 1]; - /* NAME_MAX + 1 will be equal to - * GD_VOLUME_NAME_MAX + 5.(also to - * GD_VOLUME_NAME_MAX_TIER). An extra 5 - * bytes are added to GD_VOLUME_NAME_MAX - * because, as part of the tiering - * volfile generation code, we are - * temporarily appending either "-hot" - * or "-cold" */ - int type; - int brick_count; - uint64_t snap_count; - uint64_t snap_max_hard_limit; - struct cds_list_head vol_list; - /* In case of a snap volume - i.e (is_snap_volume == TRUE) this - is linked to glusterd_snap_t->volumes. - In case of a non-snap volume, this is - linked to glusterd_conf_t->volumes */ - struct cds_list_head snapvol_list; - /* This is a current pointer for - glusterd_volinfo_t->snap_volumes */ - struct cds_list_head bricks; - struct cds_list_head snap_volumes; - /* TODO : Need to remove this, as this - * is already part of snapshot object. - */ - glusterd_volume_status status; - int sub_count; /* backward compatibility */ - int stripe_count; - int replica_count; - int arbiter_count; - int disperse_count; - int redundancy_count; - int subvol_count; /* Number of subvolumes in a - distribute volume */ - int dist_leaf_count; /* Number of bricks in one - distribute subvolume */ - int port; - gf_store_handle_t *shandle; - gf_store_handle_t *node_state_shandle; - gf_store_handle_t *quota_conf_shandle; - - /* Defrag/rebalance related */ - glusterd_rebalance_t rebal; - - /* Replace brick status */ - glusterd_replace_brick_t rep_brick; - - /* Bitrot scrub status*/ - glusterd_bitrot_scrub_t bitrot_scrub; - - glusterd_rebalance_t tier; - - int version; - uint32_t quota_conf_version; - uint32_t cksum; - uint32_t quota_conf_cksum; - gf_transport_type transport_type; - - dict_t *dict; - - uuid_t volume_id; - auth_t auth; - char *logdir; - - dict_t *gsync_slaves; - dict_t *gsync_active_slaves; - - int decommission_in_progress; - xlator_t *xl; - - gf_boolean_t memory_accounting; - int caps; /* Capability */ - - int op_version; - int client_op_version; - pthread_mutex_t reflock; - int refcnt; - gd_quorum_status_t quorum_status; - - glusterd_snapdsvc_t snapd; - glusterd_tierdsvc_t tierd; - glusterd_gfproxydsvc_t gfproxyd; - int32_t quota_xattr_version; - gf_boolean_t stage_deleted; /* volume has passed staging - * for delete operation - */ + gf_lock_t lock; + gf_boolean_t is_snap_volume; + glusterd_snap_t *snapshot; + uuid_t restored_from_snap; + gd_tier_info_t tier_info; + gf_boolean_t is_tier_enabled; + char parent_volname[GD_VOLUME_NAME_MAX]; + /* In case of a snap volume + i.e (is_snap_volume == TRUE) this + field will contain the name of + the volume which is snapped. In + case of a non-snap volume, this + field will be initialized as N/A */ + char volname[NAME_MAX + 1]; + /* NAME_MAX + 1 will be equal to + * GD_VOLUME_NAME_MAX + 5.(also to + * GD_VOLUME_NAME_MAX_TIER). An extra 5 + * bytes are added to GD_VOLUME_NAME_MAX + * because, as part of the tiering + * volfile generation code, we are + * temporarily appending either "-hot" + * or "-cold" */ + int type; + int brick_count; + uint64_t snap_count; + uint64_t snap_max_hard_limit; + struct cds_list_head vol_list; + /* In case of a snap volume + i.e (is_snap_volume == TRUE) this + is linked to glusterd_snap_t->volumes. + In case of a non-snap volume, this is + linked to glusterd_conf_t->volumes */ + struct cds_list_head snapvol_list; + /* This is a current pointer for + glusterd_volinfo_t->snap_volumes */ + struct cds_list_head bricks; + struct cds_list_head snap_volumes; + /* TODO : Need to remove this, as this + * is already part of snapshot object. + */ + glusterd_volume_status status; + int sub_count; /* backward compatibility */ + int stripe_count; + int replica_count; + int arbiter_count; + int disperse_count; + int redundancy_count; + int subvol_count; /* Number of subvolumes in a + distribute volume */ + int dist_leaf_count; /* Number of bricks in one + distribute subvolume */ + int port; + gf_store_handle_t *shandle; + gf_store_handle_t *node_state_shandle; + gf_store_handle_t *quota_conf_shandle; + + /* Defrag/rebalance related */ + glusterd_rebalance_t rebal; + + /* Replace brick status */ + glusterd_replace_brick_t rep_brick; + + /* Bitrot scrub status*/ + glusterd_bitrot_scrub_t bitrot_scrub; + + glusterd_rebalance_t tier; + + int version; + uint32_t quota_conf_version; + uint32_t cksum; + uint32_t quota_conf_cksum; + gf_transport_type transport_type; + + dict_t *dict; + + uuid_t volume_id; + auth_t auth; + char *logdir; + + dict_t *gsync_slaves; + dict_t *gsync_active_slaves; + + int decommission_in_progress; + xlator_t *xl; + + gf_boolean_t memory_accounting; + int caps; /* Capability */ + + int op_version; + int client_op_version; + pthread_mutex_t reflock; + int refcnt; + gd_quorum_status_t quorum_status; + + glusterd_snapdsvc_t snapd; + glusterd_tierdsvc_t tierd; + glusterd_gfproxydsvc_t gfproxyd; + int32_t quota_xattr_version; + gf_boolean_t stage_deleted; /* volume has passed staging + * for delete operation + */ }; typedef enum gd_snap_status_ { - GD_SNAP_STATUS_NONE, - GD_SNAP_STATUS_INIT, - GD_SNAP_STATUS_IN_USE, - GD_SNAP_STATUS_DECOMMISSION, - GD_SNAP_STATUS_UNDER_RESTORE, - GD_SNAP_STATUS_RESTORED, + GD_SNAP_STATUS_NONE, + GD_SNAP_STATUS_INIT, + GD_SNAP_STATUS_IN_USE, + GD_SNAP_STATUS_DECOMMISSION, + GD_SNAP_STATUS_UNDER_RESTORE, + GD_SNAP_STATUS_RESTORED, } gd_snap_status_t; struct glusterd_snap_ { - gf_lock_t lock; - struct cds_list_head volumes; - struct cds_list_head snap_list; - char snapname[GLUSTERD_MAX_SNAP_NAME]; - uuid_t snap_id; - char *description; - time_t time_stamp; - gf_boolean_t snap_restored; - gd_snap_status_t snap_status; - gf_store_handle_t *shandle; + gf_lock_t lock; + struct cds_list_head volumes; + struct cds_list_head snap_list; + char snapname[GLUSTERD_MAX_SNAP_NAME]; + uuid_t snap_id; + char *description; + time_t time_stamp; + gf_boolean_t snap_restored; + gd_snap_status_t snap_status; + gf_store_handle_t *shandle; }; typedef struct glusterd_snap_op_ { - char *snap_vol_id; - int32_t brick_num; - char *brick_path; - int32_t op; - int32_t status; - struct cds_list_head snap_ops_list; + char *snap_vol_id; + int32_t brick_num; + char *brick_path; + int32_t op; + int32_t status; + struct cds_list_head snap_ops_list; } glusterd_snap_op_t; typedef struct glusterd_missed_snap_ { - char *node_uuid; - char *snap_uuid; - struct cds_list_head missed_snaps; - struct cds_list_head snap_ops; + char *node_uuid; + char *snap_uuid; + struct cds_list_head missed_snaps; + struct cds_list_head snap_ops; } glusterd_missed_snap_info; typedef enum gd_node_type_ { - GD_NODE_NONE, - GD_NODE_BRICK, - GD_NODE_SHD, - GD_NODE_REBALANCE, - GD_NODE_NFS, - GD_NODE_QUOTAD, - GD_NODE_SNAPD, - GD_NODE_BITD, - GD_NODE_SCRUB, - GD_NODE_TIERD + GD_NODE_NONE, + GD_NODE_BRICK, + GD_NODE_SHD, + GD_NODE_REBALANCE, + GD_NODE_NFS, + GD_NODE_QUOTAD, + GD_NODE_SNAPD, + GD_NODE_BITD, + GD_NODE_SCRUB, + GD_NODE_TIERD } gd_node_type; typedef enum missed_snap_stat { - GD_MISSED_SNAP_NONE, - GD_MISSED_SNAP_PENDING, - GD_MISSED_SNAP_DONE, + GD_MISSED_SNAP_NONE, + GD_MISSED_SNAP_PENDING, + GD_MISSED_SNAP_DONE, } missed_snap_stat; typedef struct glusterd_pending_node_ { - struct cds_list_head list; - void *node; - gd_node_type type; - int32_t index; + struct cds_list_head list; + void *node; + gd_node_type type; + int32_t index; } glusterd_pending_node_t; struct gsync_config_opt_vals_ { - char *op_name; - int no_of_pos_vals; - gf_boolean_t case_sensitive; - char *values[GEO_CONF_MAX_OPT_VALS]; + char *op_name; + int no_of_pos_vals; + gf_boolean_t case_sensitive; + char *values[GEO_CONF_MAX_OPT_VALS]; }; enum glusterd_op_ret { - GLUSTERD_CONNECTION_AWAITED = 100, + GLUSTERD_CONNECTION_AWAITED = 100, }; enum glusterd_vol_comp_status_ { - GLUSTERD_VOL_COMP_NONE = 0, - GLUSTERD_VOL_COMP_SCS = 1, - GLUSTERD_VOL_COMP_UPDATE_REQ, - GLUSTERD_VOL_COMP_RJT, + GLUSTERD_VOL_COMP_NONE = 0, + GLUSTERD_VOL_COMP_SCS = 1, + GLUSTERD_VOL_COMP_UPDATE_REQ, + GLUSTERD_VOL_COMP_RJT, }; typedef struct addrinfo_list { - struct cds_list_head list; - struct addrinfo *info; + struct cds_list_head list; + struct addrinfo *info; } addrinfo_list_t; typedef enum { - GF_AI_COMPARE_NO_MATCH = 0, - GF_AI_COMPARE_MATCH = 1, - GF_AI_COMPARE_ERROR = 2 + GF_AI_COMPARE_NO_MATCH = 0, + GF_AI_COMPARE_MATCH = 1, + GF_AI_COMPARE_ERROR = 2 } gf_ai_compare_t; -#define GLUSTERD_DEFAULT_PORT GF_DEFAULT_BASE_PORT -#define GLUSTERD_INFO_FILE "glusterd.info" +#define GLUSTERD_DEFAULT_PORT GF_DEFAULT_BASE_PORT +#define GLUSTERD_INFO_FILE "glusterd.info" #define GLUSTERD_VOLUME_QUOTA_CONFIG "quota.conf" #define GLUSTERD_VOLUME_DIR_PREFIX "vols" #define GLUSTERD_PEER_DIR_PREFIX "peers" @@ -607,813 +609,883 @@ typedef enum { #define GLUSTERD_MISSED_SNAPS_LIST_FILE "missed_snaps_list" #define GLUSTERD_VOL_SNAP_DIR_PREFIX "snaps" -#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps" -#define GLUSTERD_BITD_RUN_DIR "/bitd" -#define GLUSTERD_SCRUB_RUN_DIR "/scrub" -#define GLUSTERD_GLUSTERSHD_RUN_DIR "/glustershd" -#define GLUSTERD_NFS_RUN_DIR "/nfs" -#define GLUSTERD_QUOTAD_RUN_DIR "/quotad" -#define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR"/ss_brick" -#define GLUSTERD_VAR_RUN_DIR "/var/run" -#define GLUSTERD_RUN_DIR "/run" +#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps" +#define GLUSTERD_BITD_RUN_DIR "/bitd" +#define GLUSTERD_SCRUB_RUN_DIR "/scrub" +#define GLUSTERD_GLUSTERSHD_RUN_DIR "/glustershd" +#define GLUSTERD_NFS_RUN_DIR "/nfs" +#define GLUSTERD_QUOTAD_RUN_DIR "/quotad" +#define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR "/ss_brick" +#define GLUSTERD_VAR_RUN_DIR "/var/run" +#define GLUSTERD_RUN_DIR "/run" /* definitions related to replace brick */ -#define RB_CLIENT_MOUNTPOINT "rb_mount" -#define RB_CLIENTVOL_FILENAME "rb_client.vol" -#define RB_DSTBRICK_PIDFILE "rb_dst_brick.pid" +#define RB_CLIENT_MOUNTPOINT "rb_mount" +#define RB_CLIENTVOL_FILENAME "rb_client.vol" +#define RB_DSTBRICK_PIDFILE "rb_dst_brick.pid" #define RB_DSTBRICKVOL_FILENAME "rb_dst_brick.vol" -#define RB_PUMP_DEF_ARG "default" +#define RB_PUMP_DEF_ARG "default" #define GLUSTERD_UUID_LEN 50 -typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args); - -#define GLUSTERD_GET_VOLUME_DIR(path, volinfo, priv) \ - do { \ - int32_t _vol_dir_len; \ - if (volinfo->is_snap_volume) { \ - _vol_dir_len = snprintf (path, PATH_MAX, "%s/snaps/%s/%s", \ - priv->workdir, \ - volinfo->snapshot->snapname, \ - volinfo->volname); \ - } else { \ - _vol_dir_len = snprintf (path, PATH_MAX, "%s/vols/%s",\ - priv->workdir, volinfo->volname); \ - } \ - if ((_vol_dir_len < 0) || (_vol_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_TIER_DIR(path, volinfo, priv) do { \ - int32_t _tier_dir_len; \ - _tier_dir_len = snprintf (path, PATH_MAX, "%s/tier/%s", \ - priv->workdir, volinfo->volname); \ - if ((_tier_dir_len < 0) || (_tier_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_TIER_PID_FILE(path, volinfo, priv) do { \ - char tier_path[PATH_MAX]; \ - int32_t _tier_pid_len; \ - GLUSTERD_GET_TIER_DIR(tier_path, volinfo, priv); \ - _tier_pid_len = snprintf (path, PATH_MAX, "%s/run/%s-tierd.pid", \ - tier_path, volinfo->volname); \ - if ((_tier_pid_len < 0) || (_tier_pid_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_VOLUME_PID_DIR(path, volinfo, priv) \ -do { \ - int32_t _vol_pid_len; \ - if (volinfo->is_snap_volume) { \ - _vol_pid_len = snprintf (path, PATH_MAX, "%s/snaps/%s/%s", \ - priv->rundir, \ - volinfo->snapshot->snapname, \ - volinfo->volname); \ - } else { \ - _vol_pid_len = snprintf (path, PATH_MAX, "%s/vols/%s", \ - priv->rundir, \ - volinfo->volname); \ - } \ - if ((_vol_pid_len < 0) || (_vol_pid_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ -} while (0) - -#define GLUSTERD_GET_SNAP_DIR(path, snap, priv) \ - do { \ - int32_t _snap_dir_len; \ - _snap_dir_len = snprintf (path, PATH_MAX, "%s/snaps/%s", priv->workdir, \ - snap->snapname); \ - if ((_snap_dir_len < 0) || (_snap_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_SNAP_GEO_REP_DIR(path, snap, priv) \ - do { \ - int32_t _snap_geo_len; \ - _snap_geo_len = snprintf (path, PATH_MAX, "%s/snaps/%s/%s", \ - priv->workdir, snap->snapname, GEOREP); \ - if ((_snap_geo_len < 0) || (_snap_geo_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_BRICK_DIR(path, volinfo, priv) \ - do { \ - int32_t _brick_len; \ - if (volinfo->is_snap_volume) { \ - _brick_len = snprintf (path, PATH_MAX, "%s/snaps/%s/%s/%s", \ - priv->workdir, \ - volinfo->snapshot->snapname, \ - volinfo->volname, \ - GLUSTERD_BRICK_INFO_DIR); \ - } else { \ - _brick_len = snprintf (path, PATH_MAX, "%s/%s/%s/%s", \ - priv->workdir, \ - GLUSTERD_VOLUME_DIR_PREFIX, \ - volinfo->volname, \ - GLUSTERD_BRICK_INFO_DIR); \ - } \ - if ((_brick_len < 0) || (_brick_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_NFS_DIR(path, priv) \ - do { \ - int32_t _nfs_dir_len; \ - _nfs_dir_len = snprintf (path, PATH_MAX, "%s/nfs", priv->workdir); \ - if ((_nfs_dir_len < 0) || (_nfs_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_QUOTAD_DIR(path, priv) \ - do { \ - int32_t _quotad_dir_len; \ - _quotad_dir_len = snprintf (path, PATH_MAX, "%s/quotad", priv->workdir); \ - if ((_quotad_dir_len < 0) || (_quotad_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(abspath, volname, path) do { \ - snprintf (abspath, sizeof (abspath)-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_limit%s", volname, path);\ - } while (0) - -#define GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH(abspath, volname, path) do { \ - snprintf (abspath, sizeof (abspath)-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_list%s", volname, path);\ - } while (0) - -#define GLUSTERD_GET_TMP_PATH(abspath, path) do { \ - snprintf (abspath, sizeof (abspath)-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/tmp%s", path); \ - } while (0) - -#define GLUSTERD_REMOVE_SLASH_FROM_PATH(path,string) do { \ - int i = 0; \ - for (i = 1; i < strlen (path); i++) { \ - string[i-1] = path[i]; \ - if (string[i-1] == '/' && (i != strlen(path) - 1)) \ - string[i-1] = '-'; \ - } \ - } while (0) - -#define GLUSTERD_GET_BRICK_PIDFILE(pidfile,volinfo,brickinfo, priv) do { \ - char exp_path[PATH_MAX] = {0,}; \ - char volpath[PATH_MAX] = {0,}; \ - int32_t _brick_pid_len = 0; \ - GLUSTERD_GET_VOLUME_PID_DIR (volpath, volinfo, priv); \ - GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path); \ - _brick_pid_len = snprintf (pidfile, PATH_MAX, "%s/%s-%s.pid", \ - volpath, brickinfo->hostname, exp_path); \ - if ((_brick_pid_len < 0) || (_brick_pid_len >= PATH_MAX)) { \ - pidfile[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_NFS_PIDFILE(pidfile, nfspath, priv) do { \ - int32_t _nfs_pid_len; \ - _nfs_pid_len = snprintf (pidfile, PATH_MAX, "%s/nfs/nfs.pid", \ - priv->rundir); \ - if ((_nfs_pid_len < 0) || (_nfs_pid_len >= PATH_MAX)) { \ - pidfile[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile, quotadpath, priv) do { \ - int32_t _quotad_pid_len; \ - _quotad_pid_len = snprintf (pidfile, PATH_MAX, "%s/quotad/quotad.pid", \ - priv->rundir); \ - if ((_quotad_pid_len < 0) || (_quotad_pid_len >= PATH_MAX)) { \ - pidfile[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_QUOTA_CRAWL_PIDDIR(piddir, volinfo, type) do { \ - char _volpath[PATH_MAX] = {0,}; \ - int32_t _crawl_pid_len; \ - GLUSTERD_GET_VOLUME_DIR (_volpath, volinfo, priv); \ - if (type == GF_QUOTA_OPTION_TYPE_ENABLE || \ - type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS) \ - _crawl_pid_len = snprintf (piddir, PATH_MAX, \ - "%s/run/quota/enable", _volpath); \ - else \ - _crawl_pid_len = snprintf (piddir, PATH_MAX, \ - "%s/run/quota/disable", _volpath); \ - if ((_crawl_pid_len < 0) || (_crawl_pid_len >= PATH_MAX)) { \ - piddir[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_STACK_DESTROY(frame) do {\ - frame->local = NULL; \ - STACK_DESTROY (frame->root); \ - } while (0) - -#define GLUSTERD_GET_DEFRAG_PROCESS(path, volinfo) do { \ - if (volinfo->rebal.defrag_cmd == GF_DEFRAG_CMD_START_TIER) \ - snprintf (path, NAME_MAX, "tier"); \ - else \ - snprintf (path, NAME_MAX, "rebalance"); \ - } while (0) - -#define GLUSTERD_GET_DEFRAG_DIR(path, volinfo, priv) do { \ - char vol_path[PATH_MAX]; \ - char operation[NAME_MAX]; \ - int32_t _defrag_dir_len; \ - GLUSTERD_GET_VOLUME_DIR(vol_path, volinfo, priv); \ - GLUSTERD_GET_DEFRAG_PROCESS(operation, volinfo); \ - _defrag_dir_len = snprintf (path, PATH_MAX, "%s/%s", vol_path,\ - operation); \ - if ((_defrag_dir_len < 0) || (_defrag_dir_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD(path, volinfo, priv) do { \ - char defrag_path[PATH_MAX]; \ - int32_t _sockfile_old_len; \ - GLUSTERD_GET_DEFRAG_DIR(defrag_path, volinfo, priv); \ - _sockfile_old_len = snprintf (path, PATH_MAX, "%s/%s.sock", \ - defrag_path, uuid_utoa(MY_UUID)); \ - if ((_sockfile_old_len < 0) || (_sockfile_old_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_DEFRAG_SOCK_FILE(path, volinfo) do { \ - char operation[NAME_MAX]; \ - int32_t _defrag_sockfile_len; \ - GLUSTERD_GET_DEFRAG_PROCESS(operation, volinfo); \ - _defrag_sockfile_len = snprintf (path, UNIX_PATH_MAX, \ - DEFAULT_VAR_RUN_DIRECTORY \ - "/gluster-%s-%s.sock", operation, \ - uuid_utoa(volinfo->volume_id)); \ - if ((_defrag_sockfile_len < 0) || (_defrag_sockfile_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERD_GET_DEFRAG_PID_FILE(path, volinfo, priv) do { \ - char defrag_path[PATH_MAX]; \ - int32_t _defrag_pidfile_len; \ - GLUSTERD_GET_DEFRAG_DIR(defrag_path, volinfo, priv); \ - _defrag_pidfile_len = snprintf (path, PATH_MAX, "%s/%s.pid", \ - defrag_path, uuid_utoa(MY_UUID)); \ - if ((_defrag_pidfile_len < 0) || (_defrag_pidfile_len >= PATH_MAX)) { \ - path[0] = 0; \ - } \ - } while (0) - -#define GLUSTERFS_GET_QUOTA_LIMIT_MOUNT_PIDFILE(pidfile, volname) { \ - snprintf (pidfile, PATH_MAX-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_limit.pid", \ - volname); \ - } - -#define GLUSTERFS_GET_QUOTA_LIST_MOUNT_PIDFILE(pidfile, volname) { \ - snprintf (pidfile, PATH_MAX-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_list.pid", \ - volname); \ - } - - -#define GLUSTERD_GET_UUID_NOHYPHEN(ret_string, uuid) do { \ - char *snap_volname_ptr = ret_string; \ - char tmp_uuid[64]; \ - char *snap_volid_ptr = uuid_utoa_r(uuid, tmp_uuid); \ - while (*snap_volid_ptr) { \ - if (*snap_volid_ptr == '-') { \ - snap_volid_ptr++; \ - } else { \ - (*snap_volname_ptr++) = \ - (*snap_volid_ptr++); \ - } \ - } \ - *snap_volname_ptr = '\0'; \ - } while (0) - -#define GLUSTERD_DUMP_PEERS(head, member, xpeers) do { \ - glusterd_peerinfo_t *_peerinfo = NULL; \ - int index = 1; \ - char *key = NULL; \ - \ - key = xpeers ? "glusterd.xaction_peer" : "glusterd.peer"; \ - \ - rcu_read_lock (); \ - cds_list_for_each_entry_rcu (_peerinfo, head, member) { \ - glusterd_dump_peer (_peerinfo, key, index, xpeers); \ - if (!xpeers) \ - glusterd_dump_peer_rpcstat (_peerinfo, key, \ - index); \ - index++; \ - } \ - rcu_read_unlock (); \ - \ - } while (0) - -int glusterd_uuid_init(); - -int glusterd_uuid_generate_save (); +typedef ssize_t (*gd_serialize_t)(struct iovec outmsg, void *args); + +#define GLUSTERD_GET_VOLUME_DIR(path, volinfo, priv) \ + do { \ + int32_t _vol_dir_len; \ + if (volinfo->is_snap_volume) { \ + _vol_dir_len = snprintf( \ + path, PATH_MAX, "%s/snaps/%s/%s", priv->workdir, \ + volinfo->snapshot->snapname, volinfo->volname); \ + } else { \ + _vol_dir_len = snprintf(path, PATH_MAX, "%s/vols/%s", \ + priv->workdir, volinfo->volname); \ + } \ + if ((_vol_dir_len < 0) || (_vol_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_TIER_DIR(path, volinfo, priv) \ + do { \ + int32_t _tier_dir_len; \ + _tier_dir_len = snprintf(path, PATH_MAX, "%s/tier/%s", priv->workdir, \ + volinfo->volname); \ + if ((_tier_dir_len < 0) || (_tier_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_TIER_PID_FILE(path, volinfo, priv) \ + do { \ + char tier_path[PATH_MAX]; \ + int32_t _tier_pid_len; \ + GLUSTERD_GET_TIER_DIR(tier_path, volinfo, priv); \ + _tier_pid_len = snprintf(path, PATH_MAX, "%s/run/%s-tierd.pid", \ + tier_path, volinfo->volname); \ + if ((_tier_pid_len < 0) || (_tier_pid_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_VOLUME_PID_DIR(path, volinfo, priv) \ + do { \ + int32_t _vol_pid_len; \ + if (volinfo->is_snap_volume) { \ + _vol_pid_len = snprintf(path, PATH_MAX, "%s/snaps/%s/%s", \ + priv->rundir, volinfo->snapshot->snapname, \ + volinfo->volname); \ + } else { \ + _vol_pid_len = snprintf(path, PATH_MAX, "%s/vols/%s", \ + priv->rundir, volinfo->volname); \ + } \ + if ((_vol_pid_len < 0) || (_vol_pid_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_SNAP_DIR(path, snap, priv) \ + do { \ + int32_t _snap_dir_len; \ + _snap_dir_len = snprintf(path, PATH_MAX, "%s/snaps/%s", priv->workdir, \ + snap->snapname); \ + if ((_snap_dir_len < 0) || (_snap_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_SNAP_GEO_REP_DIR(path, snap, priv) \ + do { \ + int32_t _snap_geo_len; \ + _snap_geo_len = snprintf(path, PATH_MAX, "%s/snaps/%s/%s", \ + priv->workdir, snap->snapname, GEOREP); \ + if ((_snap_geo_len < 0) || (_snap_geo_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_BRICK_DIR(path, volinfo, priv) \ + do { \ + int32_t _brick_len; \ + if (volinfo->is_snap_volume) { \ + _brick_len = snprintf(path, PATH_MAX, "%s/snaps/%s/%s/%s", \ + priv->workdir, volinfo->snapshot->snapname, \ + volinfo->volname, GLUSTERD_BRICK_INFO_DIR); \ + } else { \ + _brick_len = snprintf(path, PATH_MAX, "%s/%s/%s/%s", \ + priv->workdir, GLUSTERD_VOLUME_DIR_PREFIX, \ + volinfo->volname, GLUSTERD_BRICK_INFO_DIR); \ + } \ + if ((_brick_len < 0) || (_brick_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_NFS_DIR(path, priv) \ + do { \ + int32_t _nfs_dir_len; \ + _nfs_dir_len = snprintf(path, PATH_MAX, "%s/nfs", priv->workdir); \ + if ((_nfs_dir_len < 0) || (_nfs_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_QUOTAD_DIR(path, priv) \ + do { \ + int32_t _quotad_dir_len; \ + _quotad_dir_len = snprintf(path, PATH_MAX, "%s/quotad", \ + priv->workdir); \ + if ((_quotad_dir_len < 0) || (_quotad_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(abspath, volname, path) \ + do { \ + snprintf(abspath, sizeof(abspath) - 1, \ + DEFAULT_VAR_RUN_DIRECTORY "/%s_quota_limit%s", volname, \ + path); \ + } while (0) + +#define GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH(abspath, volname, path) \ + do { \ + snprintf(abspath, sizeof(abspath) - 1, \ + DEFAULT_VAR_RUN_DIRECTORY "/%s_quota_list%s", volname, path); \ + } while (0) + +#define GLUSTERD_GET_TMP_PATH(abspath, path) \ + do { \ + snprintf(abspath, sizeof(abspath) - 1, \ + DEFAULT_VAR_RUN_DIRECTORY "/tmp%s", path); \ + } while (0) + +#define GLUSTERD_REMOVE_SLASH_FROM_PATH(path, string) \ + do { \ + int i = 0; \ + for (i = 1; i < strlen(path); i++) { \ + string[i - 1] = path[i]; \ + if (string[i - 1] == '/' && (i != strlen(path) - 1)) \ + string[i - 1] = '-'; \ + } \ + } while (0) + +#define GLUSTERD_GET_BRICK_PIDFILE(pidfile, volinfo, brickinfo, priv) \ + do { \ + char exp_path[PATH_MAX] = { \ + 0, \ + }; \ + char volpath[PATH_MAX] = { \ + 0, \ + }; \ + int32_t _brick_pid_len = 0; \ + GLUSTERD_GET_VOLUME_PID_DIR(volpath, volinfo, priv); \ + GLUSTERD_REMOVE_SLASH_FROM_PATH(brickinfo->path, exp_path); \ + _brick_pid_len = snprintf(pidfile, PATH_MAX, "%s/%s-%s.pid", volpath, \ + brickinfo->hostname, exp_path); \ + if ((_brick_pid_len < 0) || (_brick_pid_len >= PATH_MAX)) { \ + pidfile[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_NFS_PIDFILE(pidfile, nfspath, priv) \ + do { \ + int32_t _nfs_pid_len; \ + _nfs_pid_len = snprintf(pidfile, PATH_MAX, "%s/nfs/nfs.pid", \ + priv->rundir); \ + if ((_nfs_pid_len < 0) || (_nfs_pid_len >= PATH_MAX)) { \ + pidfile[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile, quotadpath, priv) \ + do { \ + int32_t _quotad_pid_len; \ + _quotad_pid_len = snprintf(pidfile, PATH_MAX, "%s/quotad/quotad.pid", \ + priv->rundir); \ + if ((_quotad_pid_len < 0) || (_quotad_pid_len >= PATH_MAX)) { \ + pidfile[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_QUOTA_CRAWL_PIDDIR(piddir, volinfo, type) \ + do { \ + char _volpath[PATH_MAX] = { \ + 0, \ + }; \ + int32_t _crawl_pid_len; \ + GLUSTERD_GET_VOLUME_DIR(_volpath, volinfo, priv); \ + if (type == GF_QUOTA_OPTION_TYPE_ENABLE || \ + type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS) \ + _crawl_pid_len = snprintf(piddir, PATH_MAX, "%s/run/quota/enable", \ + _volpath); \ + else \ + _crawl_pid_len = snprintf(piddir, PATH_MAX, \ + "%s/run/quota/disable", _volpath); \ + if ((_crawl_pid_len < 0) || (_crawl_pid_len >= PATH_MAX)) { \ + piddir[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_STACK_DESTROY(frame) \ + do { \ + frame->local = NULL; \ + STACK_DESTROY(frame->root); \ + } while (0) + +#define GLUSTERD_GET_DEFRAG_PROCESS(path, volinfo) \ + do { \ + if (volinfo->rebal.defrag_cmd == GF_DEFRAG_CMD_START_TIER) \ + snprintf(path, NAME_MAX, "tier"); \ + else \ + snprintf(path, NAME_MAX, "rebalance"); \ + } while (0) + +#define GLUSTERD_GET_DEFRAG_DIR(path, volinfo, priv) \ + do { \ + char vol_path[PATH_MAX]; \ + char operation[NAME_MAX]; \ + int32_t _defrag_dir_len; \ + GLUSTERD_GET_VOLUME_DIR(vol_path, volinfo, priv); \ + GLUSTERD_GET_DEFRAG_PROCESS(operation, volinfo); \ + _defrag_dir_len = snprintf(path, PATH_MAX, "%s/%s", vol_path, \ + operation); \ + if ((_defrag_dir_len < 0) || (_defrag_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD(path, volinfo, priv) \ + do { \ + char defrag_path[PATH_MAX]; \ + int32_t _sockfile_old_len; \ + GLUSTERD_GET_DEFRAG_DIR(defrag_path, volinfo, priv); \ + _sockfile_old_len = snprintf(path, PATH_MAX, "%s/%s.sock", \ + defrag_path, uuid_utoa(MY_UUID)); \ + if ((_sockfile_old_len < 0) || (_sockfile_old_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_DEFRAG_SOCK_FILE(path, volinfo) \ + do { \ + char operation[NAME_MAX]; \ + int32_t _defrag_sockfile_len; \ + GLUSTERD_GET_DEFRAG_PROCESS(operation, volinfo); \ + _defrag_sockfile_len = snprintf( \ + path, UNIX_PATH_MAX, \ + DEFAULT_VAR_RUN_DIRECTORY "/gluster-%s-%s.sock", operation, \ + uuid_utoa(volinfo->volume_id)); \ + if ((_defrag_sockfile_len < 0) || \ + (_defrag_sockfile_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_DEFRAG_PID_FILE(path, volinfo, priv) \ + do { \ + char defrag_path[PATH_MAX]; \ + int32_t _defrag_pidfile_len; \ + GLUSTERD_GET_DEFRAG_DIR(defrag_path, volinfo, priv); \ + _defrag_pidfile_len = snprintf(path, PATH_MAX, "%s/%s.pid", \ + defrag_path, uuid_utoa(MY_UUID)); \ + if ((_defrag_pidfile_len < 0) || (_defrag_pidfile_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERFS_GET_QUOTA_LIMIT_MOUNT_PIDFILE(pidfile, volname) \ + { \ + snprintf(pidfile, PATH_MAX - 1, \ + DEFAULT_VAR_RUN_DIRECTORY "/%s_quota_limit.pid", volname); \ + } + +#define GLUSTERFS_GET_QUOTA_LIST_MOUNT_PIDFILE(pidfile, volname) \ + { \ + snprintf(pidfile, PATH_MAX - 1, \ + DEFAULT_VAR_RUN_DIRECTORY "/%s_quota_list.pid", volname); \ + } + +#define GLUSTERD_GET_UUID_NOHYPHEN(ret_string, uuid) \ + do { \ + char *snap_volname_ptr = ret_string; \ + char tmp_uuid[64]; \ + char *snap_volid_ptr = uuid_utoa_r(uuid, tmp_uuid); \ + while (*snap_volid_ptr) { \ + if (*snap_volid_ptr == '-') { \ + snap_volid_ptr++; \ + } else { \ + (*snap_volname_ptr++) = (*snap_volid_ptr++); \ + } \ + } \ + *snap_volname_ptr = '\0'; \ + } while (0) + +#define GLUSTERD_DUMP_PEERS(head, member, xpeers) \ + do { \ + glusterd_peerinfo_t *_peerinfo = NULL; \ + int index = 1; \ + char *key = NULL; \ + \ + key = xpeers ? "glusterd.xaction_peer" : "glusterd.peer"; \ + \ + rcu_read_lock(); \ + cds_list_for_each_entry_rcu(_peerinfo, head, member) \ + { \ + glusterd_dump_peer(_peerinfo, key, index, xpeers); \ + if (!xpeers) \ + glusterd_dump_peer_rpcstat(_peerinfo, key, index); \ + index++; \ + } \ + rcu_read_unlock(); \ + \ + } while (0) + +int +glusterd_uuid_init(); + +int +glusterd_uuid_generate_save(); #define MY_UUID (__glusterd_uuid()) static inline unsigned char * __glusterd_uuid() { - glusterd_conf_t *priv = THIS->private; + glusterd_conf_t *priv = THIS->private; - if (gf_uuid_is_null (priv->uuid)) - glusterd_uuid_init(); - return &priv->uuid[0]; + if (gf_uuid_is_null(priv->uuid)) + glusterd_uuid_init(); + return &priv->uuid[0]; } -int glusterd_big_locked_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, - void *data, rpc_clnt_notify_t notify_fn); +int +glusterd_big_locked_notify(struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t event, void *data, + rpc_clnt_notify_t notify_fn); int -glusterd_big_locked_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe, fop_cbk_fn_t fn); +glusterd_big_locked_cbk(struct rpc_req *req, struct iovec *iov, int count, + void *myframe, fop_cbk_fn_t fn); -int glusterd_big_locked_handler (rpcsvc_request_t *req, rpcsvc_actor actor_fn); +int +glusterd_big_locked_handler(rpcsvc_request_t *req, rpcsvc_actor actor_fn); int32_t -glusterd_brick_from_brickinfo (glusterd_brickinfo_t *brickinfo, - char **new_brick); +glusterd_brick_from_brickinfo(glusterd_brickinfo_t *brickinfo, + char **new_brick); int -glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port, - dict_t *dict, int *op_errno); +glusterd_probe_begin(rpcsvc_request_t *req, const char *hoststr, int port, + dict_t *dict, int *op_errno); int -glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *myhostname, - char *remote_hostname, int port, int32_t op_ret, - int32_t op_errno); +glusterd_xfer_friend_add_resp(rpcsvc_request_t *req, char *myhostname, + char *remote_hostname, int port, int32_t op_ret, + int32_t op_errno); int -glusterd_friend_add (const char *hoststr, int port, - glusterd_friend_sm_state_t state, - uuid_t *uuid, glusterd_peerinfo_t **friend, - gf_boolean_t restore, glusterd_peerctx_args_t *args); +glusterd_friend_add(const char *hoststr, int port, + glusterd_friend_sm_state_t state, uuid_t *uuid, + glusterd_peerinfo_t **friend, gf_boolean_t restore, + glusterd_peerctx_args_t *args); int -glusterd_friend_add_from_peerinfo (glusterd_peerinfo_t *friend, - gf_boolean_t restore, - glusterd_peerctx_args_t *args); +glusterd_friend_add_from_peerinfo(glusterd_peerinfo_t *friend, + gf_boolean_t restore, + glusterd_peerctx_args_t *args); int -glusterd_friend_rpc_create (xlator_t *this, glusterd_peerinfo_t *peerinfo, - glusterd_peerctx_args_t *args); +glusterd_friend_rpc_create(xlator_t *this, glusterd_peerinfo_t *peerinfo, + glusterd_peerctx_args_t *args); int -glusterd_friend_remove (uuid_t uuid, char *hostname); +glusterd_friend_remove(uuid_t uuid, char *hostname); int -glusterd_op_lock_send_resp (rpcsvc_request_t *req, int32_t status); +glusterd_op_lock_send_resp(rpcsvc_request_t *req, int32_t status); int -glusterd_op_unlock_send_resp (rpcsvc_request_t *req, int32_t status); +glusterd_op_unlock_send_resp(rpcsvc_request_t *req, int32_t status); int -glusterd_op_mgmt_v3_lock_send_resp (rpcsvc_request_t *req, - uuid_t *txn_id, int32_t status); +glusterd_op_mgmt_v3_lock_send_resp(rpcsvc_request_t *req, uuid_t *txn_id, + int32_t status); int -glusterd_op_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, - uuid_t *txn_id, int32_t status); +glusterd_op_mgmt_v3_unlock_send_resp(rpcsvc_request_t *req, uuid_t *txn_id, + int32_t status); int -glusterd_op_stage_send_resp (rpcsvc_request_t *req, - int32_t op, int32_t status, - char *op_errstr, dict_t *rsp_dict); +glusterd_op_stage_send_resp(rpcsvc_request_t *req, int32_t op, int32_t status, + char *op_errstr, dict_t *rsp_dict); int -glusterd_op_commmit_send_resp (rpcsvc_request_t *req, - int32_t op, int32_t status); +glusterd_op_commmit_send_resp(rpcsvc_request_t *req, int32_t op, + int32_t status); int32_t -glusterd_create_volume (rpcsvc_request_t *req, dict_t *dict); +glusterd_create_volume(rpcsvc_request_t *req, dict_t *dict); int -glusterd_handle_incoming_friend_req (rpcsvc_request_t *req); +glusterd_handle_incoming_friend_req(rpcsvc_request_t *req); int -glusterd_handle_probe_query (rpcsvc_request_t *req); +glusterd_handle_probe_query(rpcsvc_request_t *req); int -glusterd_handle_cluster_lock (rpcsvc_request_t *req); +glusterd_handle_cluster_lock(rpcsvc_request_t *req); int -glusterd_handle_cluster_unlock (rpcsvc_request_t *req); +glusterd_handle_cluster_unlock(rpcsvc_request_t *req); int -glusterd_handle_stage_op (rpcsvc_request_t *req); +glusterd_handle_stage_op(rpcsvc_request_t *req); int -glusterd_handle_commit_op (rpcsvc_request_t *req); +glusterd_handle_commit_op(rpcsvc_request_t *req); int -glusterd_handle_cli_probe (rpcsvc_request_t *req); +glusterd_handle_cli_probe(rpcsvc_request_t *req); int -glusterd_handle_create_volume (rpcsvc_request_t *req); +glusterd_handle_create_volume(rpcsvc_request_t *req); int -glusterd_handle_defrag_volume (rpcsvc_request_t *req); +glusterd_handle_defrag_volume(rpcsvc_request_t *req); int -glusterd_handle_defrag_volume_v2 (rpcsvc_request_t *req); +glusterd_handle_defrag_volume_v2(rpcsvc_request_t *req); int -glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret, - int32_t op_errno, char *op_errstr, char *hostname, - int port, dict_t *dict); +glusterd_xfer_cli_probe_resp(rpcsvc_request_t *req, int32_t op_ret, + int32_t op_errno, char *op_errstr, char *hostname, + int port, dict_t *dict); int -glusterd_op_commit_send_resp (rpcsvc_request_t *req, - int32_t op, int32_t status, char *op_errstr, - dict_t *rsp_dict); +glusterd_op_commit_send_resp(rpcsvc_request_t *req, int32_t op, int32_t status, + char *op_errstr, dict_t *rsp_dict); int -glusterd_xfer_friend_remove_resp (rpcsvc_request_t *req, char *hostname, int port); +glusterd_xfer_friend_remove_resp(rpcsvc_request_t *req, char *hostname, + int port); int -glusterd_deprobe_begin (rpcsvc_request_t *req, const char *hoststr, int port, - uuid_t uuid, dict_t *dict, int *op_errno); +glusterd_deprobe_begin(rpcsvc_request_t *req, const char *hoststr, int port, + uuid_t uuid, dict_t *dict, int *op_errno); int -glusterd_handle_cli_deprobe (rpcsvc_request_t *req); +glusterd_handle_cli_deprobe(rpcsvc_request_t *req); int -glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req); +glusterd_handle_incoming_unfriend_req(rpcsvc_request_t *req); int32_t -glusterd_list_friends (rpcsvc_request_t *req, dict_t *dict, int32_t flags); +glusterd_list_friends(rpcsvc_request_t *req, dict_t *dict, int32_t flags); int -glusterd_handle_cli_list_friends (rpcsvc_request_t *req); +glusterd_handle_cli_list_friends(rpcsvc_request_t *req); int -glusterd_handle_cli_start_volume (rpcsvc_request_t *req); +glusterd_handle_cli_start_volume(rpcsvc_request_t *req); int -glusterd_handle_friend_update (rpcsvc_request_t *req); +glusterd_handle_friend_update(rpcsvc_request_t *req); int -glusterd_handle_cli_stop_volume (rpcsvc_request_t *req); +glusterd_handle_cli_stop_volume(rpcsvc_request_t *req); int -glusterd_handle_cli_delete_volume (rpcsvc_request_t *req); +glusterd_handle_cli_delete_volume(rpcsvc_request_t *req); int -glusterd_handle_cli_get_volume (rpcsvc_request_t *req); +glusterd_handle_cli_get_volume(rpcsvc_request_t *req); int32_t -glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags); +glusterd_get_volumes(rpcsvc_request_t *req, dict_t *dict, int32_t flags); int -glusterd_handle_add_brick (rpcsvc_request_t *req); +glusterd_handle_add_brick(rpcsvc_request_t *req); int -glusterd_handle_tier (rpcsvc_request_t *req); +glusterd_handle_tier(rpcsvc_request_t *req); int -glusterd_handle_attach_tier (rpcsvc_request_t *req); +glusterd_handle_attach_tier(rpcsvc_request_t *req); int -glusterd_handle_detach_tier (rpcsvc_request_t *req); +glusterd_handle_detach_tier(rpcsvc_request_t *req); int -glusterd_handle_add_tier_brick (rpcsvc_request_t *req); +glusterd_handle_add_tier_brick(rpcsvc_request_t *req); int -glusterd_handle_replace_brick (rpcsvc_request_t *req); +glusterd_handle_replace_brick(rpcsvc_request_t *req); int -glusterd_handle_remove_brick (rpcsvc_request_t *req); +glusterd_handle_remove_brick(rpcsvc_request_t *req); int -glusterd_handle_log_rotate (rpcsvc_request_t *req); +glusterd_handle_log_rotate(rpcsvc_request_t *req); int -glusterd_handle_sync_volume (rpcsvc_request_t *req); +glusterd_handle_sync_volume(rpcsvc_request_t *req); int -glusterd_defrag_start_validate (glusterd_volinfo_t *volinfo, char *op_errstr, - size_t len, glusterd_op_t op); +glusterd_defrag_start_validate(glusterd_volinfo_t *volinfo, char *op_errstr, + size_t len, glusterd_op_t op); int -glusterd_rebalance_cmd_validate (int cmd, char *volname, - glusterd_volinfo_t **volinfo, - char *op_errstr, size_t len); +glusterd_rebalance_cmd_validate(int cmd, char *volname, + glusterd_volinfo_t **volinfo, char *op_errstr, + size_t len); int32_t -glusterd_log_filename (rpcsvc_request_t *req, dict_t *dict); +glusterd_log_filename(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_log_rotate (rpcsvc_request_t *req, dict_t *dict); +glusterd_log_rotate(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_remove_brick (rpcsvc_request_t *req, dict_t *dict); +glusterd_remove_brick(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict); +glusterd_set_volume(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_reset_volume (rpcsvc_request_t *req, dict_t *dict); +glusterd_reset_volume(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_gsync_set (rpcsvc_request_t *req, dict_t *dict); +glusterd_gsync_set(rpcsvc_request_t *req, dict_t *dict); int32_t -glusterd_quota (rpcsvc_request_t *req, dict_t *dict); +glusterd_quota(rpcsvc_request_t *req, dict_t *dict); int -glusterd_handle_set_volume (rpcsvc_request_t *req); +glusterd_handle_set_volume(rpcsvc_request_t *req); int -glusterd_handle_reset_volume (rpcsvc_request_t *req); +glusterd_handle_reset_volume(rpcsvc_request_t *req); int -glusterd_handle_copy_file (rpcsvc_request_t *req); +glusterd_handle_copy_file(rpcsvc_request_t *req); int -glusterd_handle_sys_exec (rpcsvc_request_t *req); +glusterd_handle_sys_exec(rpcsvc_request_t *req); int -glusterd_handle_gsync_set (rpcsvc_request_t *req); +glusterd_handle_gsync_set(rpcsvc_request_t *req); int -glusterd_handle_quota (rpcsvc_request_t *req); +glusterd_handle_quota(rpcsvc_request_t *req); int -glusterd_handle_bitrot (rpcsvc_request_t *req); +glusterd_handle_bitrot(rpcsvc_request_t *req); int -glusterd_handle_fsm_log (rpcsvc_request_t *req); +glusterd_handle_fsm_log(rpcsvc_request_t *req); int -glusterd_handle_reset_brick (rpcsvc_request_t *req); +glusterd_handle_reset_brick(rpcsvc_request_t *req); int -glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, - int32_t op_errno, char *op_errstr, - char *hostname, dict_t *dict); +glusterd_xfer_cli_deprobe_resp(rpcsvc_request_t *req, int32_t op_ret, + int32_t op_errno, char *op_errstr, + char *hostname, dict_t *dict); int -glusterd_client_statedump_submit_req (char *volname, char *target_ip, - char *pid); +glusterd_client_statedump_submit_req(char *volname, char *target_ip, char *pid); int -glusterd_fetchspec_notify (xlator_t *this); +glusterd_fetchspec_notify(xlator_t *this); int -glusterd_fetchsnap_notify (xlator_t *this); +glusterd_fetchsnap_notify(xlator_t *this); int -glusterd_add_tier_volume_detail_to_dict (glusterd_volinfo_t *volinfo, - dict_t *volumes, int count); +glusterd_add_tier_volume_detail_to_dict(glusterd_volinfo_t *volinfo, + dict_t *volumes, int count); int -glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, - dict_t *volumes, int count); +glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, + int count); int -glusterd_restart_bricks (); +glusterd_restart_bricks(); int32_t -glusterd_volume_txn (rpcsvc_request_t *req, char *volname, int flags, - glusterd_op_t op); +glusterd_volume_txn(rpcsvc_request_t *req, char *volname, int flags, + glusterd_op_t op); int -glusterd_peer_dump_version (xlator_t *this, struct rpc_clnt *rpc, - glusterd_peerctx_t *peerctx); +glusterd_peer_dump_version(xlator_t *this, struct rpc_clnt *rpc, + glusterd_peerctx_t *peerctx); int -glusterd_validate_reconfopts (glusterd_volinfo_t *volinfo, dict_t *val_dict, char **op_errstr); +glusterd_validate_reconfopts(glusterd_volinfo_t *volinfo, dict_t *val_dict, + char **op_errstr); int -glusterd_handle_cli_profile_volume (rpcsvc_request_t *req); +glusterd_handle_cli_profile_volume(rpcsvc_request_t *req); int -glusterd_handle_getwd (rpcsvc_request_t *req); +glusterd_handle_getwd(rpcsvc_request_t *req); int32_t -glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict); +glusterd_set_volume(rpcsvc_request_t *req, dict_t *dict); int -glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, - void *data); +glusterd_peer_rpc_notify(struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t event, void *data); int -glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata, +glusterd_brick_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, void *data); int -glusterd_rpc_create (struct rpc_clnt **rpc, dict_t *options, - rpc_clnt_notify_t notify_fn, void *notify_data, - gf_boolean_t force); - +glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options, + rpc_clnt_notify_t notify_fn, void *notify_data, + gf_boolean_t force); /* handler functions */ -int32_t glusterd_op_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx, - char *err_str, size_t size); +int32_t +glusterd_op_begin(rpcsvc_request_t *req, glusterd_op_t op, void *ctx, + char *err_str, size_t size); /* removed other definitions as they have been defined elsewhere in this file*/ -int glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req); -int glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req); +int +glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req); +int +glusterd_handle_cli_clearlocks_volume(rpcsvc_request_t *req); -int glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, - size_t len, int cmd, defrag_cbk_fn_t cbk, - glusterd_op_t op); int -glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo); +glusterd_handle_defrag_start(glusterd_volinfo_t *volinfo, char *op_errstr, + size_t len, int cmd, defrag_cbk_fn_t cbk, + glusterd_op_t op); +int +glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo); -int glusterd_rebalance_defrag_init (glusterd_volinfo_t *volinfo, - defrag_cbk_fn_t cbk); +int +glusterd_rebalance_defrag_init(glusterd_volinfo_t *volinfo, + defrag_cbk_fn_t cbk); -int glusterd_handle_cli_heal_volume (rpcsvc_request_t *req); +int +glusterd_handle_cli_heal_volume(rpcsvc_request_t *req); -int glusterd_handle_cli_list_volume (rpcsvc_request_t *req); +int +glusterd_handle_cli_list_volume(rpcsvc_request_t *req); int -glusterd_handle_snapshot (rpcsvc_request_t *req); +glusterd_handle_snapshot(rpcsvc_request_t *req); /* op-sm functions */ -int glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr); -int glusterd_op_heal_volume (dict_t *dict, char **op_errstr); -int glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr); -int glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict); -int glusterd_op_stage_copy_file (dict_t *dict, char **op_errstr); -int glusterd_op_copy_file (dict_t *dict, char **op_errstr); -int glusterd_op_stage_sys_exec (dict_t *dict, char **op_errstr); -int glusterd_op_sys_exec (dict_t *dict, char **op_errstr, dict_t *rsp_dict); -int glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr); -int glusterd_op_gsync_create (dict_t *dict, char **op_errstr, dict_t *rsp_dict); -int glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict); - -int glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict); - -int glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict); - -int glusterd_op_stage_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict); - -int glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); -int glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict); -int glusterd_op_log_rotate (dict_t *dict); -int glusterd_op_stage_log_rotate (dict_t *dict, char **op_errstr); -int glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); -int glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); -int glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr); -int glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr); -int glusterd_op_create_volume (dict_t *dict, char **op_errstr); -int glusterd_op_start_volume (dict_t *dict, char **op_errstr); -int glusterd_op_stop_volume (dict_t *dict); -int glusterd_op_delete_volume (dict_t *dict); -int manage_export_config (char *volname, char *value, char **op_errstr); - -int glusterd_op_add_brick (dict_t *dict, char **op_errstr); -int glusterd_op_add_tier_brick (dict_t *dict, char **op_errstr); -int glusterd_op_remove_brick (dict_t *dict, char **op_errstr); -int glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); -int glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr); - -int glusterd_op_stage_rebalance (dict_t *dict, char **op_errstr); -int glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict); - -int glusterd_op_stage_statedump_volume (dict_t *dict, char **op_errstr); -int glusterd_op_statedump_volume (dict_t *dict, char **op_errstr); - -int glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr); -int glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); - - -int glusterd_op_stage_barrier (dict_t *dict, char **op_errstr); -int glusterd_op_barrier (dict_t *dict, char **op_errstr); +int +glusterd_op_stage_heal_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_heal_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_stage_gsync_set(dict_t *dict, char **op_errstr); +int +glusterd_op_gsync_set(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_stage_copy_file(dict_t *dict, char **op_errstr); +int +glusterd_op_copy_file(dict_t *dict, char **op_errstr); +int +glusterd_op_stage_sys_exec(dict_t *dict, char **op_errstr); +int +glusterd_op_sys_exec(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_stage_gsync_create(dict_t *dict, char **op_errstr); +int +glusterd_op_gsync_create(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_stage_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_stage_bitrot(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_stage_replace_brick(dict_t *dict, char **op_errstr, + dict_t *rsp_dict); +int +glusterd_op_replace_brick(dict_t *dict, dict_t *rsp_dict); +int +glusterd_op_log_rotate(dict_t *dict); +int +glusterd_op_stage_log_rotate(dict_t *dict, char **op_errstr); +int +glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr, + dict_t *rsp_dict); +int +glusterd_op_stage_start_volume(dict_t *dict, char **op_errstr, + dict_t *rsp_dict); +int +glusterd_op_stage_stop_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_stage_delete_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_create_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_start_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_stop_volume(dict_t *dict); +int +glusterd_op_delete_volume(dict_t *dict); +int +manage_export_config(char *volname, char *value, char **op_errstr); + +int +glusterd_op_add_brick(dict_t *dict, char **op_errstr); +int +glusterd_op_add_tier_brick(dict_t *dict, char **op_errstr); +int +glusterd_op_remove_brick(dict_t *dict, char **op_errstr); +int +glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr); + +int +glusterd_op_stage_rebalance(dict_t *dict, char **op_errstr); +int +glusterd_op_rebalance(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_stage_statedump_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_statedump_volume(dict_t *dict, char **op_errstr); + +int +glusterd_op_stage_clearlocks_volume(dict_t *dict, char **op_errstr); +int +glusterd_op_clearlocks_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict); + +int +glusterd_op_stage_barrier(dict_t *dict, char **op_errstr); +int +glusterd_op_barrier(dict_t *dict, char **op_errstr); /* misc */ -int glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick, - int force, int *need_migrate); -int glusterd_op_stop_volume_args_get (dict_t *dict, char** volname, int *flags); -int glusterd_op_statedump_volume_args_get (dict_t *dict, char **volname, - char **options, int *option_cnt); +int +glusterd_op_perform_remove_brick(glusterd_volinfo_t *volinfo, char *brick, + int force, int *need_migrate); +int +glusterd_op_stop_volume_args_get(dict_t *dict, char **volname, int *flags); +int +glusterd_op_statedump_volume_args_get(dict_t *dict, char **volname, + char **options, int *option_cnt); -int glusterd_op_gsync_args_get (dict_t *dict, char **op_errstr, - char **master, char **slave, char **host_uuid); +int +glusterd_op_gsync_args_get(dict_t *dict, char **op_errstr, char **master, + char **slave, char **host_uuid); -int glusterd_op_get_max_opversion (char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_get_max_opversion(char **op_errstr, dict_t *rsp_dict); -int glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags, - gf_boolean_t wait); +int +glusterd_start_volume(glusterd_volinfo_t *volinfo, int flags, + gf_boolean_t wait); -int glusterd_stop_volume (glusterd_volinfo_t *volinfo); +int +glusterd_stop_volume(glusterd_volinfo_t *volinfo); /* Synctask part */ -int32_t glusterd_op_begin_synctask (rpcsvc_request_t *req, glusterd_op_t op, - void *dict); int32_t -glusterd_defrag_event_notify_handle (dict_t *dict); +glusterd_op_begin_synctask(rpcsvc_request_t *req, glusterd_op_t op, void *dict); +int32_t +glusterd_defrag_event_notify_handle(dict_t *dict); int32_t -glusterd_txn_opinfo_dict_init (); +glusterd_txn_opinfo_dict_init(); void -glusterd_txn_opinfo_dict_fini (); +glusterd_txn_opinfo_dict_fini(); void -glusterd_txn_opinfo_init (); +glusterd_txn_opinfo_init(); /* snapshot */ -glusterd_snap_t* +glusterd_snap_t * glusterd_new_snap_object(); int32_t -glusterd_list_add_snapvol (glusterd_volinfo_t *origin_vol, - glusterd_volinfo_t *snap_vol); +glusterd_list_add_snapvol(glusterd_volinfo_t *origin_vol, + glusterd_volinfo_t *snap_vol); -glusterd_snap_t* -glusterd_remove_snap_by_id (uuid_t snap_id); +glusterd_snap_t * +glusterd_remove_snap_by_id(uuid_t snap_id); -glusterd_snap_t* -glusterd_remove_snap_by_name (char *snap_name); +glusterd_snap_t * +glusterd_remove_snap_by_name(char *snap_name); -glusterd_snap_t* -glusterd_find_snap_by_name (char *snap_name); +glusterd_snap_t * +glusterd_find_snap_by_name(char *snap_name); -glusterd_snap_t* -glusterd_find_snap_by_id (uuid_t snap_id); +glusterd_snap_t * +glusterd_find_snap_by_id(uuid_t snap_id); int -glusterd_snapshot_prevalidate (dict_t *dict, char **op_errstr, - dict_t *rsp_dict, uint32_t *op_errno); +glusterd_snapshot_prevalidate(dict_t *dict, char **op_errstr, dict_t *rsp_dict, + uint32_t *op_errno); int -glusterd_snapshot_brickop (dict_t *dict, char **op_errstr, dict_t *rsp_dict); +glusterd_snapshot_brickop(dict_t *dict, char **op_errstr, dict_t *rsp_dict); int -glusterd_snapshot (dict_t *dict, char **op_errstr, - uint32_t *op_errno, dict_t *rsp_dict); +glusterd_snapshot(dict_t *dict, char **op_errstr, uint32_t *op_errno, + dict_t *rsp_dict); int -glusterd_snapshot_postvalidate (dict_t *dict, int32_t op_ret, char **op_errstr, - dict_t *rsp_dict); +glusterd_snapshot_postvalidate(dict_t *dict, int32_t op_ret, char **op_errstr, + dict_t *rsp_dict); char * -glusterd_build_snap_device_path (char *device, char *snapname, - int32_t brick_count); +glusterd_build_snap_device_path(char *device, char *snapname, + int32_t brick_count); int32_t -glusterd_snap_remove (dict_t *rsp_dict, glusterd_snap_t *snap, - gf_boolean_t remove_lvm, gf_boolean_t force, - gf_boolean_t is_clone); +glusterd_snap_remove(dict_t *rsp_dict, glusterd_snap_t *snap, + gf_boolean_t remove_lvm, gf_boolean_t force, + gf_boolean_t is_clone); int32_t -glusterd_snapshot_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict); +glusterd_snapshot_cleanup(dict_t *dict, char **op_errstr, dict_t *rsp_dict); int32_t -glusterd_add_missed_snaps_to_list (dict_t *dict, int32_t missed_snap_count); +glusterd_add_missed_snaps_to_list(dict_t *dict, int32_t missed_snap_count); int32_t -glusterd_add_new_entry_to_list (char *missed_info, char *snap_vol_id, - int32_t brick_num, char *brick_path, - int32_t snap_op, int32_t snap_status); +glusterd_add_new_entry_to_list(char *missed_info, char *snap_vol_id, + int32_t brick_num, char *brick_path, + int32_t snap_op, int32_t snap_status); int -glusterd_snapshot_revert_restore_from_snap (glusterd_snap_t *snap); - +glusterd_snapshot_revert_restore_from_snap(glusterd_snap_t *snap); int -glusterd_add_brick_status_to_dict (dict_t *dict, glusterd_volinfo_t *volinfo, - glusterd_brickinfo_t *brickinfo, - char *key_prefix); +glusterd_add_brick_status_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *brickinfo, + char *key_prefix); int32_t -glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict); +glusterd_handle_snap_limit(dict_t *dict, dict_t *rsp_dict); gf_boolean_t -glusterd_should_i_stop_bitd (); +glusterd_should_i_stop_bitd(); int -glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo, - gf_defrag_status_t status); +glusterd_remove_brick_migrate_cbk(glusterd_volinfo_t *volinfo, + gf_defrag_status_t status); /* tier */ int -__glusterd_handle_reset_brick (rpcsvc_request_t *req); -int glusterd_op_stage_tier (dict_t *dict, char **op_errstr, dict_t *rsp_dict); -int glusterd_op_tier_start_stop (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); -int glusterd_op_remove_tier_brick (dict_t *dict, char **op_errstr, - dict_t *rsp_dict); +__glusterd_handle_reset_brick(rpcsvc_request_t *req); +int +glusterd_op_stage_tier(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_tier_start_stop(dict_t *dict, char **op_errstr, dict_t *rsp_dict); +int +glusterd_op_remove_tier_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict); int -glusterd_tier_prevalidate (dict_t *dict, char **op_errstr, - dict_t *rsp_dict, uint32_t *op_errno); +glusterd_tier_prevalidate(dict_t *dict, char **op_errstr, dict_t *rsp_dict, + uint32_t *op_errno); int -glusterd_options_init (xlator_t *this); +glusterd_options_init(xlator_t *this); #endif diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index b26b5e21109..318f33b5d61 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -46,130 +46,129 @@ #ifdef GF_DARWIN_HOST_OS #define FUSE_OP_HIGH (FUSE_DESTROY + 1) #endif -#define GLUSTERFS_XATTR_LEN_MAX 65536 +#define GLUSTERFS_XATTR_LEN_MAX 65536 #define MAX_FUSE_PROC_DELAY 1 typedef struct fuse_in_header fuse_in_header_t; -typedef void (fuse_handler_t) (xlator_t *this, fuse_in_header_t *finh, - void *msg, struct iobuf *iobuf); +typedef void(fuse_handler_t)(xlator_t *this, fuse_in_header_t *finh, void *msg, + struct iobuf *iobuf); struct fuse_private { - int fd; - uint32_t proto_minor; - char *volfile; - size_t volfile_size; - char *mount_point; - struct iobuf *iobuf; - - pthread_t *fuse_thread; - uint32_t reader_thread_count; - char fuse_thread_started; - - uint32_t direct_io_mode; - size_t *msg0_len_p; - - double entry_timeout; - double negative_timeout; - double attribute_timeout; - - pthread_cond_t sync_cond; - pthread_mutex_t sync_mutex; - char event_recvd; - - char init_recvd; - - gf_boolean_t strict_volfile_check; - - fuse_handler_t **fuse_ops; - fuse_handler_t **fuse_ops0; - pthread_mutex_t fuse_dump_mutex; - int fuse_dump_fd; - - glusterfs_graph_t *next_graph; - xlator_t *active_subvol; - - pid_t client_pid; - gf_boolean_t client_pid_set; - unsigned uid_map_root; - gf_boolean_t acl; - gf_boolean_t selinux; - gf_boolean_t read_only; - int32_t fopen_keep_cache; - int32_t gid_cache_timeout; - gf_boolean_t enable_ino32; - /* This is the mount option for disabling the root-squash for the - mount irrespective of whether the root-squash option for the - volume is set or not. But this option is honoured only for - thr trusted clients. For non trusted clients this value does - not have any affect and the volume option for root-squash is - honoured. - */ - gf_boolean_t no_root_squash; - fdtable_t *fdtable; - gid_cache_t gid_cache; - char *fuse_mountopts; - - /* For fuse-reverse-validation */ - struct list_head invalidate_list; - pthread_cond_t invalidate_cond; - pthread_mutex_t invalidate_mutex; - gf_boolean_t reverse_fuse_thread_started; - - /* For communicating with separate mount thread. */ - int status_pipe[2]; - - /* for fuse queue length and congestion threshold */ - int background_qlen; - int congestion_threshold; - - /* for using fuse-kernel readdirp*/ - gf_boolean_t use_readdirp; - - /* fini started, helps prevent multiple epoll worker threads - * firing up the fini routine */ - gf_boolean_t fini_invoked; - - /* resolve gid with getgrouplist() instead of /proc/%d/status */ - gf_boolean_t resolve_gids; - - /* Enable or disable capability support */ - gf_boolean_t capability; - - /* Enable or disable event history */ - gf_boolean_t event_history; - - /* whether to run the unmount daemon */ - gf_boolean_t auto_unmount; - - /* Load the thin volfile, and connect to gfproxyd*/ - gf_boolean_t thin_client; - gf_boolean_t mount_finished; - gf_boolean_t handle_graph_switch; - pthread_cond_t migrate_cond; - - /* Writeback cache support */ - gf_boolean_t kernel_writeback_cache; - int attr_times_granularity; + int fd; + uint32_t proto_minor; + char *volfile; + size_t volfile_size; + char *mount_point; + struct iobuf *iobuf; + + pthread_t *fuse_thread; + uint32_t reader_thread_count; + char fuse_thread_started; + + uint32_t direct_io_mode; + size_t *msg0_len_p; + + double entry_timeout; + double negative_timeout; + double attribute_timeout; + + pthread_cond_t sync_cond; + pthread_mutex_t sync_mutex; + char event_recvd; + + char init_recvd; + + gf_boolean_t strict_volfile_check; + + fuse_handler_t **fuse_ops; + fuse_handler_t **fuse_ops0; + pthread_mutex_t fuse_dump_mutex; + int fuse_dump_fd; + + glusterfs_graph_t *next_graph; + xlator_t *active_subvol; + + pid_t client_pid; + gf_boolean_t client_pid_set; + unsigned uid_map_root; + gf_boolean_t acl; + gf_boolean_t selinux; + gf_boolean_t read_only; + int32_t fopen_keep_cache; + int32_t gid_cache_timeout; + gf_boolean_t enable_ino32; + /* This is the mount option for disabling the root-squash for the + mount irrespective of whether the root-squash option for the + volume is set or not. But this option is honoured only for + thr trusted clients. For non trusted clients this value does + not have any affect and the volume option for root-squash is + honoured. + */ + gf_boolean_t no_root_squash; + fdtable_t *fdtable; + gid_cache_t gid_cache; + char *fuse_mountopts; + + /* For fuse-reverse-validation */ + struct list_head invalidate_list; + pthread_cond_t invalidate_cond; + pthread_mutex_t invalidate_mutex; + gf_boolean_t reverse_fuse_thread_started; + + /* For communicating with separate mount thread. */ + int status_pipe[2]; + + /* for fuse queue length and congestion threshold */ + int background_qlen; + int congestion_threshold; + + /* for using fuse-kernel readdirp*/ + gf_boolean_t use_readdirp; + + /* fini started, helps prevent multiple epoll worker threads + * firing up the fini routine */ + gf_boolean_t fini_invoked; + + /* resolve gid with getgrouplist() instead of /proc/%d/status */ + gf_boolean_t resolve_gids; + + /* Enable or disable capability support */ + gf_boolean_t capability; + + /* Enable or disable event history */ + gf_boolean_t event_history; + + /* whether to run the unmount daemon */ + gf_boolean_t auto_unmount; + + /* Load the thin volfile, and connect to gfproxyd*/ + gf_boolean_t thin_client; + gf_boolean_t mount_finished; + gf_boolean_t handle_graph_switch; + pthread_cond_t migrate_cond; + + /* Writeback cache support */ + gf_boolean_t kernel_writeback_cache; + int attr_times_granularity; }; typedef struct fuse_private fuse_private_t; -#define INVAL_BUF_SIZE (sizeof (struct fuse_out_header) + \ - max (sizeof (struct fuse_notify_inval_inode_out), \ - sizeof (struct fuse_notify_inval_entry_out) + \ - NAME_MAX + 1)) - +#define INVAL_BUF_SIZE \ + (sizeof(struct fuse_out_header) + \ + max(sizeof(struct fuse_notify_inval_inode_out), \ + sizeof(struct fuse_notify_inval_entry_out) + NAME_MAX + 1)) struct fuse_invalidate_node { - char inval_buf[INVAL_BUF_SIZE]; - struct list_head next; + char inval_buf[INVAL_BUF_SIZE]; + struct list_head next; }; typedef struct fuse_invalidate_node fuse_invalidate_node_t; struct fuse_graph_switch_args { - xlator_t *this; - xlator_t *old_subvol; - xlator_t *new_subvol; + xlator_t *this; + xlator_t *old_subvol; + xlator_t *new_subvol; }; typedef struct fuse_graph_switch_args fuse_graph_switch_args_t; @@ -177,270 +176,284 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t; #define _FH_TO_FD(fh) ((fd_t *)(uintptr_t)(fh)) -#define FH_TO_FD(fh) ((_FH_TO_FD (fh))?(fd_ref (_FH_TO_FD (fh))):((fd_t *) 0)) +#define FH_TO_FD(fh) ((_FH_TO_FD(fh)) ? (fd_ref(_FH_TO_FD(fh))) : ((fd_t *)0)) /* Use the same logic as the Linux NFS-client */ -#define GF_FUSE_SQUASH_INO(ino) (((uint32_t) ino) ^ (ino >> 32)) - -#define FUSE_FOP(state, ret, op_num, fop, args ...) \ - do { \ - xlator_t *xl = NULL; \ - call_frame_t *frame = NULL; \ - \ - xl = state->active_subvol; \ - if (!xl) { \ - gf_log_callingfn (state->this->name, GF_LOG_ERROR, \ - "No active subvolume"); \ - send_fuse_err (state->this, state->finh, ENOENT); \ - free_fuse_state (state); \ - break; \ - } \ - \ - frame = get_call_frame_for_req (state); \ - if (!frame) { \ - /* This is not completely clean, as some \ - * earlier allocations might remain unfreed \ - * if we return at this point, but still \ - * better than trying to go on with a NULL \ - * frame ... \ - */ \ - send_fuse_err (state->this, state->finh, ENOMEM); \ - free_fuse_state (state); \ - /* ideally, need to 'return', but let the */ \ - /* calling function take care of it */ \ - break; \ - } \ - \ - frame->root->state = state; \ - frame->root->op = op_num; \ - frame->op = op_num; \ - \ - if (state->this->history) \ - gf_log_eh ("%"PRIu64", %s, path: (%s), gfid: " \ - "(%s)", frame->root->unique, \ - gf_fop_list[frame->root->op], \ - state->loc.path, \ - (state->fd == NULL)? \ - uuid_utoa (state->loc.gfid): \ - uuid_utoa (state->fd->inode->gfid)); \ - STACK_WIND (frame, ret, xl, xl->fops->fop, args); \ - } while (0) - -#define GF_SELECT_LOG_LEVEL(_errno) \ +#define GF_FUSE_SQUASH_INO(ino) (((uint32_t)ino) ^ (ino >> 32)) + +#define FUSE_FOP(state, ret, op_num, fop, args...) \ + do { \ + xlator_t *xl = NULL; \ + call_frame_t *frame = NULL; \ + \ + xl = state->active_subvol; \ + if (!xl) { \ + gf_log_callingfn(state->this->name, GF_LOG_ERROR, \ + "No active subvolume"); \ + send_fuse_err(state->this, state->finh, ENOENT); \ + free_fuse_state(state); \ + break; \ + } \ + \ + frame = get_call_frame_for_req(state); \ + if (!frame) { \ + /* This is not completely clean, as some \ + * earlier allocations might remain unfreed \ + * if we return at this point, but still \ + * better than trying to go on with a NULL \ + * frame ... \ + */ \ + send_fuse_err(state->this, state->finh, ENOMEM); \ + free_fuse_state(state); \ + /* ideally, need to 'return', but let the */ \ + /* calling function take care of it */ \ + break; \ + } \ + \ + frame->root->state = state; \ + frame->root->op = op_num; \ + frame->op = op_num; \ + \ + if (state->this->history) \ + gf_log_eh("%" PRIu64 \ + ", %s, path: (%s), gfid: " \ + "(%s)", \ + frame->root->unique, gf_fop_list[frame->root->op], \ + state->loc.path, \ + (state->fd == NULL) \ + ? uuid_utoa(state->loc.gfid) \ + : uuid_utoa(state->fd->inode->gfid)); \ + STACK_WIND(frame, ret, xl, xl->fops->fop, args); \ + } while (0) + +#define GF_SELECT_LOG_LEVEL(_errno) \ (((_errno == ENOENT) || (_errno == ESTALE))? \ GF_LOG_DEBUG) -#define GET_STATE(this, finh, state) \ - do { \ - state = get_fuse_state (this, finh); \ - if (!state) { \ - gf_log ("glusterfs-fuse", \ - GF_LOG_ERROR, \ - "FUSE message unique %"PRIu64" opcode %d:" \ - " state allocation failed", \ - finh->unique, finh->opcode); \ - \ - send_fuse_err (this, finh, ENOMEM); \ - GF_FREE (finh); \ - \ - return; \ - } \ - } while (0) - -#define FUSE_ENTRY_CREATE(this, priv, finh, state, fci, op) \ - do { \ - if (priv->proto_minor >= 12) \ - state->mode &= ~fci->umask; \ - if (priv->proto_minor >= 12 && priv->acl) { \ - state->xdata = dict_new (); \ - if (!state->xdata) { \ - gf_log ("glusterfs-fuse", \ - GF_LOG_WARNING, \ - "%s failed to allocate " \ - "a param dictionary", op); \ - send_fuse_err (this, finh, ENOMEM); \ - free_fuse_state (state); \ - return; \ - } \ - state->umask = fci->umask; \ - \ -/* TODO: remove this after 3.4.0 release. keeping it for the \ - sake of backward compatibility with old (3.3.[01]) \ - releases till then. */ \ - ret = dict_set_int16 (state->xdata, "umask", \ - fci->umask); \ - if (ret < 0) { \ - gf_log ("glusterfs-fuse", \ - GF_LOG_WARNING, \ - "%s Failed adding umask"\ - " to request", op); \ - send_fuse_err (this, finh, ENOMEM); \ - free_fuse_state (state); \ - return; \ - } \ - ret = dict_set_int16 (state->xdata, "mode", \ - fci->mode); \ - if (ret < 0) { \ - gf_log ("glusterfs-fuse", \ - GF_LOG_WARNING, \ - "%s Failed adding mode " \ - "to request", op); \ - send_fuse_err (this, finh, ENOMEM); \ - free_fuse_state (state); \ - return; \ - } \ - } \ - } while (0) - -#define fuse_log_eh_fop(this, state, frame, op_ret, op_errno) \ - do { \ - fuse_private_t *priv = this->private; \ - if (this->history && priv->event_history) { \ - if (state->fd) \ - gf_log_eh ("op_ret: %d, op_errno: %d, " \ - "%"PRIu64", %s () => %p, gfid: %s", \ - op_ret, op_errno, \ - frame->root->unique, \ - gf_fop_list[frame->root->op], \ - state->fd, \ - uuid_utoa (state->fd->inode->gfid)); \ - else \ - gf_log_eh ("op_ret: %d, op_errno: %d, " \ - "%"PRIu64", %s () => %s, gfid: %s", \ - op_ret, op_errno, \ - frame->root->unique, \ - gf_fop_list[frame->root->op], \ - state->loc.path, \ - uuid_utoa (state->loc.gfid)); \ - } \ - } while(0) - -#define fuse_log_eh(this, args...) \ - do { \ - fuse_private_t *priv = this->private; \ - if (this->history && priv->event_history) \ - gf_log_eh(args); \ - } while (0) +#define GET_STATE(this, finh, state) \ + do { \ + state = get_fuse_state(this, finh); \ + if (!state) { \ + gf_log("glusterfs-fuse", GF_LOG_ERROR, \ + "FUSE message unique %" PRIu64 \ + " opcode %d:" \ + " state allocation failed", \ + finh->unique, finh->opcode); \ + \ + send_fuse_err(this, finh, ENOMEM); \ + GF_FREE(finh); \ + \ + return; \ + } \ + } while (0) + +#define FUSE_ENTRY_CREATE(this, priv, finh, state, fci, op) \ + do { \ + if (priv->proto_minor >= 12) \ + state->mode &= ~fci->umask; \ + if (priv->proto_minor >= 12 && priv->acl) { \ + state->xdata = dict_new(); \ + if (!state->xdata) { \ + gf_log("glusterfs-fuse", GF_LOG_WARNING, \ + "%s failed to allocate " \ + "a param dictionary", \ + op); \ + send_fuse_err(this, finh, ENOMEM); \ + free_fuse_state(state); \ + return; \ + } \ + state->umask = fci->umask; \ + \ + /* TODO: remove this after 3.4.0 release. keeping it for the \ + sake of backward compatibility with old (3.3.[01]) \ + releases till then. */ \ + ret = dict_set_int16(state->xdata, "umask", fci->umask); \ + if (ret < 0) { \ + gf_log("glusterfs-fuse", GF_LOG_WARNING, \ + "%s Failed adding umask" \ + " to request", \ + op); \ + send_fuse_err(this, finh, ENOMEM); \ + free_fuse_state(state); \ + return; \ + } \ + ret = dict_set_int16(state->xdata, "mode", fci->mode); \ + if (ret < 0) { \ + gf_log("glusterfs-fuse", GF_LOG_WARNING, \ + "%s Failed adding mode " \ + "to request", \ + op); \ + send_fuse_err(this, finh, ENOMEM); \ + free_fuse_state(state); \ + return; \ + } \ + } \ + } while (0) + +#define fuse_log_eh_fop(this, state, frame, op_ret, op_errno) \ + do { \ + fuse_private_t *priv = this->private; \ + if (this->history && priv->event_history) { \ + if (state->fd) \ + gf_log_eh( \ + "op_ret: %d, op_errno: %d, " \ + "%" PRIu64 ", %s () => %p, gfid: %s", \ + op_ret, op_errno, frame->root->unique, \ + gf_fop_list[frame->root->op], state->fd, \ + uuid_utoa(state->fd->inode->gfid)); \ + else \ + gf_log_eh( \ + "op_ret: %d, op_errno: %d, " \ + "%" PRIu64 ", %s () => %s, gfid: %s", \ + op_ret, op_errno, frame->root->unique, \ + gf_fop_list[frame->root->op], state->loc.path, \ + uuid_utoa(state->loc.gfid)); \ + } \ + } while (0) + +#define fuse_log_eh(this, args...) \ + do { \ + fuse_private_t *priv = this->private; \ + if (this->history && priv->event_history) \ + gf_log_eh(args); \ + } while (0) static inline xlator_t * -fuse_active_subvol (xlator_t *fuse) +fuse_active_subvol(xlator_t *fuse) { - fuse_private_t *priv = NULL; + fuse_private_t *priv = NULL; - priv = fuse->private; + priv = fuse->private; - return priv->active_subvol; + return priv->active_subvol; } - typedef enum { - RESOLVE_MUST = 1, - RESOLVE_NOT, - RESOLVE_MAY, - RESOLVE_DONTCARE, - RESOLVE_EXACT + RESOLVE_MUST = 1, + RESOLVE_NOT, + RESOLVE_MAY, + RESOLVE_DONTCARE, + RESOLVE_EXACT } fuse_resolve_type_t; - typedef struct { - fuse_resolve_type_t type; - fd_t *fd; - char *path; - char *bname; - u_char gfid[16]; - inode_t *hint; - u_char pargfid[16]; - inode_t *parhint; - int op_ret; - int op_errno; - loc_t resolve_loc; + fuse_resolve_type_t type; + fd_t *fd; + char *path; + char *bname; + u_char gfid[16]; + inode_t *hint; + u_char pargfid[16]; + inode_t *parhint; + int op_ret; + int op_errno; + loc_t resolve_loc; } fuse_resolve_t; - typedef struct { - void *pool; - xlator_t *this; - xlator_t *active_subvol; - inode_table_t *itable; - loc_t loc; - loc_t loc2; - fuse_in_header_t *finh; - int32_t flags; - off_t off; - size_t size; - unsigned long nlookup; - fd_t *fd; - dict_t *xattr; - dict_t *xdata; - char *name; - char is_revalidate; - gf_boolean_t truncate_needed; - gf_lock_t lock; - uint64_t lk_owner; - - /* used within resolve_and_resume */ - /* */ - fuse_resolve_t resolve; - fuse_resolve_t resolve2; - - loc_t *loc_now; - fuse_resolve_t *resolve_now; - - void *resume_fn; - - int valid; - int mask; - dev_t rdev; - mode_t mode; - mode_t umask; - struct iatt attr; - struct gf_flock lk_lock; - struct iovec vector; - - uuid_t gfid; - uint32_t io_flags; - int32_t fd_no; - - gf_seek_what_t whence; - struct iobuf *iobuf; + void *pool; + xlator_t *this; + xlator_t *active_subvol; + inode_table_t *itable; + loc_t loc; + loc_t loc2; + fuse_in_header_t *finh; + int32_t flags; + off_t off; + size_t size; + unsigned long nlookup; + fd_t *fd; + dict_t *xattr; + dict_t *xdata; + char *name; + char is_revalidate; + gf_boolean_t truncate_needed; + gf_lock_t lock; + uint64_t lk_owner; + + /* used within resolve_and_resume */ + /* */ + fuse_resolve_t resolve; + fuse_resolve_t resolve2; + + loc_t *loc_now; + fuse_resolve_t *resolve_now; + + void *resume_fn; + + int valid; + int mask; + dev_t rdev; + mode_t mode; + mode_t umask; + struct iatt attr; + struct gf_flock lk_lock; + struct iovec vector; + + uuid_t gfid; + uint32_t io_flags; + int32_t fd_no; + + gf_seek_what_t whence; + struct iobuf *iobuf; } fuse_state_t; typedef struct { - uint32_t open_flags; - char migration_failed; - fd_t *activefd; + uint32_t open_flags; + char migration_failed; + fd_t *activefd; } fuse_fd_ctx_t; -typedef void (*fuse_resume_fn_t) (fuse_state_t *state); +typedef void (*fuse_resume_fn_t)(fuse_state_t *state); GF_MUST_CHECK int32_t -fuse_loc_fill (loc_t *loc, fuse_state_t *state, ino_t ino, - ino_t par, const char *name); -call_frame_t *get_call_frame_for_req (fuse_state_t *state); -fuse_state_t *get_fuse_state (xlator_t *this, fuse_in_header_t *finh); -void free_fuse_state (fuse_state_t *state); -void gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, - gf_boolean_t enable_ino32); -void gf_fuse_fill_dirent (gf_dirent_t *entry, struct fuse_dirent *fde, - gf_boolean_t enable_ino32); -uint64_t inode_to_fuse_nodeid (inode_t *inode); -xlator_t *fuse_active_subvol (xlator_t *fuse); -inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse); -int send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error); -int fuse_gfid_set (fuse_state_t *state); -int fuse_flip_xattr_ns (struct fuse_private *priv, char *okey, char **nkey); -fuse_fd_ctx_t * __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd); -fuse_fd_ctx_t * fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd); - -int fuse_resolve_and_resume (fuse_state_t *state, fuse_resume_fn_t fn); -int fuse_resolve_inode_init (fuse_state_t *state, fuse_resolve_t *resolve, - ino_t ino); -int fuse_resolve_entry_init (fuse_state_t *state, fuse_resolve_t *resolve, - ino_t par, char *name); -int fuse_resolve_fd_init (fuse_state_t *state, fuse_resolve_t *resolve, - fd_t *fd); -int fuse_ignore_xattr_set (fuse_private_t *priv, char *key); -void fuse_fop_resume (fuse_state_t *state); -int dump_history_fuse (circular_buffer_t *cb, void *data); -int fuse_check_selinux_cap_xattr (fuse_private_t *priv, char *name); +fuse_loc_fill(loc_t *loc, fuse_state_t *state, ino_t ino, ino_t par, + const char *name); +call_frame_t * +get_call_frame_for_req(fuse_state_t *state); +fuse_state_t * +get_fuse_state(xlator_t *this, fuse_in_header_t *finh); +void +free_fuse_state(fuse_state_t *state); +void +gf_fuse_stat2attr(struct iatt *st, struct fuse_attr *fa, + gf_boolean_t enable_ino32); +void +gf_fuse_fill_dirent(gf_dirent_t *entry, struct fuse_dirent *fde, + gf_boolean_t enable_ino32); +uint64_t +inode_to_fuse_nodeid(inode_t *inode); +xlator_t * +fuse_active_subvol(xlator_t *fuse); +inode_t * +fuse_ino_to_inode(uint64_t ino, xlator_t *fuse); +int +send_fuse_err(xlator_t *this, fuse_in_header_t *finh, int error); +int +fuse_gfid_set(fuse_state_t *state); +int +fuse_flip_xattr_ns(struct fuse_private *priv, char *okey, char **nkey); +fuse_fd_ctx_t * +__fuse_fd_ctx_check_n_create(xlator_t *this, fd_t *fd); +fuse_fd_ctx_t * +fuse_fd_ctx_check_n_create(xlator_t *this, fd_t *fd); + +int +fuse_resolve_and_resume(fuse_state_t *state, fuse_resume_fn_t fn); +int +fuse_resolve_inode_init(fuse_state_t *state, fuse_resolve_t *resolve, + ino_t ino); +int +fuse_resolve_entry_init(fuse_state_t *state, fuse_resolve_t *resolve, ino_t par, + char *name); +int +fuse_resolve_fd_init(fuse_state_t *state, fuse_resolve_t *resolve, fd_t *fd); +int +fuse_ignore_xattr_set(fuse_private_t *priv, char *key); +void +fuse_fop_resume(fuse_state_t *state); +int +dump_history_fuse(circular_buffer_t *cb, void *data); +int +fuse_check_selinux_cap_xattr(fuse_private_t *priv, char *name); #endif /* _GF_FUSE_BRIDGE_H_ */ diff --git a/xlators/mount/fuse/src/fuse-mem-types.h b/xlators/mount/fuse/src/fuse-mem-types.h index 721b9a347cf..5e6ab9308e0 100644 --- a/xlators/mount/fuse/src/fuse-mem-types.h +++ b/xlators/mount/fuse/src/fuse-mem-types.h @@ -14,17 +14,16 @@ #include "mem-types.h" enum gf_fuse_mem_types_ { - gf_fuse_mt_iovec = gf_common_mt_end + 1, - gf_fuse_mt_fuse_private_t, - gf_fuse_mt_char, - gf_fuse_mt_iov_base, - gf_fuse_mt_fuse_state_t, - gf_fuse_mt_fd_ctx_t, - gf_fuse_mt_graph_switch_args_t, - gf_fuse_mt_gids_t, - gf_fuse_mt_invalidate_node_t, - gf_fuse_mt_pthread_t, - gf_fuse_mt_end + gf_fuse_mt_iovec = gf_common_mt_end + 1, + gf_fuse_mt_fuse_private_t, + gf_fuse_mt_char, + gf_fuse_mt_iov_base, + gf_fuse_mt_fuse_state_t, + gf_fuse_mt_fd_ctx_t, + gf_fuse_mt_graph_switch_args_t, + gf_fuse_mt_gids_t, + gf_fuse_mt_invalidate_node_t, + gf_fuse_mt_pthread_t, + gf_fuse_mt_end }; #endif - diff --git a/xlators/nfs/server/src/acl3.h b/xlators/nfs/server/src/acl3.h index 3ccc587bd59..500d2ef6ae5 100644 --- a/xlators/nfs/server/src/acl3.h +++ b/xlators/nfs/server/src/acl3.h @@ -18,23 +18,23 @@ #define ACL3_SETACL 2 #define ACL3_PROC_COUNT 3 -#define GF_ACL3_PORT 38469 -#define GF_ACL GF_NFS"-ACL" +#define GF_ACL3_PORT 38469 +#define GF_ACL GF_NFS "-ACL" /* Flags for the getacl/setacl mode */ -#define NFS_ACL 0x0001 -#define NFS_ACLCNT 0x0002 -#define NFS_DFACL 0x0004 -#define NFS_DFACLCNT 0x0008 +#define NFS_ACL 0x0001 +#define NFS_ACLCNT 0x0002 +#define NFS_DFACL 0x0004 +#define NFS_DFACLCNT 0x0008 /* * NFSv3, identifies the default ACL by NFS_ACL_DEFAULT. Gluster * NFS needs to mask it OFF before sending it up to POSIX layer * or File system layer. */ -#define NFS_ACL_DEFAULT 0x1000 +#define NFS_ACL_DEFAULT 0x1000 -#define NFS_ACL_MAX_ENTRIES 1024 +#define NFS_ACL_MAX_ENTRIES 1024 rpcsvc_program_t * acl3svc_init(xlator_t *nfsx); diff --git a/xlators/nfs/server/src/auth-cache.h b/xlators/nfs/server/src/auth-cache.h index fa0b5d89676..d48c6f64e43 100644 --- a/xlators/nfs/server/src/auth-cache.h +++ b/xlators/nfs/server/src/auth-cache.h @@ -21,33 +21,32 @@ #include "nfs3.h" struct auth_cache { - gf_lock_t lock; /* locking for the dict (and entries) */ - dict_t *cache_dict; /* Dict holding fh -> authcache_entry */ - time_t ttl_sec; /* TTL of the auth cache in seconds */ + gf_lock_t lock; /* locking for the dict (and entries) */ + dict_t *cache_dict; /* Dict holding fh -> authcache_entry */ + time_t ttl_sec; /* TTL of the auth cache in seconds */ }; - /* Initializes the cache */ struct auth_cache * -auth_cache_init (time_t ttl_sec); +auth_cache_init(time_t ttl_sec); /* Inserts FH into cache */ int -cache_nfs_fh (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr, struct export_item *export_item); +cache_nfs_fh(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr, struct export_item *export_item); /* Checks if the filehandle cached & writable */ gf_boolean_t -is_nfs_fh_cached_and_writeable (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr); +is_nfs_fh_cached_and_writeable(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); /* Checks if the filehandle is cached */ gf_boolean_t -is_nfs_fh_cached (struct auth_cache *cache, struct nfs3_fh *fh, - const char *host_addr); +is_nfs_fh_cached(struct auth_cache *cache, struct nfs3_fh *fh, + const char *host_addr); /* Purge the cache */ void -auth_cache_purge (struct auth_cache *cache); +auth_cache_purge(struct auth_cache *cache); #endif /* _AUTH_CACHE_H_ */ diff --git a/xlators/nfs/server/src/exports.h b/xlators/nfs/server/src/exports.h index 87795dadaee..d44e32e3f74 100644 --- a/xlators/nfs/server/src/exports.h +++ b/xlators/nfs/server/src/exports.h @@ -19,19 +19,19 @@ #include "dict.h" #include "nfs.h" -#define GF_EXP GF_NFS"-exports" +#define GF_EXP GF_NFS "-exports" -#define NETGROUP_REGEX_PATTERN "(@([a-zA-Z0-9\\(=, .])+)())" -#define HOSTNAME_REGEX_PATTERN "[[:space:]]([a-zA-Z0-9.\\(=,*/:)-]+)" -#define OPTIONS_REGEX_PATTERN "([a-zA-Z0-9=\\.]+)" +#define NETGROUP_REGEX_PATTERN "(@([a-zA-Z0-9\\(=, .])+)())" +#define HOSTNAME_REGEX_PATTERN "[[:space:]]([a-zA-Z0-9.\\(=,*/:)-]+)" +#define OPTIONS_REGEX_PATTERN "([a-zA-Z0-9=\\.]+)" -#define NETGROUP_MAX_LEN 128 -#define FQDN_MAX_LEN 256 +#define NETGROUP_MAX_LEN 128 +#define FQDN_MAX_LEN 256 -#define SEC_OPTION_MAX 10 -#define UID_MAX_LEN 6 +#define SEC_OPTION_MAX 10 +#define UID_MAX_LEN 6 -#define DIR_MAX_LEN 1024 +#define DIR_MAX_LEN 1024 /* The following 2 definitions are in mount3.h * but we don't want to include it because mount3.h @@ -41,53 +41,53 @@ struct mount3_state; extern struct mnt3_export * -mnt3_mntpath_to_export (struct mount3_state *ms, const char *dirpath, - gf_boolean_t export_parsing_match); +mnt3_mntpath_to_export(struct mount3_state *ms, const char *dirpath, + gf_boolean_t export_parsing_match); struct export_options { - gf_boolean_t rw; /* Read-write option */ - gf_boolean_t nosuid; /* nosuid option */ - gf_boolean_t root; /* root option */ - char *anon_uid; /* anonuid option */ - char *sec_type; /* X, for sec=X */ + gf_boolean_t rw; /* Read-write option */ + gf_boolean_t nosuid; /* nosuid option */ + gf_boolean_t root; /* root option */ + char *anon_uid; /* anonuid option */ + char *sec_type; /* X, for sec=X */ }; struct export_item { - char *name; /* Name of the export item */ - struct export_options *opts; /* NFS Options */ - GF_REF_DECL; + char *name; /* Name of the export item */ + struct export_options *opts; /* NFS Options */ + GF_REF_DECL; }; struct export_dir { - char *dir_name; /* Directory */ - dict_t *netgroups; /* Dict of netgroups */ - dict_t *hosts; /* Dict of hosts */ + char *dir_name; /* Directory */ + dict_t *netgroups; /* Dict of netgroups */ + dict_t *hosts; /* Dict of hosts */ }; struct exports_file { - char *filename; /* Filename */ - dict_t *exports_dict; /* Dict of export_dir_t */ - dict_t *exports_map; /* Map of SuperFastHash(<export>) -> expdir */ + char *filename; /* Filename */ + dict_t *exports_dict; /* Dict of export_dir_t */ + dict_t *exports_map; /* Map of SuperFastHash(<export>) -> expdir */ }; void -exp_file_deinit (struct exports_file *expfile); +exp_file_deinit(struct exports_file *expfile); int -exp_file_parse (const char *filepath, struct exports_file **expfile, - struct mount3_state *ms); +exp_file_parse(const char *filepath, struct exports_file **expfile, + struct mount3_state *ms); struct export_dir * -exp_file_get_dir (const struct exports_file *file, const char *dir); +exp_file_get_dir(const struct exports_file *file, const char *dir); struct export_item * -exp_dir_get_host (const struct export_dir *expdir, const char *host); +exp_dir_get_host(const struct export_dir *expdir, const char *host); struct export_item * -exp_dir_get_netgroup (const struct export_dir *expdir, const char *netgroup); +exp_dir_get_netgroup(const struct export_dir *expdir, const char *netgroup); struct export_dir * -exp_file_dir_from_uuid (const struct exports_file *file, - const uuid_t export_uuid); +exp_file_dir_from_uuid(const struct exports_file *file, + const uuid_t export_uuid); -#endif /* _EXPORTS_H_ */ +#endif /* _EXPORTS_H_ */ diff --git a/xlators/nfs/server/src/mount3-auth.h b/xlators/nfs/server/src/mount3-auth.h index b25d4724fac..e50af5847d3 100644 --- a/xlators/nfs/server/src/mount3-auth.h +++ b/xlators/nfs/server/src/mount3-auth.h @@ -21,39 +21,39 @@ #include "mount3.h" #include "nfs.h" -#define GF_MNT_AUTH GF_NFS"-mount3-auth" +#define GF_MNT_AUTH GF_NFS "-mount3-auth" struct mnt3_auth_params { - struct netgroups_file *ngfile; /* The netgroup file to auth against */ - struct exports_file *expfile; /* The export file to auth against */ - struct mount3_state *ms; /* The mount state that owns this */ + struct netgroups_file *ngfile; /* The netgroup file to auth against */ + struct exports_file *expfile; /* The export file to auth against */ + struct mount3_state *ms; /* The mount state that owns this */ }; /* Initialize auth params struct */ struct mnt3_auth_params * -mnt3_auth_params_init (struct mount3_state *ms); +mnt3_auth_params_init(struct mount3_state *ms); /* Set the netgroups file to use in the auth */ int -mnt3_auth_set_netgroups_auth (struct mnt3_auth_params *aps, - const char *filename); +mnt3_auth_set_netgroups_auth(struct mnt3_auth_params *aps, + const char *filename); /* Set the exports file to use in the auth */ int -mnt3_auth_set_exports_auth (struct mnt3_auth_params *aps, const char *filename); +mnt3_auth_set_exports_auth(struct mnt3_auth_params *aps, const char *filename); /* Check if a host is authorized to perform a mount / nfs-fop */ int -mnt3_auth_host (const struct mnt3_auth_params *aps, const char *host, - struct nfs3_fh *fh, const char *dir, gf_boolean_t is_write_op, - struct export_item **save_item); +mnt3_auth_host(const struct mnt3_auth_params *aps, const char *host, + struct nfs3_fh *fh, const char *dir, gf_boolean_t is_write_op, + struct export_item **save_item); /* Free resources used by the auth params struct */ void -mnt3_auth_params_deinit (struct mnt3_auth_params *aps); +mnt3_auth_params_deinit(struct mnt3_auth_params *aps); int -mnt3_auth_fop_options_verify (const struct mnt3_auth_params *auth_params, - const char *host, const char *dir); +mnt3_auth_fop_options_verify(const struct mnt3_auth_params *auth_params, + const char *host, const char *dir); #endif /* _MOUNT3_AUTH */ diff --git a/xlators/nfs/server/src/mount3.h b/xlators/nfs/server/src/mount3.h index 8868aec787a..9b0f73e3af7 100644 --- a/xlators/nfs/server/src/mount3.h +++ b/xlators/nfs/server/src/mount3.h @@ -26,163 +26,163 @@ #include "auth-cache.h" /* Registered with portmap */ -#define GF_MOUNTV3_PORT 38465 -#define GF_MOUNTV3_IOB (2 * GF_UNIT_KB) -#define GF_MOUNTV3_IOBPOOL (GF_MOUNTV3_IOB * 50) +#define GF_MOUNTV3_PORT 38465 +#define GF_MOUNTV3_IOB (2 * GF_UNIT_KB) +#define GF_MOUNTV3_IOBPOOL (GF_MOUNTV3_IOB * 50) -#define GF_MOUNTV1_PORT 38466 -#define GF_MNT GF_NFS"-mount" +#define GF_MOUNTV1_PORT 38466 +#define GF_MNT GF_NFS "-mount" extern rpcsvc_program_t * -mnt3svc_init (xlator_t *nfsx); +mnt3svc_init(xlator_t *nfsx); extern rpcsvc_program_t * -mnt1svc_init (xlator_t *nfsx); +mnt1svc_init(xlator_t *nfsx); extern void -mnt3svc_deinit (xlator_t *nfsx); +mnt3svc_deinit(xlator_t *nfsx); extern int -mount_init_state (xlator_t *nfsx); +mount_init_state(xlator_t *nfsx); extern int -mount_reconfigure_state (xlator_t *nfsx, dict_t *options); +mount_reconfigure_state(xlator_t *nfsx, dict_t *options); void -mount_rewrite_rmtab (struct mount3_state *ms, char *new_rmtab); +mount_rewrite_rmtab(struct mount3_state *ms, char *new_rmtab); struct mnt3_export * -mnt3_mntpath_to_export (struct mount3_state *ms, const char *dirpath, - gf_boolean_t export_parsing_match); +mnt3_mntpath_to_export(struct mount3_state *ms, const char *dirpath, + gf_boolean_t export_parsing_match); extern int -mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req, - const char *expname, const char *fullpath); +mnt3svc_update_mountlist(struct mount3_state *ms, rpcsvc_request_t *req, + const char *expname, const char *fullpath); int -mnt3_authenticate_request (struct mount3_state *ms, rpcsvc_request_t *req, - struct nfs3_fh *fh, const char *volname, - const char *path, char **authorized_path, - char **authorized_host, gf_boolean_t is_write_op); +mnt3_authenticate_request(struct mount3_state *ms, rpcsvc_request_t *req, + struct nfs3_fh *fh, const char *volname, + const char *path, char **authorized_path, + char **authorized_host, gf_boolean_t is_write_op); /* Data structure used to store the list of mounts points currently * in use by NFS clients. */ struct mountentry { - /* Links to mount3_state->mountlist. */ - struct list_head mlist; + /* Links to mount3_state->mountlist. */ + struct list_head mlist; - /* The export name */ - char exname[MNTPATHLEN]; - char hostname[MNTPATHLEN]; - char fullpath[MNTPATHLEN]; + /* The export name */ + char exname[MNTPATHLEN]; + char hostname[MNTPATHLEN]; + char fullpath[MNTPATHLEN]; - gf_boolean_t has_full_path; + gf_boolean_t has_full_path; - /* Since this is stored in a dict, we want to be able - * to find easily get the key we used to store - * the struct in our dict - */ - char hashkey[MNTPATHLEN*2+2]; + /* Since this is stored in a dict, we want to be able + * to find easily get the key we used to store + * the struct in our dict + */ + char hashkey[MNTPATHLEN * 2 + 2]; }; -#define MNT3_EXPTYPE_VOLUME 1 -#define MNT3_EXPTYPE_DIR 2 +#define MNT3_EXPTYPE_VOLUME 1 +#define MNT3_EXPTYPE_DIR 2 /* Structure to hold export-dir AUTH parameter */ struct host_auth_spec { - char *host_addr; /* Allowed IP or host name */ - uint32_t netmask; /* Network mask (Big-Endian) */ - struct host_auth_spec *next; /* Pointer to next AUTH struct */ + char *host_addr; /* Allowed IP or host name */ + uint32_t netmask; /* Network mask (Big-Endian) */ + struct host_auth_spec *next; /* Pointer to next AUTH struct */ }; struct mnt3_export { - struct list_head explist; - - /* The string that may contain either the volume name if the full volume - * is exported or the subdirectory in the volume. - */ - char *expname; - /* - * IP address, hostname or subnets who are allowed to connect to expname - * subvolume or subdirectory - */ - struct host_auth_spec* hostspec; - xlator_t *vol; - int exptype; - - /* This holds the full path that the client requested including - * the volume name AND the subdirectory in the volume. - */ - char *fullpath; - - /* Extracted from nfs volume options if nfs.dynamicvolumes is on. - */ - uuid_t volumeid; - uuid_t mountid; + struct list_head explist; + + /* The string that may contain either the volume name if the full volume + * is exported or the subdirectory in the volume. + */ + char *expname; + /* + * IP address, hostname or subnets who are allowed to connect to expname + * subvolume or subdirectory + */ + struct host_auth_spec *hostspec; + xlator_t *vol; + int exptype; + + /* This holds the full path that the client requested including + * the volume name AND the subdirectory in the volume. + */ + char *fullpath; + + /* Extracted from nfs volume options if nfs.dynamicvolumes is on. + */ + uuid_t volumeid; + uuid_t mountid; }; struct mount3_state { - xlator_t *nfsx; + xlator_t *nfsx; - /* The NFS state that this belongs to */ - struct nfs_state *nfs; + /* The NFS state that this belongs to */ + struct nfs_state *nfs; - /* The buffers for all network IO are got from this pool. */ - struct iobuf_pool *iobpool; + /* The buffers for all network IO are got from this pool. */ + struct iobuf_pool *iobpool; - /* List of exports, can be volumes or directories in those volumes. */ - struct list_head exportlist; + /* List of exports, can be volumes or directories in those volumes. */ + struct list_head exportlist; - /* List of current mount points over all the exports from this - * server. - */ - struct list_head mountlist; + /* List of current mount points over all the exports from this + * server. + */ + struct list_head mountlist; - /* Dict of current mount points over all the exports from this - * server. Mirrors the mountlist above, but can be used for - * faster lookup in the event that there are several mounts. - * Currently, each NFSOP is validated against this dict: each - * op is checked to see if the host that operates on the path - * does in fact have an entry in the mount dict. - */ - dict_t *mountdict; + /* Dict of current mount points over all the exports from this + * server. Mirrors the mountlist above, but can be used for + * faster lookup in the event that there are several mounts. + * Currently, each NFSOP is validated against this dict: each + * op is checked to see if the host that operates on the path + * does in fact have an entry in the mount dict. + */ + dict_t *mountdict; - /* Used to protect the mountlist & the mount dict */ - gf_lock_t mountlock; + /* Used to protect the mountlist & the mount dict */ + gf_lock_t mountlock; - /* Used to insert additional authentication parameters */ - struct mnt3_auth_params *auth_params; + /* Used to insert additional authentication parameters */ + struct mnt3_auth_params *auth_params; - /* Set to 0 if exporting full volumes is disabled. On by default. */ - gf_boolean_t export_volumes; - gf_boolean_t export_dirs; + /* Set to 0 if exporting full volumes is disabled. On by default. */ + gf_boolean_t export_volumes; + gf_boolean_t export_dirs; - pthread_t auth_refresh_thread; - gf_boolean_t stop_refresh; + pthread_t auth_refresh_thread; + gf_boolean_t stop_refresh; - struct auth_cache *authcache; + struct auth_cache *authcache; }; -#define gf_mnt3_export_dirs(mst) ((mst)->export_dirs) +#define gf_mnt3_export_dirs(mst) ((mst)->export_dirs) struct mount3_resolve_state { - struct mnt3_export *exp; - struct mount3_state *mstate; - rpcsvc_request_t *req; + struct mnt3_export *exp; + struct mount3_state *mstate; + rpcsvc_request_t *req; - char remainingdir[MNTPATHLEN]; - loc_t resolveloc; - struct nfs3_fh parentfh; + char remainingdir[MNTPATHLEN]; + loc_t resolveloc; + struct nfs3_fh parentfh; }; typedef struct mount3_resolve_state mnt3_resolve_t; int -mnt3_parse_dir_exports (rpcsvc_request_t *req, struct mount3_state *ms, - char *subdir, gf_boolean_t send_reply); +mnt3_parse_dir_exports(rpcsvc_request_t *req, struct mount3_state *ms, + char *subdir, gf_boolean_t send_reply); -char* -mnt3_get_volume_subdir (char *path, char **volname); +char * +mnt3_get_volume_subdir(char *path, char **volname); #endif diff --git a/xlators/nfs/server/src/netgroups.h b/xlators/nfs/server/src/netgroups.h index 6044abfabb3..1bb666b9596 100644 --- a/xlators/nfs/server/src/netgroups.h +++ b/xlators/nfs/server/src/netgroups.h @@ -19,36 +19,35 @@ #include "dict.h" #include "nfs.h" -#define GF_NG GF_NFS"-netgroup" +#define GF_NG GF_NFS "-netgroup" #define NG_FILE_PARSE_REGEX "([a-zA-Z0-9.(,)-]+)" #define NG_HOST_PARSE_REGEX "([a-zA-Z0-9.-]+)" struct netgroup_host { - char *hostname; /* Hostname of entry */ - char *user; /* User field in the entry */ - char *domain; /* Domain field in the entry */ + char *hostname; /* Hostname of entry */ + char *user; /* User field in the entry */ + char *domain; /* Domain field in the entry */ }; struct netgroup_entry { - char *netgroup_name; /* Name of the netgroup */ - dict_t *netgroup_ngs; /* Dict of netgroups in this netgroup */ - dict_t *netgroup_hosts; /* Dict of hosts in this netgroup. */ + char *netgroup_name; /* Name of the netgroup */ + dict_t *netgroup_ngs; /* Dict of netgroups in this netgroup */ + dict_t *netgroup_hosts; /* Dict of hosts in this netgroup. */ }; struct netgroups_file { - char *filename; /* Filename on disk */ - dict_t *ng_file_dict; /* Dict of netgroup entries */ + char *filename; /* Filename on disk */ + dict_t *ng_file_dict; /* Dict of netgroup entries */ }; struct netgroups_file * -ng_file_parse (const char *filepath); +ng_file_parse(const char *filepath); struct netgroup_entry * -ng_file_get_netgroup (const struct netgroups_file *ngfile, - const char *netgroup); +ng_file_get_netgroup(const struct netgroups_file *ngfile, const char *netgroup); void -ng_file_deinit (struct netgroups_file *ngfile); +ng_file_deinit(struct netgroups_file *ngfile); #endif /* _NETGROUPS_H */ diff --git a/xlators/nfs/server/src/nfs-common.h b/xlators/nfs/server/src/nfs-common.h index 8c9a1e33457..46147757ef5 100644 --- a/xlators/nfs/server/src/nfs-common.h +++ b/xlators/nfs/server/src/nfs-common.h @@ -18,57 +18,56 @@ #include "iatt.h" #include "compat-uuid.h" -//NFS_PATH_MAX hard-coded to 4096 as a work around for bug 2476. -//nfs server crashes when path received is longer than PATH_MAX -#define NFS_PATH_MAX 4096 -#define NFS_NAME_MAX NAME_MAX +// NFS_PATH_MAX hard-coded to 4096 as a work around for bug 2476. +// nfs server crashes when path received is longer than PATH_MAX +#define NFS_PATH_MAX 4096 +#define NFS_NAME_MAX NAME_MAX #define NFS_DEFAULT_CREATE_MODE 0600 extern xlator_t * -nfs_xlid_to_xlator (xlator_list_t *cl, uint8_t xlid); +nfs_xlid_to_xlator(xlator_list_t *cl, uint8_t xlid); extern uint16_t -nfs_xlator_to_xlid (xlator_list_t *cl, xlator_t *xl); +nfs_xlator_to_xlid(xlator_list_t *cl, xlator_t *xl); extern xlator_t * -nfs_path_to_xlator (xlator_list_t *cl, char *path); +nfs_path_to_xlator(xlator_list_t *cl, char *path); extern xlator_t * -nfs_mntpath_to_xlator (xlator_list_t *cl, char *path); +nfs_mntpath_to_xlator(xlator_list_t *cl, char *path); extern void -nfs_loc_wipe (loc_t *loc); +nfs_loc_wipe(loc_t *loc); extern int -nfs_loc_copy (loc_t *dst, loc_t *src); +nfs_loc_copy(loc_t *dst, loc_t *src); extern int -nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path); +nfs_loc_fill(loc_t *loc, inode_t *inode, inode_t *parent, char *path); -#define NFS_RESOLVE_EXIST 1 -#define NFS_RESOLVE_CREATE 2 +#define NFS_RESOLVE_EXIST 1 +#define NFS_RESOLVE_CREATE 2 extern int -nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how); +nfs_inode_loc_fill(inode_t *inode, loc_t *loc, int how); extern int -nfs_ino_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *l); +nfs_ino_loc_fill(inode_table_t *itable, uuid_t gfid, loc_t *l); extern int -nfs_entry_loc_fill (xlator_t *this, inode_table_t *itable, uuid_t pargfid, - char *entry, loc_t *loc, int how, - gf_boolean_t *freshlookup); +nfs_entry_loc_fill(xlator_t *this, inode_table_t *itable, uuid_t pargfid, + char *entry, loc_t *loc, int how, gf_boolean_t *freshlookup); extern int -nfs_root_loc_fill (inode_table_t *itable, loc_t *loc); +nfs_root_loc_fill(inode_table_t *itable, loc_t *loc); extern uint32_t -nfs_hash_gfid (uuid_t gfid); +nfs_hash_gfid(uuid_t gfid); extern int -nfs_gfid_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *loc, int how); +nfs_gfid_loc_fill(inode_table_t *itable, uuid_t gfid, loc_t *loc, int how); void -nfs_fix_generation (xlator_t *this, inode_t *inode); +nfs_fix_generation(xlator_t *this, inode_t *inode); #endif diff --git a/xlators/nfs/server/src/nfs-fops.h b/xlators/nfs/server/src/nfs-fops.h index acf81e2ce12..1f7c3b2d1f9 100644 --- a/xlators/nfs/server/src/nfs-fops.h +++ b/xlators/nfs/server/src/nfs-fops.h @@ -38,207 +38,205 @@ * That is initiated in nfs_init_subvolumes in nfs.c. */ struct nfs_fop_local { - /* The local sent along by the user of the fop. */ - void *proglocal; - - /* The address of the callback supplied by the user. After our - * callback is executed this one is called. - * The exact cast destination of this pointer will depend on the - * fop that is being called. - */ - void *progcbk; - - /* Used only for write requests. */ - struct iobref *iobref; - - inode_t *parent; - inode_t *newparent; - inode_t *inode; - - /* Set to 1 by nfs-inodes layer, which uses this to decide whether to - * link the newly allocated inode into the itable, in case the fop was - * successful. - */ - int newinode; - - /* Used by nfs-fops layer in order to determine whether to funge the - * ino in a dir's stbuf. This funging of root ino is needed to ensure - * that the root ino remains 1 even when the NFS server has been - * restarted. Note that in distribute, a fresh lookup and a revalidate - * on the root inode returns two different inode numbers and this we - * need to handle by ourself. - */ - int rootinode; - - /* This member is used to determine whether the new parent of a file - * being renamed is the root directory. If yes, the ino is funged. - */ - int newrootinode; - int newrootparentinode; - - /* Determines whether to funge the ino in the post and pre parent - * stbufs for a file/dir where the parent directory could be the root - * dir. Needed here because of the same reason as above. - */ - int rootparentinode; - - char path[NFS_NAME_MAX + 1]; - char newpath[NFS_NAME_MAX + 1]; - xlator_t *nfsx; - dict_t *dictgfid; - - fd_t *fd; - int cmd; - struct gf_flock flock; + /* The local sent along by the user of the fop. */ + void *proglocal; + + /* The address of the callback supplied by the user. After our + * callback is executed this one is called. + * The exact cast destination of this pointer will depend on the + * fop that is being called. + */ + void *progcbk; + + /* Used only for write requests. */ + struct iobref *iobref; + + inode_t *parent; + inode_t *newparent; + inode_t *inode; + + /* Set to 1 by nfs-inodes layer, which uses this to decide whether to + * link the newly allocated inode into the itable, in case the fop was + * successful. + */ + int newinode; + + /* Used by nfs-fops layer in order to determine whether to funge the + * ino in a dir's stbuf. This funging of root ino is needed to ensure + * that the root ino remains 1 even when the NFS server has been + * restarted. Note that in distribute, a fresh lookup and a revalidate + * on the root inode returns two different inode numbers and this we + * need to handle by ourself. + */ + int rootinode; + + /* This member is used to determine whether the new parent of a file + * being renamed is the root directory. If yes, the ino is funged. + */ + int newrootinode; + int newrootparentinode; + + /* Determines whether to funge the ino in the post and pre parent + * stbufs for a file/dir where the parent directory could be the root + * dir. Needed here because of the same reason as above. + */ + int rootparentinode; + + char path[NFS_NAME_MAX + 1]; + char newpath[NFS_NAME_MAX + 1]; + xlator_t *nfsx; + dict_t *dictgfid; + + fd_t *fd; + int cmd; + struct gf_flock flock; }; extern struct nfs_fop_local * -nfs_fop_local_init (xlator_t *xl); +nfs_fop_local_init(xlator_t *xl); extern void -nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l); - -#define nfs_state(nfsxl) (nfsxl)->private -#define nfs_fop_mempool(nfxl) (((struct nfs_state *)nfs_state(nfxl))->foppool) - -#define prog_data_to_nfl(nf,nflocal, fram, pcbk, plocal) \ - do { \ - nflocal = nfs_fop_local_init (nf); \ - if (nflocal) { \ - nflocal->proglocal = plocal; \ - nflocal->progcbk = *VOID(&pcbk); \ - nflocal->nfsx = nf; \ - if (fram) \ - ((call_frame_t *)fram)->local = nflocal;\ - } \ - } while (0) \ - - - -#define nfl_to_prog_data(nflocal, pcbk, fram) \ - do { \ - nflocal = fram->local; \ - fram->local = nflocal->proglocal; \ - pcbk = nflocal->progcbk; \ - } while (0) \ - -#define nfs_fop_handle_local_init(fram,nfx, nfloc, cbck,prgloc,retval,lab) \ - do { \ - prog_data_to_nfl (nfx, nfloc, fram, cbck, prgloc); \ - if (!nfloc) { \ - gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM, \ - NFS_MSG_NO_MEMORY, "Failed to init local"); \ - retval = -ENOMEM; \ - goto lab; \ - } \ - } while (0) \ - -extern int -nfs_fop_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_stat_cbk_t cbk, void *local); +nfs_fop_local_wipe(xlator_t *xl, struct nfs_fop_local *l); + +#define nfs_state(nfsxl) (nfsxl)->private +#define nfs_fop_mempool(nfxl) (((struct nfs_state *)nfs_state(nfxl))->foppool) + +#define prog_data_to_nfl(nf, nflocal, fram, pcbk, plocal) \ + do { \ + nflocal = nfs_fop_local_init(nf); \ + if (nflocal) { \ + nflocal->proglocal = plocal; \ + nflocal->progcbk = *VOID(&pcbk); \ + nflocal->nfsx = nf; \ + if (fram) \ + ((call_frame_t *)fram)->local = nflocal; \ + } \ + } while (0) + +#define nfl_to_prog_data(nflocal, pcbk, fram) \ + do { \ + nflocal = fram->local; \ + fram->local = nflocal->proglocal; \ + pcbk = nflocal->progcbk; \ + } while (0) + +#define nfs_fop_handle_local_init(fram, nfx, nfloc, cbck, prgloc, retval, lab) \ + do { \ + prog_data_to_nfl(nfx, nfloc, fram, cbck, prgloc); \ + if (!nfloc) { \ + gf_msg(GF_NFS, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY, \ + "Failed to init local"); \ + retval = -ENOMEM; \ + goto lab; \ + } \ + } while (0) + +extern int +nfs_fop_fstat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_stat_cbk_t cbk, void *local); extern int -nfs_fop_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, - size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, - void *local); +nfs_fop_readdirp(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, + size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, + void *local); extern int -nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_lookup_cbk_t cbk, void *local); +nfs_fop_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_lookup_cbk_t cbk, void *local); extern int -nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk, - void *local); +nfs_fop_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk, + void *local); extern int -nfs_fop_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_flush_cbk_t cbk, void *local); +nfs_fop_flush(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_flush_cbk_t cbk, void *local); extern int -nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, fop_mkdir_cbk_t cbk, void *local); +nfs_fop_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_fop_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - off_t offset, fop_truncate_cbk_t cbk, void *local); +nfs_fop_truncate(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + off_t offset, fop_truncate_cbk_t cbk, void *local); extern int -nfs_fop_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - size_t size, off_t offset, fop_readv_cbk_t cbk, void *local); +nfs_fop_read(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + size_t size, off_t offset, fop_readv_cbk_t cbk, void *local); extern int -nfs_fop_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int32_t datasync, fop_fsync_cbk_t cbk, void *local); +nfs_fop_fsync(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + int32_t datasync, fop_fsync_cbk_t cbk, void *local); extern int -nfs_fop_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - struct iobref *srciobref, struct iovec *vector, int32_t count, - off_t offset, fop_writev_cbk_t cbk, void *local); +nfs_fop_write(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + struct iobref *srciobref, struct iovec *vector, int32_t count, + off_t offset, fop_writev_cbk_t cbk, void *local); extern int -nfs_fop_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t flags, fd_t *fd, fop_open_cbk_t cbk, - void *local); +nfs_fop_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t flags, fd_t *fd, fop_open_cbk_t cbk, void *local); extern int -nfs_fop_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_fop_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_fop_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_fop_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_fop_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_fop_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_fop_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_fop_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_fop_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_fop_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - size_t size, fop_readlink_cbk_t cbk, void *local); +nfs_fop_readlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + size_t size, fop_readlink_cbk_t cbk, void *local); extern int -nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); +nfs_fop_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); extern int -nfs_fop_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, - void *local); +nfs_fop_setattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, + void *local); extern int -nfs_fop_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_statfs_cbk_t cbk, void *local); +nfs_fop_statfs(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_statfs_cbk_t cbk, void *local); extern int -nfs_fop_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fd_t *dirfd, fop_opendir_cbk_t cbk, void *local); +nfs_fop_opendir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fd_t *dirfd, fop_opendir_cbk_t cbk, void *local); extern int -nfs_fop_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_stat_cbk_t cbk, void *local); +nfs_fop_stat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_stat_cbk_t cbk, void *local); extern int -nfs_fop_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t accesstest, fop_access_cbk_t cbk, void *local); +nfs_fop_access(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t accesstest, fop_access_cbk_t cbk, void *local); extern int -nfs_fop_lk (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int cmd, struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); +nfs_fop_lk(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int cmd, + struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); extern int -nfs_fop_getxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); +nfs_fop_getxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, + void *local); extern int -nfs_fop_setxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata, - fop_setxattr_cbk_t cbk, void *local); +nfs_fop_setxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata, + fop_setxattr_cbk_t cbk, void *local); #endif diff --git a/xlators/nfs/server/src/nfs-generics.h b/xlators/nfs/server/src/nfs-generics.h index c3fb4fca339..f71b45a513d 100644 --- a/xlators/nfs/server/src/nfs-generics.h +++ b/xlators/nfs/server/src/nfs-generics.h @@ -17,12 +17,12 @@ #include "nfs-inodes.h" struct nfs_direntcache { - gf_dirent_t entries; /* Head of list of cached dirents. */ - gf_dirent_t *next; /* Pointer to the next entry that - * should be sent by readdir */ - uint64_t prev_off; /* Offset where the next read will - * happen. - */ + gf_dirent_t entries; /* Head of list of cached dirents. */ + gf_dirent_t *next; /* Pointer to the next entry that + * should be sent by readdir */ + uint64_t prev_off; /* Offset where the next read will + * happen. + */ }; /* WE're trying to abstract the fops interface from the NFS xlator so that @@ -32,132 +32,130 @@ struct nfs_direntcache { * state is requires in the fd. E.g. the dirent cache for a directory fd_t. */ typedef struct nfs_fop_fdcontext { - pthread_mutex_t lock; - size_t dirent_bufsize; - off_t offset; - struct nfs_direntcache *dcache; - xlator_t *dirvol; + pthread_mutex_t lock; + size_t dirent_bufsize; + off_t offset; + struct nfs_direntcache *dcache; + xlator_t *dirvol; } nfs_fdctx_t; extern int -nfs_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_stat_cbk_t cbk, void *local); +nfs_fstat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_stat_cbk_t cbk, void *local); extern int -nfs_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, - size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local); - +nfs_readdirp(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, + size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local); extern int -nfs_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_lookup_cbk_t cbk, void *local); +nfs_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_lookup_cbk_t cbk, void *local); extern int -nfs_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int flags, mode_t mode, fop_create_cbk_t cbk, void *local); +nfs_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, mode_t mode, fop_create_cbk_t cbk, void *local); extern int -nfs_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - fop_flush_cbk_t cbk, void *local); +nfs_flush(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + fop_flush_cbk_t cbk, void *local); extern int -nfs_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, fop_mkdir_cbk_t cbk, void *local); +nfs_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - off_t offset, fop_truncate_cbk_t cbk, void *local); +nfs_truncate(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + off_t offset, fop_truncate_cbk_t cbk, void *local); extern int -nfs_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, - off_t offset, fop_readv_cbk_t cbk, void *local); +nfs_read(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, + off_t offset, fop_readv_cbk_t cbk, void *local); extern int -nfs_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int32_t datasync, fop_fsync_cbk_t cbk, void *local); +nfs_fsync(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + int32_t datasync, fop_fsync_cbk_t cbk, void *local); extern int -nfs_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - struct iobref *srciobref, struct iovec *vector, int32_t count, - off_t offset, fop_writev_cbk_t cbk, void *local); +nfs_write(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, + struct iobref *srciobref, struct iovec *vector, int32_t count, + off_t offset, fop_writev_cbk_t cbk, void *local); extern int -nfs_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t flags, fop_open_cbk_t cbk, void *local); +nfs_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int32_t flags, fop_open_cbk_t cbk, void *local); extern int -nfs_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc, - fop_readlink_cbk_t cbk, void *local); +nfs_readlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc, + fop_readlink_cbk_t cbk, void *local); extern int -nfs_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, - void *local); +nfs_setattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, + void *local); extern int -nfs_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_statfs_cbk_t cbk, void *local); +nfs_statfs(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_statfs_cbk_t cbk, void *local); extern int -nfs_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_stat_cbk_t cbk, void *local); +nfs_stat(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_stat_cbk_t cbk, void *local); extern int -nfs_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *linkloc, fop_symlink_cbk_t cbk, void *local); +nfs_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *linkloc, fop_symlink_cbk_t cbk, void *local); /* Synchronous equivalents */ extern call_stub_t * -nfs_open_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t flags); +nfs_open_sync(xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int32_t flags); extern call_stub_t * -nfs_write_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob, - struct iovec *vec, int count, off_t offset); +nfs_write_sync(xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob, + struct iovec *vec, int count, off_t offset); extern call_stub_t * -nfs_read_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, - off_t offset); +nfs_read_sync(xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size, + off_t offset); extern int -nfs_opendir (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc, - fop_opendir_cbk_t cbk, void *local); +nfs_opendir(xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc, + fop_opendir_cbk_t cbk, void *local); extern int -nfs_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int32_t accesstest, fop_access_cbk_t cbk, void *local); +nfs_access(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int32_t accesstest, fop_access_cbk_t cbk, void *local); extern int -nfs_lk (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, - int cmd, struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); +nfs_lk(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int cmd, + struct gf_flock *flock, fop_lk_cbk_t cbk, void *local); extern int -nfs_getxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); +nfs_getxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local); extern int -nfs_setxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata, - fop_setxattr_cbk_t cbk, void *local); +nfs_setxattr(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + dict_t *dict, int32_t flags, dict_t *xdata, fop_setxattr_cbk_t cbk, + void *local); #endif diff --git a/xlators/nfs/server/src/nfs-inodes.h b/xlators/nfs/server/src/nfs-inodes.h index 40037fbcbb2..7a874c8a4ce 100644 --- a/xlators/nfs/server/src/nfs-inodes.h +++ b/xlators/nfs/server/src/nfs-inodes.h @@ -17,54 +17,51 @@ #include "call-stub.h" #include "nfs-fops.h" - extern int -nfs_link_inode (inode_t *newi, inode_t *parent, char *name, - struct iatt *newstat); +nfs_link_inode(inode_t *newi, inode_t *parent, char *name, + struct iatt *newstat); extern int -nfs_inode_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, - loc_t *pathloc, int flags, int mode, fop_create_cbk_t cbk, - void *local); +nfs_inode_create(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int flags, int mode, fop_create_cbk_t cbk, void *local); extern int -nfs_inode_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - int mode, fop_mkdir_cbk_t cbk, void *local); +nfs_inode_mkdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + int mode, fop_mkdir_cbk_t cbk, void *local); extern int -nfs_inode_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - int32_t flags, fop_open_cbk_t cbk, - void *local); +nfs_inode_open(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + int32_t flags, fop_open_cbk_t cbk, void *local); extern int -nfs_inode_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_rename_cbk_t cbk, void *local); +nfs_inode_rename(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_rename_cbk_t cbk, void *local); extern int -nfs_inode_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, - loc_t *newloc, fop_link_cbk_t cbk, void *local); +nfs_inode_link(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, + loc_t *newloc, fop_link_cbk_t cbk, void *local); extern int -nfs_inode_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_unlink_cbk_t cbk, void *local); +nfs_inode_unlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_unlink_cbk_t cbk, void *local); extern int -nfs_inode_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_rmdir_cbk_t cbk, void *local); +nfs_inode_rmdir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_rmdir_cbk_t cbk, void *local); extern int -nfs_inode_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, - loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); +nfs_inode_symlink(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, + loc_t *pathloc, fop_symlink_cbk_t cbk, void *local); extern int -nfs_inode_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, - fop_opendir_cbk_t cbk, void *local); +nfs_inode_opendir(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, + fop_opendir_cbk_t cbk, void *local); extern int -nfs_inode_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); +nfs_inode_mknod(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local); extern int -nfs_inode_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, - fop_lookup_cbk_t cbk, void *local); +nfs_inode_lookup(xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, + fop_lookup_cbk_t cbk, void *local); #endif diff --git a/xlators/nfs/server/src/nfs-mem-types.h b/xlators/nfs/server/src/nfs-mem-types.h index 5cac0eb4978..5737aae6a09 100644 --- a/xlators/nfs/server/src/nfs-mem-types.h +++ b/xlators/nfs/server/src/nfs-mem-types.h @@ -8,50 +8,48 @@ cases as published by the Free Software Foundation. */ - #ifndef __NFS_MEM_TYPES_H__ #define __NFS_MEM_TYPES_H__ #include "mem-types.h" enum gf_nfs_mem_types_ { - gf_nfs_mt_mountentry = gf_common_mt_end + 1, - gf_nfs_mt_mountbody, - gf_nfs_mt_nfs_state, - gf_nfs_mt_char, - gf_nfs_mt_exportnode, - gf_nfs_mt_groupnode, - gf_nfs_mt_mount3_state, - gf_nfs_mt_write3args, - gf_nfs_mt_nfs3_export, - gf_nfs_mt_nfs3_state, - gf_nfs_mt_entry3, - gf_nfs_mt_entryp3, - gf_nfs_mt_nfs3_fd_entry, - gf_nfs_mt_nfs3_fh, - gf_nfs_mt_nfs_initer_list, - gf_nfs_mt_xlator_t, - gf_nfs_mt_list_head, - gf_nfs_mt_mnt3_resolve, - gf_nfs_mt_mnt3_export, - gf_nfs_mt_mnt3_auth_params, - gf_nfs_mt_int, - gf_nfs_mt_mountres3, - gf_nfs_mt_mountstat3, - gf_nfs_mt_inode_q, - gf_nfs_mt_nlm4_state, - gf_nfs_mt_nlm4_cm, - gf_nfs_mt_nlm4_fde, - gf_nfs_mt_nlm4_nlmclnt, - gf_nfs_mt_nlm4_share, - gf_nfs_mt_aux_gids, - gf_nfs_mt_inode_ctx, - gf_nfs_mt_auth_spec, - gf_nfs_mt_arr, - gf_nfs_mt_auth_cache, - gf_nfs_mt_auth_cache_entry, - gf_nfs_mt_nlm4_notify, - gf_nfs_mt_end + gf_nfs_mt_mountentry = gf_common_mt_end + 1, + gf_nfs_mt_mountbody, + gf_nfs_mt_nfs_state, + gf_nfs_mt_char, + gf_nfs_mt_exportnode, + gf_nfs_mt_groupnode, + gf_nfs_mt_mount3_state, + gf_nfs_mt_write3args, + gf_nfs_mt_nfs3_export, + gf_nfs_mt_nfs3_state, + gf_nfs_mt_entry3, + gf_nfs_mt_entryp3, + gf_nfs_mt_nfs3_fd_entry, + gf_nfs_mt_nfs3_fh, + gf_nfs_mt_nfs_initer_list, + gf_nfs_mt_xlator_t, + gf_nfs_mt_list_head, + gf_nfs_mt_mnt3_resolve, + gf_nfs_mt_mnt3_export, + gf_nfs_mt_mnt3_auth_params, + gf_nfs_mt_int, + gf_nfs_mt_mountres3, + gf_nfs_mt_mountstat3, + gf_nfs_mt_inode_q, + gf_nfs_mt_nlm4_state, + gf_nfs_mt_nlm4_cm, + gf_nfs_mt_nlm4_fde, + gf_nfs_mt_nlm4_nlmclnt, + gf_nfs_mt_nlm4_share, + gf_nfs_mt_aux_gids, + gf_nfs_mt_inode_ctx, + gf_nfs_mt_auth_spec, + gf_nfs_mt_arr, + gf_nfs_mt_auth_cache, + gf_nfs_mt_auth_cache_entry, + gf_nfs_mt_nlm4_notify, + gf_nfs_mt_end }; #endif - diff --git a/xlators/nfs/server/src/nfs-messages.h b/xlators/nfs/server/src/nfs-messages.h index 919fb5eb1d1..b8fe99e45d3 100644 --- a/xlators/nfs/server/src/nfs-messages.h +++ b/xlators/nfs/server/src/nfs-messages.h @@ -22,210 +22,81 @@ * glfs-message-id.h. */ -GLFS_MSGID(NFS, - NFS_MSG_UNUSED_1, - NFS_MSG_UNUSED_2, - NFS_MSG_INVALID_ENTRY, - NFS_MSG_INODE_LOC_FILL_ERROR, - NFS_MSG_HARD_RESOLVE_FAIL, - NFS_MSG_ARGS_DECODE_ERROR, - NFS_MSG_LOOKUP_PROC_FAIL, - NFS_MSG_UNUSED_8, - NFS_MSG_UNUSED_9, - NFS_MSG_READLINK_PROC_FAIL, - NFS_MSG_UNUSED_11, - NFS_MSG_ANONYMOUS_FD_FAIL, - NFS_MSG_READ_FAIL, - NFS_MSG_UNUSED_14, - NFS_MSG_UNUSED_15, - NFS_MSG_STATE_WRONG, - NFS_MSG_WRITE_FAIL, - NFS_MSG_UNUSED_18, - NFS_MSG_UNUSED_19, - NFS_MSG_UNUSED_20, - NFS_MSG_CREATE_FAIL, - NFS_MSG_UNUSED_22, - NFS_MSG_UNUSED_23, - NFS_MSG_DIR_OP_FAIL, - NFS_MSG_UNUSED_25, - NFS_MSG_SYMLINK_FAIL, - NFS_MSG_UNUSED_27, - NFS_MSG_MKNOD_FAIL, - NFS_MSG_OPT_INIT_FAIL, - NFS_MSG_UNUSED_30, - NFS_MSG_REMOVE_FAIL, - NFS_MSG_RMDIR_CBK, - NFS_MSG_UNUSED_33, - NFS_MSG_RENAME_FAIL, - NFS_MSG_UNUSED_35, - NFS_MSG_LINK_FAIL, - NFS_MSG_UNUSED_37, - NFS_MSG_UNUSED_38, - NFS_MSG_READDIR_FAIL, - NFS_MSG_READDIRP_FAIL, - NFS_MSG_UNUSED_41, - NFS_MSG_UNUSED_42, - NFS_MSG_FSTAT_FAIL, - NFS_MSG_UNUSED_44, - NFS_MSG_FSINFO_FAIL, - NFS_MSG_UNUSED_46, - NFS_MSG_PATHCONF_FAIL, - NFS_MSG_UNUSED_48, - NFS_MSG_COMMIT_FAIL, - NFS_MSG_PROT_INIT_ADD_FAIL, - NFS_MSG_FORMAT_FAIL, - NFS_MSG_SNPRINTF_FAIL, - NFS_MSG_VOLID_MISSING, - NFS_MSG_PARSE_VOL_UUID_FAIL, - NFS_MSG_STR2BOOL_FAIL, - NFS_MSG_SUBVOL_INIT_FAIL, - NFS_MSG_NO_MEMORY, - NFS_MSG_LISTENERS_CREATE_FAIL, - NFS_MSG_STATE_INIT_FAIL, - NFS_MSG_RECONF_FAIL, - NFS_MSG_RECONF_SUBVOL_FAIL, - NFS_MSG_STR_TOO_LONG, - NFS_MSG_STATE_MISSING, - NFS_MSG_INDEX_NOT_FOUND, - NFS_MSG_EXPORT_ID_FAIL, - NFS_MSG_NO_RW_ACCESS, - NFS_MSG_BAD_HANDLE, - NFS_MSG_RESOLVE_FH_FAIL, - NFS_MSG_RESOLVE_STAT, - NFS_MSG_VOL_DISABLE, - NFS_MSG_INIT_CALL_STAT_FAIL, - NFS_MSG_ENCODE_FAIL, - NFS_MSG_SERIALIZE_REPLY_FAIL, - NFS_MSG_SUBMIT_REPLY_FAIL, - NFS_MSG_UNUSED_75, - NFS_MSG_UNUSED_76, - NFS_MSG_STAT_FOP_FAIL, - NFS_MSG_GETATTR_FAIL, - NFS_MSG_UNUSED_79, - NFS_MSG_UNUSED_80, - NFS_MSG_TIMESTAMP_NO_SYNC, - NFS_MSG_SETATTR_INVALID, - NFS_MSG_SETATTR_FAIL, - NFS_MSG_UNUSED_84, - NFS_MSG_ACCESS_PROC_FAIL, - NFS_MSG_PGM_NOT_FOUND, - NFS_MSG_PGM_INIT_FAIL, - NFS_MSG_PGM_REG_FAIL, - NFS_MSG_LOOKUP_ROOT_FAIL, - NFS_MSG_ROOT_LOC_INIT_FAIL, - NFS_MSG_STARTUP_FAIL, - NFS_MSG_XLATOR_INIT_FAIL, - NFS_MSG_NFS_MAN_DISABLE, - NFS_MSG_DICT_GET_FAILED, - NFS_MSG_PARSE_FAIL, - NFS_MSG_NLM_MAN_DISABLE, - NFS_MSG_ACL_MAN_DISABLE, - NFS_MSG_DICT_SET_FAILED, - NFS_MSG_INIT_GRP_CACHE_FAIL, - NFS_MSG_NO_PERM, - NFS_MSG_REG_FILE_ERROR, - NFS_MSG_RPC_INIT_FAIL, - NFS_MSG_RPC_CONFIG_FAIL, - NFS_MSG_RECONFIG_PATH, - NFS_MSG_RECONFIG_VALUE, - NFS_MSG_RECONFIG_VOL, - NFS_MSG_NLM_INFO, - NFS_MSG_ACL_INFO, - NFS_MSG_INIT_FAIL, - NFS_MSG_STARTED, - NFS_MSG_VOL_NOT_FOUND, - NFS_MSG_RECONFIG_ENABLE, - NFS_MSG_RECONFIG_FAIL, - NFS_MSG_MNT_STATE_NOT_FOUND, - NFS_MSG_ENCODE_MSG_FAIL, - NFS_MSG_REP_SUBMIT_FAIL, - NFS_MSG_READ_LOCKED, - NFS_MSG_MODIFY_LOCKED, - NFS_MSG_RWTAB_OVERWRITE_FAIL, - NFS_MSG_UPDATE_FAIL, - NFS_MSG_OPEN_FAIL, - NFS_MSG_LOCK_FAIL, - NFS_MSG_REWRITE_ERROR, - NFS_MSG_HASH_PATH_FAIL, - NFS_MSG_LOOKUP_MNT_ERROR, - NFS_MSG_GET_ROOT_INODE_FAIL, - NFS_MSG_RESOLVE_INODE_FAIL, - NFS_MSG_RESOLVE_SUBDIR_FAIL, - NFS_MSG_RESOLVE_SYMLINK_ERROR, - NFS_MSG_RESOLVE_ERROR, - NFS_MSG_UNSUPPORTED_VERSION, - NFS_MSG_AUTH_VERIFY_FAILED, - NFS_MSG_PEER_NOT_ALLOWED, - NFS_MSG_GET_PEER_ADDR_FAIL, - NFS_MSG_BAD_PEER, - NFS_MSG_PEER_TOO_LONG, - NFS_MSG_CALLER_NOT_FOUND, - NFS_MSG_GET_REMOTE_NAME_FAIL, - NFS_MSG_UNKNOWN_MNT_TYPE, - NFS_MSG_PARSE_HOSTSPEC_FAIL, - NFS_MSG_PARSE_AUTH_PARAM_FAIL, - NFS_MSG_SET_EXP_FAIL, - NFS_MSG_INIT_DIR_EXP_FAIL, - NFS_MSG_DIR_EXP_SETUP_FAIL, - NFS_MSG_VOL_INIT_FAIL, - NFS_MSG_AUTH_ERROR, - NFS_MSG_UPDATING_EXP, - NFS_MSG_SET_EXP_AUTH_PARAM_FAIL, - NFS_MSG_UPDATING_NET_GRP, - NFS_MSG_SET_NET_GRP_FAIL, - NFS_MSG_PURGING_AUTH_CACHE, - NFS_MSG_MNT_STATE_INIT_FAIL, - NFS_MSG_EXP_AUTH_DISABLED, - NFS_MSG_FH_TO_VOL_FAIL, - NFS_MSG_INODE_SHARES_NOT_FOUND, - NFS_MSG_VOLUME_ERROR, - NFS_MSG_GET_USER_ACL_FAIL, - NFS_MSG_GET_DEF_ACL_FAIL, - NFS_MSG_SET_USER_ACL_FAIL, - NFS_MSG_SET_DEF_ACL_FAIL, - NFS_MSG_ACL_INIT_FAIL, - NFS_MSG_LOAD_PARSE_ERROR, - NFS_MSG_CLNT_CALL_ERROR, - NFS_MSG_CLNT_CREATE_ERROR, - NFS_MSG_NLM_GRACE_PERIOD, - NFS_MSG_RPC_CLNT_ERROR, - NFS_MSG_GET_PORT_ERROR, - NFS_MSG_NLMCLNT_NOT_FOUND, - NFS_MSG_FD_LOOKUP_NULL, - NFS_MSG_SM_NOTIFY, - NFS_MSG_NLM_INIT_FAIL, - NFS_MSG_START_ERROR, - NFS_MSG_UNLINK_ERROR, - NFS_MSG_SHARE_LIST_STORE_FAIL, - NFS_MSG_CLIENT_NOT_FOUND, - NFS_MSG_SHARE_CALL_FAIL, - NFS_MSG_UNSHARE_CALL_FAIL, - NFS_MSG_GET_PID_FAIL, - NFS_MSG_ARG_FREE_FAIL, - NFS_MSG_PMAP_UNSET_FAIL, - NFS_MSG_UDP_SERV_FAIL, - NFS_MSG_REG_NLMCBK_FAIL, - NFS_MSG_TCP_SERV_FAIL, - NFS_MSG_SVC_RUN_RETURNED, - NFS_MSG_XLATOR_SET_FAIL, - NFS_MSG_SVC_ERROR, - NFS_MSG_GET_FH_FAIL, - NFS_MSG_FIND_FIRST_MATCH_FAIL, - NFS_MSG_NETGRP_NOT_FOUND, - NFS_MSG_FILE_OP_FAILED, - NFS_MSG_PATH_RESOLVE_FAIL, - NFS_MSG_LOC_FILL_RESOLVE_FAIL, - NFS_MSG_INODE_NOT_FOUND, - NFS_MSG_INODE_CTX_STORE_FAIL, - NFS_MSG_GETPWUID_FAIL, - NFS_MSG_MAP_GRP_LIST_FAIL, - NFS_MSG_PARSE_DIR_FAIL, - NFS_MSG_LOOKUP_FAIL, - NFS_MSG_STAT_ERROR, - NFS_MSG_GFID_DICT_CREATE_FAIL, - NFS_MSG_HASH_XLATOR_FAIL, - NFS_MSG_ENABLE_THROTTLE_FAIL -); +GLFS_MSGID( + NFS, NFS_MSG_UNUSED_1, NFS_MSG_UNUSED_2, NFS_MSG_INVALID_ENTRY, + NFS_MSG_INODE_LOC_FILL_ERROR, NFS_MSG_HARD_RESOLVE_FAIL, + NFS_MSG_ARGS_DECODE_ERROR, NFS_MSG_LOOKUP_PROC_FAIL, NFS_MSG_UNUSED_8, + NFS_MSG_UNUSED_9, NFS_MSG_READLINK_PROC_FAIL, NFS_MSG_UNUSED_11, + NFS_MSG_ANONYMOUS_FD_FAIL, NFS_MSG_READ_FAIL, NFS_MSG_UNUSED_14, + NFS_MSG_UNUSED_15, NFS_MSG_STATE_WRONG, NFS_MSG_WRITE_FAIL, + NFS_MSG_UNUSED_18, NFS_MSG_UNUSED_19, NFS_MSG_UNUSED_20, + NFS_MSG_CREATE_FAIL, NFS_MSG_UNUSED_22, NFS_MSG_UNUSED_23, + NFS_MSG_DIR_OP_FAIL, NFS_MSG_UNUSED_25, NFS_MSG_SYMLINK_FAIL, + NFS_MSG_UNUSED_27, NFS_MSG_MKNOD_FAIL, NFS_MSG_OPT_INIT_FAIL, + NFS_MSG_UNUSED_30, NFS_MSG_REMOVE_FAIL, NFS_MSG_RMDIR_CBK, + NFS_MSG_UNUSED_33, NFS_MSG_RENAME_FAIL, NFS_MSG_UNUSED_35, + NFS_MSG_LINK_FAIL, NFS_MSG_UNUSED_37, NFS_MSG_UNUSED_38, + NFS_MSG_READDIR_FAIL, NFS_MSG_READDIRP_FAIL, NFS_MSG_UNUSED_41, + NFS_MSG_UNUSED_42, NFS_MSG_FSTAT_FAIL, NFS_MSG_UNUSED_44, + NFS_MSG_FSINFO_FAIL, NFS_MSG_UNUSED_46, NFS_MSG_PATHCONF_FAIL, + NFS_MSG_UNUSED_48, NFS_MSG_COMMIT_FAIL, NFS_MSG_PROT_INIT_ADD_FAIL, + NFS_MSG_FORMAT_FAIL, NFS_MSG_SNPRINTF_FAIL, NFS_MSG_VOLID_MISSING, + NFS_MSG_PARSE_VOL_UUID_FAIL, NFS_MSG_STR2BOOL_FAIL, + NFS_MSG_SUBVOL_INIT_FAIL, NFS_MSG_NO_MEMORY, NFS_MSG_LISTENERS_CREATE_FAIL, + NFS_MSG_STATE_INIT_FAIL, NFS_MSG_RECONF_FAIL, NFS_MSG_RECONF_SUBVOL_FAIL, + NFS_MSG_STR_TOO_LONG, NFS_MSG_STATE_MISSING, NFS_MSG_INDEX_NOT_FOUND, + NFS_MSG_EXPORT_ID_FAIL, NFS_MSG_NO_RW_ACCESS, NFS_MSG_BAD_HANDLE, + NFS_MSG_RESOLVE_FH_FAIL, NFS_MSG_RESOLVE_STAT, NFS_MSG_VOL_DISABLE, + NFS_MSG_INIT_CALL_STAT_FAIL, NFS_MSG_ENCODE_FAIL, + NFS_MSG_SERIALIZE_REPLY_FAIL, NFS_MSG_SUBMIT_REPLY_FAIL, NFS_MSG_UNUSED_75, + NFS_MSG_UNUSED_76, NFS_MSG_STAT_FOP_FAIL, NFS_MSG_GETATTR_FAIL, + NFS_MSG_UNUSED_79, NFS_MSG_UNUSED_80, NFS_MSG_TIMESTAMP_NO_SYNC, + NFS_MSG_SETATTR_INVALID, NFS_MSG_SETATTR_FAIL, NFS_MSG_UNUSED_84, + NFS_MSG_ACCESS_PROC_FAIL, NFS_MSG_PGM_NOT_FOUND, NFS_MSG_PGM_INIT_FAIL, + NFS_MSG_PGM_REG_FAIL, NFS_MSG_LOOKUP_ROOT_FAIL, NFS_MSG_ROOT_LOC_INIT_FAIL, + NFS_MSG_STARTUP_FAIL, NFS_MSG_XLATOR_INIT_FAIL, NFS_MSG_NFS_MAN_DISABLE, + NFS_MSG_DICT_GET_FAILED, NFS_MSG_PARSE_FAIL, NFS_MSG_NLM_MAN_DISABLE, + NFS_MSG_ACL_MAN_DISABLE, NFS_MSG_DICT_SET_FAILED, + NFS_MSG_INIT_GRP_CACHE_FAIL, NFS_MSG_NO_PERM, NFS_MSG_REG_FILE_ERROR, + NFS_MSG_RPC_INIT_FAIL, NFS_MSG_RPC_CONFIG_FAIL, NFS_MSG_RECONFIG_PATH, + NFS_MSG_RECONFIG_VALUE, NFS_MSG_RECONFIG_VOL, NFS_MSG_NLM_INFO, + NFS_MSG_ACL_INFO, NFS_MSG_INIT_FAIL, NFS_MSG_STARTED, NFS_MSG_VOL_NOT_FOUND, + NFS_MSG_RECONFIG_ENABLE, NFS_MSG_RECONFIG_FAIL, NFS_MSG_MNT_STATE_NOT_FOUND, + NFS_MSG_ENCODE_MSG_FAIL, NFS_MSG_REP_SUBMIT_FAIL, NFS_MSG_READ_LOCKED, + NFS_MSG_MODIFY_LOCKED, NFS_MSG_RWTAB_OVERWRITE_FAIL, NFS_MSG_UPDATE_FAIL, + NFS_MSG_OPEN_FAIL, NFS_MSG_LOCK_FAIL, NFS_MSG_REWRITE_ERROR, + NFS_MSG_HASH_PATH_FAIL, NFS_MSG_LOOKUP_MNT_ERROR, + NFS_MSG_GET_ROOT_INODE_FAIL, NFS_MSG_RESOLVE_INODE_FAIL, + NFS_MSG_RESOLVE_SUBDIR_FAIL, NFS_MSG_RESOLVE_SYMLINK_ERROR, + NFS_MSG_RESOLVE_ERROR, NFS_MSG_UNSUPPORTED_VERSION, + NFS_MSG_AUTH_VERIFY_FAILED, NFS_MSG_PEER_NOT_ALLOWED, + NFS_MSG_GET_PEER_ADDR_FAIL, NFS_MSG_BAD_PEER, NFS_MSG_PEER_TOO_LONG, + NFS_MSG_CALLER_NOT_FOUND, NFS_MSG_GET_REMOTE_NAME_FAIL, + NFS_MSG_UNKNOWN_MNT_TYPE, NFS_MSG_PARSE_HOSTSPEC_FAIL, + NFS_MSG_PARSE_AUTH_PARAM_FAIL, NFS_MSG_SET_EXP_FAIL, + NFS_MSG_INIT_DIR_EXP_FAIL, NFS_MSG_DIR_EXP_SETUP_FAIL, + NFS_MSG_VOL_INIT_FAIL, NFS_MSG_AUTH_ERROR, NFS_MSG_UPDATING_EXP, + NFS_MSG_SET_EXP_AUTH_PARAM_FAIL, NFS_MSG_UPDATING_NET_GRP, + NFS_MSG_SET_NET_GRP_FAIL, NFS_MSG_PURGING_AUTH_CACHE, + NFS_MSG_MNT_STATE_INIT_FAIL, NFS_MSG_EXP_AUTH_DISABLED, + NFS_MSG_FH_TO_VOL_FAIL, NFS_MSG_INODE_SHARES_NOT_FOUND, + NFS_MSG_VOLUME_ERROR, NFS_MSG_GET_USER_ACL_FAIL, NFS_MSG_GET_DEF_ACL_FAIL, + NFS_MSG_SET_USER_ACL_FAIL, NFS_MSG_SET_DEF_ACL_FAIL, NFS_MSG_ACL_INIT_FAIL, + NFS_MSG_LOAD_PARSE_ERROR, NFS_MSG_CLNT_CALL_ERROR, + NFS_MSG_CLNT_CREATE_ERROR, NFS_MSG_NLM_GRACE_PERIOD, NFS_MSG_RPC_CLNT_ERROR, + NFS_MSG_GET_PORT_ERROR, NFS_MSG_NLMCLNT_NOT_FOUND, NFS_MSG_FD_LOOKUP_NULL, + NFS_MSG_SM_NOTIFY, NFS_MSG_NLM_INIT_FAIL, NFS_MSG_START_ERROR, + NFS_MSG_UNLINK_ERROR, NFS_MSG_SHARE_LIST_STORE_FAIL, + NFS_MSG_CLIENT_NOT_FOUND, NFS_MSG_SHARE_CALL_FAIL, + NFS_MSG_UNSHARE_CALL_FAIL, NFS_MSG_GET_PID_FAIL, NFS_MSG_ARG_FREE_FAIL, + NFS_MSG_PMAP_UNSET_FAIL, NFS_MSG_UDP_SERV_FAIL, NFS_MSG_REG_NLMCBK_FAIL, + NFS_MSG_TCP_SERV_FAIL, NFS_MSG_SVC_RUN_RETURNED, NFS_MSG_XLATOR_SET_FAIL, + NFS_MSG_SVC_ERROR, NFS_MSG_GET_FH_FAIL, NFS_MSG_FIND_FIRST_MATCH_FAIL, + NFS_MSG_NETGRP_NOT_FOUND, NFS_MSG_FILE_OP_FAILED, NFS_MSG_PATH_RESOLVE_FAIL, + NFS_MSG_LOC_FILL_RESOLVE_FAIL, NFS_MSG_INODE_NOT_FOUND, + NFS_MSG_INODE_CTX_STORE_FAIL, NFS_MSG_GETPWUID_FAIL, + NFS_MSG_MAP_GRP_LIST_FAIL, NFS_MSG_PARSE_DIR_FAIL, NFS_MSG_LOOKUP_FAIL, + NFS_MSG_STAT_ERROR, NFS_MSG_GFID_DICT_CREATE_FAIL, NFS_MSG_HASH_XLATOR_FAIL, + NFS_MSG_ENABLE_THROTTLE_FAIL); #endif /* _NFS_MESSAGES_H_ */ - diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index 33ba419a573..531a269071c 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -17,135 +17,138 @@ #include "lkowner.h" #include "gidcache.h" -#define GF_NFS "nfs" +#define GF_NFS "nfs" -#define GF_NFS_CONCURRENT_OPS_MULT 15 +#define GF_NFS_CONCURRENT_OPS_MULT 15 -#define GF_NFS_INODE_LRU_MULT 6000 +#define GF_NFS_INODE_LRU_MULT 6000 -#define GF_RPC_MIN_THREADS 1 -#define GF_RPC_MAX_THREADS 16 +#define GF_RPC_MIN_THREADS 1 +#define GF_RPC_MAX_THREADS 16 -#define GF_NFS_DEFAULT_MEMFACTOR 15 -#define GF_NFS_MIN_MEMFACTOR 1 -#define GF_NFS_MAX_MEMFACTOR 30 +#define GF_NFS_DEFAULT_MEMFACTOR 15 +#define GF_NFS_MIN_MEMFACTOR 1 +#define GF_NFS_MAX_MEMFACTOR 30 -#define GF_NFS_DVM_ON 1 -#define GF_NFS_DVM_OFF 0 +#define GF_NFS_DVM_ON 1 +#define GF_NFS_DVM_OFF 0 /* Disable using the exports file by default */ -#define GF_NFS_DEFAULT_EXPORT_AUTH 0 +#define GF_NFS_DEFAULT_EXPORT_AUTH 0 -#define GF_NFS_DEFAULT_AUTH_REFRESH_INTERVAL_SEC 2 -#define GF_NFS_DEFAULT_AUTH_CACHE_TTL_SEC 300 /* 5 min */ +#define GF_NFS_DEFAULT_AUTH_REFRESH_INTERVAL_SEC 2 +#define GF_NFS_DEFAULT_AUTH_CACHE_TTL_SEC 300 /* 5 min */ /* This corresponds to the max 16 number of group IDs that are sent through an * RPC request. Since NFS is the only one going to set this, we can be safe * in keeping this size hardcoded. */ -#define GF_REQUEST_MAXGROUPS 16 +#define GF_REQUEST_MAXGROUPS 16 /* Callback into a version-specific NFS protocol. * The return type is used by the nfs.c code to register the protocol. * with the RPC service. */ -typedef rpcsvc_program_t *(*nfs_version_initer_t) (xlator_t *nfsx); +typedef rpcsvc_program_t *(*nfs_version_initer_t)(xlator_t *nfsx); /* List of version-specific protocol initiators */ struct nfs_initer_list { - struct list_head list; - nfs_version_initer_t init; - rpcsvc_program_t *program; - gf_boolean_t required; + struct list_head list; + nfs_version_initer_t init; + rpcsvc_program_t *program; + gf_boolean_t required; }; struct nfs_state { - rpcsvc_t *rpcsvc; - struct list_head versions; - struct mount3_state *mstate; - struct nfs3_state *nfs3state; - struct nlm4_state *nlm4state; - struct mem_pool *foppool; - unsigned int memfactor; - xlator_list_t *subvols; - - gf_lock_t svinitlock; - int allsubvols; - int upsubvols; - xlator_t **initedxl; - int subvols_started; - int dynamicvolumes; - int enable_ino32; - unsigned int override_portnum; - int allow_insecure; - int enable_nlm; - int enable_acl; - int mount_udp; - - /* Enable exports auth model */ - int exports_auth; - /* Refresh auth params from disk periodically */ - int refresh_auth; - - unsigned int auth_refresh_time_secs; - unsigned int auth_cache_ttl_sec; - - char *rmtab; - struct rpc_clnt *rpc_clnt; - gf_boolean_t server_aux_gids; - uint32_t server_aux_gids_max_age; - gid_cache_t gid_cache; - uint32_t generation; - gf_boolean_t register_portmap; - char *rpc_statd; - char *rpc_statd_pid_file; - gf_boolean_t rdirplus; - uint32_t event_threads; + rpcsvc_t *rpcsvc; + struct list_head versions; + struct mount3_state *mstate; + struct nfs3_state *nfs3state; + struct nlm4_state *nlm4state; + struct mem_pool *foppool; + unsigned int memfactor; + xlator_list_t *subvols; + + gf_lock_t svinitlock; + int allsubvols; + int upsubvols; + xlator_t **initedxl; + int subvols_started; + int dynamicvolumes; + int enable_ino32; + unsigned int override_portnum; + int allow_insecure; + int enable_nlm; + int enable_acl; + int mount_udp; + + /* Enable exports auth model */ + int exports_auth; + /* Refresh auth params from disk periodically */ + int refresh_auth; + + unsigned int auth_refresh_time_secs; + unsigned int auth_cache_ttl_sec; + + char *rmtab; + struct rpc_clnt *rpc_clnt; + gf_boolean_t server_aux_gids; + uint32_t server_aux_gids_max_age; + gid_cache_t gid_cache; + uint32_t generation; + gf_boolean_t register_portmap; + char *rpc_statd; + char *rpc_statd_pid_file; + gf_boolean_t rdirplus; + uint32_t event_threads; }; struct nfs_inode_ctx { - struct list_head shares; - uint32_t generation; + struct list_head shares; + uint32_t generation; }; -#define gf_nfs_dvm_on(nfsstt) (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON) -#define gf_nfs_dvm_off(nfsstt) (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_OFF) -#define __gf_nfs_enable_ino32(nfsstt) (((struct nfs_state *)nfsstt)->enable_ino32) -#define gf_nfs_this_private ((struct nfs_state *)((xlator_t *)THIS)->private) -#define gf_nfs_enable_ino32() (__gf_nfs_enable_ino32(gf_nfs_this_private)) +#define gf_nfs_dvm_on(nfsstt) \ + (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON) +#define gf_nfs_dvm_off(nfsstt) \ + (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_OFF) +#define __gf_nfs_enable_ino32(nfsstt) \ + (((struct nfs_state *)nfsstt)->enable_ino32) +#define gf_nfs_this_private ((struct nfs_state *)((xlator_t *)THIS)->private) +#define gf_nfs_enable_ino32() (__gf_nfs_enable_ino32(gf_nfs_this_private)) /* We have one gid more than the glusterfs maximum since we pass the primary * gid as the first element of the array. */ -#define NFS_NGROUPS (GF_REQUEST_MAXGROUPS + 1) +#define NFS_NGROUPS (GF_REQUEST_MAXGROUPS + 1) /* Index of the primary gid */ -#define NFS_PRIMGID_IDX 0 +#define NFS_PRIMGID_IDX 0 typedef struct nfs_user_info { - uid_t uid; - gid_t gids[NFS_NGROUPS]; - int ngrps; - gf_lkowner_t lk_owner; - char identifier[UNIX_PATH_MAX]; /* ip of user */ + uid_t uid; + gid_t gids[NFS_NGROUPS]; + int ngrps; + gf_lkowner_t lk_owner; + char identifier[UNIX_PATH_MAX]; /* ip of user */ } nfs_user_t; extern int -nfs_user_root_create (nfs_user_t *newnfu); +nfs_user_root_create(nfs_user_t *newnfu); extern int -nfs_user_create (nfs_user_t *newnfu, uid_t uid, gid_t gid, - rpc_transport_t *trans, gid_t *auxgids, int auxcount); +nfs_user_create(nfs_user_t *newnfu, uid_t uid, gid_t gid, + rpc_transport_t *trans, gid_t *auxgids, int auxcount); extern void -nfs_request_user_init (nfs_user_t *nfu, rpcsvc_request_t *req); +nfs_request_user_init(nfs_user_t *nfu, rpcsvc_request_t *req); extern void -nfs_request_primary_user_init (nfs_user_t *nfu, rpcsvc_request_t *req, - uid_t uid, gid_t gid); +nfs_request_primary_user_init(nfs_user_t *nfu, rpcsvc_request_t *req, uid_t uid, + gid_t gid); extern int -nfs_subvolume_started (struct nfs_state *nfs, xlator_t *xl); +nfs_subvolume_started(struct nfs_state *nfs, xlator_t *xl); extern void -nfs_fix_groups (xlator_t *this, call_stack_t *root); +nfs_fix_groups(xlator_t *this, call_stack_t *root); #endif diff --git a/xlators/nfs/server/src/nfs3-fh.h b/xlators/nfs/server/src/nfs3-fh.h index 3af36cc98b0..442f6feeb25 100644 --- a/xlators/nfs/server/src/nfs3-fh.h +++ b/xlators/nfs/server/src/nfs3-fh.h @@ -19,82 +19,83 @@ /* BIG FAT WARNING: The file handle code is tightly coupled to NFSv3 file * handles for now. This will change if and when we need v4. */ -#define GF_NFSFH_IDENT0 ':' -#define GF_NFSFH_IDENT1 'O' -#define GF_NFSFH_IDENT2 'G' -#define GF_NFSFH_IDENT3 'L' -#define GF_NFSFH_IDENT_SIZE (sizeof(char) * 4) -#define GF_NFSFH_STATIC_SIZE (GF_NFSFH_IDENT_SIZE + (3*sizeof (uuid_t))) - -#define nfs3_fh_exportid_to_index(exprtid) ((uint16_t)exprtid[15]) +#define GF_NFSFH_IDENT0 ':' +#define GF_NFSFH_IDENT1 'O' +#define GF_NFSFH_IDENT2 'G' +#define GF_NFSFH_IDENT3 'L' +#define GF_NFSFH_IDENT_SIZE (sizeof(char) * 4) +#define GF_NFSFH_STATIC_SIZE (GF_NFSFH_IDENT_SIZE + (3 * sizeof(uuid_t))) + +#define nfs3_fh_exportid_to_index(exprtid) ((uint16_t)exprtid[15]) /* ATTENTION: Change in size of the structure below should be reflected in the * GF_NFSFH_STATIC_SIZE. */ struct nfs3_fh { - - /* Used to ensure that a bunch of bytes are actually a GlusterFS NFS - * file handle. Should contain ":OGL" - */ - char ident[4]; - - /* UUID that identifies an export. The value stored in exportid - * depends on the usage of gluster nfs. If the DVM is enabled using - * the nfs.dynamic-volumes option then exportid will contain the UUID - * of the volume so that gnfs is able to identify volumes uniquely - * through volume additions,deletions,migrations, etc. - * - * When not using dvm, exportid contains the index of the volume - * based on the position of the volume in the list of subvolumes - * for gnfs. - */ - uuid_t exportid; - - /* File/dir gfid. */ - uuid_t gfid; - uuid_t mountid; - /* This structure must be exactly NFS3_FHSIZE (64) bytes long. - Having the structure shorter results in buffer overflows - during XDR decoding. - */ - unsigned char padding[NFS3_FHSIZE - GF_NFSFH_STATIC_SIZE]; + /* Used to ensure that a bunch of bytes are actually a GlusterFS NFS + * file handle. Should contain ":OGL" + */ + char ident[4]; + + /* UUID that identifies an export. The value stored in exportid + * depends on the usage of gluster nfs. If the DVM is enabled using + * the nfs.dynamic-volumes option then exportid will contain the UUID + * of the volume so that gnfs is able to identify volumes uniquely + * through volume additions,deletions,migrations, etc. + * + * When not using dvm, exportid contains the index of the volume + * based on the position of the volume in the list of subvolumes + * for gnfs. + */ + uuid_t exportid; + + /* File/dir gfid. */ + uuid_t gfid; + uuid_t mountid; + /* This structure must be exactly NFS3_FHSIZE (64) bytes long. + Having the structure shorter results in buffer overflows + during XDR decoding. + */ + unsigned char padding[NFS3_FHSIZE - GF_NFSFH_STATIC_SIZE]; } __attribute__((__packed__)); -#define GF_NFS3FH_STATIC_INITIALIZER {{0},} +#define GF_NFS3FH_STATIC_INITIALIZER \ + { \ + {0}, \ + } extern uint32_t -nfs3_fh_compute_size (); +nfs3_fh_compute_size(); extern uint16_t -nfs3_fh_hash_entry (uuid_t gfid); +nfs3_fh_hash_entry(uuid_t gfid); extern int -nfs3_fh_validate (struct nfs3_fh *fh); +nfs3_fh_validate(struct nfs3_fh *fh); extern struct nfs3_fh -nfs3_fh_build_indexed_root_fh (xlator_list_t *cl, xlator_t *xl); +nfs3_fh_build_indexed_root_fh(xlator_list_t *cl, xlator_t *xl); extern int -nfs3_fh_is_root_fh (struct nfs3_fh *fh); +nfs3_fh_is_root_fh(struct nfs3_fh *fh); extern int -nfs3_fh_build_child_fh (struct nfs3_fh *parent, struct iatt *newstat, - struct nfs3_fh *newfh); +nfs3_fh_build_child_fh(struct nfs3_fh *parent, struct iatt *newstat, + struct nfs3_fh *newfh); extern void -nfs3_log_fh (struct nfs3_fh *fh); +nfs3_log_fh(struct nfs3_fh *fh); extern void -nfs3_fh_to_str (struct nfs3_fh *fh, char *str, size_t len); +nfs3_fh_to_str(struct nfs3_fh *fh, char *str, size_t len); extern int -nfs3_fh_build_parent_fh (struct nfs3_fh *child, struct iatt *newstat, - struct nfs3_fh *newfh); +nfs3_fh_build_parent_fh(struct nfs3_fh *child, struct iatt *newstat, + struct nfs3_fh *newfh); extern struct nfs3_fh -nfs3_fh_build_uuid_root_fh (uuid_t volumeid, uuid_t mountid); +nfs3_fh_build_uuid_root_fh(uuid_t volumeid, uuid_t mountid); extern int -nfs3_build_fh (inode_t *inode, uuid_t exportid, - struct nfs3_fh *newfh); +nfs3_build_fh(inode_t *inode, uuid_t exportid, struct nfs3_fh *newfh); #endif diff --git a/xlators/nfs/server/src/nfs3-helpers.h b/xlators/nfs/server/src/nfs3-helpers.h index 213639e3806..7c70c20b787 100644 --- a/xlators/nfs/server/src/nfs3-helpers.h +++ b/xlators/nfs/server/src/nfs3-helpers.h @@ -19,41 +19,40 @@ #include <sys/statvfs.h> -#define GF_NFS3_FD_CACHED 0xcaced +#define GF_NFS3_FD_CACHED 0xcaced extern struct nfs3_fh -nfs3_extract_lookup_fh (lookup3args *args); +nfs3_extract_lookup_fh(lookup3args *args); extern char * -nfs3_extract_lookup_name (lookup3args *args); +nfs3_extract_lookup_name(lookup3args *args); extern nfsstat3 -nfs3_errno_to_nfsstat3 (int errnum); +nfs3_errno_to_nfsstat3(int errnum); -extern nfsstat3 -nfs3_cbk_errno_status (int32_t, int32_t); +extern nfsstat3 nfs3_cbk_errno_status(int32_t, int32_t); extern void -nfs3_fill_lookup3res (lookup3res *res, nfsstat3 stat, struct nfs3_fh *newfh, - struct iatt *stbuf, struct iatt *postparent, - uint64_t deviceid); +nfs3_fill_lookup3res(lookup3res *res, nfsstat3 stat, struct nfs3_fh *newfh, + struct iatt *stbuf, struct iatt *postparent, + uint64_t deviceid); extern post_op_attr -nfs3_stat_to_post_op_attr (struct iatt *buf); +nfs3_stat_to_post_op_attr(struct iatt *buf); extern struct nfs3_fh -nfs3_extract_getattr_fh (getattr3args *args); +nfs3_extract_getattr_fh(getattr3args *args); extern void -nfs3_fill_getattr3res (getattr3res *res, nfsstat3 stat, struct iatt *buf, - uint64_t deviceid); +nfs3_fill_getattr3res(getattr3res *res, nfsstat3 stat, struct iatt *buf, + uint64_t deviceid); extern struct nfs3_fh -nfs3_extract_fsinfo_fh (fsinfo3args *args); +nfs3_extract_fsinfo_fh(fsinfo3args *args); extern void -nfs3_fill_fsinfo3res (struct nfs3_state *nfs3, fsinfo3res *res, - nfsstat3 status, struct iatt *fsroot,uint64_t deviceid); +nfs3_fill_fsinfo3res(struct nfs3_state *nfs3, fsinfo3res *res, nfsstat3 status, + struct iatt *fsroot, uint64_t deviceid); /* Functions containing _prep_ are used specifically to work around * the memory allocations that happen inside Sun RPC library. @@ -73,271 +72,268 @@ nfs3_fill_fsinfo3res (struct nfs3_state *nfs3, fsinfo3res *res, * looking through the glibc/sunrpc sources. */ extern void -nfs3_prep_lookup3args (lookup3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_lookup3args(lookup3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_prep_getattr3args (getattr3args *args, struct nfs3_fh *fh); +nfs3_prep_getattr3args(getattr3args *args, struct nfs3_fh *fh); extern void -nfs3_prep_fsinfo3args (fsinfo3args *args, struct nfs3_fh *root); +nfs3_prep_fsinfo3args(fsinfo3args *args, struct nfs3_fh *root); extern char * nfsstat3_strerror(int stat); extern void -nfs3_prep_access3args (access3args *args, struct nfs3_fh *fh); +nfs3_prep_access3args(access3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_access3res (access3res *res, nfsstat3 status, int32_t accbits, - int32_t reqaccbits); +nfs3_fill_access3res(access3res *res, nfsstat3 status, int32_t accbits, + int32_t reqaccbits); extern char * -nfs3_fhcache_getpath (struct nfs3_state *nfs3, struct nfs3_fh *fh); +nfs3_fhcache_getpath(struct nfs3_state *nfs3, struct nfs3_fh *fh); extern int -nfs3_fhcache_putpath (struct nfs3_state *nfs3, struct nfs3_fh *fh, char *path); +nfs3_fhcache_putpath(struct nfs3_state *nfs3, struct nfs3_fh *fh, char *path); extern void -nfs3_prep_readdir3args (readdir3args *ra, struct nfs3_fh *fh); +nfs3_prep_readdir3args(readdir3args *ra, struct nfs3_fh *fh); extern void -nfs3_fill_readdir3res (readdir3res *res, nfsstat3 stat, struct nfs3_fh *dfh, - uint64_t cverf, struct iatt *dirstat, - gf_dirent_t *entries, count3 count, int is_eof, - uint64_t deviceid); +nfs3_fill_readdir3res(readdir3res *res, nfsstat3 stat, struct nfs3_fh *dfh, + uint64_t cverf, struct iatt *dirstat, + gf_dirent_t *entries, count3 count, int is_eof, + uint64_t deviceid); extern void -nfs3_prep_readdirp3args (readdirp3args *ra, struct nfs3_fh *fh); +nfs3_prep_readdirp3args(readdirp3args *ra, struct nfs3_fh *fh); extern void -nfs3_fill_readdirp3res (readdirp3res *res, nfsstat3 stat, - struct nfs3_fh *dirfh, uint64_t cverf, - struct iatt *dirstat, gf_dirent_t *entries, - count3 dircount, count3 maxcount, int is_eof, - uint64_t deviceid); +nfs3_fill_readdirp3res(readdirp3res *res, nfsstat3 stat, struct nfs3_fh *dirfh, + uint64_t cverf, struct iatt *dirstat, + gf_dirent_t *entries, count3 dircount, count3 maxcount, + int is_eof, uint64_t deviceid); extern void -nfs3_free_readdirp3res (readdirp3res *res); +nfs3_free_readdirp3res(readdirp3res *res); extern void -nfs3_free_readdir3res (readdir3res *res); +nfs3_free_readdir3res(readdir3res *res); extern void -nfs3_prep_fsstat3args (fsstat3args *args, struct nfs3_fh *fh); +nfs3_prep_fsstat3args(fsstat3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_fsstat3res (fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf, - struct iatt *postbuf, uint64_t deviceid); +nfs3_fill_fsstat3res(fsstat3res *res, nfsstat3 stat, struct statvfs *fsbuf, + struct iatt *postbuf, uint64_t deviceid); extern int32_t -nfs3_sattr3_to_setattr_valid (sattr3 *sattr, struct iatt *buf, mode_t *omode); +nfs3_sattr3_to_setattr_valid(sattr3 *sattr, struct iatt *buf, mode_t *omode); extern void -nfs3_fill_create3res (create3res *res, nfsstat3 stat, struct nfs3_fh *newfh, - struct iatt *newbuf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_create3res(create3res *res, nfsstat3 stat, struct nfs3_fh *newfh, + struct iatt *newbuf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_create3args (create3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_create3args(create3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_prep_setattr3args (setattr3args *args, struct nfs3_fh *fh); +nfs3_prep_setattr3args(setattr3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_setattr3res (setattr3res *res, nfsstat3 stat, struct iatt *preop, - struct iatt *postop, uint64_t deviceid); +nfs3_fill_setattr3res(setattr3res *res, nfsstat3 stat, struct iatt *preop, + struct iatt *postop, uint64_t deviceid); extern void -nfs3_prep_mkdir3args (mkdir3args *args, struct nfs3_fh *dirfh, char *name); +nfs3_prep_mkdir3args(mkdir3args *args, struct nfs3_fh *dirfh, char *name); extern void -nfs3_fill_mkdir3res (mkdir3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_mkdir3res(mkdir3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_symlink3args (symlink3args *args, struct nfs3_fh *dirfh, char *name, - char *target); +nfs3_prep_symlink3args(symlink3args *args, struct nfs3_fh *dirfh, char *name, + char *target); extern void -nfs3_fill_symlink3res (symlink3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_symlink3res(symlink3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_readlink3args (readlink3args *args, struct nfs3_fh *fh); +nfs3_prep_readlink3args(readlink3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_readlink3res (readlink3res *res, nfsstat3 stat, char *path, - struct iatt *buf, uint64_t deviceid); +nfs3_fill_readlink3res(readlink3res *res, nfsstat3 stat, char *path, + struct iatt *buf, uint64_t deviceid); extern void -nfs3_prep_mknod3args (mknod3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_mknod3args(mknod3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_mknod3res (mknod3res *res, nfsstat3 stat, struct nfs3_fh *fh, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_mknod3res(mknod3res *res, nfsstat3 stat, struct nfs3_fh *fh, + struct iatt *buf, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_fill_remove3res (remove3res *res, nfsstat3 stat, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_remove3res(remove3res *res, nfsstat3 stat, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_remove3args (remove3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_remove3args(remove3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_rmdir3res (rmdir3res *res, nfsstat3 stat, struct iatt *preparent, - struct iatt *postparent, uint64_t deviceid); +nfs3_fill_rmdir3res(rmdir3res *res, nfsstat3 stat, struct iatt *preparent, + struct iatt *postparent, uint64_t deviceid); extern void -nfs3_prep_rmdir3args (rmdir3args *args, struct nfs3_fh *fh, char *name); +nfs3_prep_rmdir3args(rmdir3args *args, struct nfs3_fh *fh, char *name); extern void -nfs3_fill_link3res (link3res *res, nfsstat3 stat, struct iatt *buf, - struct iatt *preparent, struct iatt *postparent, - uint64_t deviceid); +nfs3_fill_link3res(link3res *res, nfsstat3 stat, struct iatt *buf, + struct iatt *preparent, struct iatt *postparent, + uint64_t deviceid); extern void -nfs3_prep_link3args (link3args *args, struct nfs3_fh *target, - struct nfs3_fh * dirfh, char *name); +nfs3_prep_link3args(link3args *args, struct nfs3_fh *target, + struct nfs3_fh *dirfh, char *name); extern void -nfs3_prep_rename3args (rename3args *args, struct nfs3_fh *olddirfh, - char *oldname, struct nfs3_fh *newdirfh, - char *newname); +nfs3_prep_rename3args(rename3args *args, struct nfs3_fh *olddirfh, + char *oldname, struct nfs3_fh *newdirfh, char *newname); extern void -nfs3_fill_rename3res (rename3res *res, nfsstat3 stat, struct iatt *buf, - struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent, - uint64_t deviceid); +nfs3_fill_rename3res(rename3res *res, nfsstat3 stat, struct iatt *buf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent, + uint64_t deviceid); extern void -nfs3_prep_write3args (write3args *args, struct nfs3_fh *fh); +nfs3_prep_write3args(write3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_write3res (write3res *res, nfsstat3 stat, count3 count, - stable_how stable, uint64_t wverf, struct iatt *prestat, - struct iatt *poststat, uint64_t deviceid); +nfs3_fill_write3res(write3res *res, nfsstat3 stat, count3 count, + stable_how stable, uint64_t wverf, struct iatt *prestat, + struct iatt *poststat, uint64_t deviceid); extern void -nfs3_prep_commit3args (commit3args *args, struct nfs3_fh *fh); +nfs3_prep_commit3args(commit3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_commit3res (commit3res *res, nfsstat3 stat, uint64_t wverf, - struct iatt *prestat, struct iatt *poststat, - uint64_t deviceid); +nfs3_fill_commit3res(commit3res *res, nfsstat3 stat, uint64_t wverf, + struct iatt *prestat, struct iatt *poststat, + uint64_t deviceid); extern void -nfs3_fill_read3res (read3res *res, nfsstat3 stat, count3 count, - struct iatt *poststat, int is_eof, uint64_t deviceid); +nfs3_fill_read3res(read3res *res, nfsstat3 stat, count3 count, + struct iatt *poststat, int is_eof, uint64_t deviceid); extern void -nfs3_prep_read3args (read3args *args, struct nfs3_fh *fh); +nfs3_prep_read3args(read3args *args, struct nfs3_fh *fh); extern void -nfs3_prep_pathconf3args (pathconf3args *args, struct nfs3_fh *fh); +nfs3_prep_pathconf3args(pathconf3args *args, struct nfs3_fh *fh); extern void -nfs3_fill_pathconf3res (pathconf3res *res, nfsstat3 stat, struct iatt *buf, - uint64_t deviceid); +nfs3_fill_pathconf3res(pathconf3res *res, nfsstat3 stat, struct iatt *buf, + uint64_t deviceid); extern int -nfs3_cached_inode_opened (xlator_t *nfsxl, inode_t *inode); +nfs3_cached_inode_opened(xlator_t *nfsxl, inode_t *inode); extern void -nfs3_log_common_res (uint32_t xid, int op, nfsstat3 stat, int pstat, - const char *path); +nfs3_log_common_res(uint32_t xid, int op, nfsstat3 stat, int pstat, + const char *path); extern void -nfs3_log_readlink_res (uint32_t xid, nfsstat3 stat, int pstat, - char *linkpath, const char *path); +nfs3_log_readlink_res(uint32_t xid, nfsstat3 stat, int pstat, char *linkpath, + const char *path); extern void -nfs3_log_read_res (uint32_t xid, nfsstat3 stat, int pstat, - count3 count, int is_eof, struct iovec *vec, - int32_t vcount, const char *path); +nfs3_log_read_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, + int is_eof, struct iovec *vec, int32_t vcount, + const char *path); extern void -nfs3_log_write_res (uint32_t xid, nfsstat3 stat, int pstat, count3 count, - int stable, uint64_t wverf, const char *path); +nfs3_log_write_res(uint32_t xid, nfsstat3 stat, int pstat, count3 count, + int stable, uint64_t wverf, const char *path); extern void -nfs3_log_newfh_res (uint32_t xid, int op, nfsstat3 stat, int pstat, - struct nfs3_fh *newfh, const char *path); +nfs3_log_newfh_res(uint32_t xid, int op, nfsstat3 stat, int pstat, + struct nfs3_fh *newfh, const char *path); extern void -nfs3_log_readdir_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, - count3 count, int is_eof, const char *path); +nfs3_log_readdir_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, + count3 count, int is_eof, const char *path); extern void -nfs3_log_readdirp_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, - count3 dircount, count3 maxcount, int is_eof, - const char *path); +nfs3_log_readdirp_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf, + count3 dircount, count3 maxcount, int is_eof, + const char *path); extern void -nfs3_log_commit_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf, - const char *path); +nfs3_log_commit_res(uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf, + const char *path); extern void -nfs3_log_common_call (uint32_t xid, char *op, struct nfs3_fh *fh); +nfs3_log_common_call(uint32_t xid, char *op, struct nfs3_fh *fh); extern void -nfs3_log_fh_entry_call (uint32_t xid, char *op, struct nfs3_fh *fh, - char *name); +nfs3_log_fh_entry_call(uint32_t xid, char *op, struct nfs3_fh *fh, char *name); extern void -nfs3_log_rw_call (uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt, - count3 count, int stablewrite); +nfs3_log_rw_call(uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt, + count3 count, int stablewrite); extern void -nfs3_log_create_call (uint32_t xid, struct nfs3_fh *fh, char *name, - createmode3 mode); +nfs3_log_create_call(uint32_t xid, struct nfs3_fh *fh, char *name, + createmode3 mode); extern void -nfs3_log_symlink_call (uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt); +nfs3_log_symlink_call(uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt); extern void -nfs3_log_mknod_call (uint32_t xid, struct nfs3_fh *fh, char *name, int type); +nfs3_log_mknod_call(uint32_t xid, struct nfs3_fh *fh, char *name, int type); extern void -nfs3_log_rename_call (uint32_t xid, struct nfs3_fh *src, char *sname, - struct nfs3_fh *dst, char *dname); +nfs3_log_rename_call(uint32_t xid, struct nfs3_fh *src, char *sname, + struct nfs3_fh *dst, char *dname); extern void -nfs3_log_link_call (uint32_t xid, struct nfs3_fh *fh, char *name, - struct nfs3_fh *tgt); +nfs3_log_link_call(uint32_t xid, struct nfs3_fh *fh, char *name, + struct nfs3_fh *tgt); extern void -nfs3_log_readdir_call (uint32_t xid, struct nfs3_fh *fh, count3 dircount, - count3 maxcount); +nfs3_log_readdir_call(uint32_t xid, struct nfs3_fh *fh, count3 dircount, + count3 maxcount); extern int -nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs); +nfs3_fh_resolve_entry_hard(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_inode (nfs3_call_state_t *cs); +nfs3_fh_resolve_inode(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_entry (nfs3_call_state_t *cs); +nfs3_fh_resolve_entry(nfs3_call_state_t *cs); extern int -nfs3_fh_resolve_and_resume (nfs3_call_state_t *cs, struct nfs3_fh *fh, - char *entry, nfs3_resume_fn_t resum_fn); +nfs3_fh_resolve_and_resume(nfs3_call_state_t *cs, struct nfs3_fh *fh, + char *entry, nfs3_resume_fn_t resum_fn); extern int -nfs3_verify_dircookie (struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie, - uint64_t cverf, nfsstat3 *stat); +nfs3_verify_dircookie(struct nfs3_state *nfs3, fd_t *dirfd, cookie3 cookie, + uint64_t cverf, nfsstat3 *stat); extern int -nfs3_is_parentdir_entry (char *entry); +nfs3_is_parentdir_entry(char *entry); uint32_t -nfs3_request_to_accessbits (int32_t accbits); +nfs3_request_to_accessbits(int32_t accbits); extern int -nfs3_fh_auth_nfsop (nfs3_call_state_t *cs, gf_boolean_t is_write_op); +nfs3_fh_auth_nfsop(nfs3_call_state_t *cs, gf_boolean_t is_write_op); void -nfs3_map_deviceid_to_statdev (struct iatt *ia, uint64_t deviceid); +nfs3_map_deviceid_to_statdev(struct iatt *ia, uint64_t deviceid); #endif diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h index 187fb7e1912..f6d98d9f308 100644 --- a/xlators/nfs/server/src/nfs3.h +++ b/xlators/nfs/server/src/nfs3.h @@ -26,13 +26,12 @@ #include "refcount.h" #include <sys/statvfs.h> -#define GF_NFS3 GF_NFS"-nfsv3" - -#define GF_NFS3_DEFAULT_MEMFACTOR 15 -#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT -#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 -#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 +#define GF_NFS3 GF_NFS "-nfsv3" +#define GF_NFS3_DEFAULT_MEMFACTOR 15 +#define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT +#define GF_NFS3_CLTABLE_BUCKETS_MULT 2 +#define GF_NFS3_FDTABLE_BUCKETS_MULT 2 /* Static values used for FSINFO * To change the maximum rsize and wsize supported by the NFS client, adjust @@ -43,136 +42,143 @@ * * NB: For Kernel-NFS, NFS_MAX_FILE_IO_SIZE is 1048576U (1MB). */ -#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ -#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ +#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */ +#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */ -#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_RTMULT GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_WTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_WTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_WTMULT GF_NFS3_FILE_IO_SIZE_MIN /* This can be tuned through nfs.readdir-size */ -#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX -#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN -#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF +#define GF_NFS3_DTMAX GF_NFS3_FILE_IO_SIZE_MAX +#define GF_NFS3_DTMIN GF_NFS3_FILE_IO_SIZE_MIN +#define GF_NFS3_DTPREF GF_NFS3_FILE_IO_SIZE_DEF -#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) +#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB) -#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ -#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ +#define GF_NFS3_IO_SIZE 4096 /* 4-KB */ +#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */ /* FIXME: Handle time resolutions */ -#define GF_NFS3_TIMEDELTA_SECS {1,0} -#define GF_NFS3_TIMEDELTA_NSECS {0,1} -#define GF_NFS3_TIMEDELTA_MSECS {0,1000000} - -#define GF_NFS3_FS_PROP (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) - -#define GF_NFS3_DIRFD_VALID 1 -#define GF_NFS3_DIRFD_INVALID 0 - -#define GF_NFS3_VOLACCESS_RW 1 -#define GF_NFS3_VOLACCESS_RO 2 - - -#define GF_NFS3_FDCACHE_SIZE 512 +#define GF_NFS3_TIMEDELTA_SECS \ + { \ + 1, 0 \ + } +#define GF_NFS3_TIMEDELTA_NSECS \ + { \ + 0, 1 \ + } +#define GF_NFS3_TIMEDELTA_MSECS \ + { \ + 0, 1000000 \ + } + +#define GF_NFS3_FS_PROP \ + (FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME) + +#define GF_NFS3_DIRFD_VALID 1 +#define GF_NFS3_DIRFD_INVALID 0 + +#define GF_NFS3_VOLACCESS_RW 1 +#define GF_NFS3_VOLACCESS_RO 2 + +#define GF_NFS3_FDCACHE_SIZE 512 /* This should probably be moved to a more generic layer so that if needed * different versions of NFS protocol can use the same thing. */ struct nfs3_fd_entry { - fd_t *cachedfd; - struct list_head list; + fd_t *cachedfd; + struct list_head list; }; /* Per subvolume nfs3 specific state */ struct nfs3_export { - struct list_head explist; - xlator_t *subvol; - uuid_t volumeid; - int access; - int trusted_sync; - int trusted_write; - int rootlookedup; + struct list_head explist; + xlator_t *subvol; + uuid_t volumeid; + int access; + int trusted_sync; + int trusted_write; + int rootlookedup; }; -#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) +#define GF_NFS3_DEFAULT_VOLACCESS (GF_NFS3_VOLACCESS_RW) /* The NFSv3 protocol state */ typedef struct nfs3_state { - - /* The NFS xlator pointer. The NFS xlator can be running - * multiple versions of the NFS protocol. - */ - xlator_t *nfsx; - - /* The iob pool from which memory allocations are made for receiving - * and sending network messages. - */ - struct iobuf_pool *iobpool; - - /* List of child subvolumes for the NFSv3 protocol. - * Right now, is simply referring to the list of children in nfsx above. - */ - xlator_list_t *exportslist; - - struct list_head exports; - /* Mempool for allocations of struct nfs3_local */ - struct mem_pool *localpool; - - /* Server start-up timestamp, currently used for write verifier. */ - uint64_t serverstart; - - /* NFSv3 Protocol configurables */ - uint64_t readsize; - uint64_t writesize; - uint64_t readdirsize; - - /* Size of the iobufs used, depends on the sizes of the three params - * above. - */ - uint64_t iobsize; - - struct list_head fdlru; - gf_lock_t fdlrulock; - int fdcount; - uint32_t occ_logger; + /* The NFS xlator pointer. The NFS xlator can be running + * multiple versions of the NFS protocol. + */ + xlator_t *nfsx; + + /* The iob pool from which memory allocations are made for receiving + * and sending network messages. + */ + struct iobuf_pool *iobpool; + + /* List of child subvolumes for the NFSv3 protocol. + * Right now, is simply referring to the list of children in nfsx above. + */ + xlator_list_t *exportslist; + + struct list_head exports; + /* Mempool for allocations of struct nfs3_local */ + struct mem_pool *localpool; + + /* Server start-up timestamp, currently used for write verifier. */ + uint64_t serverstart; + + /* NFSv3 Protocol configurables */ + uint64_t readsize; + uint64_t writesize; + uint64_t readdirsize; + + /* Size of the iobufs used, depends on the sizes of the three params + * above. + */ + uint64_t iobsize; + + struct list_head fdlru; + gf_lock_t fdlrulock; + int fdcount; + uint32_t occ_logger; } nfs3_state_t; typedef enum nfs3_lookup_type { - GF_NFS3_REVALIDATE = 1, - GF_NFS3_FRESH, + GF_NFS3_REVALIDATE = 1, + GF_NFS3_FRESH, } nfs3_lookup_type_t; typedef union args_ { - nlm4_stat nlm4_stat; - nlm4_holder nlm4_holder; - nlm4_lock nlm4_lock; - nlm4_share nlm4_share; - nlm4_testrply nlm4_testrply; - nlm4_testres nlm4_testres; - nlm4_testargs nlm4_testargs; - nlm4_res nlm4_res; - nlm4_lockargs nlm4_lockargs; - nlm4_cancargs nlm4_cancargs; - nlm4_unlockargs nlm4_unlockargs; - nlm4_shareargs nlm4_shareargs; - nlm4_shareres nlm4_shareres; - nlm4_freeallargs nlm4_freeallargs; - getaclargs getaclargs; - setaclargs setaclargs; - getaclreply getaclreply; - setaclreply setaclreply; + nlm4_stat nlm4_stat; + nlm4_holder nlm4_holder; + nlm4_lock nlm4_lock; + nlm4_share nlm4_share; + nlm4_testrply nlm4_testrply; + nlm4_testres nlm4_testres; + nlm4_testargs nlm4_testargs; + nlm4_res nlm4_res; + nlm4_lockargs nlm4_lockargs; + nlm4_cancargs nlm4_cancargs; + nlm4_unlockargs nlm4_unlockargs; + nlm4_shareargs nlm4_shareargs; + nlm4_shareres nlm4_shareres; + nlm4_freeallargs nlm4_freeallargs; + getaclargs getaclargs; + setaclargs setaclargs; + getaclreply getaclreply; + setaclreply setaclreply; } args; - -typedef int (*nfs3_resume_fn_t) (void *cs); +typedef int (*nfs3_resume_fn_t)(void *cs); /* Structure used to communicate state between a fop and its callback. * Not all members are used at all times. Usage is fop and NFS request * dependent. @@ -185,80 +191,80 @@ typedef int (*nfs3_resume_fn_t) (void *cs); * Imagine the chaos if we need a mem-pool for each one of those sub-structures. */ struct nfs3_local { - GF_REF_DECL; - - rpcsvc_request_t *req; - xlator_t *vol; - nfs3_resume_fn_t resume_fn; - xlator_t *nfsx; - struct nfs3_state *nfs3state; - - /* The list hook to attach this call state to the inode's queue till - * the opening of the fd on the inode completes. - */ - struct list_head openwait_q; - - /* Per-NFSv3 Op state */ - struct nfs3_fh parent; - struct nfs3_fh fh; - fd_t *fd; - uint32_t accessbits; - int operrno; - count3 dircount; - count3 maxcount; - struct statvfs fsstat; - gf_dirent_t entries; - struct iatt stbuf; - struct iatt preparent; - struct iatt postparent; - int32_t setattr_valid; - nfstime3 timestamp; - loc_t oploc; - int writetype; - count3 datacount; - offset3 dataoffset; - struct iobuf *iob; - struct iobref *iobref; - createmode3 createmode; - uint64_t cookieverf; - int sattrguardcheck; - char *pathname; - ftype3 mknodtype; - specdata3 devnums; - cookie3 cookie; - struct iovec datavec; - mode_t mode; - struct iatt attr_in; - - /* NFSv3 FH resolver state */ - int hardresolved; - struct nfs3_fh resolvefh; - loc_t resolvedloc; - int resolve_ret; - int resolve_errno; - int hashidx; - fd_t *resolve_dir_fd; - char *resolventry; - nfs3_lookup_type_t lookuptype; - gf_dirent_t *hashmatch; - gf_dirent_t *entrymatch; - off_t lastentryoffset; - struct flock flock; - args args; - nlm4_lkowner_t lkowner; - char cookiebytes[1024]; - struct nfs3_fh lockfh; - int monitor; - rpc_transport_t *trans; - call_frame_t *frame; - - /* ACL */ - aclentry aclentry[NFS_ACL_MAX_ENTRIES]; - aclentry daclentry[NFS_ACL_MAX_ENTRIES]; - int aclcount; - char aclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; - int daclcount; - char daclxattr[NFS_ACL_MAX_ENTRIES*8 + 4]; + GF_REF_DECL; + + rpcsvc_request_t *req; + xlator_t *vol; + nfs3_resume_fn_t resume_fn; + xlator_t *nfsx; + struct nfs3_state *nfs3state; + + /* The list hook to attach this call state to the inode's queue till + * the opening of the fd on the inode completes. + */ + struct list_head openwait_q; + + /* Per-NFSv3 Op state */ + struct nfs3_fh parent; + struct nfs3_fh fh; + fd_t *fd; + uint32_t accessbits; + int operrno; + count3 dircount; + count3 maxcount; + struct statvfs fsstat; + gf_dirent_t entries; + struct iatt stbuf; + struct iatt preparent; + struct iatt postparent; + int32_t setattr_valid; + nfstime3 timestamp; + loc_t oploc; + int writetype; + count3 datacount; + offset3 dataoffset; + struct iobuf *iob; + struct iobref *iobref; + createmode3 createmode; + uint64_t cookieverf; + int sattrguardcheck; + char *pathname; + ftype3 mknodtype; + specdata3 devnums; + cookie3 cookie; + struct iovec datavec; + mode_t mode; + struct iatt attr_in; + + /* NFSv3 FH resolver state */ + int hardresolved; + struct nfs3_fh resolvefh; + loc_t resolvedloc; + int resolve_ret; + int resolve_errno; + int hashidx; + fd_t *resolve_dir_fd; + char *resolventry; + nfs3_lookup_type_t lookuptype; + gf_dirent_t *hashmatch; + gf_dirent_t *entrymatch; + off_t lastentryoffset; + struct flock flock; + args args; + nlm4_lkowner_t lkowner; + char cookiebytes[1024]; + struct nfs3_fh lockfh; + int monitor; + rpc_transport_t *trans; + call_frame_t *frame; + + /* ACL */ + aclentry aclentry[NFS_ACL_MAX_ENTRIES]; + aclentry daclentry[NFS_ACL_MAX_ENTRIES]; + int aclcount; + char aclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; + int daclcount; + char daclxattr[NFS_ACL_MAX_ENTRIES * 8 + 4]; }; #define nfs3_is_revalidate_lookup(cst) ((cst)->lookuptype == GF_NFS3_REVALIDATE) @@ -270,17 +276,17 @@ typedef struct nfs3_local nfs3_call_state_t; /* Queue of ops waiting for open fop to return. */ struct inode_op_queue { - struct list_head opq; - pthread_mutex_t qlock; + struct list_head opq; + pthread_mutex_t qlock; }; extern rpcsvc_program_t * -nfs3svc_init (xlator_t *nfsx); +nfs3svc_init(xlator_t *nfsx); extern int -nfs3_reconfigure_state (xlator_t *nfsx, dict_t *options); +nfs3_reconfigure_state(xlator_t *nfsx, dict_t *options); extern uint64_t -nfs3_request_xlator_deviceid (rpcsvc_request_t *req); +nfs3_request_xlator_deviceid(rpcsvc_request_t *req); #endif diff --git a/xlators/nfs/server/src/nlm4.h b/xlators/nfs/server/src/nlm4.h index f9d254e2a37..4755c83f3dc 100644 --- a/xlators/nfs/server/src/nlm4.h +++ b/xlators/nfs/server/src/nlm4.h @@ -26,86 +26,86 @@ #include "nlm4-xdr.h" #include "lkowner.h" -#define NLM4_NULL 0 -#define NLM4_TEST 1 -#define NLM4_LOCK 2 -#define NLM4_CANCEL 3 -#define NLM4_UNLOCK 4 -#define NLM4_GRANTED 5 -#define NLM4_TEST_MSG 6 -#define NLM4_LOCK_MSG 7 -#define NLM4_CANCEL_MSG 8 -#define NLM4_UNLOCK_MSG 9 -#define NLM4_GRANTED_MSG 10 -#define NLM4_TEST_RES 11 -#define NLM4_LOCK_RES 12 -#define NLM4_CANCEL_RES 13 -#define NLM4_UNLOCK_RES 14 -#define NLM4_GRANTED_RES 15 -#define NLM4_SM_NOTIFY 16 -#define NLM4_SEVENTEEN 17 -#define NLM4_EIGHTEEN 18 -#define NLM4_NINETEEN 19 -#define NLM4_SHARE 20 -#define NLM4_UNSHARE 21 -#define NLM4_NM_LOCK 22 -#define NLM4_FREE_ALL 23 -#define NLM4_PROC_COUNT 24 +#define NLM4_NULL 0 +#define NLM4_TEST 1 +#define NLM4_LOCK 2 +#define NLM4_CANCEL 3 +#define NLM4_UNLOCK 4 +#define NLM4_GRANTED 5 +#define NLM4_TEST_MSG 6 +#define NLM4_LOCK_MSG 7 +#define NLM4_CANCEL_MSG 8 +#define NLM4_UNLOCK_MSG 9 +#define NLM4_GRANTED_MSG 10 +#define NLM4_TEST_RES 11 +#define NLM4_LOCK_RES 12 +#define NLM4_CANCEL_RES 13 +#define NLM4_UNLOCK_RES 14 +#define NLM4_GRANTED_RES 15 +#define NLM4_SM_NOTIFY 16 +#define NLM4_SEVENTEEN 17 +#define NLM4_EIGHTEEN 18 +#define NLM4_NINETEEN 19 +#define NLM4_SHARE 20 +#define NLM4_UNSHARE 21 +#define NLM4_NM_LOCK 22 +#define NLM4_FREE_ALL 23 +#define NLM4_PROC_COUNT 24 /* Registered with portmap */ -#define GF_NLM4_PORT 38468 -#define GF_NLM GF_NFS"-NLM" +#define GF_NLM4_PORT 38468 +#define GF_NLM GF_NFS "-NLM" #if defined(GF_DARWIN_HOST_OS) -#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/statd.notify.pid" +#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/statd.notify.pid" #elif defined(__NetBSD__) -#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/inexistent.pid" +#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/inexistent.pid" #else -#define GF_RPC_STATD_PROG "/sbin/rpc.statd" -#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" -#define GF_SM_NOTIFY_PIDFILE "/var/run/sm-notify.pid" +#define GF_RPC_STATD_PROG "/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/sm-notify.pid" #endif extern rpcsvc_program_t * -nlm4svc_init (xlator_t *nfsx); +nlm4svc_init(xlator_t *nfsx); extern int -nlm4_init_state (xlator_t *nfsx); +nlm4_init_state(xlator_t *nfsx); #define NLM_PROGRAM 100021 #define NLM_V4 4 typedef struct nlm4_lwowner { - char temp[1024]; + char temp[1024]; } nlm4_lkowner_t; typedef struct nlm_client { - struct sockaddr_storage sa; - pid_t uniq; - struct list_head nlm_clients; - struct list_head fdes; - struct list_head shares; - struct rpc_clnt *rpc_clnt; - char *caller_name; - int nsm_monitor; + struct sockaddr_storage sa; + pid_t uniq; + struct list_head nlm_clients; + struct list_head fdes; + struct list_head shares; + struct rpc_clnt *rpc_clnt; + char *caller_name; + int nsm_monitor; } nlm_client_t; typedef struct nlm_share { - struct list_head client_list; - struct list_head inode_list; - gf_lkowner_t lkowner; - inode_t *inode; - fsh_mode mode; - fsh_access access; + struct list_head client_list; + struct list_head inode_list; + gf_lkowner_t lkowner; + inode_t *inode; + fsh_mode mode; + fsh_access access; } nlm_share_t; typedef struct nlm_fde { - struct list_head fde_list; - fd_t *fd; - int transit_cnt; + struct list_head fde_list; + fd_t *fd; + int transit_cnt; } nlm_fde_t; #endif diff --git a/xlators/performance/decompounder/src/decompounder-mem-types.h b/xlators/performance/decompounder/src/decompounder-mem-types.h index 5c211c1a907..8b3049ffb18 100644 --- a/xlators/performance/decompounder/src/decompounder-mem-types.h +++ b/xlators/performance/decompounder/src/decompounder-mem-types.h @@ -13,8 +13,5 @@ #include "mem-types.h" -enum gf_dc_mem_types_ { - gf_dc_mt_rsp_t = gf_common_mt_end + 1, - gf_dc_mt_end -}; +enum gf_dc_mem_types_ { gf_dc_mt_rsp_t = gf_common_mt_end + 1, gf_dc_mt_end }; #endif diff --git a/xlators/performance/decompounder/src/decompounder-messages.h b/xlators/performance/decompounder/src/decompounder-messages.h index 5f0aab4d92f..60674f32e78 100644 --- a/xlators/performance/decompounder/src/decompounder-messages.h +++ b/xlators/performance/decompounder/src/decompounder-messages.h @@ -23,9 +23,6 @@ * glfs-message-id.h. */ -GLFS_MSGID(DC, - DC_MSG_VOL_MISCONFIGURED, - DC_MSG_ERROR_RECEIVED -); +GLFS_MSGID(DC, DC_MSG_VOL_MISCONFIGURED, DC_MSG_ERROR_RECEIVED); #endif /* !_DC_MESSAGES_H_ */ diff --git a/xlators/performance/decompounder/src/decompounder.h b/xlators/performance/decompounder/src/decompounder.h index 59fb908ed06..486d0caf369 100644 --- a/xlators/performance/decompounder/src/decompounder.h +++ b/xlators/performance/decompounder/src/decompounder.h @@ -18,58 +18,61 @@ #include "decompounder-messages.h" typedef struct { - compound_args_t *compound_req; - compound_args_cbk_t *compound_rsp; - int counter; - int length; + compound_args_t *compound_req; + compound_args_cbk_t *compound_rsp; + int counter; + int length; } dc_local_t; -#define DC_STACK_UNWIND(frame, op_ret, op_errno, rsp, xdata) do {\ - dc_local_t *__local = NULL; \ - \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (compound, frame, op_ret, op_errno, \ - (void *)rsp, xdata); \ - if (__local) { \ - dc_local_cleanup (__local); \ - mem_put (__local); \ - } \ - } while (0) +#define DC_STACK_UNWIND(frame, op_ret, op_errno, rsp, xdata) \ + do { \ + dc_local_t *__local = NULL; \ + \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(compound, frame, op_ret, op_errno, (void *)rsp, \ + xdata); \ + if (__local) { \ + dc_local_cleanup(__local); \ + mem_put(__local); \ + } \ + } while (0) int32_t -dc_compound_fop_wind (call_frame_t *frame, xlator_t *this); +dc_compound_fop_wind(call_frame_t *frame, xlator_t *this); void -dc_local_cleanup (dc_local_t *local); +dc_local_cleanup(dc_local_t *local); -#define DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fop, frame, op_ret, op_errno, params ...) do { \ - dc_local_t *__local = frame->local; \ - xlator_t *__this = frame->this; \ - int __ret = 0; \ - int __counter = __local->counter; \ - compound_args_cbk_t *__compound_rsp = __local->compound_rsp; \ - default_args_cbk_t *__fop_rsp = &__local->compound_rsp->rsp_list[__counter]; \ - \ - if (op_ret < 0) { \ - gf_msg (__this->name, GF_LOG_ERROR, op_errno, DC_MSG_ERROR_RECEIVED, \ - "fop number %d failed. Unwinding.", __counter+1); \ - args_##fop##_cbk_store (__fop_rsp, \ - op_ret, op_errno, params); \ - /*TODO : Fill the rest of the responses to -1 or NULL*/ \ - DC_STACK_UNWIND (frame, op_ret, op_errno, \ - (void *)__compound_rsp, NULL); \ - } else { \ - args_##fop##_cbk_store (__fop_rsp, \ - op_ret, op_errno, params); \ - __local->counter++; \ - __ret = dc_compound_fop_wind (frame, __this); \ - if (__ret < 0) { \ - DC_STACK_UNWIND (frame, -1, -__ret, \ - (void *)__compound_rsp, NULL); \ - } \ - } \ - } while (0) +#define DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fop, frame, op_ret, op_errno, \ + params...) \ + do { \ + dc_local_t *__local = frame->local; \ + xlator_t *__this = frame->this; \ + int __ret = 0; \ + int __counter = __local->counter; \ + compound_args_cbk_t *__compound_rsp = __local->compound_rsp; \ + default_args_cbk_t *__fop_rsp = &__local->compound_rsp \ + ->rsp_list[__counter]; \ + \ + if (op_ret < 0) { \ + gf_msg(__this->name, GF_LOG_ERROR, op_errno, \ + DC_MSG_ERROR_RECEIVED, "fop number %d failed. Unwinding.", \ + __counter + 1); \ + args_##fop##_cbk_store(__fop_rsp, op_ret, op_errno, params); \ + /*TODO : Fill the rest of the responses to -1 or NULL*/ \ + DC_STACK_UNWIND(frame, op_ret, op_errno, (void *)__compound_rsp, \ + NULL); \ + } else { \ + args_##fop##_cbk_store(__fop_rsp, op_ret, op_errno, params); \ + __local->counter++; \ + __ret = dc_compound_fop_wind(frame, __this); \ + if (__ret < 0) { \ + DC_STACK_UNWIND(frame, -1, -__ret, (void *)__compound_rsp, \ + NULL); \ + } \ + } \ + } while (0) #endif /* DC_H__ */ diff --git a/xlators/performance/io-cache/src/io-cache-messages.h b/xlators/performance/io-cache/src/io-cache-messages.h index f49a977554b..09c5439ca71 100644 --- a/xlators/performance/io-cache/src/io-cache-messages.h +++ b/xlators/performance/io-cache/src/io-cache-messages.h @@ -22,16 +22,11 @@ * glfs-message-id.h. */ -GLFS_MSGID(IO_CACHE, - IO_CACHE_MSG_ENFORCEMENT_FAILED, - IO_CACHE_MSG_INVALID_ARGUMENT, - IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED, - IO_CACHE_MSG_NO_MEMORY, - IO_CACHE_MSG_VOL_MISCONFIGURED, - IO_CACHE_MSG_INODE_NULL, - IO_CACHE_MSG_PAGE_WAIT_VALIDATE, - IO_CACHE_MSG_STR_COVERSION_FAILED, - IO_CACHE_MSG_WASTED_COPY -); +GLFS_MSGID(IO_CACHE, IO_CACHE_MSG_ENFORCEMENT_FAILED, + IO_CACHE_MSG_INVALID_ARGUMENT, + IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED, IO_CACHE_MSG_NO_MEMORY, + IO_CACHE_MSG_VOL_MISCONFIGURED, IO_CACHE_MSG_INODE_NULL, + IO_CACHE_MSG_PAGE_WAIT_VALIDATE, IO_CACHE_MSG_STR_COVERSION_FAILED, + IO_CACHE_MSG_WASTED_COPY); #endif /* _IO_CACHE_MESSAGES_H_ */ diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h index 50008ef7004..cc66fcea714 100644 --- a/xlators/performance/io-cache/src/io-cache.h +++ b/xlators/performance/io-cache/src/io-cache.h @@ -26,8 +26,8 @@ #include <fnmatch.h> #include "io-cache-messages.h" -#define IOC_PAGE_SIZE (1024 * 128) /* 128KB */ -#define IOC_CACHE_SIZE (32 * 1024 * 1024) +#define IOC_PAGE_SIZE (1024 * 128) /* 128KB */ +#define IOC_CACHE_SIZE (32 * 1024 * 1024) #define IOC_PAGE_TABLE_BUCKET_COUNT 1 struct ioc_table; @@ -36,9 +36,9 @@ struct ioc_page; struct ioc_inode; struct ioc_priority { - struct list_head list; - char *pattern; - uint32_t priority; + struct list_head list; + char *pattern; + uint32_t priority; }; /* @@ -49,10 +49,10 @@ struct ioc_priority { * @data: pointer to the frame which is waiting */ struct ioc_waitq { - struct ioc_waitq *next; - void *data; - off_t pending_offset; - size_t pending_size; + struct ioc_waitq *next; + void *data; + off_t pending_offset; + size_t pending_size; }; /* @@ -60,39 +60,39 @@ struct ioc_waitq { * */ struct ioc_fill { - struct list_head list; /* list of ioc_fill structures of a frame */ - off_t offset; - size_t size; - struct iovec *vector; - int32_t count; - struct iobref *iobref; + struct list_head list; /* list of ioc_fill structures of a frame */ + off_t offset; + size_t size; + struct iovec *vector; + int32_t count; + struct iobref *iobref; }; struct ioc_local { - mode_t mode; - int32_t flags; - loc_t file_loc; - off_t offset; - size_t size; - int32_t op_ret; - int32_t op_errno; - struct list_head fill_list; /* list of ioc_fill structures */ - off_t pending_offset; /* - * offset from this frame should - * continue - */ - size_t pending_size; /* - * size of data this frame is waiting - * on - */ - struct ioc_inode *inode; - int32_t wait_count; - pthread_mutex_t local_lock; - struct ioc_waitq *waitq; - void *stub; - fd_t *fd; - int32_t need_xattr; - dict_t *xattr_req; + mode_t mode; + int32_t flags; + loc_t file_loc; + off_t offset; + size_t size; + int32_t op_ret; + int32_t op_errno; + struct list_head fill_list; /* list of ioc_fill structures */ + off_t pending_offset; /* + * offset from this frame should + * continue + */ + size_t pending_size; /* + * size of data this frame is waiting + * on + */ + struct ioc_inode *inode; + int32_t wait_count; + pthread_mutex_t local_lock; + struct ioc_waitq *waitq; + void *stub; + fd_t *fd; + int32_t need_xattr; + dict_t *xattr_req; }; /* @@ -100,71 +100,71 @@ struct ioc_local { * */ struct ioc_page { - struct list_head page_lru; - struct ioc_inode *inode; /* inode this page belongs to */ - struct ioc_priority *priority; - char dirty; - char ready; - struct iovec *vector; - int32_t count; - off_t offset; - size_t size; - struct ioc_waitq *waitq; - struct iobref *iobref; - pthread_mutex_t page_lock; - int32_t op_errno; - char stale; + struct list_head page_lru; + struct ioc_inode *inode; /* inode this page belongs to */ + struct ioc_priority *priority; + char dirty; + char ready; + struct iovec *vector; + int32_t count; + off_t offset; + size_t size; + struct ioc_waitq *waitq; + struct iobref *iobref; + pthread_mutex_t page_lock; + int32_t op_errno; + char stale; }; struct ioc_cache { - rbthash_table_t *page_table; - struct list_head page_lru; - time_t mtime; /* - * seconds component of file mtime - */ - time_t mtime_nsec; /* - * nanosecond component of file mtime - */ - struct timeval tv; /* - * time-stamp at last re-validate - */ + rbthash_table_t *page_table; + struct list_head page_lru; + time_t mtime; /* + * seconds component of file mtime + */ + time_t mtime_nsec; /* + * nanosecond component of file mtime + */ + struct timeval tv; /* + * time-stamp at last re-validate + */ }; struct ioc_inode { - struct ioc_table *table; - off_t ia_size; - struct ioc_cache cache; - struct list_head inode_list; /* - * list of inodes, maintained by - * io-cache translator - */ - struct list_head inode_lru; - struct ioc_waitq *waitq; - pthread_mutex_t inode_lock; - uint32_t weight; /* - * weight of the inode, increases - * on each read - */ - inode_t *inode; + struct ioc_table *table; + off_t ia_size; + struct ioc_cache cache; + struct list_head inode_list; /* + * list of inodes, maintained by + * io-cache translator + */ + struct list_head inode_lru; + struct ioc_waitq *waitq; + pthread_mutex_t inode_lock; + uint32_t weight; /* + * weight of the inode, increases + * on each read + */ + inode_t *inode; }; struct ioc_table { - uint64_t page_size; - uint64_t cache_size; - uint64_t cache_used; - uint64_t min_file_size; - uint64_t max_file_size; - struct list_head inodes; /* list of inodes cached */ - struct list_head active; - struct list_head *inode_lru; - struct list_head priority_list; - int32_t readv_count; - pthread_mutex_t table_lock; - xlator_t *xl; - uint32_t inode_count; - int32_t cache_timeout; - int32_t max_pri; - struct mem_pool *mem_pool; + uint64_t page_size; + uint64_t cache_size; + uint64_t cache_used; + uint64_t min_file_size; + uint64_t max_file_size; + struct list_head inodes; /* list of inodes cached */ + struct list_head active; + struct list_head *inode_lru; + struct list_head priority_list; + int32_t readv_count; + pthread_mutex_t table_lock; + xlator_t *xl; + uint32_t inode_count; + int32_t cache_timeout; + int32_t max_pri; + struct mem_pool *mem_pool; }; typedef struct ioc_table ioc_table_t; @@ -175,158 +175,147 @@ typedef struct ioc_waitq ioc_waitq_t; typedef struct ioc_fill ioc_fill_t; void * -str_to_ptr (char *string); +str_to_ptr(char *string); char * -ptr_to_str (void *ptr); +ptr_to_str(void *ptr); int32_t -ioc_readv_disabled_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iovec *vector, - int32_t count, struct iatt *stbuf, - struct iobref *iobref, dict_t *xdata); +ioc_readv_disabled_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iovec *vector, + int32_t count, struct iatt *stbuf, struct iobref *iobref, + dict_t *xdata); ioc_page_t * -__ioc_page_get (ioc_inode_t *ioc_inode, off_t offset); +__ioc_page_get(ioc_inode_t *ioc_inode, off_t offset); ioc_page_t * -__ioc_page_create (ioc_inode_t *ioc_inode, off_t offset); +__ioc_page_create(ioc_inode_t *ioc_inode, off_t offset); void -ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd, - off_t offset); +ioc_page_fault(ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd, + off_t offset); void -__ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset, - size_t size); +__ioc_wait_on_page(ioc_page_t *page, call_frame_t *frame, off_t offset, + size_t size); ioc_waitq_t * -__ioc_page_wakeup (ioc_page_t *page, int32_t op_errno); +__ioc_page_wakeup(ioc_page_t *page, int32_t op_errno); void -ioc_page_flush (ioc_page_t *page); +ioc_page_flush(ioc_page_t *page); ioc_waitq_t * -__ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno); +__ioc_page_error(ioc_page_t *page, int32_t op_ret, int32_t op_errno); void -ioc_frame_return (call_frame_t *frame); +ioc_frame_return(call_frame_t *frame); void -ioc_waitq_return (ioc_waitq_t *waitq); +ioc_waitq_return(ioc_waitq_t *waitq); int32_t -ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset, - size_t size, int32_t op_errno); - -#define ioc_inode_lock(ioc_inode) \ - do { \ - gf_msg_trace (ioc_inode->table->xl->name, 0, \ - "locked inode(%p)", ioc_inode); \ - pthread_mutex_lock (&ioc_inode->inode_lock); \ - } while (0) - - -#define ioc_inode_unlock(ioc_inode) \ - do { \ - gf_msg_trace (ioc_inode->table->xl->name, 0, \ - "unlocked inode(%p)", ioc_inode); \ - pthread_mutex_unlock (&ioc_inode->inode_lock); \ - } while (0) - - -#define ioc_table_lock(table) \ - do { \ - gf_msg_trace (table->xl->name, 0, \ - "locked table(%p)", table); \ - pthread_mutex_lock (&table->table_lock); \ - } while (0) - - -#define ioc_table_unlock(table) \ - do { \ - gf_msg_trace (table->xl->name, 0, \ - "unlocked table(%p)", table); \ - pthread_mutex_unlock (&table->table_lock); \ - } while (0) - - -#define ioc_local_lock(local) \ - do { \ - gf_msg_trace (local->inode->table->xl->name, 0, \ - "locked local(%p)", local); \ - pthread_mutex_lock (&local->local_lock); \ - } while (0) - - -#define ioc_local_unlock(local) \ - do { \ - gf_msg_trace (local->inode->table->xl->name, 0, \ - "unlocked local(%p)", local); \ - pthread_mutex_unlock (&local->local_lock); \ - } while (0) - - -#define ioc_page_lock(page) \ - do { \ - gf_msg_trace (page->inode->table->xl->name, 0, \ - "locked page(%p)", page); \ - pthread_mutex_lock (&page->page_lock); \ - } while (0) - - -#define ioc_page_unlock(page) \ - do { \ - gf_msg_trace (page->inode->table->xl->name, 0, \ - "unlocked page(%p)", page); \ - pthread_mutex_unlock (&page->page_lock); \ - } while (0) - +ioc_frame_fill(ioc_page_t *page, call_frame_t *frame, off_t offset, size_t size, + int32_t op_errno); + +#define ioc_inode_lock(ioc_inode) \ + do { \ + gf_msg_trace(ioc_inode->table->xl->name, 0, "locked inode(%p)", \ + ioc_inode); \ + pthread_mutex_lock(&ioc_inode->inode_lock); \ + } while (0) + +#define ioc_inode_unlock(ioc_inode) \ + do { \ + gf_msg_trace(ioc_inode->table->xl->name, 0, "unlocked inode(%p)", \ + ioc_inode); \ + pthread_mutex_unlock(&ioc_inode->inode_lock); \ + } while (0) + +#define ioc_table_lock(table) \ + do { \ + gf_msg_trace(table->xl->name, 0, "locked table(%p)", table); \ + pthread_mutex_lock(&table->table_lock); \ + } while (0) + +#define ioc_table_unlock(table) \ + do { \ + gf_msg_trace(table->xl->name, 0, "unlocked table(%p)", table); \ + pthread_mutex_unlock(&table->table_lock); \ + } while (0) + +#define ioc_local_lock(local) \ + do { \ + gf_msg_trace(local->inode->table->xl->name, 0, "locked local(%p)", \ + local); \ + pthread_mutex_lock(&local->local_lock); \ + } while (0) + +#define ioc_local_unlock(local) \ + do { \ + gf_msg_trace(local->inode->table->xl->name, 0, "unlocked local(%p)", \ + local); \ + pthread_mutex_unlock(&local->local_lock); \ + } while (0) + +#define ioc_page_lock(page) \ + do { \ + gf_msg_trace(page->inode->table->xl->name, 0, "locked page(%p)", \ + page); \ + pthread_mutex_lock(&page->page_lock); \ + } while (0) + +#define ioc_page_unlock(page) \ + do { \ + gf_msg_trace(page->inode->table->xl->name, 0, "unlocked page(%p)", \ + page); \ + pthread_mutex_unlock(&page->page_lock); \ + } while (0) static inline uint64_t -time_elapsed (struct timeval *now, - struct timeval *then) +time_elapsed(struct timeval *now, struct timeval *then) { - uint64_t sec = now->tv_sec - then->tv_sec; + uint64_t sec = now->tv_sec - then->tv_sec; - if (sec) - return sec; + if (sec) + return sec; - return 0; + return 0; } ioc_inode_t * -ioc_inode_search (ioc_table_t *table, inode_t *inode); +ioc_inode_search(ioc_table_t *table, inode_t *inode); void -ioc_inode_destroy (ioc_inode_t *ioc_inode); +ioc_inode_destroy(ioc_inode_t *ioc_inode); int32_t -ioc_inode_update (xlator_t *this, inode_t *inode, char *path, - struct iatt *iabuf); +ioc_inode_update(xlator_t *this, inode_t *inode, char *path, + struct iatt *iabuf); ioc_inode_t * -ioc_inode_create (ioc_table_t *table, inode_t *inode, uint32_t weight); +ioc_inode_create(ioc_table_t *table, inode_t *inode, uint32_t weight); int64_t -__ioc_page_destroy (ioc_page_t *page); +__ioc_page_destroy(ioc_page_t *page); int64_t -__ioc_inode_flush (ioc_inode_t *ioc_inode); +__ioc_inode_flush(ioc_inode_t *ioc_inode); void -ioc_inode_flush (ioc_inode_t *ioc_inode); +ioc_inode_flush(ioc_inode_t *ioc_inode); void -ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode, - struct iatt *stbuf); +ioc_inode_wakeup(call_frame_t *frame, ioc_inode_t *ioc_inode, + struct iatt *stbuf); int8_t -ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct iatt *stbuf); +ioc_cache_still_valid(ioc_inode_t *ioc_inode, struct iatt *stbuf); int32_t -ioc_prune (ioc_table_t *table); +ioc_prune(ioc_table_t *table); int32_t -ioc_need_prune (ioc_table_t *table); +ioc_need_prune(ioc_table_t *table); #endif /* __IO_CACHE_H */ diff --git a/xlators/performance/io-cache/src/ioc-mem-types.h b/xlators/performance/io-cache/src/ioc-mem-types.h index 9b68f9fce5f..3271840bb43 100644 --- a/xlators/performance/io-cache/src/ioc-mem-types.h +++ b/xlators/performance/io-cache/src/ioc-mem-types.h @@ -14,16 +14,16 @@ #include "mem-types.h" enum gf_ioc_mem_types_ { - gf_ioc_mt_iovec = gf_common_mt_end + 1, - gf_ioc_mt_ioc_table_t, - gf_ioc_mt_char, - gf_ioc_mt_ioc_waitq_t, - gf_ioc_mt_ioc_priority, - gf_ioc_mt_list_head, - gf_ioc_mt_call_pool_t, - gf_ioc_mt_ioc_inode_t, - gf_ioc_mt_ioc_fill_t, - gf_ioc_mt_ioc_newpage_t, - gf_ioc_mt_end + gf_ioc_mt_iovec = gf_common_mt_end + 1, + gf_ioc_mt_ioc_table_t, + gf_ioc_mt_char, + gf_ioc_mt_ioc_waitq_t, + gf_ioc_mt_ioc_priority, + gf_ioc_mt_list_head, + gf_ioc_mt_call_pool_t, + gf_ioc_mt_ioc_inode_t, + gf_ioc_mt_ioc_fill_t, + gf_ioc_mt_ioc_newpage_t, + gf_ioc_mt_end }; #endif diff --git a/xlators/performance/io-threads/src/io-threads-messages.h b/xlators/performance/io-threads/src/io-threads-messages.h index 0f3fe707a36..25e08f4b687 100644 --- a/xlators/performance/io-threads/src/io-threads-messages.h +++ b/xlators/performance/io-threads/src/io-threads-messages.h @@ -22,12 +22,8 @@ * glfs-message-id.h. */ -GLFS_MSGID(IO_THREADS, - IO_THREADS_MSG_INIT_FAILED, - IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED, - IO_THREADS_MSG_NO_MEMORY, - IO_THREADS_MSG_VOL_MISCONFIGURED, - IO_THREADS_MSG_SIZE_NOT_SET -); +GLFS_MSGID(IO_THREADS, IO_THREADS_MSG_INIT_FAILED, + IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED, IO_THREADS_MSG_NO_MEMORY, + IO_THREADS_MSG_VOL_MISCONFIGURED, IO_THREADS_MSG_SIZE_NOT_SET); #endif /* _IO_THREADS_MESSAGES_H_ */ diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h index 7124169b795..949d1d1b1e0 100644 --- a/xlators/performance/io-threads/src/io-threads.h +++ b/xlators/performance/io-threads/src/io-threads.h @@ -11,7 +11,6 @@ #ifndef __IOT_H #define __IOT_H - #include "compat-errno.h" #include "glusterfs.h" #include "logging.h" @@ -25,61 +24,60 @@ #include <semaphore.h> #include "statedump.h" - struct iot_conf; -#define MAX_IDLE_SKEW 4 /* In secs */ -#define skew_sec_idle_time(sec) ((sec) + (random () % MAX_IDLE_SKEW)) -#define IOT_DEFAULT_IDLE 120 /* In secs. */ +#define MAX_IDLE_SKEW 4 /* In secs */ +#define skew_sec_idle_time(sec) ((sec) + (random() % MAX_IDLE_SKEW)) +#define IOT_DEFAULT_IDLE 120 /* In secs. */ -#define IOT_MIN_THREADS 1 -#define IOT_DEFAULT_THREADS 16 -#define IOT_MAX_THREADS 64 +#define IOT_MIN_THREADS 1 +#define IOT_DEFAULT_THREADS 16 +#define IOT_MAX_THREADS 64 -#define IOT_THREAD_STACK_SIZE ((size_t)(256*1024)) +#define IOT_THREAD_STACK_SIZE ((size_t)(256 * 1024)) typedef struct { - struct list_head clients; - struct list_head reqs; + struct list_head clients; + struct list_head reqs; } iot_client_ctx_t; struct iot_conf { - pthread_mutex_t mutex; - pthread_cond_t cond; - - int32_t max_count; /* configured maximum */ - int32_t curr_count; /* actual number of threads running */ - int32_t sleep_count; - - int32_t idle_time; /* in seconds */ - - struct list_head clients[GF_FOP_PRI_MAX]; - /* - * It turns out that there are several ways a frame can get to us - * without having an associated client (server_first_lookup was the - * first one I hit). Instead of trying to update all such callers, - * we use this to queue them. - */ - iot_client_ctx_t no_client[GF_FOP_PRI_MAX]; - - int32_t ac_iot_limit[GF_FOP_PRI_MAX]; - int32_t ac_iot_count[GF_FOP_PRI_MAX]; - int queue_sizes[GF_FOP_PRI_MAX]; - int queue_size; - pthread_attr_t w_attr; - gf_boolean_t least_priority; /*Enable/Disable least-priority */ - - xlator_t *this; - size_t stack_size; - gf_boolean_t down; /*PARENT_DOWN event is notified*/ - gf_boolean_t mutex_inited; - gf_boolean_t cond_inited; - - int32_t watchdog_secs; - gf_boolean_t watchdog_running; - pthread_t watchdog_thread; - gf_boolean_t queue_marked[GF_FOP_PRI_MAX]; - gf_boolean_t cleanup_disconnected_reqs; + pthread_mutex_t mutex; + pthread_cond_t cond; + + int32_t max_count; /* configured maximum */ + int32_t curr_count; /* actual number of threads running */ + int32_t sleep_count; + + int32_t idle_time; /* in seconds */ + + struct list_head clients[GF_FOP_PRI_MAX]; + /* + * It turns out that there are several ways a frame can get to us + * without having an associated client (server_first_lookup was the + * first one I hit). Instead of trying to update all such callers, + * we use this to queue them. + */ + iot_client_ctx_t no_client[GF_FOP_PRI_MAX]; + + int32_t ac_iot_limit[GF_FOP_PRI_MAX]; + int32_t ac_iot_count[GF_FOP_PRI_MAX]; + int queue_sizes[GF_FOP_PRI_MAX]; + int queue_size; + pthread_attr_t w_attr; + gf_boolean_t least_priority; /*Enable/Disable least-priority */ + + xlator_t *this; + size_t stack_size; + gf_boolean_t down; /*PARENT_DOWN event is notified*/ + gf_boolean_t mutex_inited; + gf_boolean_t cond_inited; + + int32_t watchdog_secs; + gf_boolean_t watchdog_running; + pthread_t watchdog_thread; + gf_boolean_t queue_marked[GF_FOP_PRI_MAX]; + gf_boolean_t cleanup_disconnected_reqs; }; typedef struct iot_conf iot_conf_t; diff --git a/xlators/performance/io-threads/src/iot-mem-types.h b/xlators/performance/io-threads/src/iot-mem-types.h index fbf9188f9cd..d6b5e7b6899 100644 --- a/xlators/performance/io-threads/src/iot-mem-types.h +++ b/xlators/performance/io-threads/src/iot-mem-types.h @@ -8,16 +8,14 @@ cases as published by the Free Software Foundation. */ - #ifndef __IOT_MEM_TYPES_H__ #define __IOT_MEM_TYPES_H__ #include "mem-types.h" enum gf_iot_mem_types_ { - gf_iot_mt_iot_conf_t = gf_common_mt_end + 1, - gf_iot_mt_client_ctx_t, - gf_iot_mt_end + gf_iot_mt_iot_conf_t = gf_common_mt_end + 1, + gf_iot_mt_client_ctx_t, + gf_iot_mt_end }; #endif - diff --git a/xlators/performance/md-cache/src/md-cache-mem-types.h b/xlators/performance/md-cache/src/md-cache-mem-types.h index 5cfc68e13c1..e6658577731 100644 --- a/xlators/performance/md-cache/src/md-cache-mem-types.h +++ b/xlators/performance/md-cache/src/md-cache-mem-types.h @@ -8,18 +8,16 @@ cases as published by the Free Software Foundation. */ - #ifndef __MDC_MEM_TYPES_H__ #define __MDC_MEM_TYPES_H__ #include "mem-types.h" enum gf_mdc_mem_types_ { - gf_mdc_mt_mdc_local_t = gf_common_mt_end + 1, - gf_mdc_mt_md_cache_t, - gf_mdc_mt_mdc_conf_t, - gf_mdc_mt_mdc_ipc, - gf_mdc_mt_end + gf_mdc_mt_mdc_local_t = gf_common_mt_end + 1, + gf_mdc_mt_md_cache_t, + gf_mdc_mt_mdc_conf_t, + gf_mdc_mt_mdc_ipc, + gf_mdc_mt_end }; #endif - diff --git a/xlators/performance/md-cache/src/md-cache-messages.h b/xlators/performance/md-cache/src/md-cache-messages.h index 7aa6fc27824..dfc321372ce 100644 --- a/xlators/performance/md-cache/src/md-cache-messages.h +++ b/xlators/performance/md-cache/src/md-cache-messages.h @@ -22,12 +22,8 @@ * glfs-message-id.h. */ -GLFS_MSGID(MD_CACHE, - MD_CACHE_MSG_NO_MEMORY, - MD_CACHE_MSG_DISCARD_UPDATE, - MD_CACHE_MSG_CACHE_UPDATE, - MD_CACHE_MSG_IPC_UPCALL_FAILED, - MD_CACHE_MSG_NO_XATTR_CACHE -); +GLFS_MSGID(MD_CACHE, MD_CACHE_MSG_NO_MEMORY, MD_CACHE_MSG_DISCARD_UPDATE, + MD_CACHE_MSG_CACHE_UPDATE, MD_CACHE_MSG_IPC_UPCALL_FAILED, + MD_CACHE_MSG_NO_XATTR_CACHE); #endif /* _MD_CACHE_MESSAGES_H_ */ diff --git a/xlators/performance/nl-cache/src/nl-cache-mem-types.h b/xlators/performance/nl-cache/src/nl-cache-mem-types.h index 5952402737a..bc61eeca9da 100644 --- a/xlators/performance/nl-cache/src/nl-cache-mem-types.h +++ b/xlators/performance/nl-cache/src/nl-cache-mem-types.h @@ -8,22 +8,21 @@ * cases as published by the Free Software Foundation. */ - #ifndef __NL_CACHE_MEM_TYPES_H__ #define __NL_CACHE_MEM_TYPES_H__ #include "mem-types.h" enum gf_nlc_mem_types_ { - gf_nlc_mt_conf_t = gf_common_mt_end + 1, - gf_nlc_mt_nlc_conf_t, - gf_nlc_mt_nlc_ctx_t, - gf_nlc_mt_nlc_local_t, - gf_nlc_mt_nlc_pe_t, - gf_nlc_mt_nlc_ne_t, - gf_nlc_mt_nlc_timer_data_t, - gf_nlc_mt_nlc_lru_node, - gf_nlc_mt_end + gf_nlc_mt_conf_t = gf_common_mt_end + 1, + gf_nlc_mt_nlc_conf_t, + gf_nlc_mt_nlc_ctx_t, + gf_nlc_mt_nlc_local_t, + gf_nlc_mt_nlc_pe_t, + gf_nlc_mt_nlc_ne_t, + gf_nlc_mt_nlc_timer_data_t, + gf_nlc_mt_nlc_lru_node, + gf_nlc_mt_end }; #endif /* __NL_CACHE_MEM_TYPES_H__ */ diff --git a/xlators/performance/nl-cache/src/nl-cache-messages.h b/xlators/performance/nl-cache/src/nl-cache-messages.h index 6afa98f691e..17fd96de17c 100644 --- a/xlators/performance/nl-cache/src/nl-cache-messages.h +++ b/xlators/performance/nl-cache/src/nl-cache-messages.h @@ -23,11 +23,7 @@ * glfs-message-id.h. */ -GLFS_MSGID(NLC, - NLC_MSG_NO_MEMORY, - NLC_MSG_EINVAL, - NLC_MSG_NO_TIMER_WHEEL, - NLC_MSG_DICT_FAILURE -); +GLFS_MSGID(NLC, NLC_MSG_NO_MEMORY, NLC_MSG_EINVAL, NLC_MSG_NO_TIMER_WHEEL, + NLC_MSG_DICT_FAILURE); #endif /* __NL_CACHE_MESSAGES_H__ */ diff --git a/xlators/performance/nl-cache/src/nl-cache.h b/xlators/performance/nl-cache/src/nl-cache.h index afc3bec4a7f..9c9682f6396 100644 --- a/xlators/performance/nl-cache/src/nl-cache.h +++ b/xlators/performance/nl-cache/src/nl-cache.h @@ -23,153 +23,153 @@ #define NLC_PE_PARTIAL 0x0002 #define NLC_NE_VALID 0x0004 -#define IS_PE_VALID(state) ((state != NLC_INVALID) && \ - (state & (NLC_PE_FULL | NLC_PE_PARTIAL))) +#define IS_PE_VALID(state) \ + ((state != NLC_INVALID) && (state & (NLC_PE_FULL | NLC_PE_PARTIAL))) #define IS_NE_VALID(state) ((state != NLC_INVALID) && (state & NLC_NE_VALID)) #define IS_PEC_ENABLED(conf) (conf->positive_entry_cache) #define IS_CACHE_ENABLED(conf) ((!conf->cache_disabled)) -#define NLC_STACK_UNWIND(fop, frame, params ...) do { \ - nlc_local_t *__local = NULL; \ - xlator_t *__xl = NULL; \ - if (frame) { \ - __xl = frame->this; \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - nlc_local_wipe (__xl, __local); \ -} while (0) +#define NLC_STACK_UNWIND(fop, frame, params...) \ + do { \ + nlc_local_t *__local = NULL; \ + xlator_t *__xl = NULL; \ + if (frame) { \ + __xl = frame->this; \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + nlc_local_wipe(__xl, __local); \ + } while (0) enum nlc_cache_clear_reason { - NLC_NONE = 0, - NLC_LRU_PRUNE, + NLC_NONE = 0, + NLC_LRU_PRUNE, }; struct nlc_ne { - struct list_head list; - char *name; + struct list_head list; + char *name; }; typedef struct nlc_ne nlc_ne_t; struct nlc_pe { - struct list_head list; - inode_t *inode; - char *name; + struct list_head list; + inode_t *inode; + char *name; }; typedef struct nlc_pe nlc_pe_t; struct nlc_timer_data { - inode_t *inode; - xlator_t *this; + inode_t *inode; + xlator_t *this; }; typedef struct nlc_timer_data nlc_timer_data_t; struct nlc_lru_node { - inode_t *inode; - struct list_head list; + inode_t *inode; + struct list_head list; }; typedef struct nlc_lru_node nlc_lru_node_t; struct nlc_ctx { - struct list_head pe; /* list of positive entries */ - struct list_head ne; /* list of negative entries */ - uint64_t state; - time_t cache_time; - struct gf_tw_timer_list *timer; - nlc_timer_data_t *timer_data; - size_t cache_size; - uint64_t refd_inodes; - gf_lock_t lock; + struct list_head pe; /* list of positive entries */ + struct list_head ne; /* list of negative entries */ + uint64_t state; + time_t cache_time; + struct gf_tw_timer_list *timer; + nlc_timer_data_t *timer_data; + size_t cache_size; + uint64_t refd_inodes; + gf_lock_t lock; }; typedef struct nlc_ctx nlc_ctx_t; struct nlc_local { - loc_t loc; - loc_t loc2; - inode_t *inode; - inode_t *parent; - fd_t *fd; - char *linkname; - glusterfs_fop_t fop; + loc_t loc; + loc_t loc2; + inode_t *inode; + inode_t *parent; + fd_t *fd; + char *linkname; + glusterfs_fop_t fop; }; typedef struct nlc_local nlc_local_t; struct nlc_statistics { - gf_atomic_t nlc_hit; /* No. of times lookup/stat was served from this xl */ - gf_atomic_t nlc_miss; /* No. of times negative lookups were sent to disk */ - /* More granular counters */ - gf_atomic_t nameless_lookup; - gf_atomic_t getrealfilename_hit; - gf_atomic_t getrealfilename_miss; - gf_atomic_t pe_inode_cnt; - gf_atomic_t ne_inode_cnt; - gf_atomic_t nlc_invals; /* No. of invalidates received from upcall*/ + gf_atomic_t nlc_hit; /* No. of times lookup/stat was served from this xl */ + gf_atomic_t nlc_miss; /* No. of times negative lookups were sent to disk */ + /* More granular counters */ + gf_atomic_t nameless_lookup; + gf_atomic_t getrealfilename_hit; + gf_atomic_t getrealfilename_miss; + gf_atomic_t pe_inode_cnt; + gf_atomic_t ne_inode_cnt; + gf_atomic_t nlc_invals; /* No. of invalidates received from upcall*/ }; struct nlc_conf { - int32_t cache_timeout; - gf_boolean_t positive_entry_cache; - gf_boolean_t negative_entry_cache; - gf_boolean_t disable_cache; - uint64_t cache_size; - gf_atomic_t current_cache_size; - uint64_t inode_limit; - gf_atomic_t refd_inodes; - struct tvec_base *timer_wheel; - time_t last_child_down; - struct list_head lru; - gf_lock_t lock; - struct nlc_statistics nlc_counter; + int32_t cache_timeout; + gf_boolean_t positive_entry_cache; + gf_boolean_t negative_entry_cache; + gf_boolean_t disable_cache; + uint64_t cache_size; + gf_atomic_t current_cache_size; + uint64_t inode_limit; + gf_atomic_t refd_inodes; + struct tvec_base *timer_wheel; + time_t last_child_down; + struct list_head lru; + gf_lock_t lock; + struct nlc_statistics nlc_counter; }; typedef struct nlc_conf nlc_conf_t; gf_boolean_t -nlc_get_real_file_name (xlator_t *this, loc_t *loc, const char *fname, - int32_t *op_ret, int32_t *op_errno, dict_t *dict); +nlc_get_real_file_name(xlator_t *this, loc_t *loc, const char *fname, + int32_t *op_ret, int32_t *op_errno, dict_t *dict); gf_boolean_t -nlc_is_negative_lookup (xlator_t *this, loc_t *loc); +nlc_is_negative_lookup(xlator_t *this, loc_t *loc); void -nlc_set_dir_state (xlator_t *this, inode_t *inode, uint64_t state); +nlc_set_dir_state(xlator_t *this, inode_t *inode, uint64_t state); void -nlc_dir_add_pe (xlator_t *this, inode_t *inode, inode_t *entry_ino, - const char *name); +nlc_dir_add_pe(xlator_t *this, inode_t *inode, inode_t *entry_ino, + const char *name); void -nlc_dir_remove_pe (xlator_t *this, inode_t *inode, inode_t *entry_ino, - const char *name, gf_boolean_t multilink); +nlc_dir_remove_pe(xlator_t *this, inode_t *inode, inode_t *entry_ino, + const char *name, gf_boolean_t multilink); void -nlc_dir_add_ne (xlator_t *this, inode_t *inode, const char *name); +nlc_dir_add_ne(xlator_t *this, inode_t *inode, const char *name); void -nlc_local_wipe (xlator_t *this, nlc_local_t *local); +nlc_local_wipe(xlator_t *this, nlc_local_t *local); nlc_local_t * -nlc_local_init (call_frame_t *frame, xlator_t *this, glusterfs_fop_t fop, - loc_t *loc, loc_t *loc2); +nlc_local_init(call_frame_t *frame, xlator_t *this, glusterfs_fop_t fop, + loc_t *loc, loc_t *loc2); void -nlc_update_child_down_time (xlator_t *this, time_t *now); +nlc_update_child_down_time(xlator_t *this, time_t *now); void -nlc_inode_clear_cache (xlator_t *this, inode_t *inode, - int reason); +nlc_inode_clear_cache(xlator_t *this, inode_t *inode, int reason); void -nlc_dump_inodectx (xlator_t *this, inode_t *inode); +nlc_dump_inodectx(xlator_t *this, inode_t *inode); void -nlc_clear_all_cache (xlator_t *this); +nlc_clear_all_cache(xlator_t *this); void -nlc_disable_cache (xlator_t *this); +nlc_disable_cache(xlator_t *this); void -nlc_lru_prune (xlator_t *this, inode_t *inode); +nlc_lru_prune(xlator_t *this, inode_t *inode); #endif /* __NL_CACHE_H__ */ diff --git a/xlators/performance/open-behind/src/open-behind-mem-types.h b/xlators/performance/open-behind/src/open-behind-mem-types.h index 8ddd061a835..b16a678cbf4 100644 --- a/xlators/performance/open-behind/src/open-behind-mem-types.h +++ b/xlators/performance/open-behind/src/open-behind-mem-types.h @@ -14,9 +14,9 @@ #include "mem-types.h" enum gf_ob_mem_types_ { - gf_ob_mt_fd_t = gf_common_mt_end + 1, - gf_ob_mt_conf_t, - gf_ob_mt_inode_t, - gf_ob_mt_end + gf_ob_mt_fd_t = gf_common_mt_end + 1, + gf_ob_mt_conf_t, + gf_ob_mt_inode_t, + gf_ob_mt_end }; #endif diff --git a/xlators/performance/open-behind/src/open-behind-messages.h b/xlators/performance/open-behind/src/open-behind-messages.h index 9cb4cd5228f..09b4e8f0c28 100644 --- a/xlators/performance/open-behind/src/open-behind-messages.h +++ b/xlators/performance/open-behind/src/open-behind-messages.h @@ -22,10 +22,7 @@ * glfs-message-id.h. */ -GLFS_MSGID(OPEN_BEHIND, - OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED, - OPEN_BEHIND_MSG_VOL_MISCONFIGURED, - OPEN_BEHIND_MSG_NO_MEMORY -); +GLFS_MSGID(OPEN_BEHIND, OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED, + OPEN_BEHIND_MSG_VOL_MISCONFIGURED, OPEN_BEHIND_MSG_NO_MEMORY); #endif /* _OPEN_BEHIND_MESSAGES_H_ */ diff --git a/xlators/performance/quick-read/src/quick-read-mem-types.h b/xlators/performance/quick-read/src/quick-read-mem-types.h index 78547f64116..0ebd7e81c3a 100644 --- a/xlators/performance/quick-read/src/quick-read-mem-types.h +++ b/xlators/performance/quick-read/src/quick-read-mem-types.h @@ -14,14 +14,14 @@ #include "mem-types.h" enum gf_qr_mem_types_ { - gf_qr_mt_qr_inode_t = gf_common_mt_end + 1, - gf_qr_mt_content_t, - gf_qr_mt_qr_fd_ctx_t, - gf_qr_mt_iovec, - gf_qr_mt_qr_conf_t, - gf_qr_mt_qr_priority_t, - gf_qr_mt_qr_private_t, - gf_qr_mt_qr_unlink_ctx_t, - gf_qr_mt_end + gf_qr_mt_qr_inode_t = gf_common_mt_end + 1, + gf_qr_mt_content_t, + gf_qr_mt_qr_fd_ctx_t, + gf_qr_mt_iovec, + gf_qr_mt_qr_conf_t, + gf_qr_mt_qr_priority_t, + gf_qr_mt_qr_private_t, + gf_qr_mt_qr_unlink_ctx_t, + gf_qr_mt_end }; #endif diff --git a/xlators/performance/quick-read/src/quick-read-messages.h b/xlators/performance/quick-read/src/quick-read-messages.h index 5f55658a82d..745eabbc664 100644 --- a/xlators/performance/quick-read/src/quick-read-messages.h +++ b/xlators/performance/quick-read/src/quick-read-messages.h @@ -22,15 +22,10 @@ * glfs-message-id.h. */ -GLFS_MSGID(QUICK_READ, - QUICK_READ_MSG_ENFORCEMENT_FAILED, - QUICK_READ_MSG_INVALID_ARGUMENT, - QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED, - QUICK_READ_MSG_NO_MEMORY, - QUICK_READ_MSG_VOL_MISCONFIGURED, - QUICK_READ_MSG_DICT_SET_FAILED, - QUICK_READ_MSG_INVALID_CONFIG, - QUICK_READ_MSG_LRU_NOT_EMPTY -); +GLFS_MSGID(QUICK_READ, QUICK_READ_MSG_ENFORCEMENT_FAILED, + QUICK_READ_MSG_INVALID_ARGUMENT, + QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED, QUICK_READ_MSG_NO_MEMORY, + QUICK_READ_MSG_VOL_MISCONFIGURED, QUICK_READ_MSG_DICT_SET_FAILED, + QUICK_READ_MSG_INVALID_CONFIG, QUICK_READ_MSG_LRU_NOT_EMPTY); #endif /* _QUICK_READ_MESSAGES_H_ */ diff --git a/xlators/performance/quick-read/src/quick-read.h b/xlators/performance/quick-read/src/quick-read.h index 0f816cd8431..ae99863b426 100644 --- a/xlators/performance/quick-read/src/quick-read.h +++ b/xlators/performance/quick-read/src/quick-read.h @@ -29,66 +29,63 @@ #include <fnmatch.h> #include "quick-read-mem-types.h" - struct qr_inode { - void *data; - size_t size; - int priority; - uint32_t ia_mtime; - uint32_t ia_mtime_nsec; - uint32_t ia_ctime; - uint32_t ia_ctime_nsec; - uint32_t gen_rollover; - struct iatt buf; - struct timeval last_refresh; - struct list_head lru; - uint64_t gen; - uint64_t invalidation_time; + void *data; + size_t size; + int priority; + uint32_t ia_mtime; + uint32_t ia_mtime_nsec; + uint32_t ia_ctime; + uint32_t ia_ctime_nsec; + uint32_t gen_rollover; + struct iatt buf; + struct timeval last_refresh; + struct list_head lru; + uint64_t gen; + uint64_t invalidation_time; }; typedef struct qr_inode qr_inode_t; - struct qr_priority { - char *pattern; - int32_t priority; - struct list_head list; + char *pattern; + int32_t priority; + struct list_head list; }; typedef struct qr_priority qr_priority_t; struct qr_conf { - uint64_t max_file_size; - int32_t cache_timeout; - uint64_t cache_size; - int max_pri; - gf_boolean_t qr_invalidation; - gf_boolean_t ctime_invalidation; - struct list_head priority_list; + uint64_t max_file_size; + int32_t cache_timeout; + uint64_t cache_size; + int max_pri; + gf_boolean_t qr_invalidation; + gf_boolean_t ctime_invalidation; + struct list_head priority_list; }; typedef struct qr_conf qr_conf_t; struct qr_inode_table { - uint64_t cache_used; - struct list_head *lru; - gf_lock_t lock; + uint64_t cache_used; + struct list_head *lru; + gf_lock_t lock; }; typedef struct qr_inode_table qr_inode_table_t; struct qr_statistics { - gf_atomic_t cache_hit; - gf_atomic_t cache_miss; - gf_atomic_t file_data_invals; /* No. of invalidates received from upcall */ - gf_atomic_t files_cached; + gf_atomic_t cache_hit; + gf_atomic_t cache_miss; + gf_atomic_t file_data_invals; /* No. of invalidates received from upcall */ + gf_atomic_t files_cached; }; struct qr_private { - qr_conf_t conf; - qr_inode_table_t table; - time_t last_child_down; - gf_lock_t lock; - struct qr_statistics qr_counter; - gf_atomic_int32_t generation; + qr_conf_t conf; + qr_inode_table_t table; + time_t last_child_down; + gf_lock_t lock; + struct qr_statistics qr_counter; + gf_atomic_int32_t generation; }; typedef struct qr_private qr_private_t; - #endif /* #ifndef __QUICK_READ_H */ diff --git a/xlators/performance/read-ahead/src/read-ahead-mem-types.h b/xlators/performance/read-ahead/src/read-ahead-mem-types.h index 219e2928919..239e574506a 100644 --- a/xlators/performance/read-ahead/src/read-ahead-mem-types.h +++ b/xlators/performance/read-ahead/src/read-ahead-mem-types.h @@ -8,19 +8,18 @@ cases as published by the Free Software Foundation. */ - #ifndef __RA_MEM_TYPES_H__ #define __RA_MEM_TYPES_H__ #include "mem-types.h" enum gf_ra_mem_types_ { - gf_ra_mt_ra_file_t = gf_common_mt_end + 1, - gf_ra_mt_ra_conf_t, - gf_ra_mt_ra_page_t, - gf_ra_mt_ra_waitq_t, - gf_ra_mt_ra_fill_t, - gf_ra_mt_iovec, - gf_ra_mt_end + gf_ra_mt_ra_file_t = gf_common_mt_end + 1, + gf_ra_mt_ra_conf_t, + gf_ra_mt_ra_page_t, + gf_ra_mt_ra_waitq_t, + gf_ra_mt_ra_fill_t, + gf_ra_mt_iovec, + gf_ra_mt_end }; #endif diff --git a/xlators/performance/read-ahead/src/read-ahead-messages.h b/xlators/performance/read-ahead/src/read-ahead-messages.h index b2e6a1bced7..500d3246946 100644 --- a/xlators/performance/read-ahead/src/read-ahead-messages.h +++ b/xlators/performance/read-ahead/src/read-ahead-messages.h @@ -22,13 +22,10 @@ * glfs-message-id.h. */ -GLFS_MSGID(READ_AHEAD, - READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED, - READ_AHEAD_MSG_VOL_MISCONFIGURED, - READ_AHEAD_MSG_NO_MEMORY, - READ_AHEAD_MSG_FD_CONTEXT_NOT_SET, - READ_AHEAD_MSG_UNDESTROYED_FILE_FOUND, - READ_AHEAD_MSG_XLATOR_CONF_NULL -); +GLFS_MSGID(READ_AHEAD, READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED, + READ_AHEAD_MSG_VOL_MISCONFIGURED, READ_AHEAD_MSG_NO_MEMORY, + READ_AHEAD_MSG_FD_CONTEXT_NOT_SET, + READ_AHEAD_MSG_UNDESTROYED_FILE_FOUND, + READ_AHEAD_MSG_XLATOR_CONF_NULL); #endif /* _READ_AHEAD_MESSAGES_H_ */ diff --git a/xlators/performance/read-ahead/src/read-ahead.h b/xlators/performance/read-ahead/src/read-ahead.h index debcd8fdeb4..4e99853cc32 100644 --- a/xlators/performance/read-ahead/src/read-ahead.h +++ b/xlators/performance/read-ahead/src/read-ahead.h @@ -11,7 +11,6 @@ #ifndef __READ_AHEAD_H #define __READ_AHEAD_H - #include "glusterfs.h" #include "logging.h" #include "dict.h" @@ -25,84 +24,77 @@ struct ra_page; struct ra_file; struct ra_waitq; - struct ra_waitq { - struct ra_waitq *next; - void *data; + struct ra_waitq *next; + void *data; }; - struct ra_fill { - struct ra_fill *next; - struct ra_fill *prev; - off_t offset; - size_t size; - struct iovec *vector; - int32_t count; - struct iobref *iobref; + struct ra_fill *next; + struct ra_fill *prev; + off_t offset; + size_t size; + struct iovec *vector; + int32_t count; + struct iobref *iobref; }; - struct ra_local { - mode_t mode; - struct ra_fill fill; - off_t offset; - size_t size; - int32_t op_ret; - int32_t op_errno; - off_t pending_offset; - size_t pending_size; - fd_t *fd; - int32_t wait_count; - pthread_mutex_t local_lock; + mode_t mode; + struct ra_fill fill; + off_t offset; + size_t size; + int32_t op_ret; + int32_t op_errno; + off_t pending_offset; + size_t pending_size; + fd_t *fd; + int32_t wait_count; + pthread_mutex_t local_lock; }; - struct ra_page { - struct ra_page *next; - struct ra_page *prev; - struct ra_file *file; - char dirty; /* Internal request, not from user. */ - char poisoned; /* Pending read invalidated by write. */ - char ready; - struct iovec *vector; - int32_t count; - off_t offset; - size_t size; - struct ra_waitq *waitq; - struct iobref *iobref; - char stale; + struct ra_page *next; + struct ra_page *prev; + struct ra_file *file; + char dirty; /* Internal request, not from user. */ + char poisoned; /* Pending read invalidated by write. */ + char ready; + struct iovec *vector; + int32_t count; + off_t offset; + size_t size; + struct ra_waitq *waitq; + struct iobref *iobref; + char stale; }; - struct ra_file { - struct ra_file *next; - struct ra_file *prev; - struct ra_conf *conf; - fd_t *fd; - int disabled; - size_t expected; - struct ra_page pages; - off_t offset; - size_t size; - int32_t refcount; - pthread_mutex_t file_lock; - struct iatt stbuf; - uint64_t page_size; - uint32_t page_count; + struct ra_file *next; + struct ra_file *prev; + struct ra_conf *conf; + fd_t *fd; + int disabled; + size_t expected; + struct ra_page pages; + off_t offset; + size_t size; + int32_t refcount; + pthread_mutex_t file_lock; + struct iatt stbuf; + uint64_t page_size; + uint32_t page_count; }; - struct ra_conf { - uint64_t page_size; - uint32_t page_count; - void *cache_block; - struct ra_file files; - gf_boolean_t force_atime_update; - pthread_mutex_t conf_lock; + uint64_t page_size; + uint32_t page_count; + void *cache_block; + struct ra_file files; + gf_boolean_t force_atime_update; + pthread_mutex_t conf_lock; }; - typedef struct ra_conf ra_conf_t; typedef struct ra_local ra_local_t; typedef struct ra_page ra_page_t; @@ -111,77 +103,69 @@ typedef struct ra_waitq ra_waitq_t; typedef struct ra_fill ra_fill_t; ra_page_t * -ra_page_get (ra_file_t *file, - off_t offset); +ra_page_get(ra_file_t *file, off_t offset); ra_page_t * -ra_page_create (ra_file_t *file, - off_t offset); +ra_page_create(ra_file_t *file, off_t offset); void -ra_page_fault (ra_file_t *file, - call_frame_t *frame, - off_t offset); +ra_page_fault(ra_file_t *file, call_frame_t *frame, off_t offset); void -ra_wait_on_page (ra_page_t *page, - call_frame_t *frame); +ra_wait_on_page(ra_page_t *page, call_frame_t *frame); ra_waitq_t * -ra_page_wakeup (ra_page_t *page); +ra_page_wakeup(ra_page_t *page); void -ra_page_flush (ra_page_t *page); +ra_page_flush(ra_page_t *page); ra_waitq_t * -ra_page_error (ra_page_t *page, - int32_t op_ret, - int32_t op_errno); +ra_page_error(ra_page_t *page, int32_t op_ret, int32_t op_errno); void -ra_page_purge (ra_page_t *page); +ra_page_purge(ra_page_t *page); void -ra_frame_return (call_frame_t *frame); +ra_frame_return(call_frame_t *frame); void -ra_frame_fill (ra_page_t *page, - call_frame_t *frame); +ra_frame_fill(ra_page_t *page, call_frame_t *frame); void -ra_file_destroy (ra_file_t *file); +ra_file_destroy(ra_file_t *file); static inline void -ra_file_lock (ra_file_t *file) +ra_file_lock(ra_file_t *file) { - pthread_mutex_lock (&file->file_lock); + pthread_mutex_lock(&file->file_lock); } static inline void -ra_file_unlock (ra_file_t *file) +ra_file_unlock(ra_file_t *file) { - pthread_mutex_unlock (&file->file_lock); + pthread_mutex_unlock(&file->file_lock); } static inline void -ra_conf_lock (ra_conf_t *conf) +ra_conf_lock(ra_conf_t *conf) { - pthread_mutex_lock (&conf->conf_lock); + pthread_mutex_lock(&conf->conf_lock); } static inline void -ra_conf_unlock (ra_conf_t *conf) +ra_conf_unlock(ra_conf_t *conf) { - pthread_mutex_unlock (&conf->conf_lock); + pthread_mutex_unlock(&conf->conf_lock); } static inline void -ra_local_lock (ra_local_t *local) +ra_local_lock(ra_local_t *local) { - pthread_mutex_lock (&local->local_lock); + pthread_mutex_lock(&local->local_lock); } static inline void -ra_local_unlock (ra_local_t *local) +ra_local_unlock(ra_local_t *local) { - pthread_mutex_unlock (&local->local_lock); + pthread_mutex_unlock(&local->local_lock); } #endif /* __READ_AHEAD_H */ diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead-mem-types.h b/xlators/performance/readdir-ahead/src/readdir-ahead-mem-types.h index ae533840c7e..e2462b48833 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead-mem-types.h +++ b/xlators/performance/readdir-ahead/src/readdir-ahead-mem-types.h @@ -8,18 +8,17 @@ cases as published by the Free Software Foundation. */ - #ifndef __RDA_MEM_TYPES_H__ #define __RDA_MEM_TYPES_H__ #include "mem-types.h" enum gf_rda_mem_types_ { - gf_rda_mt_rda_local = gf_common_mt_end + 1, - gf_rda_mt_rda_fd_ctx, - gf_rda_mt_rda_priv, - gf_rda_mt_inode_ctx_t, - gf_rda_mt_end + gf_rda_mt_rda_local = gf_common_mt_end + 1, + gf_rda_mt_rda_fd_ctx, + gf_rda_mt_rda_priv, + gf_rda_mt_inode_ctx_t, + gf_rda_mt_end }; #endif diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h index fdcebe21f69..c9ce16307e6 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h +++ b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h @@ -22,13 +22,9 @@ * glfs-message-id.h. */ -GLFS_MSGID(READDIR_AHEAD, - READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED, - READDIR_AHEAD_MSG_VOL_MISCONFIGURED, - READDIR_AHEAD_MSG_NO_MEMORY, - READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB, - READDIR_AHEAD_MSG_OUT_OF_SEQUENCE, - READDIR_AHEAD_MSG_DICT_OP_FAILED -); +GLFS_MSGID(READDIR_AHEAD, READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED, + READDIR_AHEAD_MSG_VOL_MISCONFIGURED, READDIR_AHEAD_MSG_NO_MEMORY, + READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB, + READDIR_AHEAD_MSG_OUT_OF_SEQUENCE, READDIR_AHEAD_MSG_DICT_OP_FAILED); #endif /* _READDIR_AHEAD_MESSAGES_H_ */ diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.h b/xlators/performance/readdir-ahead/src/readdir-ahead.h index 7dbed4c60ed..b5e13800826 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead.h +++ b/xlators/performance/readdir-ahead/src/readdir-ahead.h @@ -12,86 +12,85 @@ #define __READDIR_AHEAD_H /* state flags */ -#define RDA_FD_NEW (1 << 0) -#define RDA_FD_RUNNING (1 << 1) -#define RDA_FD_EOD (1 << 2) -#define RDA_FD_ERROR (1 << 3) -#define RDA_FD_BYPASS (1 << 4) -#define RDA_FD_PLUGGED (1 << 5) +#define RDA_FD_NEW (1 << 0) +#define RDA_FD_RUNNING (1 << 1) +#define RDA_FD_EOD (1 << 2) +#define RDA_FD_ERROR (1 << 3) +#define RDA_FD_BYPASS (1 << 4) +#define RDA_FD_PLUGGED (1 << 5) - -#define RDA_COMMON_MODIFICATION_FOP(name, frame, this, __inode, __xdata, args ...)\ - do { \ - struct rda_local *__local = NULL; \ - rda_inode_ctx_t *ctx_p = NULL; \ +#define RDA_COMMON_MODIFICATION_FOP(name, frame, this, __inode, __xdata, \ + args...) \ + do { \ + struct rda_local *__local = NULL; \ + rda_inode_ctx_t *ctx_p = NULL; \ \ - __local = mem_get0 (this->local_pool); \ - __local->inode = inode_ref (__inode); \ - LOCK (&__inode->lock); \ - { \ - ctx_p = __rda_inode_ctx_get (__inode, this); \ - } \ - UNLOCK (&__inode->lock); \ - __local->generation = GF_ATOMIC_GET (ctx_p->generation); \ + __local = mem_get0(this->local_pool); \ + __local->inode = inode_ref(__inode); \ + LOCK(&__inode->lock); \ + { \ + ctx_p = __rda_inode_ctx_get(__inode, this); \ + } \ + UNLOCK(&__inode->lock); \ + __local->generation = GF_ATOMIC_GET(ctx_p->generation); \ \ - frame->local = __local; \ - if (__xdata) \ - __local->xattrs = dict_ref (__xdata); \ + frame->local = __local; \ + if (__xdata) \ + __local->xattrs = dict_ref(__xdata); \ \ - STACK_WIND (frame, rda_##name##_cbk, FIRST_CHILD(this), \ - FIRST_CHILD(this)->fops->name, args, __xdata); \ - } while (0) - - -#define RDA_STACK_UNWIND(fop, frame, params ...) do { \ - struct rda_local *__local = NULL; \ - if (frame) { \ - __local = frame->local; \ - frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - if (__local) { \ - rda_local_wipe (__local); \ - mem_put (__local); \ - } \ -} while (0) + STACK_WIND(frame, rda_##name##_cbk, FIRST_CHILD(this), \ + FIRST_CHILD(this)->fops->name, args, __xdata); \ + } while (0) +#define RDA_STACK_UNWIND(fop, frame, params...) \ + do { \ + struct rda_local *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT(fop, frame, params); \ + if (__local) { \ + rda_local_wipe(__local); \ + mem_put(__local); \ + } \ + } while (0) struct rda_fd_ctx { - off_t cur_offset; /* current head of the ctx */ - size_t cur_size; /* current size of the preload */ - off_t next_offset; /* tail of the ctx */ - uint32_t state; - gf_lock_t lock; - gf_dirent_t entries; - call_frame_t *fill_frame; - call_stub_t *stub; - int op_errno; - dict_t *xattrs; /* md-cache keys to be sent in readdirp() */ + off_t cur_offset; /* current head of the ctx */ + size_t cur_size; /* current size of the preload */ + off_t next_offset; /* tail of the ctx */ + uint32_t state; + gf_lock_t lock; + gf_dirent_t entries; + call_frame_t *fill_frame; + call_stub_t *stub; + int op_errno; + dict_t *xattrs; /* md-cache keys to be sent in readdirp() */ }; struct rda_local { - struct rda_fd_ctx *ctx; - fd_t *fd; - dict_t *xattrs; /* md-cache keys to be sent in readdirp() */ - inode_t *inode; - off_t offset; - uint64_t generation; - int32_t skip_dir; + struct rda_fd_ctx *ctx; + fd_t *fd; + dict_t *xattrs; /* md-cache keys to be sent in readdirp() */ + inode_t *inode; + off_t offset; + uint64_t generation; + int32_t skip_dir; }; struct rda_priv { - uint64_t rda_req_size; - uint64_t rda_low_wmark; - uint64_t rda_high_wmark; - uint64_t rda_cache_limit; - gf_atomic_t rda_cache_size; - gf_boolean_t parallel_readdir; + uint64_t rda_req_size; + uint64_t rda_low_wmark; + uint64_t rda_high_wmark; + uint64_t rda_cache_limit; + gf_atomic_t rda_cache_size; + gf_boolean_t parallel_readdir; }; typedef struct rda_inode_ctx { - struct iatt statbuf; - gf_atomic_t generation; + struct iatt statbuf; + gf_atomic_t generation; } rda_inode_ctx_t; #endif /* __READDIR_AHEAD_H */ diff --git a/xlators/performance/symlink-cache/src/symlink-cache-messages.h b/xlators/performance/symlink-cache/src/symlink-cache-messages.h index 46685b7695d..c1ef1a67f9b 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache-messages.h +++ b/xlators/performance/symlink-cache/src/symlink-cache-messages.h @@ -22,12 +22,9 @@ * glfs-message-id.h. */ -GLFS_MSGID(SYMLINK_CACHE, - SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED, - SYMLINK_CACHE_MSG_VOL_MISCONFIGURED, - SYMLINK_CACHE_MSG_NO_MEMORY, - SYMLINK_CACHE_MSG_DICT_GET_FAILED, - SYMLINK_CACHE_MSG_DICT_SET_FAILED -); +GLFS_MSGID(SYMLINK_CACHE, SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED, + SYMLINK_CACHE_MSG_VOL_MISCONFIGURED, SYMLINK_CACHE_MSG_NO_MEMORY, + SYMLINK_CACHE_MSG_DICT_GET_FAILED, + SYMLINK_CACHE_MSG_DICT_SET_FAILED); #endif /* _SYMLINK_CACHE_MESSAGES_H_ */ diff --git a/xlators/performance/write-behind/src/write-behind-mem-types.h b/xlators/performance/write-behind/src/write-behind-mem-types.h index f64f429ce22..c92a7d4c1f4 100644 --- a/xlators/performance/write-behind/src/write-behind-mem-types.h +++ b/xlators/performance/write-behind/src/write-behind-mem-types.h @@ -8,19 +8,17 @@ cases as published by the Free Software Foundation. */ - #ifndef __WB_MEM_TYPES_H__ #define __WB_MEM_TYPES_H__ #include "mem-types.h" enum gf_wb_mem_types_ { - gf_wb_mt_wb_file_t = gf_common_mt_end + 1, - gf_wb_mt_wb_request_t, - gf_wb_mt_iovec, - gf_wb_mt_wb_conf_t, - gf_wb_mt_wb_inode_t, - gf_wb_mt_end + gf_wb_mt_wb_file_t = gf_common_mt_end + 1, + gf_wb_mt_wb_request_t, + gf_wb_mt_iovec, + gf_wb_mt_wb_conf_t, + gf_wb_mt_wb_inode_t, + gf_wb_mt_end }; #endif - diff --git a/xlators/performance/write-behind/src/write-behind-messages.h b/xlators/performance/write-behind/src/write-behind-messages.h index cf16b0afc6e..914fc63dda6 100644 --- a/xlators/performance/write-behind/src/write-behind-messages.h +++ b/xlators/performance/write-behind/src/write-behind-messages.h @@ -22,14 +22,10 @@ * glfs-message-id.h. */ -GLFS_MSGID(WRITE_BEHIND, - WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE, - WRITE_BEHIND_MSG_INIT_FAILED, - WRITE_BEHIND_MSG_INVALID_ARGUMENT, - WRITE_BEHIND_MSG_NO_MEMORY, - WRITE_BEHIND_MSG_SIZE_NOT_SET, - WRITE_BEHIND_MSG_VOL_MISCONFIGURED, - WRITE_BEHIND_MSG_RES_UNAVAILABLE -); +GLFS_MSGID(WRITE_BEHIND, WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE, + WRITE_BEHIND_MSG_INIT_FAILED, WRITE_BEHIND_MSG_INVALID_ARGUMENT, + WRITE_BEHIND_MSG_NO_MEMORY, WRITE_BEHIND_MSG_SIZE_NOT_SET, + WRITE_BEHIND_MSG_VOL_MISCONFIGURED, + WRITE_BEHIND_MSG_RES_UNAVAILABLE); #endif /* _WRITE_BEHIND_MESSAGES_H_ */ diff --git a/xlators/playground/template/src/template.h b/xlators/playground/template/src/template.h index e384c0181f7..0abe2245296 100644 --- a/xlators/playground/template/src/template.h +++ b/xlators/playground/template/src/template.h @@ -17,8 +17,8 @@ #include "defaults.h" struct template_private { - /* Add all the relevant fields you need here */ - int32_t dummy; + /* Add all the relevant fields you need here */ + int32_t dummy; }; typedef struct template_private template_private_t; @@ -27,8 +27,8 @@ typedef struct template_private template_private_t; #include "mem-types.h" enum gf_template_mem_types_ { - gf_template_mt_private_t = gf_common_mt_end + 1, - gf_template_mt_end, + gf_template_mt_private_t = gf_common_mt_end + 1, + gf_template_mt_end, }; /* This normally goes to another file 'template-messages.h", @@ -38,9 +38,6 @@ enum gf_template_mem_types_ { */ #include "glfs-message-id.h" -GLFS_MSGID(TEMPLATE, - TEMPLATE_MSG_NO_MEMORY, - TEMPLATE_MSG_NO_GRAPH - ); +GLFS_MSGID(TEMPLATE, TEMPLATE_MSG_NO_MEMORY, TEMPLATE_MSG_NO_GRAPH); #endif /* __TEMPLATE_H__ */ diff --git a/xlators/protocol/client/src/client-common.h b/xlators/protocol/client/src/client-common.h index b0690aa75d8..21d416d9f27 100644 --- a/xlators/protocol/client/src/client-common.h +++ b/xlators/protocol/client/src/client-common.h @@ -20,629 +20,605 @@ #include "client.h" int -client_pre_stat (xlator_t *this, gfs3_stat_req *req, loc_t *loc, - dict_t *xdata); +client_pre_stat(xlator_t *this, gfs3_stat_req *req, loc_t *loc, dict_t *xdata); int -client_pre_readlink (xlator_t *this, gfs3_readlink_req *req, loc_t *loc, - size_t size, dict_t *xdata); +client_pre_readlink(xlator_t *this, gfs3_readlink_req *req, loc_t *loc, + size_t size, dict_t *xdata); int -client_pre_mknod (xlator_t *this, gfs3_mknod_req *req, loc_t *loc, - mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata); +client_pre_mknod(xlator_t *this, gfs3_mknod_req *req, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata); int -client_pre_mkdir (xlator_t *this, gfs3_mkdir_req *req, loc_t *loc, - mode_t mode, mode_t umask, dict_t *xdata); +client_pre_mkdir(xlator_t *this, gfs3_mkdir_req *req, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); int -client_pre_unlink (xlator_t *this, gfs3_unlink_req *req, loc_t *loc, - int32_t flags, dict_t *xdata); +client_pre_unlink(xlator_t *this, gfs3_unlink_req *req, loc_t *loc, + int32_t flags, dict_t *xdata); int -client_pre_rmdir (xlator_t *this, gfs3_rmdir_req *req, loc_t *loc, - int32_t flags, dict_t *xdata); +client_pre_rmdir(xlator_t *this, gfs3_rmdir_req *req, loc_t *loc, int32_t flags, + dict_t *xdata); int -client_pre_symlink (xlator_t *this, gfs3_symlink_req *req, loc_t *loc, - const char *linkname, mode_t umask, dict_t *xdata); +client_pre_symlink(xlator_t *this, gfs3_symlink_req *req, loc_t *loc, + const char *linkname, mode_t umask, dict_t *xdata); int -client_pre_rename (xlator_t *this, gfs3_rename_req *req, loc_t *oldloc, - loc_t *newloc, dict_t *xdata); +client_pre_rename(xlator_t *this, gfs3_rename_req *req, loc_t *oldloc, + loc_t *newloc, dict_t *xdata); int -client_pre_link (xlator_t *this, - gfs3_link_req *req, loc_t *oldloc, loc_t *newloc, - dict_t *xdata); +client_pre_link(xlator_t *this, gfs3_link_req *req, loc_t *oldloc, + loc_t *newloc, dict_t *xdata); int -client_pre_truncate (xlator_t *this, gfs3_truncate_req *req, - loc_t *loc, off_t offset, dict_t *xdata); +client_pre_truncate(xlator_t *this, gfs3_truncate_req *req, loc_t *loc, + off_t offset, dict_t *xdata); int -client_pre_open (xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_open(xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd, + int32_t flags, dict_t *xdata); int -client_pre_readv (xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size, - off_t offset, int32_t flags, dict_t *xdata); +client_pre_readv(xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size, + off_t offset, int32_t flags, dict_t *xdata); int -client_pre_writev (xlator_t *this, gfs3_write_req *req, - fd_t *fd, size_t size, off_t offset, int32_t flags, - dict_t **xdata); +client_pre_writev(xlator_t *this, gfs3_write_req *req, fd_t *fd, size_t size, + off_t offset, int32_t flags, dict_t **xdata); int -client_pre_statfs (xlator_t *this, gfs3_statfs_req *req, loc_t *loc, - dict_t *xdata); +client_pre_statfs(xlator_t *this, gfs3_statfs_req *req, loc_t *loc, + dict_t *xdata); int -client_pre_flush (xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata); +client_pre_flush(xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata); int -client_pre_fsync (xlator_t *this, gfs3_fsync_req *req, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_fsync(xlator_t *this, gfs3_fsync_req *req, fd_t *fd, int32_t flags, + dict_t *xdata); int -client_pre_setxattr (xlator_t *this, gfs3_setxattr_req *req, loc_t *loc, - dict_t *xattr, int32_t flags, dict_t *xdata); +client_pre_setxattr(xlator_t *this, gfs3_setxattr_req *req, loc_t *loc, + dict_t *xattr, int32_t flags, dict_t *xdata); int -client_pre_getxattr (xlator_t *this, gfs3_getxattr_req *req, loc_t *loc, - const char *name, dict_t *xdata); +client_pre_getxattr(xlator_t *this, gfs3_getxattr_req *req, loc_t *loc, + const char *name, dict_t *xdata); int -client_pre_removexattr (xlator_t *this, gfs3_removexattr_req *req, - loc_t *loc, const char *name, dict_t *xdata); +client_pre_removexattr(xlator_t *this, gfs3_removexattr_req *req, loc_t *loc, + const char *name, dict_t *xdata); int -client_pre_opendir (xlator_t *this, - gfs3_opendir_req *req, loc_t *loc, - fd_t *fd, dict_t *xdata); +client_pre_opendir(xlator_t *this, gfs3_opendir_req *req, loc_t *loc, fd_t *fd, + dict_t *xdata); int -client_pre_fsyncdir (xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_fsyncdir(xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd, + int32_t flags, dict_t *xdata); int -client_pre_access (xlator_t *this, gfs3_access_req *req, loc_t *loc, - int32_t mask, dict_t *xdata); +client_pre_access(xlator_t *this, gfs3_access_req *req, loc_t *loc, + int32_t mask, dict_t *xdata); int -client_pre_create (xlator_t *this, gfs3_create_req *req, - loc_t *loc, fd_t *fd, mode_t mode, - int32_t flags, mode_t umask, dict_t *xdata); +client_pre_create(xlator_t *this, gfs3_create_req *req, loc_t *loc, fd_t *fd, + mode_t mode, int32_t flags, mode_t umask, dict_t *xdata); int -client_pre_ftruncate (xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd, - off_t offset, dict_t *xdata); +client_pre_ftruncate(xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd, + off_t offset, dict_t *xdata); int -client_pre_fstat (xlator_t *this, gfs3_fstat_req *req, fd_t *fd, - dict_t *xdata); +client_pre_fstat(xlator_t *this, gfs3_fstat_req *req, fd_t *fd, dict_t *xdata); int -client_pre_lk (xlator_t *this, gfs3_lk_req *req, - int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata); +client_pre_lk(xlator_t *this, gfs3_lk_req *req, int32_t cmd, + struct gf_flock *flock, fd_t *fd, dict_t *xdata); int -client_pre_lookup (xlator_t *this, gfs3_lookup_req *req, loc_t *loc, - dict_t *xdata); +client_pre_lookup(xlator_t *this, gfs3_lookup_req *req, loc_t *loc, + dict_t *xdata); int -client_pre_readdir (xlator_t *this, gfs3_readdir_req *req, fd_t *fd, - size_t size, off_t offset, dict_t *xdata); +client_pre_readdir(xlator_t *this, gfs3_readdir_req *req, fd_t *fd, size_t size, + off_t offset, dict_t *xdata); int -client_pre_inodelk (xlator_t *this, gfs3_inodelk_req *req, loc_t *loc, - int cmd, struct gf_flock *flock, const char *volume, - dict_t *xdata); +client_pre_inodelk(xlator_t *this, gfs3_inodelk_req *req, loc_t *loc, int cmd, + struct gf_flock *flock, const char *volume, dict_t *xdata); int -client_pre_finodelk (xlator_t *this, gfs3_finodelk_req *req, fd_t *fd, - int cmd, struct gf_flock *flock, const char *volume, - dict_t *xdata); +client_pre_finodelk(xlator_t *this, gfs3_finodelk_req *req, fd_t *fd, int cmd, + struct gf_flock *flock, const char *volume, dict_t *xdata); int -client_pre_entrylk (xlator_t *this, gfs3_entrylk_req *req, loc_t *loc, - entrylk_cmd cmd_entrylk, entrylk_type type, - const char *volume, const char *basename, dict_t *xdata); +client_pre_entrylk(xlator_t *this, gfs3_entrylk_req *req, loc_t *loc, + entrylk_cmd cmd_entrylk, entrylk_type type, + const char *volume, const char *basename, dict_t *xdata); int -client_pre_fentrylk (xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd, - entrylk_cmd cmd_entrylk, entrylk_type type, - const char *volume, const char *basename, dict_t *xdata); +client_pre_fentrylk(xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd, + entrylk_cmd cmd_entrylk, entrylk_type type, + const char *volume, const char *basename, dict_t *xdata); int -client_pre_xattrop (xlator_t *this, gfs3_xattrop_req *req, loc_t *loc, - dict_t *xattr, int32_t flags, dict_t *xdata); +client_pre_xattrop(xlator_t *this, gfs3_xattrop_req *req, loc_t *loc, + dict_t *xattr, int32_t flags, dict_t *xdata); int -client_pre_fxattrop (xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd, +client_pre_fxattrop(xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd, dict_t *xattr, int32_t flags, dict_t *xdata); int -client_pre_fgetxattr (xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd, - const char *name, dict_t *xdata); +client_pre_fgetxattr(xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd, + const char *name, dict_t *xdata); int -client_pre_fsetxattr (xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd, - int32_t flags, dict_t *xattr, dict_t *xdata); +client_pre_fsetxattr(xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd, + int32_t flags, dict_t *xattr, dict_t *xdata); int -client_pre_seek (xlator_t *this, gfs3_seek_req *req, fd_t *fd, - off_t offset, gf_seek_what_t what, dict_t *xdata); +client_pre_seek(xlator_t *this, gfs3_seek_req *req, fd_t *fd, off_t offset, + gf_seek_what_t what, dict_t *xdata); int -client_pre_rchecksum (xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd, - int32_t len, off_t offset, dict_t *xdata); +client_pre_rchecksum(xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd, + int32_t len, off_t offset, dict_t *xdata); int -client_pre_setattr (xlator_t *this, gfs3_setattr_req *req, loc_t *loc, - int32_t valid, struct iatt *stbuf, dict_t *xdata); +client_pre_setattr(xlator_t *this, gfs3_setattr_req *req, loc_t *loc, + int32_t valid, struct iatt *stbuf, dict_t *xdata); int -client_pre_fsetattr (xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd, - int32_t valid, struct iatt *stbuf, dict_t *xdata); +client_pre_fsetattr(xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd, + int32_t valid, struct iatt *stbuf, dict_t *xdata); int -client_pre_readdirp (xlator_t *this, gfs3_readdirp_req *req, fd_t *fd, - size_t size, off_t offset, dict_t *xdata); +client_pre_readdirp(xlator_t *this, gfs3_readdirp_req *req, fd_t *fd, + size_t size, off_t offset, dict_t *xdata); int -client_pre_fremovexattr (xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd, - const char *name, dict_t *xdata); +client_pre_fremovexattr(xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd, + const char *name, dict_t *xdata); int -client_pre_fallocate (xlator_t *this, gfs3_fallocate_req *req, fd_t *fd, - int32_t flags, off_t offset, size_t size, dict_t *xdata); +client_pre_fallocate(xlator_t *this, gfs3_fallocate_req *req, fd_t *fd, + int32_t flags, off_t offset, size_t size, dict_t *xdata); int -client_pre_discard (xlator_t *this, gfs3_discard_req *req, fd_t *fd, - off_t offset, size_t size, dict_t *xdata); +client_pre_discard(xlator_t *this, gfs3_discard_req *req, fd_t *fd, + off_t offset, size_t size, dict_t *xdata); int -client_pre_zerofill (xlator_t *this, gfs3_zerofill_req *req, fd_t *fd, - off_t offset, size_t size, dict_t *xdata); +client_pre_zerofill(xlator_t *this, gfs3_zerofill_req *req, fd_t *fd, + off_t offset, size_t size, dict_t *xdata); int -client_pre_ipc (xlator_t *this, gfs3_ipc_req *req, int32_t cmd, - dict_t *xdata); +client_pre_ipc(xlator_t *this, gfs3_ipc_req *req, int32_t cmd, dict_t *xdata); int -client_pre_lease (xlator_t *this, gfs3_lease_req *req, loc_t *loc, - struct gf_lease *lease, dict_t *xdata); +client_pre_lease(xlator_t *this, gfs3_lease_req *req, loc_t *loc, + struct gf_lease *lease, dict_t *xdata); int -client_post_stat (xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt, - dict_t **xdata); +client_post_stat(xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt, + dict_t **xdata); int -client_post_readlink (xlator_t *this, gfs3_readlink_rsp *rsp, - struct iatt *iatt, dict_t **xdata); +client_post_readlink(xlator_t *this, gfs3_readlink_rsp *rsp, struct iatt *iatt, + dict_t **xdata); int -client_post_mknod (xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_mknod(xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + dict_t **xdata); int -client_post_mkdir (xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_mkdir(xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + dict_t **xdata); int -client_post_unlink (xlator_t *this, gfs3_unlink_rsp *rsp, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_unlink(xlator_t *this, gfs3_unlink_rsp *rsp, struct iatt *preparent, + struct iatt *postparent, dict_t **xdata); int -client_post_rmdir (xlator_t *this, gfs3_rmdir_rsp *rsp, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_rmdir(xlator_t *this, gfs3_rmdir_rsp *rsp, struct iatt *preparent, + struct iatt *postparent, dict_t **xdata); int -client_post_symlink (xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_symlink(xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + dict_t **xdata); int -client_post_rename (xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf, +client_post_rename(xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf, struct iatt *preoldparent, struct iatt *postoldparent, struct iatt *prenewparent, struct iatt *postnewparent, dict_t **xdata); int -client_post_link (xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent, - dict_t **xdata); +client_post_link(xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + dict_t **xdata); int -client_post_truncate (xlator_t *this, gfs3_truncate_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_truncate(xlator_t *this, gfs3_truncate_rsp *rsp, + struct iatt *prestat, struct iatt *poststat, + dict_t **xdata); int -client_post_open (xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata); +client_post_open(xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata); int -client_post_readv (xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref, - struct iobref *rsp_iobref, struct iatt *stat, - struct iovec *vector, struct iovec *rsp_vector, - int *rspcount, dict_t **xdata); +client_post_readv(xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref, + struct iobref *rsp_iobref, struct iatt *stat, + struct iovec *vector, struct iovec *rsp_vector, int *rspcount, + dict_t **xdata); int -client_post_writev (xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat, - struct iatt *poststat, dict_t **xdata); +client_post_writev(xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat, + struct iatt *poststat, dict_t **xdata); int -client_post_statfs (xlator_t *this, gfs3_statfs_rsp *rsp, - struct statvfs *statfs, dict_t **xdata); +client_post_statfs(xlator_t *this, gfs3_statfs_rsp *rsp, struct statvfs *statfs, + dict_t **xdata); int -client_post_flush (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_flush(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_fsync (xlator_t *this, gfs3_fsync_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_fsync(xlator_t *this, gfs3_fsync_rsp *rsp, struct iatt *prestat, + struct iatt *poststat, dict_t **xdata); int -client_post_setxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_setxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_getxattr (xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict, - dict_t **xdata); +client_post_getxattr(xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict, + dict_t **xdata); int -client_post_removexattr (xlator_t *this, gf_common_rsp *rsp, - dict_t **xdata); +client_post_removexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_opendir (xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata); +client_post_opendir(xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata); int -client_post_fsyncdir (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_fsyncdir(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_access (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_access(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_create (xlator_t *this, gfs3_create_rsp *rsp, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, - clnt_local_t *local, dict_t **xdata); +client_post_create(xlator_t *this, gfs3_create_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + clnt_local_t *local, dict_t **xdata); int -client_post_ftruncate (xlator_t *this, gfs3_ftruncate_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_ftruncate(xlator_t *this, gfs3_ftruncate_rsp *rsp, + struct iatt *prestat, struct iatt *poststat, + dict_t **xdata); int -client_post_fstat (xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat, - dict_t **xdata); +client_post_fstat(xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat, + dict_t **xdata); int -client_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock, - dict_t **xdata); +client_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock, + dict_t **xdata); int -client_post_lookup (xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf, - struct iatt *postparent, dict_t **xdata); +client_post_lookup(xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf, + struct iatt *postparent, dict_t **xdata); int -client_post_readdir (xlator_t *this, gfs3_readdir_rsp *rsp, - gf_dirent_t *entries, dict_t **xdata); +client_post_readdir(xlator_t *this, gfs3_readdir_rsp *rsp, gf_dirent_t *entries, + dict_t **xdata); int -client_post_inodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_inodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_finodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_finodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_entrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_entrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_fentrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_fentrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_xattrop (xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict, - dict_t **xdata); +client_post_xattrop(xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict, + dict_t **xdata); int -client_post_fxattrop (xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict, - dict_t **xdata); +client_post_fxattrop(xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict, + dict_t **xdata); int -client_post_fgetxattr (xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict, +client_post_fgetxattr(xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict, dict_t **xdata); int -client_post_fsetxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); +client_post_fsetxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_rchecksum (xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata); +client_post_rchecksum(xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata); int -client_post_setattr (xlator_t *this, gfs3_setattr_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_setattr(xlator_t *this, gfs3_setattr_rsp *rsp, struct iatt *prestat, + struct iatt *poststat, dict_t **xdata); int -client_post_fsetattr (xlator_t *this, gfs3_fsetattr_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_fsetattr(xlator_t *this, gfs3_fsetattr_rsp *rsp, + struct iatt *prestat, struct iatt *poststat, + dict_t **xdata); int -client_post_readdirp (xlator_t *this, gfs3_readdirp_rsp *rsp, - fd_t *fd, gf_dirent_t *entries, - dict_t **xdata); +client_post_readdirp(xlator_t *this, gfs3_readdirp_rsp *rsp, fd_t *fd, + gf_dirent_t *entries, dict_t **xdata); int -client_post_fremovexattr (xlator_t *this, gf_common_rsp *rsp, - dict_t **xdata); +client_post_fremovexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata); int -client_post_fallocate (xlator_t *this, gfs3_fallocate_rsp *rsp, - struct iatt *prestat, struct iatt *poststat, - dict_t **xdata); +client_post_fallocate(xlator_t *this, gfs3_fallocate_rsp *rsp, + struct iatt *prestat, struct iatt *poststat, + dict_t **xdata); int -client_post_discard (xlator_t *this, gfs3_discard_rsp *rsp, - struct iatt *prestat, - struct iatt *poststat, dict_t **xdata); +client_post_discard(xlator_t *this, gfs3_discard_rsp *rsp, struct iatt *prestat, + struct iatt *poststat, dict_t **xdata); int -client_post_zerofill (xlator_t *this, gfs3_zerofill_rsp *rsp, +client_post_zerofill(xlator_t *this, gfs3_zerofill_rsp *rsp, struct iatt *prestat, struct iatt *poststat, dict_t **xdata); int -client_post_ipc (xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata); +client_post_ipc(xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata); int -client_post_seek (xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata); +client_post_seek(xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata); int -client_post_lease (xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease, - dict_t **xdata); +client_post_lease(xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease, + dict_t **xdata); /* New functions for version 4 */ int -client_post_common_dict (xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict, - dict_t **xdata); +client_post_common_dict(xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict, + dict_t **xdata); int -client_post_common_3iatt (xlator_t *this, gfx_common_3iatt_rsp *rsp, struct iatt *iatt, - struct iatt *iatt2, struct iatt *iatt3, dict_t **xdata); +client_post_common_3iatt(xlator_t *this, gfx_common_3iatt_rsp *rsp, + struct iatt *iatt, struct iatt *iatt2, + struct iatt *iatt3, dict_t **xdata); int -client_post_common_2iatt (xlator_t *this, gfx_common_2iatt_rsp *rsp, struct iatt *iatt, - struct iatt *iatt2, dict_t **xdata); +client_post_common_2iatt(xlator_t *this, gfx_common_2iatt_rsp *rsp, + struct iatt *iatt, struct iatt *iatt2, dict_t **xdata); int -client_post_common_iatt (xlator_t *this, gfx_common_iatt_rsp *rsp, struct iatt *iatt, - dict_t **xdata); +client_post_common_iatt(xlator_t *this, gfx_common_iatt_rsp *rsp, + struct iatt *iatt, dict_t **xdata); int -client_post_common_rsp (xlator_t *this, gfx_common_rsp *rsp, dict_t **xdata); +client_post_common_rsp(xlator_t *this, gfx_common_rsp *rsp, dict_t **xdata); +int +client_pre_stat_v2(xlator_t *this, gfx_stat_req *req, loc_t *loc, + dict_t *xdata); int -client_pre_stat_v2 (xlator_t *this, gfx_stat_req *req, loc_t *loc, - dict_t *xdata); +client_pre_readlink_v2(xlator_t *this, gfx_readlink_req *req, loc_t *loc, + size_t size, dict_t *xdata); int -client_pre_readlink_v2 (xlator_t *this, gfx_readlink_req *req, loc_t *loc, - size_t size, dict_t *xdata); +client_pre_mknod_v2(xlator_t *this, gfx_mknod_req *req, loc_t *loc, mode_t mode, + dev_t rdev, mode_t umask, dict_t *xdata); int -client_pre_mknod_v2 (xlator_t *this, gfx_mknod_req *req, loc_t *loc, - mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata); +client_pre_mkdir_v2(xlator_t *this, gfx_mkdir_req *req, loc_t *loc, mode_t mode, + mode_t umask, dict_t *xdata); int -client_pre_mkdir_v2 (xlator_t *this, gfx_mkdir_req *req, loc_t *loc, - mode_t mode, mode_t umask, dict_t *xdata); +client_pre_unlink_v2(xlator_t *this, gfx_unlink_req *req, loc_t *loc, + int32_t flags, dict_t *xdata); int -client_pre_unlink_v2 (xlator_t *this, gfx_unlink_req *req, loc_t *loc, +client_pre_rmdir_v2(xlator_t *this, gfx_rmdir_req *req, loc_t *loc, int32_t flags, dict_t *xdata); int -client_pre_rmdir_v2 (xlator_t *this, gfx_rmdir_req *req, loc_t *loc, - int32_t flags, dict_t *xdata); +client_pre_symlink_v2(xlator_t *this, gfx_symlink_req *req, loc_t *loc, + const char *linkname, mode_t umask, dict_t *xdata); int -client_pre_symlink_v2 (xlator_t *this, gfx_symlink_req *req, loc_t *loc, - const char *linkname, mode_t umask, dict_t *xdata); +client_pre_rename_v2(xlator_t *this, gfx_rename_req *req, loc_t *oldloc, + loc_t *newloc, dict_t *xdata); int -client_pre_rename_v2 (xlator_t *this, gfx_rename_req *req, loc_t *oldloc, +client_pre_link_v2(xlator_t *this, gfx_link_req *req, loc_t *oldloc, loc_t *newloc, dict_t *xdata); int -client_pre_link_v2 (xlator_t *this, - gfx_link_req *req, loc_t *oldloc, loc_t *newloc, - dict_t *xdata); - -int -client_pre_truncate_v2 (xlator_t *this, gfx_truncate_req *req, - loc_t *loc, off_t offset, dict_t *xdata); - -int -client_pre_open_v2 (xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_truncate_v2(xlator_t *this, gfx_truncate_req *req, loc_t *loc, + off_t offset, dict_t *xdata); int -client_pre_readv_v2 (xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size, - off_t offset, int32_t flags, dict_t *xdata); +client_pre_open_v2(xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd, + int32_t flags, dict_t *xdata); int -client_pre_writev_v2 (xlator_t *this, gfx_write_req *req, - fd_t *fd, size_t size, off_t offset, int32_t flags, - dict_t **xdata); +client_pre_readv_v2(xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size, + off_t offset, int32_t flags, dict_t *xdata); int -client_pre_statfs_v2 (xlator_t *this, gfx_statfs_req *req, loc_t *loc, - dict_t *xdata); +client_pre_writev_v2(xlator_t *this, gfx_write_req *req, fd_t *fd, size_t size, + off_t offset, int32_t flags, dict_t **xdata); int -client_pre_flush_v2 (xlator_t *this, gfx_flush_req *req, fd_t *fd, dict_t *xdata); +client_pre_statfs_v2(xlator_t *this, gfx_statfs_req *req, loc_t *loc, + dict_t *xdata); int -client_pre_fsync_v2 (xlator_t *this, gfx_fsync_req *req, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_flush_v2(xlator_t *this, gfx_flush_req *req, fd_t *fd, + dict_t *xdata); int -client_pre_setxattr_v2 (xlator_t *this, gfx_setxattr_req *req, loc_t *loc, - dict_t *xattr, int32_t flags, dict_t *xdata); +client_pre_fsync_v2(xlator_t *this, gfx_fsync_req *req, fd_t *fd, int32_t flags, + dict_t *xdata); int -client_pre_getxattr_v2 (xlator_t *this, gfx_getxattr_req *req, loc_t *loc, - const char *name, dict_t *xdata); +client_pre_setxattr_v2(xlator_t *this, gfx_setxattr_req *req, loc_t *loc, + dict_t *xattr, int32_t flags, dict_t *xdata); int -client_pre_removexattr_v2 (xlator_t *this, gfx_removexattr_req *req, - loc_t *loc, const char *name, dict_t *xdata); +client_pre_getxattr_v2(xlator_t *this, gfx_getxattr_req *req, loc_t *loc, + const char *name, dict_t *xdata); int -client_pre_opendir_v2 (xlator_t *this, - gfx_opendir_req *req, loc_t *loc, - fd_t *fd, dict_t *xdata); +client_pre_removexattr_v2(xlator_t *this, gfx_removexattr_req *req, loc_t *loc, + const char *name, dict_t *xdata); int -client_pre_fsyncdir_v2 (xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd, - int32_t flags, dict_t *xdata); +client_pre_opendir_v2(xlator_t *this, gfx_opendir_req *req, loc_t *loc, + fd_t *fd, dict_t *xdata); int -client_pre_access_v2 (xlator_t *this, gfx_access_req *req, loc_t *loc, - int32_t mask, dict_t *xdata); +client_pre_fsyncdir_v2(xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd, + int32_t flags, dict_t *xdata); int -client_pre_create_v2 (xlator_t *this, gfx_create_req *req, - loc_t *loc, fd_t *fd, mode_t mode, - int32_t flags, mode_t umask, dict_t *xdata); +client_pre_access_v2(xlator_t *this, gfx_access_req *req, loc_t *loc, + int32_t mask, dict_t *xdata); int -client_pre_ftruncate_v2 (xlator_t *this, gfx_ftruncate_req *req, fd_t *fd, - off_t offset, dict_t *xdata); +client_pre_create_v2(xlator_t *this, gfx_create_req *req, loc_t *loc, fd_t *fd, + mode_t mode, int32_t flags, mode_t umask, dict_t *xdata); int -client_pre_fstat_v2 (xlator_t *this, gfx_fstat_req *req, fd_t *fd, - dict_t *xdata); +client_pre_ftruncate_v2(xlator_t *this, gfx_ftruncate_req *req, fd_t *fd, + off_t offset, dict_t *xdata); int -client_pre_lk_v2 (xlator_t *this, gfx_lk_req *req, - int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata); +client_pre_fstat_v2(xlator_t *this, gfx_fstat_req *req, fd_t *fd, + dict_t *xdata); int -client_pre_lookup_v2 (xlator_t *this, gfx_lookup_req *req, loc_t *loc, - dict_t *xdata); +client_pre_lk_v2(xlator_t *this, gfx_lk_req *req, int32_t cmd, + struct gf_flock *flock, fd_t *fd, dict_t *xdata); int -client_pre_readdir_v2 (xlator_t *this, gfx_readdir_req *req, fd_t *fd, - size_t size, off_t offset, dict_t *xdata); +client_pre_lookup_v2(xlator_t *this, gfx_lookup_req *req, loc_t *loc, + dict_t *xdata); int -client_pre_inodelk_v2 (xlator_t *this, gfx_inodelk_req *req, loc_t *loc, - int cmd, struct gf_flock *flock, const char *volume, - dict_t *xdata); +client_pre_readdir_v2(xlator_t *this, gfx_readdir_req *req, fd_t *fd, + size_t size, off_t offset, dict_t *xdata); int -client_pre_finodelk_v2 (xlator_t *this, gfx_finodelk_req *req, fd_t *fd, - int cmd, struct gf_flock *flock, const char *volume, - dict_t *xdata); +client_pre_inodelk_v2(xlator_t *this, gfx_inodelk_req *req, loc_t *loc, int cmd, + struct gf_flock *flock, const char *volume, + dict_t *xdata); int -client_pre_entrylk_v2 (xlator_t *this, gfx_entrylk_req *req, loc_t *loc, - entrylk_cmd cmd_entrylk, entrylk_type type, - const char *volume, const char *basename, dict_t *xdata); +client_pre_finodelk_v2(xlator_t *this, gfx_finodelk_req *req, fd_t *fd, int cmd, + struct gf_flock *flock, const char *volume, + dict_t *xdata); int -client_pre_fentrylk_v2 (xlator_t *this, gfx_fentrylk_req *req, fd_t *fd, +client_pre_entrylk_v2(xlator_t *this, gfx_entrylk_req *req, loc_t *loc, entrylk_cmd cmd_entrylk, entrylk_type type, const char *volume, const char *basename, dict_t *xdata); int -client_pre_xattrop_v2 (xlator_t *this, gfx_xattrop_req *req, loc_t *loc, - dict_t *xattr, int32_t flags, dict_t *xdata); +client_pre_fentrylk_v2(xlator_t *this, gfx_fentrylk_req *req, fd_t *fd, + entrylk_cmd cmd_entrylk, entrylk_type type, + const char *volume, const char *basename, dict_t *xdata); int -client_pre_fxattrop_v2 (xlator_t *this, gfx_fxattrop_req *req, fd_t *fd, - dict_t *xattr, int32_t flags, dict_t *xdata); +client_pre_xattrop_v2(xlator_t *this, gfx_xattrop_req *req, loc_t *loc, + dict_t *xattr, int32_t flags, dict_t *xdata); + +int +client_pre_fxattrop_v2(xlator_t *this, gfx_fxattrop_req *req, fd_t *fd, + dict_t *xattr, int32_t flags, dict_t *xdata); int -client_pre_fgetxattr_v2 (xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd, - const char *name, dict_t *xdata); +client_pre_fgetxattr_v2(xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd, + const char *name, dict_t *xdata); int -client_pre_fsetxattr_v2 (xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd, - int32_t flags, dict_t *xattr, dict_t *xdata); +client_pre_fsetxattr_v2(xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd, + int32_t flags, dict_t *xattr, dict_t *xdata); int -client_pre_seek_v2 (xlator_t *this, gfx_seek_req *req, fd_t *fd, - off_t offset, gf_seek_what_t what, dict_t *xdata); +client_pre_seek_v2(xlator_t *this, gfx_seek_req *req, fd_t *fd, off_t offset, + gf_seek_what_t what, dict_t *xdata); int -client_pre_rchecksum_v2 (xlator_t *this, gfx_rchecksum_req *req, fd_t *fd, - int32_t len, off_t offset, dict_t *xdata); +client_pre_rchecksum_v2(xlator_t *this, gfx_rchecksum_req *req, fd_t *fd, + int32_t len, off_t offset, dict_t *xdata); int -client_pre_setattr_v2 (xlator_t *this, gfx_setattr_req *req, loc_t *loc, - int32_t valid, struct iatt *stbuf, dict_t *xdata); +client_pre_setattr_v2(xlator_t *this, gfx_setattr_req *req, loc_t *loc, + int32_t valid, struct iatt *stbuf, dict_t *xdata); int -client_pre_fsetattr_v2 (xlator_t *this, gfx_fsetattr_req *req, fd_t *fd, - int32_t valid, struct iatt *stbuf, dict_t *xdata); +client_pre_fsetattr_v2(xlator_t *this, gfx_fsetattr_req *req, fd_t *fd, + int32_t valid, struct iatt *stbuf, dict_t *xdata); int -client_pre_readdirp_v2 (xlator_t *this, gfx_readdirp_req *req, fd_t *fd, - size_t size, off_t offset, dict_t *xdata); +client_pre_readdirp_v2(xlator_t *this, gfx_readdirp_req *req, fd_t *fd, + size_t size, off_t offset, dict_t *xdata); int -client_pre_fremovexattr_v2 (xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd, - const char *name, dict_t *xdata); +client_pre_fremovexattr_v2(xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd, + const char *name, dict_t *xdata); int -client_pre_fallocate_v2 (xlator_t *this, gfx_fallocate_req *req, fd_t *fd, - int32_t flags, off_t offset, size_t size, dict_t *xdata); +client_pre_fallocate_v2(xlator_t *this, gfx_fallocate_req *req, fd_t *fd, + int32_t flags, off_t offset, size_t size, + dict_t *xdata); int -client_pre_discard_v2 (xlator_t *this, gfx_discard_req *req, fd_t *fd, - off_t offset, size_t size, dict_t *xdata); +client_pre_discard_v2(xlator_t *this, gfx_discard_req *req, fd_t *fd, + off_t offset, size_t size, dict_t *xdata); int -client_pre_zerofill_v2 (xlator_t *this, gfx_zerofill_req *req, fd_t *fd, - off_t offset, size_t size, dict_t *xdata); +client_pre_zerofill_v2(xlator_t *this, gfx_zerofill_req *req, fd_t *fd, + off_t offset, size_t size, dict_t *xdata); int -client_pre_ipc_v2 (xlator_t *this, gfx_ipc_req *req, int32_t cmd, - dict_t *xdata); +client_pre_ipc_v2(xlator_t *this, gfx_ipc_req *req, int32_t cmd, dict_t *xdata); int -client_pre_lease_v2 (xlator_t *this, gfx_lease_req *req, loc_t *loc, - struct gf_lease *lease, dict_t *xdata); +client_pre_lease_v2(xlator_t *this, gfx_lease_req *req, loc_t *loc, + struct gf_lease *lease, dict_t *xdata); int -client_pre_put_v2 (xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode, - mode_t umask, int32_t flags, size_t size, off_t offset, - dict_t *xattr, dict_t *xdata); +client_pre_put_v2(xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode, + mode_t umask, int32_t flags, size_t size, off_t offset, + dict_t *xattr, dict_t *xdata); int -client_post_readv_v2 (xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref, - struct iobref *rsp_iobref, struct iatt *stat, - struct iovec *vector, struct iovec *rsp_vector, - int *rspcount, dict_t **xdata); - +client_post_readv_v2(xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref, + struct iobref *rsp_iobref, struct iatt *stat, + struct iovec *vector, struct iovec *rsp_vector, + int *rspcount, dict_t **xdata); int -client_post_create_v2 (xlator_t *this, gfx_create_rsp *rsp, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, - clnt_local_t *local, dict_t **xdata); +client_post_create_v2(xlator_t *this, gfx_create_rsp *rsp, struct iatt *stbuf, + struct iatt *preparent, struct iatt *postparent, + clnt_local_t *local, dict_t **xdata); int -client_post_lease_v2 (xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease, - dict_t **xdata); +client_post_lease_v2(xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease, + dict_t **xdata); int -client_post_lk_v2 (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock, - dict_t **xdata); +client_post_lk_v2(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock, + dict_t **xdata); int -client_post_readdir_v2 (xlator_t *this, gfx_readdir_rsp *rsp, - gf_dirent_t *entries, dict_t **xdata); +client_post_readdir_v2(xlator_t *this, gfx_readdir_rsp *rsp, + gf_dirent_t *entries, dict_t **xdata); int -client_post_readdirp_v2 (xlator_t *this, gfx_readdirp_rsp *rsp, - fd_t *fd, gf_dirent_t *entries, - dict_t **xdata); +client_post_readdirp_v2(xlator_t *this, gfx_readdirp_rsp *rsp, fd_t *fd, + gf_dirent_t *entries, dict_t **xdata); int -client_post_rename_v2 (xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf, - struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent, - dict_t **xdata); +client_post_rename_v2(xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent, + dict_t **xdata); #endif /* __CLIENT_COMMON_H__ */ diff --git a/xlators/protocol/client/src/client-mem-types.h b/xlators/protocol/client/src/client-mem-types.h index 1e995414ed8..bf01a90abb9 100644 --- a/xlators/protocol/client/src/client-mem-types.h +++ b/xlators/protocol/client/src/client-mem-types.h @@ -8,21 +8,20 @@ cases as published by the Free Software Foundation. */ - #ifndef __CLIENT_MEM_TYPES_H__ #define __CLIENT_MEM_TYPES_H__ #include "mem-types.h" enum gf_client_mem_types_ { - gf_client_mt_clnt_conf_t = gf_common_mt_end + 1, - gf_client_mt_clnt_req_buf_t, - gf_client_mt_clnt_fdctx_t, - gf_client_mt_clnt_lock_t, - gf_client_mt_clnt_fd_lk_local_t, - gf_client_mt_clnt_args_t, - gf_client_mt_compound_req_t, - gf_client_mt_clnt_lock_request_t, - gf_client_mt_end, + gf_client_mt_clnt_conf_t = gf_common_mt_end + 1, + gf_client_mt_clnt_req_buf_t, + gf_client_mt_clnt_fdctx_t, + gf_client_mt_clnt_lock_t, + gf_client_mt_clnt_fd_lk_local_t, + gf_client_mt_clnt_args_t, + gf_client_mt_compound_req_t, + gf_client_mt_clnt_lock_request_t, + gf_client_mt_end, }; #endif /* __CLIENT_MEM_TYPES_H__ */ diff --git a/xlators/protocol/client/src/client-messages.h b/xlators/protocol/client/src/client-messages.h index 5f146c67efe..879d53741d1 100644 --- a/xlators/protocol/client/src/client-messages.h +++ b/xlators/protocol/client/src/client-messages.h @@ -23,75 +23,31 @@ * glfs-message-id.h. */ -GLFS_MSGID(PC, - PC_MSG_TIMER_EXPIRED, - PC_MSG_DIR_OP_FAILED, - PC_MSG_FILE_OP_FAILED, - PC_MSG_TIMER_REG, - PC_MSG_GRACE_TIMER_CANCELLED, - PC_MSG_DICT_SET_FAILED, - PC_MSG_DICT_GET_FAILED, - PC_MSG_NO_MEMORY, - PC_MSG_RPC_CBK_FAILED, - PC_MSG_FUNCTION_CALL_ERROR, - PC_MSG_RPC_INITED_ALREADY, - PC_MSG_RPC_INIT, - PC_MSG_RPC_DESTROY, - PC_MSG_RPC_INVALID_CALL, - PC_MSG_INVALID_ENTRY, - PC_MSG_HANDSHAKE_RETURN, - PC_MSG_CHILD_UP_NOTIFY_FAILED, - PC_MSG_CLIENT_DISCONNECTED, - PC_MSG_CHILD_DOWN_NOTIFY_FAILED, - PC_MSG_PARENT_UP, - PC_MSG_PARENT_DOWN, - PC_MSG_RPC_INIT_FAILED, - PC_MSG_RPC_NOTIFY_FAILED, - PC_MSG_FD_DUPLICATE_TRY, - PC_MSG_FD_SET_FAIL, - PC_MSG_DICT_UNSERIALIZE_FAIL, - PC_MSG_FD_GET_FAIL, - PC_MSG_FD_CTX_INVALID, - PC_MSG_FOP_SEND_FAILED, - PC_MSG_XDR_DECODING_FAILED, - PC_MSG_REMOTE_OP_FAILED, - PC_MSG_RPC_STATUS_ERROR, - PC_MSG_VOL_FILE_NOT_FOUND, - PC_MSG_SEND_REQ_FAIL, - PC_MSG_LOCK_VERSION_SERVER, - PC_MSG_SET_LK_VERSION_ERROR, - PC_MSG_LOCK_REQ_FAIL, - PC_MSG_CLIENT_REQ_FAIL, - PC_MSG_LOCK_ERROR, - PC_MSG_LOCK_REACQUIRE, - PC_MSG_CHILD_UP_NOTIFY, - PC_MSG_CHILD_UP_NOTIFY_DELAY, - PC_MSG_VOL_SET_FAIL, - PC_MSG_SETVOLUME_FAIL, - PC_MSG_VOLFILE_NOTIFY_FAILED, - PC_MSG_REMOTE_VOL_CONNECTED, - PC_MSG_LOCK_MISMATCH, - PC_MSG_LOCK_MATCH, - PC_MSG_AUTH_FAILED, - PC_MSG_AUTH_FAILED_NOTIFY_FAILED, - PC_MSG_CHILD_CONNECTING_EVENT, - PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED, - PC_MSG_PROCESS_UUID_SET_FAIL, - PC_MSG_DICT_ERROR, - PC_MSG_DICT_SERIALIZE_FAIL, - PC_MSG_PGM_NOT_FOUND, - PC_MSG_VERSION_INFO, - PC_MSG_PORT_NUM_ERROR, - PC_MSG_VERSION_ERROR, - PC_MSG_DIR_OP_SUCCESS, - PC_MSG_BAD_FD, - PC_MSG_CLIENT_LOCK_INFO, - PC_MSG_CACHE_INVALIDATION_FAIL, - PC_MSG_CHILD_STATUS, - PC_MSG_GFID_NULL, - PC_MSG_RECALL_LEASE_FAIL, - PC_MSG_INODELK_CONTENTION_FAIL, - PC_MSG_ENTRYLK_CONTENTION_FAIL -); +GLFS_MSGID( + PC, PC_MSG_TIMER_EXPIRED, PC_MSG_DIR_OP_FAILED, PC_MSG_FILE_OP_FAILED, + PC_MSG_TIMER_REG, PC_MSG_GRACE_TIMER_CANCELLED, PC_MSG_DICT_SET_FAILED, + PC_MSG_DICT_GET_FAILED, PC_MSG_NO_MEMORY, PC_MSG_RPC_CBK_FAILED, + PC_MSG_FUNCTION_CALL_ERROR, PC_MSG_RPC_INITED_ALREADY, PC_MSG_RPC_INIT, + PC_MSG_RPC_DESTROY, PC_MSG_RPC_INVALID_CALL, PC_MSG_INVALID_ENTRY, + PC_MSG_HANDSHAKE_RETURN, PC_MSG_CHILD_UP_NOTIFY_FAILED, + PC_MSG_CLIENT_DISCONNECTED, PC_MSG_CHILD_DOWN_NOTIFY_FAILED, + PC_MSG_PARENT_UP, PC_MSG_PARENT_DOWN, PC_MSG_RPC_INIT_FAILED, + PC_MSG_RPC_NOTIFY_FAILED, PC_MSG_FD_DUPLICATE_TRY, PC_MSG_FD_SET_FAIL, + PC_MSG_DICT_UNSERIALIZE_FAIL, PC_MSG_FD_GET_FAIL, PC_MSG_FD_CTX_INVALID, + PC_MSG_FOP_SEND_FAILED, PC_MSG_XDR_DECODING_FAILED, PC_MSG_REMOTE_OP_FAILED, + PC_MSG_RPC_STATUS_ERROR, PC_MSG_VOL_FILE_NOT_FOUND, PC_MSG_SEND_REQ_FAIL, + PC_MSG_LOCK_VERSION_SERVER, PC_MSG_SET_LK_VERSION_ERROR, + PC_MSG_LOCK_REQ_FAIL, PC_MSG_CLIENT_REQ_FAIL, PC_MSG_LOCK_ERROR, + PC_MSG_LOCK_REACQUIRE, PC_MSG_CHILD_UP_NOTIFY, PC_MSG_CHILD_UP_NOTIFY_DELAY, + PC_MSG_VOL_SET_FAIL, PC_MSG_SETVOLUME_FAIL, PC_MSG_VOLFILE_NOTIFY_FAILED, + PC_MSG_REMOTE_VOL_CONNECTED, PC_MSG_LOCK_MISMATCH, PC_MSG_LOCK_MATCH, + PC_MSG_AUTH_FAILED, PC_MSG_AUTH_FAILED_NOTIFY_FAILED, + PC_MSG_CHILD_CONNECTING_EVENT, PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED, + PC_MSG_PROCESS_UUID_SET_FAIL, PC_MSG_DICT_ERROR, PC_MSG_DICT_SERIALIZE_FAIL, + PC_MSG_PGM_NOT_FOUND, PC_MSG_VERSION_INFO, PC_MSG_PORT_NUM_ERROR, + PC_MSG_VERSION_ERROR, PC_MSG_DIR_OP_SUCCESS, PC_MSG_BAD_FD, + PC_MSG_CLIENT_LOCK_INFO, PC_MSG_CACHE_INVALIDATION_FAIL, + PC_MSG_CHILD_STATUS, PC_MSG_GFID_NULL, PC_MSG_RECALL_LEASE_FAIL, + PC_MSG_INODELK_CONTENTION_FAIL, PC_MSG_ENTRYLK_CONTENTION_FAIL); #endif /* !_PC_MESSAGES_H__ */ diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index b72404f5639..c63e3a290d6 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -27,447 +27,460 @@ #include "client-messages.h" /* FIXME: Needs to be defined in a common file */ -#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump" -#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) -#define GF_MIN_SOCKET_WINDOW_SIZE (0) +#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump" +#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) +#define GF_MIN_SOCKET_WINDOW_SIZE (0) typedef enum { - DEFAULT_REMOTE_FD = 0, - FALLBACK_TO_ANON_FD = 1 + DEFAULT_REMOTE_FD = 0, + FALLBACK_TO_ANON_FD = 1 } clnt_remote_fd_flags_t; -#define CPD_REQ_FIELD(v,f) (v)->compound_req_u.compound_##f##_req -#define CPD_RSP_FIELD(v,f) (v)->compound_rsp_u.compound_##f##_rsp - -#define CLIENT_POST_FOP(fop, this_rsp_u, this_args_cbk, params ...) \ - do { \ - gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u,fop); \ - int _op_ret = 0; \ - int _op_errno = 0; \ - \ - _op_ret = _this_rsp->op_ret; \ - _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ - args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ - params); \ - } while (0) - -#define CLIENT_POST_FOP_TYPE(fop, this_rsp_u, this_args_cbk, params ...) \ - do { \ - gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u,fop);\ - int _op_ret = 0; \ - int _op_errno = 0; \ - \ - _op_ret = _this_rsp->op_ret; \ - _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ - args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ - params); \ - } while (0) - -#define CLIENT_PRE_FOP(fop, xl, compound_req, op_errno, label, params ...) \ - do { \ - gfs3_##fop##_req *_req = (gfs3_##fop##_req *) compound_req; \ - int _ret = 0; \ - \ - _ret = client_pre_##fop (xl, _req, params); \ - if (_ret < 0) { \ - op_errno = -ret; \ - goto label; \ - } \ - } while (0) - -#define CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fop) \ - do { \ - gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req,fop); \ - \ - GF_FREE (_req->xdata.xdata_val); \ - } while (0) - -#define CLIENT_COMMON_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gf_common_rsp *_this_rsp = &CPD_RSP_FIELD (this_rsp, fop); \ - \ - free (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define CLIENT_FOP_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD (this_rsp, fop); \ - \ - free (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define CLIENT_GET_REMOTE_FD(xl, fd, flags, remote_fd, op_errno, label) \ - do { \ - int _ret = 0; \ - _ret = client_get_remote_fd (xl, fd, flags, &remote_fd);\ - if (_ret < 0) { \ - op_errno = errno; \ - goto label; \ - } \ - if (remote_fd == -1) { \ - gf_msg (xl->name, GF_LOG_WARNING, EBADFD, \ - PC_MSG_BAD_FD, " (%s) " \ - "remote_fd is -1. EBADFD", \ - uuid_utoa (fd->inode->gfid)); \ - op_errno = EBADFD; \ - goto label; \ - } \ - } while (0) - -#define CLIENT_STACK_UNWIND(op, frame, params ...) do { \ - if (!frame) \ - break; \ - clnt_local_t *__local = frame->local; \ - frame->local = NULL; \ - STACK_UNWIND_STRICT (op, frame, params); \ - client_local_wipe (__local); \ - } while (0) +#define CPD_REQ_FIELD(v, f) (v)->compound_req_u.compound_##f##_req +#define CPD_RSP_FIELD(v, f) (v)->compound_rsp_u.compound_##f##_rsp + +#define CLIENT_POST_FOP(fop, this_rsp_u, this_args_cbk, params...) \ + do { \ + gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno(_this_rsp->op_errno); \ + args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \ + } while (0) + +#define CLIENT_POST_FOP_TYPE(fop, this_rsp_u, this_args_cbk, params...) \ + do { \ + gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno(_this_rsp->op_errno); \ + args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \ + } while (0) + +#define CLIENT_PRE_FOP(fop, xl, compound_req, op_errno, label, params...) \ + do { \ + gfs3_##fop##_req *_req = (gfs3_##fop##_req *)compound_req; \ + int _ret = 0; \ + \ + _ret = client_pre_##fop(xl, _req, params); \ + if (_ret < 0) { \ + op_errno = -ret; \ + goto label; \ + } \ + } while (0) + +#define CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fop) \ + do { \ + gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \ + \ + GF_FREE(_req->xdata.xdata_val); \ + } while (0) + +#define CLIENT_COMMON_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + free(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define CLIENT_FOP_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + free(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define CLIENT_GET_REMOTE_FD(xl, fd, flags, remote_fd, op_errno, label) \ + do { \ + int _ret = 0; \ + _ret = client_get_remote_fd(xl, fd, flags, &remote_fd); \ + if (_ret < 0) { \ + op_errno = errno; \ + goto label; \ + } \ + if (remote_fd == -1) { \ + gf_msg(xl->name, GF_LOG_WARNING, EBADFD, PC_MSG_BAD_FD, \ + " (%s) " \ + "remote_fd is -1. EBADFD", \ + uuid_utoa(fd->inode->gfid)); \ + op_errno = EBADFD; \ + goto label; \ + } \ + } while (0) + +#define CLIENT_STACK_UNWIND(op, frame, params...) \ + do { \ + if (!frame) \ + break; \ + clnt_local_t *__local = frame->local; \ + frame->local = NULL; \ + STACK_UNWIND_STRICT(op, frame, params); \ + client_local_wipe(__local); \ + } while (0) /* compound v2 */ -#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) -#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) - -#define CLIENT4_POST_FOP(fop, this_rsp_u, this_args_cbk, params ...) \ - do { \ - gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ - int _op_ret = 0; \ - int _op_errno = 0; \ - \ - _op_ret = _this_rsp->op_ret; \ - _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ - args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ - params); \ - } while (0) - -#define CLIENT4_POST_FOP_TYPE(fop, rsp_type, this_rsp_u, this_args_cbk, params ...) \ - do { \ - gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ - int _op_ret = 0; \ - int _op_errno = 0; \ - \ - _op_ret = _this_rsp->op_ret; \ - _op_errno = gf_error_to_errno (_this_rsp->op_errno); \ - args_##fop##_cbk_store (this_args_cbk, _op_ret, _op_errno, \ - params); \ - } while (0) - -#define CLIENT4_PRE_FOP(fop, xl, compound_req, op_errno, label, params ...) \ - do { \ - gfx_##fop##_req *_req = (gfx_##fop##_req *)compound_req; \ - int _ret = 0; \ - \ - _ret = client_pre_##fop##_v2 (xl, _req, params); \ - if (_ret < 0) { \ - op_errno = -ret; \ - goto label; \ - } \ - } while (0) - -#define CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fop) \ - do { \ - gfx_##fop##_req *_req = &CPD4_REQ_FIELD(curr_req, fop); \ - \ - GF_FREE (_req->xdata.pairs.pairs_val); \ - } while (0) - - +#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) +#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) + +#define CLIENT4_POST_FOP(fop, this_rsp_u, this_args_cbk, params...) \ + do { \ + gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno(_this_rsp->op_errno); \ + args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \ + } while (0) + +#define CLIENT4_POST_FOP_TYPE(fop, rsp_type, this_rsp_u, this_args_cbk, \ + params...) \ + do { \ + gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \ + int _op_ret = 0; \ + int _op_errno = 0; \ + \ + _op_ret = _this_rsp->op_ret; \ + _op_errno = gf_error_to_errno(_this_rsp->op_errno); \ + args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \ + } while (0) + +#define CLIENT4_PRE_FOP(fop, xl, compound_req, op_errno, label, params...) \ + do { \ + gfx_##fop##_req *_req = (gfx_##fop##_req *)compound_req; \ + int _ret = 0; \ + \ + _ret = client_pre_##fop##_v2(xl, _req, params); \ + if (_ret < 0) { \ + op_errno = -ret; \ + goto label; \ + } \ + } while (0) + +#define CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fop) \ + do { \ + gfx_##fop##_req *_req = &CPD4_REQ_FIELD(curr_req, fop); \ + \ + GF_FREE(_req->xdata.pairs.pairs_val); \ + } while (0) struct clnt_options { - char *remote_subvolume; - int ping_timeout; + char *remote_subvolume; + int ping_timeout; }; typedef struct clnt_conf { - struct rpc_clnt *rpc; - struct clnt_options opt; - struct rpc_clnt_config rpc_conf; - struct list_head saved_fds; - pthread_spinlock_t fd_lock; /* protects saved_fds list - * and all fdctx */ - pthread_mutex_t lock; - int connected; - - rpc_clnt_prog_t *fops; - rpc_clnt_prog_t *mgmt; - rpc_clnt_prog_t *handshake; - rpc_clnt_prog_t *dump; - - int client_id; - uint64_t reopen_fd_count; /* Count of fds reopened after a - connection is established */ - gf_lock_t rec_lock; - int skip_notify; - - int last_sent_event; /* Flag used to make sure we are - not repeating the same event - which was sent earlier */ - char portmap_err_logged; /* flag used to prevent - excessive logging */ - char disconnect_err_logged; /* flag used to prevent - excessive disconnect - logging */ - char parent_down; - gf_boolean_t quick_reconnect; /* When reconnecting after - portmap query, do not let - the reconnection happen after - the usual 3-second wait - */ - gf_boolean_t filter_o_direct; /* if set, filter O_DIRECT from - the flags list of open() */ - /* set volume is the op which results in creating/re-using - * the conn-id and is called once per connection, this remembers - * how manytimes set_volume is called - */ - uint64_t setvol_count; - - gf_boolean_t send_gids; /* let the server resolve gids */ - - int event_threads; /* # of event threads - * configured */ - - gf_boolean_t destroy; /* if enabled implies fini was called - * on @this xlator instance */ - - gf_boolean_t child_up; /* Set to true, when child is up, and - * false, when child is down */ - - gf_boolean_t can_log_disconnect; /* socket level connection is - * up, disconnects can be - * logged - */ + struct rpc_clnt *rpc; + struct clnt_options opt; + struct rpc_clnt_config rpc_conf; + struct list_head saved_fds; + pthread_spinlock_t fd_lock; /* protects saved_fds list + * and all fdctx */ + pthread_mutex_t lock; + int connected; + + rpc_clnt_prog_t *fops; + rpc_clnt_prog_t *mgmt; + rpc_clnt_prog_t *handshake; + rpc_clnt_prog_t *dump; + + int client_id; + uint64_t reopen_fd_count; /* Count of fds reopened after a + connection is established */ + gf_lock_t rec_lock; + int skip_notify; + + int last_sent_event; /* Flag used to make sure we are + not repeating the same event + which was sent earlier */ + char portmap_err_logged; /* flag used to prevent + excessive logging */ + char disconnect_err_logged; /* flag used to prevent + excessive disconnect + logging */ + char parent_down; + gf_boolean_t quick_reconnect; /* When reconnecting after + portmap query, do not let + the reconnection happen after + the usual 3-second wait + */ + gf_boolean_t filter_o_direct; /* if set, filter O_DIRECT from + the flags list of open() */ + /* set volume is the op which results in creating/re-using + * the conn-id and is called once per connection, this remembers + * how manytimes set_volume is called + */ + uint64_t setvol_count; + + gf_boolean_t send_gids; /* let the server resolve gids */ + + int event_threads; /* # of event threads + * configured */ + + gf_boolean_t destroy; /* if enabled implies fini was called + * on @this xlator instance */ + + gf_boolean_t child_up; /* Set to true, when child is up, and + * false, when child is down */ + + gf_boolean_t can_log_disconnect; /* socket level connection is + * up, disconnects can be + * logged + */ } clnt_conf_t; typedef struct _client_fd_ctx { - struct list_head sfd_pos; /* Stores the reference to this - fd's position in the saved_fds list. - */ - int64_t remote_fd; - char is_dir; - char released; - int32_t flags; - fd_lk_ctx_t *lk_ctx; - uuid_t gfid; - void (*reopen_done)(struct _client_fd_ctx*, int64_t rfd, xlator_t *); - struct list_head lock_list; /* List of all granted locks on this fd */ - int32_t reopen_attempts; + struct list_head sfd_pos; /* Stores the reference to this + fd's position in the saved_fds list. + */ + int64_t remote_fd; + char is_dir; + char released; + int32_t flags; + fd_lk_ctx_t *lk_ctx; + uuid_t gfid; + void (*reopen_done)(struct _client_fd_ctx *, int64_t rfd, xlator_t *); + struct list_head lock_list; /* List of all granted locks on this fd */ + int32_t reopen_attempts; } clnt_fd_ctx_t; typedef struct _client_posix_lock { - fd_t *fd; /* The fd on which the lk operation was made */ - - struct gf_flock user_flock; /* the flock supplied by the user */ - off_t fl_start; - off_t fl_end; - short fl_type; - int32_t cmd; /* the cmd for the lock call */ - gf_lkowner_t owner; /* lock owner from fuse */ - struct list_head list; /* reference used to add to the fdctx list of locks */ + fd_t *fd; /* The fd on which the lk operation was made */ + + struct gf_flock user_flock; /* the flock supplied by the user */ + off_t fl_start; + off_t fl_end; + short fl_type; + int32_t cmd; /* the cmd for the lock call */ + gf_lkowner_t owner; /* lock owner from fuse */ + struct list_head + list; /* reference used to add to the fdctx list of locks */ } client_posix_lock_t; typedef struct client_local { - loc_t loc; - loc_t loc2; - fd_t *fd; - clnt_fd_ctx_t *fdctx; - uint32_t flags; - struct iobref *iobref; - - client_posix_lock_t *client_lock; - gf_lkowner_t owner; - int32_t cmd; - struct list_head lock_list; - pthread_mutex_t mutex; - char *name; - gf_boolean_t attempt_reopen; - /* required for compound fops */ - compound_args_t *compound_args; - unsigned int length; /* length of a compound fop */ - unsigned int read_length; /* defines the last processed length for a compound read */ + loc_t loc; + loc_t loc2; + fd_t *fd; + clnt_fd_ctx_t *fdctx; + uint32_t flags; + struct iobref *iobref; + + client_posix_lock_t *client_lock; + gf_lkowner_t owner; + int32_t cmd; + struct list_head lock_list; + pthread_mutex_t mutex; + char *name; + gf_boolean_t attempt_reopen; + /* required for compound fops */ + compound_args_t *compound_args; + unsigned int length; /* length of a compound fop */ + unsigned int + read_length; /* defines the last processed length for a compound read */ } clnt_local_t; typedef struct client_args { - loc_t *loc; - fd_t *fd; - const char *linkname; - struct iobref *iobref; - struct iovec *vector; - dict_t *xattr; - struct iatt *stbuf; - loc_t *oldloc; - loc_t *newloc; - const char *name; - struct gf_flock *flock; - const char *volume; - const char *basename; - off_t offset; - int32_t mask; - int32_t cmd; - size_t size; - mode_t mode; - dev_t rdev; - int32_t flags; - int32_t count; - int32_t datasync; - entrylk_cmd cmd_entrylk; - entrylk_type type; - gf_xattrop_flags_t optype; - int32_t valid; - int32_t len; - gf_seek_what_t what; - struct gf_lease *lease; - - mode_t umask; - dict_t *xdata; - lock_migration_info_t *locklist; + loc_t *loc; + fd_t *fd; + const char *linkname; + struct iobref *iobref; + struct iovec *vector; + dict_t *xattr; + struct iatt *stbuf; + loc_t *oldloc; + loc_t *newloc; + const char *name; + struct gf_flock *flock; + const char *volume; + const char *basename; + off_t offset; + int32_t mask; + int32_t cmd; + size_t size; + mode_t mode; + dev_t rdev; + int32_t flags; + int32_t count; + int32_t datasync; + entrylk_cmd cmd_entrylk; + entrylk_type type; + gf_xattrop_flags_t optype; + int32_t valid; + int32_t len; + gf_seek_what_t what; + struct gf_lease *lease; + + mode_t umask; + dict_t *xdata; + lock_migration_info_t *locklist; } clnt_args_t; -typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *args); +typedef ssize_t (*gfs_serialize_t)(struct iovec outmsg, void *args); + +clnt_fd_ctx_t * +this_fd_get_ctx(fd_t *file, xlator_t *this); +clnt_fd_ctx_t * +this_fd_del_ctx(fd_t *file, xlator_t *this); +void +this_fd_set_ctx(fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx); -clnt_fd_ctx_t *this_fd_get_ctx (fd_t *file, xlator_t *this); -clnt_fd_ctx_t *this_fd_del_ctx (fd_t *file, xlator_t *this); -void this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, - clnt_fd_ctx_t *ctx); +int +client_local_wipe(clnt_local_t *local); +int +client_submit_request(xlator_t *this, void *req, call_frame_t *frame, + rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbk, + struct iobref *iobref, struct iovec *rsphdr, + int rsphdr_count, struct iovec *rsp_payload, + int rsp_count, struct iobref *rsp_iobref, + xdrproc_t xdrproc); -int client_local_wipe (clnt_local_t *local); -int client_submit_request (xlator_t *this, void *req, - call_frame_t *frame, rpc_clnt_prog_t *prog, - int procnum, fop_cbk_fn_t cbk, - struct iobref *iobref, - struct iovec *rsphdr, int rsphdr_count, - struct iovec *rsp_payload, int rsp_count, - struct iobref *rsp_iobref, xdrproc_t xdrproc); +int +client_submit_compound_request(xlator_t *this, void *req, call_frame_t *frame, + rpc_clnt_prog_t *prog, int procnum, + fop_cbk_fn_t cbkfn, struct iovec *req_vector, + int req_count, struct iobref *iobref, + struct iovec *rsphdr, int rsphdr_count, + struct iovec *rsp_payload, int rsp_payload_count, + struct iobref *rsp_iobref, xdrproc_t xdrproc); int -client_submit_compound_request (xlator_t *this, void *req, call_frame_t *frame, - rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, - struct iovec *req_vector, int req_count, - struct iobref *iobref, struct iovec *rsphdr, - int rsphdr_count, struct iovec *rsp_payload, - int rsp_payload_count, struct iobref *rsp_iobref, - xdrproc_t xdrproc); - -int unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp, - gf_dirent_t *entries); -int unserialize_rsp_direntp (xlator_t *this, fd_t *fd, - struct gfs3_readdirp_rsp *rsp, gf_dirent_t *entries); - -int clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp); -int clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp); -int client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx); -int32_t delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner); -int32_t delete_granted_locks_fd (clnt_fd_ctx_t *fdctx); -int32_t client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd); -void client_save_number_fds (clnt_conf_t *conf, int count); -int dump_client_locks (inode_t *inode); -int client_notify_parents_child_up (xlator_t *this); -int32_t is_client_dump_locks_cmd (char *name); -int32_t client_dump_locks (char *name, inode_t *inode, - dict_t *dict); -int client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx); - -int32_t client_type_to_gf_type (short l_type); - -int client_mark_fd_bad (xlator_t *this); - -int client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t use_try_lock); -void client_default_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, - xlator_t *this); -void client_attempt_reopen (fd_t *fd, xlator_t *this); -int client_get_remote_fd (xlator_t *this, fd_t *fd, int flags, - int64_t *remote_fd); -int client_fd_fop_prepare_local (call_frame_t *frame, fd_t *fd, - int64_t remote_fd); +unserialize_rsp_dirent(xlator_t *this, struct gfs3_readdir_rsp *rsp, + gf_dirent_t *entries); +int +unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp, + gf_dirent_t *entries); + +int +clnt_readdir_rsp_cleanup(gfs3_readdir_rsp *rsp); +int +clnt_readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp); +int +client_attempt_lock_recovery(xlator_t *this, clnt_fd_ctx_t *fdctx); +int32_t +delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner); +int32_t +delete_granted_locks_fd(clnt_fd_ctx_t *fdctx); +int32_t +client_cmd_to_gf_cmd(int32_t cmd, int32_t *gf_cmd); +void +client_save_number_fds(clnt_conf_t *conf, int count); +int +dump_client_locks(inode_t *inode); +int +client_notify_parents_child_up(xlator_t *this); +int32_t +is_client_dump_locks_cmd(char *name); +int32_t +client_dump_locks(char *name, inode_t *inode, dict_t *dict); +int +client_fdctx_destroy(xlator_t *this, clnt_fd_ctx_t *fdctx); + +int32_t +client_type_to_gf_type(short l_type); + +int +client_mark_fd_bad(xlator_t *this); + +int +client_fd_lk_list_empty(fd_lk_ctx_t *lk_ctx, gf_boolean_t use_try_lock); +void +client_default_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this); +void +client_attempt_reopen(fd_t *fd, xlator_t *this); +int +client_get_remote_fd(xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd); +int +client_fd_fop_prepare_local(call_frame_t *frame, fd_t *fd, int64_t remote_fd); gf_boolean_t -__is_fd_reopen_in_progress (clnt_fd_ctx_t *fdctx); +__is_fd_reopen_in_progress(clnt_fd_ctx_t *fdctx); int -client_notify_dispatch (xlator_t *this, int32_t event, void *data, ...); +client_notify_dispatch(xlator_t *this, int32_t event, void *data, ...); int -client_notify_dispatch_uniq (xlator_t *this, int32_t event, void *data, ...); +client_notify_dispatch_uniq(xlator_t *this, int32_t event, void *data, ...); gf_boolean_t -client_is_reopen_needed (fd_t *fd, xlator_t *this, int64_t remote_fd); +client_is_reopen_needed(fd_t *fd, xlator_t *this, int64_t remote_fd); int -client_add_fd_to_saved_fds (xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags, - int64_t remote_fd, int is_dir); +client_add_fd_to_saved_fds(xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags, + int64_t remote_fd, int is_dir); int -client_handle_fop_requirements (xlator_t *this, call_frame_t *frame, - gfs3_compound_req *req, - clnt_local_t *local, - struct iobref **req_iobref, - struct iobref **rsp_iobref, - struct iovec *req_vector, - struct iovec *rsp_vector, int *req_count, - int *rsp_count, default_args_t *args, - int fop_enum, int index); +client_handle_fop_requirements( + xlator_t *this, call_frame_t *frame, gfs3_compound_req *req, + clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref, + struct iovec *req_vector, struct iovec *rsp_vector, int *req_count, + int *rsp_count, default_args_t *args, int fop_enum, int index); int -client_process_response (call_frame_t *frame, xlator_t *this, - struct rpc_req *req, - gfs3_compound_rsp *rsp, compound_args_cbk_t *args_cbk, - int index); +client_process_response(call_frame_t *frame, xlator_t *this, + struct rpc_req *req, gfs3_compound_rsp *rsp, + compound_args_cbk_t *args_cbk, int index); void -compound_request_cleanup (gfs3_compound_req *req); +compound_request_cleanup(gfs3_compound_req *req); int -clnt_unserialize_rsp_locklist (xlator_t *this, struct gfs3_getactivelk_rsp *rsp, - lock_migration_info_t *lmi); +clnt_unserialize_rsp_locklist(xlator_t *this, struct gfs3_getactivelk_rsp *rsp, + lock_migration_info_t *lmi); void -clnt_getactivelk_rsp_cleanup (gfs3_getactivelk_rsp *rsp); +clnt_getactivelk_rsp_cleanup(gfs3_getactivelk_rsp *rsp); void -clnt_setactivelk_req_cleanup (gfs3_setactivelk_req *req); +clnt_setactivelk_req_cleanup(gfs3_setactivelk_req *req); int -serialize_req_locklist (lock_migration_info_t *locklist, - gfs3_setactivelk_req *req); +serialize_req_locklist(lock_migration_info_t *locklist, + gfs3_setactivelk_req *req); void -client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len); +client_compound_rsp_cleanup(gfs3_compound_rsp *rsp, int len); void -clnt_getactivelk_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp); +clnt_getactivelk_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp); void -clnt_setactivelk_req_cleanup_v2 (gfx_setactivelk_req *req); +clnt_setactivelk_req_cleanup_v2(gfx_setactivelk_req *req); int -serialize_req_locklist_v2 (lock_migration_info_t *locklist, - gfx_setactivelk_req *req); +serialize_req_locklist_v2(lock_migration_info_t *locklist, + gfx_setactivelk_req *req); int -clnt_unserialize_rsp_locklist_v2 (xlator_t *this, struct gfx_getactivelk_rsp *rsp, - lock_migration_info_t *lmi); +clnt_unserialize_rsp_locklist_v2(xlator_t *this, + struct gfx_getactivelk_rsp *rsp, + lock_migration_info_t *lmi); -int unserialize_rsp_dirent_v2 (xlator_t *this, struct gfx_readdir_rsp *rsp, - gf_dirent_t *entries); -int unserialize_rsp_direntp_v2 (xlator_t *this, fd_t *fd, - struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries); +int +unserialize_rsp_dirent_v2(xlator_t *this, struct gfx_readdir_rsp *rsp, + gf_dirent_t *entries); +int +unserialize_rsp_direntp_v2(xlator_t *this, fd_t *fd, + struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries); -int clnt_readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp); -int clnt_readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp); +int +clnt_readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp); +int +clnt_readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp); int -client_handle_fop_requirements_v2 (xlator_t *this, call_frame_t *frame, - gfx_compound_req *req, - clnt_local_t *local, - struct iobref **req_iobref, - struct iobref **rsp_iobref, - struct iovec *req_vector, - struct iovec *rsp_vector, int *req_count, - int *rsp_count, default_args_t *args, - int fop_enum, int index); +client_handle_fop_requirements_v2( + xlator_t *this, call_frame_t *frame, gfx_compound_req *req, + clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref, + struct iovec *req_vector, struct iovec *rsp_vector, int *req_count, + int *rsp_count, default_args_t *args, int fop_enum, int index); int -client_process_response_v2 (call_frame_t *frame, xlator_t *this, - struct rpc_req *req, - gfx_compound_rsp *rsp, compound_args_cbk_t *args_cbk, - int index); +client_process_response_v2(call_frame_t *frame, xlator_t *this, + struct rpc_req *req, gfx_compound_rsp *rsp, + compound_args_cbk_t *args_cbk, int index); void -compound_request_cleanup_v2 (gfx_compound_req *req); +compound_request_cleanup_v2(gfx_compound_req *req); void -client_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, int len); +client_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, int len); #endif /* !_CLIENT_H */ diff --git a/xlators/protocol/server/src/authenticate.h b/xlators/protocol/server/src/authenticate.h index 5f92183fb12..6fc53933343 100644 --- a/xlators/protocol/server/src/authenticate.h +++ b/xlators/protocol/server/src/authenticate.h @@ -22,23 +22,21 @@ #include "list.h" #include "xlator.h" -typedef enum { - AUTH_ACCEPT, - AUTH_REJECT, - AUTH_DONT_CARE -} auth_result_t; +typedef enum { AUTH_ACCEPT, AUTH_REJECT, AUTH_DONT_CARE } auth_result_t; -typedef auth_result_t (*auth_fn_t) (dict_t *input_params, - dict_t *config_params); +typedef auth_result_t (*auth_fn_t)(dict_t *input_params, dict_t *config_params); typedef struct { - void *handle; - auth_fn_t authenticate; - volume_opt_list_t *vol_opt; + void *handle; + auth_fn_t authenticate; + volume_opt_list_t *vol_opt; } auth_handle_t; -int32_t gf_auth_init (xlator_t *xl, dict_t *auth_modules); -void gf_auth_fini (dict_t *auth_modules); -auth_result_t gf_authenticate (dict_t *, dict_t *, dict_t *); +int32_t +gf_auth_init(xlator_t *xl, dict_t *auth_modules); +void +gf_auth_fini(dict_t *auth_modules); +auth_result_t +gf_authenticate(dict_t *, dict_t *, dict_t *); #endif /* _AUTHENTICATE_H */ diff --git a/xlators/protocol/server/src/server-common.h b/xlators/protocol/server/src/server-common.h index e272235a192..53e46afdc69 100644 --- a/xlators/protocol/server/src/server-common.h +++ b/xlators/protocol/server/src/server-common.h @@ -9,200 +9,186 @@ #include "xdr-nfs3.h" void -server_post_stat (server_state_t *state, - gfs3_stat_rsp *rsp, struct iatt *stbuf); +server_post_stat(server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf); void -server_post_readlink (gfs3_readlink_rsp *rsp, struct iatt *stbuf, - const char *buf); +server_post_readlink(gfs3_readlink_rsp *rsp, struct iatt *stbuf, + const char *buf); void -server_post_mknod (server_state_t *state, gfs3_mknod_rsp *rsp, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, inode_t *inode); +server_post_mknod(server_state_t *state, gfs3_mknod_rsp *rsp, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, inode_t *inode); void -server_post_mkdir (server_state_t *state, gfs3_mkdir_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_mkdir(server_state_t *state, gfs3_mkdir_rsp *rsp, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_unlink (server_state_t *state, gfs3_unlink_rsp *rsp, - struct iatt *preparent, struct iatt *postparent); +server_post_unlink(server_state_t *state, gfs3_unlink_rsp *rsp, + struct iatt *preparent, struct iatt *postparent); void -server_post_rmdir (server_state_t *state, gfs3_rmdir_rsp *rsp, - struct iatt *preparent, struct iatt *postparent); +server_post_rmdir(server_state_t *state, gfs3_rmdir_rsp *rsp, + struct iatt *preparent, struct iatt *postparent); void -server_post_symlink (server_state_t *state, gfs3_symlink_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_symlink(server_state_t *state, gfs3_symlink_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_link (server_state_t *state, gfs3_link_rsp *rsp, - inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata); +server_post_link(server_state_t *state, gfs3_link_rsp *rsp, inode_t *inode, + struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata); void -server_post_truncate (gfs3_truncate_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_truncate(gfs3_truncate_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_writev (gfs3_write_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_writev(gfs3_write_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_statfs (gfs3_statfs_rsp *rsp, struct statvfs *stbuf); +server_post_statfs(gfs3_statfs_rsp *rsp, struct statvfs *stbuf); void -server_post_fsync (gfs3_fsync_rsp *rsp, struct iatt *prebuf, - struct iatt *postbuf); +server_post_fsync(gfs3_fsync_rsp *rsp, struct iatt *prebuf, + struct iatt *postbuf); void -server_post_ftruncate (gfs3_ftruncate_rsp *rsp, struct iatt *prebuf, +server_post_ftruncate(gfs3_ftruncate_rsp *rsp, struct iatt *prebuf, struct iatt *postbuf); void -server_post_fstat (server_state_t *state, - gfs3_fstat_rsp *rsp, struct iatt *stbuf); +server_post_fstat(server_state_t *state, gfs3_fstat_rsp *rsp, + struct iatt *stbuf); void -server_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock); +server_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock); int -server_post_readdir (gfs3_readdir_rsp *rsp, gf_dirent_t *entries); +server_post_readdir(gfs3_readdir_rsp *rsp, gf_dirent_t *entries); void -server_post_zerofill (gfs3_zerofill_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_zerofill(gfs3_zerofill_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_discard (gfs3_discard_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_discard(gfs3_discard_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_fallocate (gfs3_fallocate_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_fallocate(gfs3_fallocate_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_seek (gfs3_seek_rsp *rsp, off_t offset); +server_post_seek(gfs3_seek_rsp *rsp, off_t offset); int -server_post_readdirp (gfs3_readdirp_rsp *rsp, gf_dirent_t *entries); +server_post_readdirp(gfs3_readdirp_rsp *rsp, gf_dirent_t *entries); void -server_post_fsetattr (gfs3_fsetattr_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_fsetattr(gfs3_fsetattr_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_setattr (gfs3_setattr_rsp *rsp, struct iatt *statpre, - struct iatt *statpost); +server_post_setattr(gfs3_setattr_rsp *rsp, struct iatt *statpre, + struct iatt *statpost); void -server_post_rchecksum (gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum, - uint8_t *strong_checksum); +server_post_rchecksum(gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum, + uint8_t *strong_checksum); void -server_post_rename (call_frame_t *frame, server_state_t *state, - gfs3_rename_rsp *rsp, - struct iatt *stbuf, - struct iatt *preoldparent, - struct iatt *postoldparent, - struct iatt *prenewparent, - struct iatt *postnewparent); +server_post_rename(call_frame_t *frame, server_state_t *state, + gfs3_rename_rsp *rsp, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent); int -server_post_open (call_frame_t *frame, xlator_t *this, - gfs3_open_rsp *rsp, fd_t *fd); +server_post_open(call_frame_t *frame, xlator_t *this, gfs3_open_rsp *rsp, + fd_t *fd); void -server_post_readv (gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret); +server_post_readv(gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret); int -server_post_opendir (call_frame_t *frame, xlator_t *this, - gfs3_opendir_rsp *rsp, fd_t *fd); +server_post_opendir(call_frame_t *frame, xlator_t *this, gfs3_opendir_rsp *rsp, + fd_t *fd); int -server_post_create (call_frame_t *frame, gfs3_create_rsp *rsp, - server_state_t *state, - xlator_t *this, fd_t *fd, inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent); +server_post_create(call_frame_t *frame, gfs3_create_rsp *rsp, + server_state_t *state, xlator_t *this, fd_t *fd, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, + struct iatt *postparent); void -server_post_lookup (gfs3_lookup_rsp *rsp, call_frame_t *frame, - server_state_t *state, - inode_t *inode, struct iatt *stbuf, - struct iatt *postparent); +server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame, + server_state_t *state, inode_t *inode, struct iatt *stbuf, + struct iatt *postparent); void -server_post_lease (gfs3_lease_rsp *rsp, struct gf_lease *lease); +server_post_lease(gfs3_lease_rsp *rsp, struct gf_lease *lease); void -server4_post_readlink (gfx_readlink_rsp *rsp, struct iatt *stbuf, +server4_post_readlink(gfx_readlink_rsp *rsp, struct iatt *stbuf, const char *buf); void -server4_post_statfs (gfx_statfs_rsp *rsp, struct statvfs *stbuf); +server4_post_statfs(gfx_statfs_rsp *rsp, struct statvfs *stbuf); void -server4_post_lk (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock); +server4_post_lk(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock); int -server4_post_readdir (gfx_readdir_rsp *rsp, gf_dirent_t *entries); +server4_post_readdir(gfx_readdir_rsp *rsp, gf_dirent_t *entries); void -server4_post_seek (gfx_seek_rsp *rsp, off_t offset); +server4_post_seek(gfx_seek_rsp *rsp, off_t offset); int -server4_post_readdirp (gfx_readdirp_rsp *rsp, gf_dirent_t *entries); +server4_post_readdirp(gfx_readdirp_rsp *rsp, gf_dirent_t *entries); void -server4_post_rchecksum (gfx_rchecksum_rsp *rsp, uint32_t weak_checksum, +server4_post_rchecksum(gfx_rchecksum_rsp *rsp, uint32_t weak_checksum, uint8_t *strong_checksum); void -server4_post_rename (call_frame_t *frame, server_state_t *state, - gfx_rename_rsp *rsp, - struct iatt *stbuf, - struct iatt *preoldparent, - struct iatt *postoldparent, - struct iatt *prenewparent, - struct iatt *postnewparent); +server4_post_rename(call_frame_t *frame, server_state_t *state, + gfx_rename_rsp *rsp, struct iatt *stbuf, + struct iatt *preoldparent, struct iatt *postoldparent, + struct iatt *prenewparent, struct iatt *postnewparent); int -server4_post_open (call_frame_t *frame, xlator_t *this, - gfx_open_rsp *rsp, fd_t *fd); +server4_post_open(call_frame_t *frame, xlator_t *this, gfx_open_rsp *rsp, + fd_t *fd); void -server4_post_readv (gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret); +server4_post_readv(gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret); int -server4_post_create (call_frame_t *frame, gfx_create_rsp *rsp, - server_state_t *state, - xlator_t *this, fd_t *fd, inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, +server4_post_create(call_frame_t *frame, gfx_create_rsp *rsp, + server_state_t *state, xlator_t *this, fd_t *fd, + inode_t *inode, struct iatt *stbuf, struct iatt *preparent, struct iatt *postparent); void -server4_post_common_2iatt (gfx_common_2iatt_rsp *rsp, - struct iatt *stbuf1, struct iatt *stbuf2); +server4_post_common_2iatt(gfx_common_2iatt_rsp *rsp, struct iatt *stbuf1, + struct iatt *stbuf2); void -server4_post_entry_remove (server_state_t *state, gfx_common_2iatt_rsp *rsp, - struct iatt *stbuf1, struct iatt *stbuf2); +server4_post_entry_remove(server_state_t *state, gfx_common_2iatt_rsp *rsp, + struct iatt *stbuf1, struct iatt *stbuf2); void -server4_post_common_3iatt (server_state_t *state, gfx_common_3iatt_rsp *rsp, - inode_t *inode, struct iatt *stbuf, struct iatt *pre, - struct iatt *post); +server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *pre, + struct iatt *post); void -server4_post_common_iatt (server_state_t *state, gfx_common_iatt_rsp *rsp, - struct iatt *stbuf); +server4_post_common_iatt(server_state_t *state, gfx_common_iatt_rsp *rsp, + struct iatt *stbuf); void -server4_post_lease (gfx_lease_rsp *rsp, struct gf_lease *lease); +server4_post_lease(gfx_lease_rsp *rsp, struct gf_lease *lease); void -server4_post_lookup (gfx_common_2iatt_rsp *rsp, call_frame_t *frame, - server_state_t *state, - inode_t *inode, struct iatt *stbuf); +server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame, + server_state_t *state, inode_t *inode, struct iatt *stbuf); void -server4_post_link (server_state_t *state, gfx_common_3iatt_rsp *rsp, - inode_t *inode, struct iatt *stbuf, struct iatt *pre, - struct iatt *post); +server4_post_link(server_state_t *state, gfx_common_3iatt_rsp *rsp, + inode_t *inode, struct iatt *stbuf, struct iatt *pre, + struct iatt *post); diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index b89105a355f..20b8d901bd2 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -14,119 +14,127 @@ #include "server.h" #include "defaults.h" -#define CALL_STATE(frame) ((server_state_t *)frame->root->state) +#define CALL_STATE(frame) ((server_state_t *)frame->root->state) -#define XPRT_FROM_FRAME(frame) ((rpc_transport_t *) CALL_STATE(frame)->xprt) +#define XPRT_FROM_FRAME(frame) ((rpc_transport_t *)CALL_STATE(frame)->xprt) -#define SERVER_CONF(frame) \ - ((server_conf_t *)XPRT_FROM_FRAME(frame)->this->private) +#define SERVER_CONF(frame) \ + ((server_conf_t *)XPRT_FROM_FRAME(frame)->this->private) #define XPRT_FROM_XLATOR(this) ((((server_conf_t *)this->private))->listen) -#define INODE_LRU_LIMIT(this) \ - (((server_conf_t *)(this->private))->config.inode_lru_limit) +#define INODE_LRU_LIMIT(this) \ + (((server_conf_t *)(this->private))->config.inode_lru_limit) #define IS_ROOT_INODE(inode) (inode == inode->table->root) -#define IS_NOT_ROOT(pathlen) ((pathlen > 2)? 1 : 0) +#define IS_NOT_ROOT(pathlen) ((pathlen > 2) ? 1 : 0) -void free_state (server_state_t *state); +void +free_state(server_state_t *state); -void server_loc_wipe (loc_t *loc); +void +server_loc_wipe(loc_t *loc); void -server_print_request (call_frame_t *frame); +server_print_request(call_frame_t *frame); call_frame_t * -get_frame_from_request (rpcsvc_request_t *req); +get_frame_from_request(rpcsvc_request_t *req); int -server_connection_cleanup (xlator_t *this, struct _client *client, - int32_t flags); +server_connection_cleanup(xlator_t *this, struct _client *client, + int32_t flags); int -server_build_config (xlator_t *this, server_conf_t *conf); +server_build_config(xlator_t *this, server_conf_t *conf); -int serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp); -int serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); -int readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp); -int readdir_rsp_cleanup (gfs3_readdir_rsp *rsp); -int readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp); -int readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp); -int auth_set_username_passwd (dict_t *input_params, dict_t *config_params, - struct _client *client); +int +serialize_rsp_dirent(gf_dirent_t *entries, gfs3_readdir_rsp *rsp); +int +serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); +int +readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp); +int +readdir_rsp_cleanup(gfs3_readdir_rsp *rsp); +int +readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp); +int +readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp); +int +auth_set_username_passwd(dict_t *input_params, dict_t *config_params, + struct _client *client); -server_ctx_t *server_ctx_get (client_t *client, xlator_t *xlator); -int server_process_event_upcall (xlator_t *this, void *data); +server_ctx_t * +server_ctx_get(client_t *client, xlator_t *xlator); +int +server_process_event_upcall(xlator_t *this, void *data); inode_t * -server_inode_new (inode_table_t *itable, uuid_t gfid); +server_inode_new(inode_table_t *itable, uuid_t gfid); int -serialize_rsp_locklist (lock_migration_info_t *locklist, - gfs3_getactivelk_rsp *rsp); +serialize_rsp_locklist(lock_migration_info_t *locklist, + gfs3_getactivelk_rsp *rsp); int -serialize_rsp_locklist_v2 (lock_migration_info_t *locklist, - gfx_getactivelk_rsp *rsp); +serialize_rsp_locklist_v2(lock_migration_info_t *locklist, + gfx_getactivelk_rsp *rsp); int -getactivelkinfo_rsp_cleanup (gfs3_getactivelk_rsp *rsp); +getactivelkinfo_rsp_cleanup(gfs3_getactivelk_rsp *rsp); int -getactivelkinfo_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp); +getactivelkinfo_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp); int -server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp, - call_frame_t *frame, - compound_args_cbk_t *args_cbk, int index); +server_populate_compound_response(xlator_t *this, gfs3_compound_rsp *rsp, + call_frame_t *frame, + compound_args_cbk_t *args_cbk, int index); int -server_get_compound_resolve (server_state_t *state, gfs3_compound_req *req); +server_get_compound_resolve(server_state_t *state, gfs3_compound_req *req); int -server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame, - default_args_t *this_args, - int index); +server_populate_compound_request(gfs3_compound_req *req, call_frame_t *frame, + default_args_t *this_args, int index); void -server_compound_rsp_cleanup (gfs3_compound_rsp *rsp, compound_args_cbk_t *args); +server_compound_rsp_cleanup(gfs3_compound_rsp *rsp, compound_args_cbk_t *args); void -server_compound_req_cleanup (gfs3_compound_req *req, int len); +server_compound_req_cleanup(gfs3_compound_req *req, int len); int -unserialize_req_locklist (gfs3_setactivelk_req *req, - lock_migration_info_t *lmi); +unserialize_req_locklist(gfs3_setactivelk_req *req, lock_migration_info_t *lmi); int -unserialize_req_locklist_v2 (gfx_setactivelk_req *req, - lock_migration_info_t *lmi); +unserialize_req_locklist_v2(gfx_setactivelk_req *req, + lock_migration_info_t *lmi); int -serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp); +serialize_rsp_dirent(gf_dirent_t *entries, gfs3_readdir_rsp *rsp); int -serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); +serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp); int -serialize_rsp_dirent_v2 (gf_dirent_t *entries, gfx_readdir_rsp *rsp); +serialize_rsp_dirent_v2(gf_dirent_t *entries, gfx_readdir_rsp *rsp); int -serialize_rsp_direntp_v2 (gf_dirent_t *entries, gfx_readdirp_rsp *rsp); +serialize_rsp_direntp_v2(gf_dirent_t *entries, gfx_readdirp_rsp *rsp); int -server_populate_compound_response_v2 (xlator_t *this, gfx_compound_rsp *rsp, - call_frame_t *frame, - compound_args_cbk_t *args_cbk, int index); +server_populate_compound_response_v2(xlator_t *this, gfx_compound_rsp *rsp, + call_frame_t *frame, + compound_args_cbk_t *args_cbk, int index); int -server_get_compound_resolve_v2 (server_state_t *state, gfx_compound_req *req); +server_get_compound_resolve_v2(server_state_t *state, gfx_compound_req *req); int -server_populate_compound_request_v2 (gfx_compound_req *req, call_frame_t *frame, - default_args_t *this_args, - int index); +server_populate_compound_request_v2(gfx_compound_req *req, call_frame_t *frame, + default_args_t *this_args, int index); void -server_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, compound_args_cbk_t *args); +server_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, + compound_args_cbk_t *args); void -server_compound_req_cleanup_v2 (gfx_compound_req *req, int len); - +server_compound_req_cleanup_v2(gfx_compound_req *req, int len); #endif /* !_SERVER_HELPERS_H */ diff --git a/xlators/protocol/server/src/server-mem-types.h b/xlators/protocol/server/src/server-mem-types.h index 76a78ac3ede..4b341e53845 100644 --- a/xlators/protocol/server/src/server-mem-types.h +++ b/xlators/protocol/server/src/server-mem-types.h @@ -8,27 +8,26 @@ cases as published by the Free Software Foundation. */ - #ifndef __SERVER_MEM_TYPES_H__ #define __SERVER_MEM_TYPES_H__ #include "mem-types.h" enum gf_server_mem_types_ { - gf_server_mt_server_conf_t = gf_common_mt_end + 1, - gf_server_mt_resolv_comp_t, - gf_server_mt_state_t, - gf_server_mt_locker_t, - gf_server_mt_lock_table_t, - gf_server_mt_conn_t, - gf_server_mt_dirent_rsp_t, - gf_server_mt_rsp_buf_t, - gf_server_mt_volfile_ctx_t, - gf_server_mt_timer_data_t, - gf_server_mt_setvolume_rsp_t, - gf_server_mt_lock_mig_t, - gf_server_mt_compound_rsp_t, - gf_server_mt_child_status, - gf_server_mt_end, + gf_server_mt_server_conf_t = gf_common_mt_end + 1, + gf_server_mt_resolv_comp_t, + gf_server_mt_state_t, + gf_server_mt_locker_t, + gf_server_mt_lock_table_t, + gf_server_mt_conn_t, + gf_server_mt_dirent_rsp_t, + gf_server_mt_rsp_buf_t, + gf_server_mt_volfile_ctx_t, + gf_server_mt_timer_data_t, + gf_server_mt_setvolume_rsp_t, + gf_server_mt_lock_mig_t, + gf_server_mt_compound_rsp_t, + gf_server_mt_child_status, + gf_server_mt_end, }; #endif /* __SERVER_MEM_TYPES_H__ */ diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h index f7698806e3c..bc7431b9d86 100644 --- a/xlators/protocol/server/src/server-messages.h +++ b/xlators/protocol/server/src/server-messages.h @@ -23,101 +23,43 @@ * glfs-message-id.h. */ -GLFS_MSGID(PS, - PS_MSG_AUTHENTICATE_ERROR, - PS_MSG_VOL_VALIDATE_FAILED, - PS_MSG_AUTH_INIT_FAILED, - PS_MSG_REMOTE_CLIENT_REFUSED, - PS_MSG_GFID_RESOLVE_FAILED, - PS_MSG_ANONYMOUS_FD_CREATE_FAILED, - PS_MSG_NO_MEMORY, - PS_MSG_FD_NOT_FOUND, - PS_MSG_INVALID_ENTRY, - PS_MSG_GET_UID_FAILED, - PS_MSG_UID_NOT_FOUND, - PS_MSG_MAPPING_ERROR, - PS_MSG_FD_CLEANUP, - PS_MSG_SERVER_CTX_GET_FAILED, - PS_MSG_FDENTRY_NULL, - PS_MSG_DIR_NOT_FOUND, - PS_MSG_SERVER_MSG, - PS_MSG_DICT_SERIALIZE_FAIL, - PS_MSG_RW_STAT, - PS_MSG_DICT_GET_FAILED, - PS_MSG_LOGIN_ERROR, - PS_MSG_REMOUNT_CLIENT_REQD, - PS_MSG_DEFAULTING_FILE, - PS_MSG_VOL_FILE_OPEN_FAILED, - PS_MSG_STAT_ERROR, - PS_MSG_SSL_NAME_SET_FAILED, - PS_MSG_ASPRINTF_FAILED, - PS_MSG_CLIENT_VERSION_NOT_SET, - PS_MSG_CLIENT_ACCEPTED, - PS_MSG_CLIENT_LK_VERSION_ERROR, - PS_MSG_GRACE_TIMER_EXPD, - PS_MSG_SERIALIZE_REPLY_FAILED, - PS_MSG_AUTH_IP_ERROR, - PS_MSG_SKIP_FORMAT_CHK, - PS_MSG_INTERNET_ADDR_ERROR, - PS_MSG_CLIENT_DISCONNECTING, - PS_MSG_GRACE_TIMER_START, - PS_MSG_STATEDUMP_PATH_ERROR, - PS_MSG_GRP_CACHE_ERROR, - PS_MSG_RPC_CONF_ERROR, - PS_MSG_TRANSPORT_ERROR, - PS_MSG_SUBVOL_NULL, - PS_MSG_PARENT_VOL_ERROR, - PS_MSG_RPCSVC_CREATE_FAILED, - PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, - PS_MSG_RPCSVC_NOTIFY, - PS_MSG_PGM_REG_FAILED, - PS_MSG_ULIMIT_SET_FAILED, - PS_MSG_STATFS, - PS_MSG_LOOKUP_INFO, - PS_MSG_LK_INFO, - PS_MSG_LOCK_ERROR, - PS_MSG_INODELK_INFO, - PS_MSG_ENTRYLK_INFO, - PS_MSG_ACCESS_INFO, - PS_MSG_DIR_INFO, - PS_MSG_MKNOD_INFO, - PS_MSG_REMOVEXATTR_INFO, - PS_MSG_GETXATTR_INFO, - PS_MSG_SETXATTR_INFO, - PS_MSG_RENAME_INFO, - PS_MSG_LINK_INFO, - PS_MSG_TRUNCATE_INFO, - PS_MSG_FSTAT_INFO, - PS_MSG_FLUSH_INFO, - PS_MSG_SYNC_INFO, - PS_MSG_WRITE_INFO, - PS_MSG_READ_INFO, - PS_MSG_CHKSUM_INFO, - PS_MSG_OPEN_INFO, - PS_MSG_CREATE_INFO, - PS_MSG_SETATTR_INFO, - PS_MSG_XATTROP_INFO, - PS_MSG_ALLOC_INFO, - PS_MSG_DISCARD_INFO, - PS_MSG_ZEROFILL_INFO, - PS_MSG_FD_CREATE_FAILED, - PS_MSG_WRONG_STATE, - PS_MSG_CONF_DIR_INVALID, - PS_MSG_MOUNT_PT_FAIL, - PS_MSG_STAT_INFO, - PS_MSG_FILE_OP_FAILED, - PS_MSG_GRACE_TIMER_CANCELLED, - PS_MSG_ENCODE_MSG_FAILED, - PS_MSG_REPLY_SUBMIT_FAILED, - PS_MSG_RPC_NOTIFY_ERROR, - PS_MSG_SERVER_EVENT_UPCALL_FAILED, - PS_MSG_SERVER_IPC_INFO, - PS_MSG_SEEK_INFO, - PS_MSG_COMPOUND_INFO, - PS_MSG_CLIENT_OPVERSION_GET_FAILED, - PS_MSG_CHILD_STATUS_FAILED, - PS_MSG_PUT_INFO -); +GLFS_MSGID(PS, PS_MSG_AUTHENTICATE_ERROR, PS_MSG_VOL_VALIDATE_FAILED, + PS_MSG_AUTH_INIT_FAILED, PS_MSG_REMOTE_CLIENT_REFUSED, + PS_MSG_GFID_RESOLVE_FAILED, PS_MSG_ANONYMOUS_FD_CREATE_FAILED, + PS_MSG_NO_MEMORY, PS_MSG_FD_NOT_FOUND, PS_MSG_INVALID_ENTRY, + PS_MSG_GET_UID_FAILED, PS_MSG_UID_NOT_FOUND, PS_MSG_MAPPING_ERROR, + PS_MSG_FD_CLEANUP, PS_MSG_SERVER_CTX_GET_FAILED, PS_MSG_FDENTRY_NULL, + PS_MSG_DIR_NOT_FOUND, PS_MSG_SERVER_MSG, PS_MSG_DICT_SERIALIZE_FAIL, + PS_MSG_RW_STAT, PS_MSG_DICT_GET_FAILED, PS_MSG_LOGIN_ERROR, + PS_MSG_REMOUNT_CLIENT_REQD, PS_MSG_DEFAULTING_FILE, + PS_MSG_VOL_FILE_OPEN_FAILED, PS_MSG_STAT_ERROR, + PS_MSG_SSL_NAME_SET_FAILED, PS_MSG_ASPRINTF_FAILED, + PS_MSG_CLIENT_VERSION_NOT_SET, PS_MSG_CLIENT_ACCEPTED, + PS_MSG_CLIENT_LK_VERSION_ERROR, PS_MSG_GRACE_TIMER_EXPD, + PS_MSG_SERIALIZE_REPLY_FAILED, PS_MSG_AUTH_IP_ERROR, + PS_MSG_SKIP_FORMAT_CHK, PS_MSG_INTERNET_ADDR_ERROR, + PS_MSG_CLIENT_DISCONNECTING, PS_MSG_GRACE_TIMER_START, + PS_MSG_STATEDUMP_PATH_ERROR, PS_MSG_GRP_CACHE_ERROR, + PS_MSG_RPC_CONF_ERROR, PS_MSG_TRANSPORT_ERROR, PS_MSG_SUBVOL_NULL, + PS_MSG_PARENT_VOL_ERROR, PS_MSG_RPCSVC_CREATE_FAILED, + PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, PS_MSG_RPCSVC_NOTIFY, + PS_MSG_PGM_REG_FAILED, PS_MSG_ULIMIT_SET_FAILED, PS_MSG_STATFS, + PS_MSG_LOOKUP_INFO, PS_MSG_LK_INFO, PS_MSG_LOCK_ERROR, + PS_MSG_INODELK_INFO, PS_MSG_ENTRYLK_INFO, PS_MSG_ACCESS_INFO, + PS_MSG_DIR_INFO, PS_MSG_MKNOD_INFO, PS_MSG_REMOVEXATTR_INFO, + PS_MSG_GETXATTR_INFO, PS_MSG_SETXATTR_INFO, PS_MSG_RENAME_INFO, + PS_MSG_LINK_INFO, PS_MSG_TRUNCATE_INFO, PS_MSG_FSTAT_INFO, + PS_MSG_FLUSH_INFO, PS_MSG_SYNC_INFO, PS_MSG_WRITE_INFO, + PS_MSG_READ_INFO, PS_MSG_CHKSUM_INFO, PS_MSG_OPEN_INFO, + PS_MSG_CREATE_INFO, PS_MSG_SETATTR_INFO, PS_MSG_XATTROP_INFO, + PS_MSG_ALLOC_INFO, PS_MSG_DISCARD_INFO, PS_MSG_ZEROFILL_INFO, + PS_MSG_FD_CREATE_FAILED, PS_MSG_WRONG_STATE, PS_MSG_CONF_DIR_INVALID, + PS_MSG_MOUNT_PT_FAIL, PS_MSG_STAT_INFO, PS_MSG_FILE_OP_FAILED, + PS_MSG_GRACE_TIMER_CANCELLED, PS_MSG_ENCODE_MSG_FAILED, + PS_MSG_REPLY_SUBMIT_FAILED, PS_MSG_RPC_NOTIFY_ERROR, + PS_MSG_SERVER_EVENT_UPCALL_FAILED, PS_MSG_SERVER_IPC_INFO, + PS_MSG_SEEK_INFO, PS_MSG_COMPOUND_INFO, + PS_MSG_CLIENT_OPVERSION_GET_FAILED, PS_MSG_CHILD_STATUS_FAILED, + PS_MSG_PUT_INFO); #endif /* !_PS_MESSAGES_H__ */ - diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index 88aaa263018..e6064af076e 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -26,237 +26,234 @@ #include "defaults.h" #include "authenticate.h" -#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */ -#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol" -#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) -#define GF_MIN_SOCKET_WINDOW_SIZE (0) - -#define CPD_REQ_FIELD(v, f) ((v)->compound_req_u.compound_##f##_req) -#define CPD_RSP_FIELD(v, f) ((v)->compound_rsp_u.compound_##f##_rsp) - -#define SERVER_COMMON_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define SERVER_FOP_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\ - gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.xdata_val); \ - } while (0) - -#define SERVER_COMPOUND_FOP_CLEANUP(curr_req, fop) \ - do { \ - gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \ - \ - free (_req->xdata.xdata_val); \ - } while (0) - -#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) -#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) - -#define SERVER4_COMMON_RSP_CLEANUP(rsp, fop, i) \ - do { \ - compound_rsp_v2 *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ - gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.pairs.pairs_val); \ - } while (0) - -#define SERVER4_FOP_RSP_CLEANUP(rsp, fop, i, rsp_type) \ - do { \ - compound_rsp_v2 *this_rsp = NULL; \ - this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ - gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ - \ - GF_FREE (_this_rsp->xdata.pairs.pairs_val); \ - } while (0) - +#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */ +#define DEFAULT_VOLUME_FILE_PATH CONFDIR "/glusterfs.vol" +#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) +#define GF_MIN_SOCKET_WINDOW_SIZE (0) + +#define CPD_REQ_FIELD(v, f) ((v)->compound_req_u.compound_##f##_req) +#define CPD_RSP_FIELD(v, f) ((v)->compound_rsp_u.compound_##f##_rsp) + +#define SERVER_COMMON_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define SERVER_FOP_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.xdata_val); \ + } while (0) + +#define SERVER_COMPOUND_FOP_CLEANUP(curr_req, fop) \ + do { \ + gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \ + \ + free(_req->xdata.xdata_val); \ + } while (0) + +#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req) +#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp) + +#define SERVER4_COMMON_RSP_CLEANUP(rsp, fop, i) \ + do { \ + compound_rsp_v2 *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.pairs.pairs_val); \ + } while (0) + +#define SERVER4_FOP_RSP_CLEANUP(rsp, fop, i, rsp_type) \ + do { \ + compound_rsp_v2 *this_rsp = NULL; \ + this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \ + gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \ + \ + GF_FREE(_this_rsp->xdata.pairs.pairs_val); \ + } while (0) typedef enum { - INTERNAL_LOCKS = 1, - POSIX_LOCKS = 2, + INTERNAL_LOCKS = 1, + POSIX_LOCKS = 2, } server_lock_flags_t; typedef struct _server_state server_state_t; -int server_null (rpcsvc_request_t *req); +int +server_null(rpcsvc_request_t *req); struct _volfile_ctx { - struct _volfile_ctx *next; - char *key; - uint32_t checksum; + struct _volfile_ctx *next; + char *key; + uint32_t checksum; }; struct _child_status { - struct list_head status_list; - char *name; - gf_boolean_t child_up; - gf_atomic_t xprtrefcnt; + struct list_head status_list; + char *name; + gf_boolean_t child_up; + gf_atomic_t xprtrefcnt; }; struct server_conf { - rpcsvc_t *rpc; - struct rpcsvc_config rpc_conf; - int inode_lru_limit; - gf_boolean_t verify_volfile; - gf_boolean_t trace; - char *conf_dir; - struct _volfile_ctx *volfile; - dict_t *auth_modules; - pthread_mutex_t mutex; - struct list_head xprt_list; - pthread_t barrier_th; - - gf_boolean_t server_manage_gids; /* resolve gids on brick */ - gid_cache_t gid_cache; - int32_t gid_cache_timeout; - - int event_threads; /* # of event threads - * configured */ - - gf_boolean_t parent_up; - gf_boolean_t dync_auth; /* if set authenticate dynamically, - * in case if volume set options - * (say *.allow | *.reject) are - * tweeked */ - struct _child_status *child_status; - gf_lock_t itable_lock; - gf_boolean_t strict_auth_enabled; + rpcsvc_t *rpc; + struct rpcsvc_config rpc_conf; + int inode_lru_limit; + gf_boolean_t verify_volfile; + gf_boolean_t trace; + char *conf_dir; + struct _volfile_ctx *volfile; + dict_t *auth_modules; + pthread_mutex_t mutex; + struct list_head xprt_list; + pthread_t barrier_th; + + gf_boolean_t server_manage_gids; /* resolve gids on brick */ + gid_cache_t gid_cache; + int32_t gid_cache_timeout; + + int event_threads; /* # of event threads + * configured */ + + gf_boolean_t parent_up; + gf_boolean_t dync_auth; /* if set authenticate dynamically, + * in case if volume set options + * (say *.allow | *.reject) are + * tweeked */ + struct _child_status *child_status; + gf_lock_t itable_lock; + gf_boolean_t strict_auth_enabled; }; typedef struct server_conf server_conf_t; - typedef enum { - RESOLVE_MUST = 1, - RESOLVE_NOT, - RESOLVE_MAY, - RESOLVE_DONTCARE, - RESOLVE_EXACT + RESOLVE_MUST = 1, + RESOLVE_NOT, + RESOLVE_MAY, + RESOLVE_DONTCARE, + RESOLVE_EXACT } server_resolve_type_t; - struct resolve_comp { - char *basename; - inode_t *inode; + char *basename; + inode_t *inode; }; typedef struct { - server_resolve_type_t type; - int64_t fd_no; - u_char gfid[16]; - u_char pargfid[16]; - char *path; - char *bname; - int op_ret; - int op_errno; - loc_t resolve_loc; + server_resolve_type_t type; + int64_t fd_no; + u_char gfid[16]; + u_char pargfid[16]; + char *path; + char *bname; + int op_ret; + int op_errno; + loc_t resolve_loc; } server_resolve_t; - -typedef int (*server_resume_fn_t) (call_frame_t *frame, xlator_t *bound_xl); +typedef int (*server_resume_fn_t)(call_frame_t *frame, xlator_t *bound_xl); int -resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn); +resolve_and_resume(call_frame_t *frame, server_resume_fn_t fn); struct _server_state { - rpc_transport_t *xprt; - inode_table_t *itable; - - server_resume_fn_t resume_fn; - - loc_t loc; - loc_t loc2; - server_resolve_t resolve; - server_resolve_t resolve2; - - /* used within resolve_and_resume */ - loc_t *loc_now; - server_resolve_t *resolve_now; - - struct iatt stbuf; - int valid; - - fd_t *fd; - dict_t *params; - int32_t flags; - int wbflags; - struct iovec payload_vector[MAX_IOVEC]; - int payload_count; - struct iobuf *iobuf; - struct iobref *iobref; - - size_t size; - off_t offset; - mode_t mode; - dev_t dev; - size_t nr_count; - int cmd; - int type; - char *name; - int name_len; - - int mask; - char is_revalidate; - dict_t *dict; - struct gf_flock flock; - const char *volume; - dir_entry_t *entry; - gf_seek_what_t what; - - dict_t *xdata; - mode_t umask; - struct gf_lease lease; - lock_migration_info_t locklist; - /* required for compound fops */ - gfs3_compound_req req; - /* TODO: having xdr definition here - is not a good idea, but not taking - up the functionality right now */ - gfx_compound_req req_v2; - - /* last length till which iovec for compound - * writes was processed */ - int write_length; - struct iovec rsp_vector[MAX_IOVEC]; - int rsp_count; - struct iobuf *rsp_iobuf; - struct iobref *rsp_iobref; - compound_args_t *args; - - /* subdir mount */ - client_t *client; + rpc_transport_t *xprt; + inode_table_t *itable; + + server_resume_fn_t resume_fn; + + loc_t loc; + loc_t loc2; + server_resolve_t resolve; + server_resolve_t resolve2; + + /* used within resolve_and_resume */ + loc_t *loc_now; + server_resolve_t *resolve_now; + + struct iatt stbuf; + int valid; + + fd_t *fd; + dict_t *params; + int32_t flags; + int wbflags; + struct iovec payload_vector[MAX_IOVEC]; + int payload_count; + struct iobuf *iobuf; + struct iobref *iobref; + + size_t size; + off_t offset; + mode_t mode; + dev_t dev; + size_t nr_count; + int cmd; + int type; + char *name; + int name_len; + + int mask; + char is_revalidate; + dict_t *dict; + struct gf_flock flock; + const char *volume; + dir_entry_t *entry; + gf_seek_what_t what; + + dict_t *xdata; + mode_t umask; + struct gf_lease lease; + lock_migration_info_t locklist; + /* required for compound fops */ + gfs3_compound_req req; + /* TODO: having xdr definition here + is not a good idea, but not taking + up the functionality right now */ + gfx_compound_req req_v2; + + /* last length till which iovec for compound + * writes was processed */ + int write_length; + struct iovec rsp_vector[MAX_IOVEC]; + int rsp_count; + struct iobuf *rsp_iobuf; + struct iobref *rsp_iobref; + compound_args_t *args; + + /* subdir mount */ + client_t *client; }; - extern struct rpcsvc_program gluster_handshake_prog; extern struct rpcsvc_program glusterfs3_3_fop_prog; extern struct rpcsvc_program glusterfs4_0_fop_prog; typedef struct _server_ctx { - gf_lock_t fdtable_lock; - fdtable_t *fdtable; + gf_lock_t fdtable_lock; + fdtable_t *fdtable; } server_ctx_t; - int -server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, - struct iovec *payload, int payloadcount, - struct iobref *iobref, xdrproc_t xdrproc); +server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg, + struct iovec *payload, int payloadcount, + struct iobref *iobref, xdrproc_t xdrproc); -int gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict); -int gf_server_check_getxattr_cmd (call_frame_t *frame, const char *name); +int +gf_server_check_setxattr_cmd(call_frame_t *frame, dict_t *dict); +int +gf_server_check_getxattr_cmd(call_frame_t *frame, const char *name); void -forget_inode_if_no_dentry (inode_t *inode); +forget_inode_if_no_dentry(inode_t *inode); -server_ctx_t* -server_ctx_get (client_t *client, xlator_t *xlator); +server_ctx_t * +server_ctx_get(client_t *client, xlator_t *xlator); #endif /* !_SERVER_H */ 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 */ diff --git a/xlators/system/posix-acl/src/posix-acl-mem-types.h b/xlators/system/posix-acl/src/posix-acl-mem-types.h index 7eed2ebb539..19b6e9a2df7 100644 --- a/xlators/system/posix-acl/src/posix-acl-mem-types.h +++ b/xlators/system/posix-acl/src/posix-acl-mem-types.h @@ -14,11 +14,10 @@ #include "mem-types.h" typedef enum gf_posix_acl_mem_types_ { - gf_posix_acl_mt_ctx_t = gf_common_mt_end + 1, - gf_posix_acl_mt_posix_ace_t, - gf_posix_acl_mt_char, - gf_posix_acl_mt_conf_t, - gf_posix_acl_mt_end + gf_posix_acl_mt_ctx_t = gf_common_mt_end + 1, + gf_posix_acl_mt_posix_ace_t, + gf_posix_acl_mt_char, + gf_posix_acl_mt_conf_t, + gf_posix_acl_mt_end } gf_posix_acl_mem_types_t; #endif - diff --git a/xlators/system/posix-acl/src/posix-acl-messages.h b/xlators/system/posix-acl/src/posix-acl-messages.h index 782750e99a5..f4f47ffbc1c 100644 --- a/xlators/system/posix-acl/src/posix-acl-messages.h +++ b/xlators/system/posix-acl/src/posix-acl-messages.h @@ -23,8 +23,6 @@ * glfs-message-id.h. */ -GLFS_MSGID(POSIX_ACL, - POSIX_ACL_MSG_EACCES -); +GLFS_MSGID(POSIX_ACL, POSIX_ACL_MSG_EACCES); #endif /* !_POSIX_ACL_MESSAGES_H_ */ diff --git a/xlators/system/posix-acl/src/posix-acl-xattr.h b/xlators/system/posix-acl/src/posix-acl-xattr.h index 2933c205725..bb63a10f8fb 100644 --- a/xlators/system/posix-acl/src/posix-acl-xattr.h +++ b/xlators/system/posix-acl/src/posix-acl-xattr.h @@ -16,11 +16,14 @@ #include "glusterfs.h" #include "glusterfs-acl.h" -struct posix_acl *posix_acl_from_xattr (xlator_t *this, const char *buf, int size); +struct posix_acl * +posix_acl_from_xattr(xlator_t *this, const char *buf, int size); -int posix_acl_to_xattr (xlator_t *this, struct posix_acl *acl, char *buf, int size); - -int posix_acl_matches_xattr (xlator_t *this, struct posix_acl *acl, const char *buf, int size); +int +posix_acl_to_xattr(xlator_t *this, struct posix_acl *acl, char *buf, int size); +int +posix_acl_matches_xattr(xlator_t *this, struct posix_acl *acl, const char *buf, + int size); #endif /* !_POSIX_ACL_XATTR_H */ diff --git a/xlators/system/posix-acl/src/posix-acl.h b/xlators/system/posix-acl/src/posix-acl.h index c5e01967a11..e25fbb54941 100644 --- a/xlators/system/posix-acl/src/posix-acl.h +++ b/xlators/system/posix-acl/src/posix-acl.h @@ -16,15 +16,21 @@ #include "byte-order.h" #include "glusterfs-acl.h" -struct posix_acl *posix_acl_new (xlator_t *this, int entry_count); -struct posix_acl *posix_acl_ref (xlator_t *this, struct posix_acl *acl); -void posix_acl_unref (xlator_t *this, struct posix_acl *acl); -void posix_acl_destroy (xlator_t *this, struct posix_acl *acl); -struct posix_acl_ctx *posix_acl_ctx_get (inode_t *inode, xlator_t *this); -int posix_acl_get (inode_t *inode, xlator_t *this, - struct posix_acl **acl_access_p, - struct posix_acl **acl_default_p); -int posix_acl_set (inode_t *inode, xlator_t *this, struct posix_acl *acl_access, - struct posix_acl *acl_default); +struct posix_acl * +posix_acl_new(xlator_t *this, int entry_count); +struct posix_acl * +posix_acl_ref(xlator_t *this, struct posix_acl *acl); +void +posix_acl_unref(xlator_t *this, struct posix_acl *acl); +void +posix_acl_destroy(xlator_t *this, struct posix_acl *acl); +struct posix_acl_ctx * +posix_acl_ctx_get(inode_t *inode, xlator_t *this); +int +posix_acl_get(inode_t *inode, xlator_t *this, struct posix_acl **acl_access_p, + struct posix_acl **acl_default_p); +int +posix_acl_set(inode_t *inode, xlator_t *this, struct posix_acl *acl_access, + struct posix_acl *acl_default); #endif /* !_POSIX_ACL_H */ |