diff options
author | Gluster Ant <bugzilla-bot@gluster.org> | 2018-09-12 17:22:48 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2018-09-12 17:22:48 +0530 |
commit | 45a71c0548b6fd2c757aa2e7b7671a1411948894 (patch) | |
tree | 2a5a9b73bae47ab53a41166fd041a06612587f48 /xlators/features/marker | |
parent | be77dbbda692792335a8e9e7c02e0c281f003c40 (diff) |
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'xlators/features/marker')
-rw-r--r-- | xlators/features/marker/src/marker-common.h | 4 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-mem-types.h | 20 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-quota-helper.h | 76 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-quota.h | 203 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.h | 219 |
5 files changed, 257 insertions, 265 deletions
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; |