glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

stack.h File Reference
#include <sys/time.h>
#include "glusterfs/xlator.h"
#include "glusterfs/dict.h"
#include "glusterfs/list.h"
#include "glusterfs/common-utils.h"
#include "glusterfs/lkowner.h"
#include "glusterfs/client_t.h"
#include "glusterfs/libglusterfs-messages.h"
#include "glusterfs/timespec.h"
Include dependency graph for stack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  call_pool
 
struct  _call_frame
 
struct  _ns_info
 
struct  _call_stack
 

Macros

#define NFS_PID   1
 
#define LOW_PRIO_PROC_PID   -1
 
#define STACK_ERR_XL_NAME(stack)   (stack->err_xl ? stack->err_xl->name : "-")
 
#define STACK_CLIENT_NAME(stack)    (stack->client ? stack->client->client_uid : "-")
 
#define SMALL_GROUP_COUNT   128
 
#define MDATA_CTIME   (1 << 0)
 
#define MDATA_MTIME   (1 << 1)
 
#define MDATA_ATIME   (1 << 2)
 
#define MDATA_PAR_CTIME   (1 << 3)
 
#define MDATA_PAR_MTIME   (1 << 4)
 
#define MDATA_PAR_ATIME   (1 << 5)
 
#define frame_set_uid_gid(frm, u, g)
 
#define FRAME_SU_DO(frm, local_type)
 
#define FRAME_SU_UNDO(frm, local_type)
 
#define get_fop_index_from_fn(xl, fn)    (1 + (((long)&(fn) - (long)&((xl)->fops->stat)) / sizeof(void *)))
 
#define STACK_WIND_TAIL(frame, obj, fn, params...)
 
#define STACK_WIND(frame, rfn, obj, fn, params...)    STACK_WIND_COMMON(frame, rfn, 0, NULL, obj, fn, params)
 
#define STACK_WIND_COOKIE(frame, rfn, cky, obj, fn, params...)    STACK_WIND_COMMON(frame, rfn, 1, cky, obj, fn, params)
 
#define STACK_WIND_COMMON(frame, rfn, has_cookie, cky, obj, fn, params...)
 
#define STACK_UNWIND   STACK_UNWIND_STRICT
 
#define STACK_UNWIND_STRICT(fop, frame, op_ret, op_errno, params...)
 

Typedefs

typedef struct _call_stack call_stack_t
 
typedef struct _call_frame call_frame_t
 
typedef struct call_pool call_pool_t
 
typedef int32_t(* ret_fn_t) (call_frame_t *frame, call_frame_t *prev_frame, xlator_t *this, int32_t op_ret, int32_t op_errno,...)
 
typedef struct _ns_info ns_info_t
 

Functions

void gf_update_latency (call_frame_t *frame)
 
static void FRAME_DESTROY (call_frame_t *frame)
 
static void STACK_DESTROY (call_stack_t *stack)
 
static void STACK_RESET (call_stack_t *stack)
 
static void * get_the_pt_fop (void *base_fop, int fop_idx)
 
static int call_stack_alloc_groups (call_stack_t *stack, int ngrps)
 
static int call_frames_count (call_stack_t *call_stack)
 
static call_frame_tcopy_frame (call_frame_t *frame)
 
void call_stack_set_groups (call_stack_t *stack, int ngrps, gid_t **groupbuf_p)
 
void gf_proc_dump_pending_frames (call_pool_t *call_pool)
 
void gf_proc_dump_pending_frames_to_dict (call_pool_t *call_pool, dict_t *dict)
 
call_frame_tcreate_frame (xlator_t *xl, call_pool_t *pool)
 
bool __is_fuse_call (call_frame_t *frame)
 

Macro Definition Documentation

◆ frame_set_uid_gid

#define frame_set_uid_gid (   frm,
  u,
 
)
Value:
do { \
if (frm) { \
(frm)->root->uid = u; \
(frm)->root->gid = g; \
(frm)->root->ngrps = 0; \
} \
} while (0);

Definition at line 142 of file stack.h.

◆ FRAME_SU_DO

#define FRAME_SU_DO (   frm,
  local_type 
)
Value:
do { \
local_type *__local = (frm)->local; \
__local->uid = frm->root->uid; \
__local->gid = frm->root->gid; \
__local->pid = frm->root->pid; \
frm->root->uid = 0; \
frm->root->gid = 0; \
frm->root->pid = GF_CLIENT_PID_NO_ROOT_SQUASH; \
} while (0);

Definition at line 230 of file stack.h.

◆ FRAME_SU_UNDO

#define FRAME_SU_UNDO (   frm,
  local_type 
)
Value:
do { \
local_type *__local = (frm)->local; \
frm->root->uid = __local->uid; \
frm->root->gid = __local->gid; \
frm->root->pid = __local->pid; \
} while (0);

Definition at line 241 of file stack.h.

◆ get_fop_index_from_fn

#define get_fop_index_from_fn (   xl,
  fn 
)     (1 + (((long)&(fn) - (long)&((xl)->fops->stat)) / sizeof(void *)))

Definition at line 257 of file stack.h.

◆ LOW_PRIO_PROC_PID

#define LOW_PRIO_PROC_PID   -1

Definition at line 38 of file stack.h.

◆ MDATA_ATIME

#define MDATA_ATIME   (1 << 2)

Definition at line 137 of file stack.h.

◆ MDATA_CTIME

#define MDATA_CTIME   (1 << 0)

Definition at line 135 of file stack.h.

◆ MDATA_MTIME

#define MDATA_MTIME   (1 << 1)

Definition at line 136 of file stack.h.

◆ MDATA_PAR_ATIME

#define MDATA_PAR_ATIME   (1 << 5)

Definition at line 140 of file stack.h.

◆ MDATA_PAR_CTIME

#define MDATA_PAR_CTIME   (1 << 3)

Definition at line 138 of file stack.h.

◆ MDATA_PAR_MTIME

#define MDATA_PAR_MTIME   (1 << 4)

Definition at line 139 of file stack.h.

◆ NFS_PID

#define NFS_PID   1

Definition at line 37 of file stack.h.

◆ SMALL_GROUP_COUNT

#define SMALL_GROUP_COUNT   128

Definition at line 91 of file stack.h.

◆ STACK_CLIENT_NAME

#define STACK_CLIENT_NAME (   stack)     (stack->client ? stack->client->client_uid : "-")

Definition at line 41 of file stack.h.

◆ STACK_ERR_XL_NAME

#define STACK_ERR_XL_NAME (   stack)    (stack->err_xl ? stack->err_xl->name : "-")

Definition at line 40 of file stack.h.

◆ STACK_UNWIND

#define STACK_UNWIND   STACK_UNWIND_STRICT

Definition at line 369 of file stack.h.

◆ STACK_UNWIND_STRICT

#define STACK_UNWIND_STRICT (   fop,
  frame,
  op_ret,
  op_errno,
  params... 
)

Definition at line 372 of file stack.h.

◆ STACK_WIND

#define STACK_WIND (   frame,
  rfn,
  obj,
  fn,
  params... 
)     STACK_WIND_COMMON(frame, rfn, 0, NULL, obj, fn, params)

Definition at line 306 of file stack.h.

◆ STACK_WIND_COMMON

#define STACK_WIND_COMMON (   frame,
  rfn,
  has_cookie,
  cky,
  obj,
  fn,
  params... 
)

Definition at line 318 of file stack.h.

◆ STACK_WIND_COOKIE

#define STACK_WIND_COOKIE (   frame,
  rfn,
  cky,
  obj,
  fn,
  params... 
)     STACK_WIND_COMMON(frame, rfn, 1, cky, obj, fn, params)

Definition at line 310 of file stack.h.

◆ STACK_WIND_TAIL

#define STACK_WIND_TAIL (   frame,
  obj,
  fn,
  params... 
)
Value:
do { \
xlator_t *old_THIS = NULL; \
xlator_t *next_xl = obj; \
typeof(fn) next_xl_fn = fn; \
int opn = get_fop_index_from_fn((next_xl), (fn)); \
\
frame->this = next_xl; \
frame->wind_to = #fn; \
old_THIS = THIS; \
THIS = next_xl; \
gf_msg_trace("stack-trace", 0, \
"stack-address: %p, " \
"winding from %s to %s", \
frame->root, old_THIS->name, THIS->name); \
/* Need to capture counts at leaf node */ \
if (!next_xl->pass_through && !next_xl->children) { \
GF_ATOMIC_INC(next_xl->stats.total.metrics[opn].fop); \
GF_ATOMIC_INC(next_xl->stats.interval.metrics[opn].fop); \
GF_ATOMIC_INC(next_xl->stats.total.count); \
GF_ATOMIC_INC(next_xl->stats.interval.count); \
} \
\
if (next_xl->pass_through) { \
next_xl_fn = get_the_pt_fop(&next_xl->pass_through_fops->stat, \
opn); \
} \
next_xl_fn(frame, next_xl, params); \
THIS = old_THIS; \
} while (0)

Definition at line 274 of file stack.h.

Typedef Documentation

◆ call_frame_t

typedef struct _call_frame call_frame_t

Definition at line 1 of file stack.h.

◆ call_pool_t

typedef struct call_pool call_pool_t

Definition at line 1 of file stack.h.

◆ call_stack_t

typedef struct _call_stack call_stack_t

Definition at line 1 of file stack.h.

◆ ns_info_t

typedef struct _ns_info ns_info_t

Definition at line 44 of file stack.h.

◆ ret_fn_t

typedef int32_t(* ret_fn_t) (call_frame_t *frame, call_frame_t *prev_frame, xlator_t *this, int32_t op_ret, int32_t op_errno,...)

Definition at line 44 of file stack.h.

Function Documentation

◆ __is_fuse_call()

◆ call_frames_count()

static int call_frames_count ( call_stack_t call_stack)
inlinestatic

Definition at line 445 of file stack.h.

References list_for_each_entry, and _call_stack::myframes.

Referenced by gf_proc_dump_call_stack(), and gf_proc_dump_call_stack_to_dict().

◆ call_stack_alloc_groups()

static int call_stack_alloc_groups ( call_stack_t stack,
int  ngrps 
)
inlinestatic

◆ call_stack_set_groups()

void call_stack_set_groups ( call_stack_t stack,
int  ngrps,
gid_t **  groupbuf_p 
)

◆ copy_frame()

static call_frame_t* copy_frame ( call_frame_t frame)
inlinestatic

Definition at line 459 of file stack.h.

References _call_stack::all_frames, _call_frame::begin, call_stack_alloc_groups(), call_pool::cnt, _call_stack::ctime, _call_stack::ctx, _call_stack::flags, call_pool::frame_mem_pool, _call_frame::frames, GF_ATOMIC_INC, gf_msg_debug, _call_stack::gid, _call_stack::groups, _call_stack::groups_large, _call_stack::groups_small, INIT_LIST_HEAD, list_add(), _call_stack::lk_owner, LOCK, call_pool::lock, _call_frame::lock, LOCK_INIT, _glusterfs_ctx::measure_latency, mem_get0(), mem_put(), _call_stack::myframes, _call_stack::ngrps, _call_stack::op, _call_stack::pid, _call_stack::pool, _call_frame::root, _call_stack::stack_lock, call_pool::stack_mem_pool, _call_frame::this, timespec_now(), call_pool::total_count, _call_stack::tv, _call_stack::type, _call_stack::uid, _call_stack::unique, and UNLOCK.

Referenced by _afr_handle_empty_brick(), afr_copy_frame(), afr_create(), afr_discard(), afr_do_writev(), afr_fallocate(), afr_fremovexattr(), afr_fsetattr(), afr_fsetxattr(), afr_fsync(), afr_ftruncate(), afr_fxattrop(), afr_link(), afr_mark_new_entry_changelog(), afr_mkdir(), afr_mknod(), afr_removexattr(), afr_rename(), afr_rmdir(), afr_setattr(), afr_setxattr(), afr_symlink(), afr_truncate(), afr_unlink(), afr_xattrop(), afr_zerofill(), aws_write_callback(), cs_lock_frame(), dht_create_finish(), dht_do_discover(), dht_get_du_info(), dht_handle_parent_layout_change(), dht_linkfile_attr_heal(), dht_linkfile_unlink(), dht_lock_frame(), dht_mknod_finish(), dht_rename_cbk(), dht_rmdir_cbk(), dht_rmdir_hashed_subvol_cbk(), dht_rmdir_is_subvol_empty(), dht_rmdir_opendir_cbk(), dht_rmdir_unlock(), dht_selfheal_dir_finish(), dht_unlock_entrylk_wrapper(), dht_unlock_inodelk_wrapper(), dispatch_requests(), do_quota_check_limit(), ec_fop_data_allocate(), ga_heal_entry(), ga_new_entry(), gf_utime_set_mdata_lookup_cbk(), ioc_cache_validate(), ioc_page_fault(), nlm4svc_lock_cbk(), ob_open(), ra_page_fault(), rda_fill_fd(), sdfs_get_new_frame_common(), sdfs_link(), sdfs_rename(), synctask_create(), and wb_flush_helper().

◆ create_frame()

call_frame_t* create_frame ( xlator_t xl,
call_pool_t pool 
)

Definition at line 16 of file stack.c.

References call_pool::all_frames, _call_stack::all_frames, _call_frame::begin, call_pool::cnt, _call_stack::ctx, _xlator::ctx, call_pool::frame_mem_pool, _call_frame::frames, GF_ATOMIC_INC, INIT_LIST_HEAD, list_add(), LOCK, call_pool::lock, _call_frame::lock, LOCK_INIT, _glusterfs_ctx::measure_latency, mem_get0(), mem_put(), _call_stack::myframes, _call_stack::pool, _call_frame::root, _call_stack::stack_lock, call_pool::stack_mem_pool, _call_frame::this, timespec_now(), call_pool::total_count, _call_stack::tv, _call_stack::unique, and UNLOCK.

Referenced by __afr_lock_heal_synctask(), __gf_quiesce_perform_failover(), __glusterd_send_svc_configure_req(), afr_attempt_local_discovery(), afr_fix_open(), afr_frame_create(), afr_ta_frame_create(), br_stub_send_ipc_fop(), changelog_invoke_rpc(), cli_cmd_bitrot_cbk(), cli_cmd_copy_file_cbk(), cli_cmd_fsm_log_cbk(), cli_cmd_ganesha_cbk(), cli_cmd_get_state_cbk(), cli_cmd_getspec_cbk(), cli_cmd_getwd_cbk(), cli_cmd_log_rotate_cbk(), cli_cmd_mount_cbk(), cli_cmd_peer_deprobe_cbk(), cli_cmd_peer_probe_cbk(), cli_cmd_peer_status_cbk(), cli_cmd_pmap_b2p_cbk(), cli_cmd_quota_cbk(), cli_cmd_quota_handle_list_all(), cli_cmd_sync_volume_cbk(), cli_cmd_sys_exec_cbk(), cli_cmd_umount_cbk(), cli_cmd_uuid_get_cbk(), cli_cmd_volume_add_brick_cbk(), cli_cmd_volume_barrier_cbk(), cli_cmd_volume_clearlocks_cbk(), cli_cmd_volume_create_cbk(), cli_cmd_volume_defrag_cbk(), cli_cmd_volume_delete_cbk(), cli_cmd_volume_gsync_set_cbk(), cli_cmd_volume_heal_cbk(), cli_cmd_volume_info_cbk(), cli_cmd_volume_list_cbk(), cli_cmd_volume_profile_cbk(), cli_cmd_volume_remove_brick_cbk(), cli_cmd_volume_rename_cbk(), cli_cmd_volume_replace_brick_cbk(), cli_cmd_volume_reset_brick_cbk(), cli_cmd_volume_reset_cbk(), cli_cmd_volume_set_cbk(), cli_cmd_volume_start_cbk(), cli_cmd_volume_statedump_cbk(), cli_cmd_volume_status_cbk(), cli_cmd_volume_stop_cbk(), cli_cmd_volume_top_cbk(), cli_get_soft_limit(), client_fdctx_destroy(), client_handshake(), client_query_portmap(), client_setvolume(), create_internalop_directory(), create_or_rename_trash_directory(), dht_common_mark_mdsxattr(), dht_dir_xattr_heal(), dht_discover_complete(), dht_get_du_info_for_subvol(), dht_link_cbk(), do_fd_cleanup(), ec_fop_data_allocate(), ec_get_heal_info(), ec_heal_do(), ec_launch_heal(), fuse_handle_graph_switch(), gd_syncop_submit_request(), get_call_frame_for_req(), gf_defrag_migrate_single_file(), gf_defrag_start(), gf_defrag_start_crawl(), glfs_get_volume_info(), glfs_volfile_fetch(), glusterd_ac_friend_add(), glusterd_ac_friend_probe(), glusterd_ac_send_friend_remove_req(), glusterd_brick_op(), glusterd_cluster_lock(), glusterd_cluster_unlock(), glusterd_commit_op(), glusterd_mgmt_handshake(), glusterd_mgmt_v3_lock_peers(), glusterd_mgmt_v3_unlock_peers(), glusterd_peer_dump_version(), glusterd_rpc_friend_update(), glusterd_stage_op(), glusterfs_mgmt_pmap_signin(), glusterfs_rebalance_event_notify(), glusterfs_volfile_fetch_one(), marker_create_frame(), marker_rename(), mdc_register_xattr_inval(), nfs_create_frame(), nlm4_file_open_and_resume(), protocol_client_reopendir(), protocol_client_reopendir_v2(), protocol_client_reopenfile(), protocol_client_reopenfile_v2(), quota_build_ancestry(), quotad_aggregator_alloc_frame(), rename_trash_directory(), rpc_clnt_mgmt_pmap_signout(), rpc_clnt_ping(), send_attach_req(), send_brick_req(), server_alloc_frame(), shard_acquire_entrylk(), shard_acquire_inodelk(), shard_initiate_evicted_inode_fsync(), shard_start_background_deletion(), svs_get_snapshot_list(), synctask_create(), and wb_fulfill_head().

◆ FRAME_DESTROY()

◆ get_the_pt_fop()

static void* get_the_pt_fop ( void *  base_fop,
int  fop_idx 
)
inlinestatic

Definition at line 266 of file stack.h.

◆ gf_proc_dump_pending_frames()

◆ gf_proc_dump_pending_frames_to_dict()

◆ gf_update_latency()

◆ STACK_DESTROY()

static void STACK_DESTROY ( call_stack_t stack)
inlinestatic

Definition at line 177 of file stack.h.

References _call_stack::all_frames, call_pool::cnt, FRAME_DESTROY(), GF_FREE, _call_stack::groups_large, list_del_init(), list_for_each_entry_safe, LOCK, call_pool::lock, LOCK_DESTROY, mem_put(), _call_stack::myframes, _call_stack::pool, _call_stack::stack_lock, and UNLOCK.

Referenced by __glusterd_mgmt_hndsk_version_ack_cbk(), __glusterd_mgmt_hndsk_version_cbk(), __glusterd_peer_dump_version_cbk(), __glusterd_send_svc_configure_req(), _gd_syncop_brick_op_cbk(), _gd_syncop_commit_op_cbk(), _gd_syncop_mgmt_lock_cbk(), _gd_syncop_mgmt_unlock_cbk(), _gd_syncop_stage_op_cbk(), afr_frame_create(), afr_local_discovery_cbk(), afr_lock_heal_done(), afr_ta_lock_release_done(), afr_ta_lock_release_synctask(), afr_ta_post_op_done(), afr_ta_post_op_synctask(), afr_ta_read_txn_done(), afr_ta_read_txn_synctask(), attach_brick_callback(), br_stub_noop(), changelog_invoke_rpc(), client3_3_release_cbk(), client3_3_releasedir_cbk(), client3_3_reopen_cbk(), client3_3_reopendir_cbk(), client4_0_release_cbk(), client4_0_releasedir_cbk(), client4_0_reopen_cbk(), client4_0_reopendir_cbk(), client_dump_version_cbk(), client_query_portmap_cbk(), client_setvolume_cbk(), do_quota_check_limit(), ec_fop_data_release(), ec_get_heal_info(), ec_heal_do(), ec_launch_heal(), fuse_attr_cbk(), fuse_create_cbk(), fuse_entry_cbk(), fuse_err_cbk(), fuse_fd_cbk(), fuse_getlk_cbk(), fuse_handle_graph_switch(), fuse_interrupt_finish_fop(), fuse_readdir_cbk(), fuse_readdirp_cbk(), fuse_readlink_cbk(), fuse_readv_cbk(), fuse_removexattr_cbk(), fuse_rename_cbk(), fuse_resolve_entry_cbk(), fuse_resolve_gfid_cbk(), fuse_setattr_cbk(), fuse_setlk_cbk(), fuse_setlk_interrupt_handler_cbk(), fuse_statfs_cbk(), fuse_truncate_cbk(), fuse_unlink_cbk(), fuse_writev_cbk(), fuse_xattr_cbk(), ga_heal_cbk(), ga_newentry_cbk(), ga_newentry_lookup_cbk(), gd_mgmt_v3_brick_op_cbk_fn(), gd_mgmt_v3_commit_cbk_fn(), gd_mgmt_v3_lock_cbk_fn(), gd_mgmt_v3_post_validate_cbk_fn(), gd_mgmt_v3_pre_validate_cbk_fn(), gd_mgmt_v3_unlock_cbk_fn(), gd_syncop_mgmt_v3_lock_cbk_fn(), gd_syncop_mgmt_v3_unlock_cbk_fn(), gd_syncop_submit_request(), get_path_resume_cbk(), gf_defrag_done(), gf_defrag_migrate_single_file(), gf_defrag_start_crawl(), gf_quiesce_failover_cbk(), gf_utime_set_mdata_lookup_cbk(), gf_utime_set_mdata_setxattr_cbk(), glfs_get_volume_info(), glfs_mgmt_getspec_cbk(), glusterd_ac_friend_add(), glusterd_ac_friend_probe(), glusterd_ac_send_friend_remove_req(), glusterd_cluster_lock(), glusterd_cluster_unlock(), glusterd_mgmt_handshake(), glusterd_peer_dump_version(), glusterd_rpc_friend_update(), glusterfs_rebalance_event_notify_cbk(), glusterfs_volfile_fetch_one(), ioc_cache_validate_cbk(), ioc_fault_cbk(), ioc_page_fault(), marker_get_oldpath_contribution(), marker_local_unref(), marker_setxattr_done(), mdc_register_xattr_inval(), mdc_send_xattrs_cbk(), mgmt_getspec_cbk(), mgmt_pmap_signin2_cbk(), mgmt_pmap_signin_cbk(), mgmt_pmap_signout_cbk(), my_callback(), nfs_create_frame(), nlm4_file_open_cbk(), nlm4_notify_free(), ob_open(), ob_open_cbk(), ob_open_destroy(), protocol_client_reopenfile(), protocol_client_reopenfile_v2(), quota_build_ancestry(), quota_build_ancestry_cbk(), quota_link_count_decrement(), quotad_aggregator_submit_reply(), ra_fault_cbk(), ra_need_atime_cbk(), ra_page_fault(), rda_fill_fd_cbk(), rda_releasedir(), rename_trash_directory(), rpc_clnt_ping_cbk(), send_brick_req(), server_connection_cleanup_flush_cbk(), server_submit_reply(), shard_acquire_entrylk(), shard_acquire_inodelk(), shard_evicted_inode_fsync_cbk(), shard_initiate_evicted_inode_fsync(), shard_start_background_deletion(), synctask_create(), synctask_destroy(), trash_dir_getxattr_cbk(), trash_dir_lookup_cbk(), trash_dir_mkdir_cbk(), trash_dir_rename_cbk(), trash_internal_op_mkdir_cbk(), trash_internalop_dir_lookup_cbk(), wb_flush_bg_cbk(), and wb_fulfill_cbk().

◆ STACK_RESET()

GF_CLIENT_PID_NO_ROOT_SQUASH
@ GF_CLIENT_PID_NO_ROOT_SQUASH
Definition: common-utils.h:162
get_fop_index_from_fn
#define get_fop_index_from_fn(xl, fn)
Definition: stack.h:257
THIS
#define THIS
Definition: globals.h:126
get_the_pt_fop
static void * get_the_pt_fop(void *base_fop, int fop_idx)
Definition: stack.h:266