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/upcall | |
parent | be77dbbda692792335a8e9e7c02e0c281f003c40 (diff) |
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'xlators/features/upcall')
-rw-r--r-- | xlators/features/upcall/src/upcall-cache-invalidation.h | 6 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall-mem-types.h | 11 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall-messages.h | 7 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall.h | 214 |
4 files changed, 128 insertions, 110 deletions
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__ */ |