diff options
Diffstat (limited to 'xlators/performance')
28 files changed, 637 insertions, 721 deletions
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_ */ |