- 主要阅读了服务端Locks xlators的实现,由于是分布式系统,client应该对锁应该也有一定的处理。还未深入了解,后续进一步研究后进行补充。
1.1 数据结构
-
锁的类型:__posix_lock/__pl_inode_lock/__entry_lock,成员比较类似,重要的数据成员(最后三个成员用来标记加锁的源:客户端和进程):
-
struct list_head list; 插入Inode的ext_list
-
short fl_type;
-
off_t fl_start;
-
off_t fl_end;
-
short blocked: 锁是否在阻塞状态
-
fd_num; fd对象的指针值转换为ulong类型
-
fd_t* fd;
-
blkd_time; 进入blkd list的时间
-
granted_time; 进入active list的时间
-
transport; 表示客户端
-
owner;
-
client_pid; 客户端进程PID
-
Inode数据结构__pl_inode: