使用glusterfs3.3-release版本进行分析,ls命令执行后,抓取trace, 分析glusterfs的代码处理过程,用一台centos6.2虚拟机进行即可,创建卷及挂载过程步骤如下:
1. 官网下载release版本路径如下:http://www.gluster.org,下载后解压,然后我们先打入一个patch,使能glusterfs各个translator调用的trace,patch如下:
--- /root/stack.h 2013-06-13 00:57:40.244154611 -0700
+++ libglusterfs/src/stack.h 2013-06-07 01:10:59.752761043 -0700
@@ -248,6 +248,7 @@
} \
UNLOCK(&frame->root->stack_lock); \
old_THIS = THIS; \
+ gf_log(old_THIS->name, GF_LOG_TRACE, " enter stack"); \
THIS = obj; \
fn (_new, obj, params); \
THIS = old_THIS; \
@@ -287,6 +288,7 @@
UNLOCK(&frame->root->stack_lock); \
fn##_cbk = rfn; \
old_THIS = THIS; \
+ gf_log(old_THIS->name, GF_LOG_TRACE, " enter stack cookie"); \
THIS = obj; \
fn (_new, obj, params); \
THIS = old_THIS; \
@@ -311,6 +313,7 @@
} \
UNLOCK(&frame->root->stack_lock); \
old_THIS = THIS; \
+ gf_log(old_THIS->name, GF_LOG_TRACE, " exit stack"); \
THIS = _parent->this; \
frame->complete = _gf_true; \
frame->unwind_from = __FUNCTION__; \
@@ -338,6 +341,7 @@
} &nbs