Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1859260
  • 博文数量: 211
  • 博客积分: 464
  • 博客等级: 下士
  • 技术积分: 3794
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-24 18:25
个人简介

阿弥陀佛

文章分类

全部博文(211)

文章存档

2020年(2)

2019年(3)

2018年(5)

2017年(6)

2016年(10)

2015年(9)

2014年(73)

2013年(90)

2012年(13)

分类: 服务器与存储

2013-01-16 16:27:51

在dmu buffer当中,最为常见的是互斥锁,但是有一个问题随之而来,如何使用互斥锁,而且怎么样来规定mutex锁所保护的范围呢?

	/* db_mtx protects the members below */
	kmutex_t db_mtx;

	/*
	 * Current state of the buffer
	 */
	dbuf_states_t db_state;

	/*
	 * Refcount accessed by dmu_buf_{hold,rele}.
	 * If nonzero, the buffer can't be destroyed.
	 * Protected by db_mtx.
	 */
	refcount_t db_holds;
找到了其中的定义,在dmu_buf_impl_t 这个数据结构当中,可以看到这样一句话,db_mtx这个成员变量的注释说明,这个锁他保护了这个变量以下的成员变量,可以理解成将需要该锁保护的变量放到db_mtx变量下面即可。

阅读(1301) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~