免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1858 | 回复: 6
打印 上一主题 下一主题

[文件系统] 关于generic_make_request上锁的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-30 12:56 |只看该作者 |倒序浏览
/*
* We only want one ->make_request_fn to be active at a time,
* else stack usage with stacked devices could be a problem.
* So use current->bio_list to keep a list of requests
* submited by a make_request_fn function.
* current->bio_list is also used as a flag to say if
* generic_make_request is currently active in this task or not.
* If it is NULL, then no make_request is active.  If it is non-NULL,
* then a make_request is active, and new requests should be added
* at the tail
*/
void generic_make_request(struct bio *bio)
{
...
        if (current->bio_list) {
                /* make_request is active */
                bio_list_add(current->bio_list, bio);
                return;
        }
...
}

虽然generic_make_request表明only want one make_request_fn 处于激活状态,但是我没找到这个是怎么保证的。
但是current->bio_list是一个全局的变量,为什么直接bio_list_add都没有加锁呢?

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
2 [报告]
发表于 2013-05-01 11:41 |只看该作者
本帖最后由 firkraag 于 2013-05-01 11:43 编辑

in 2.6.34, function generic_make_request(), the comment said:

__generic_make_request may indeed add some more bios through a recursive call to generic_make_request.  If it did, we find a non-NULL value in bio_list and re-enter the loop from the top.  In this case we really did just take the bio of the top of the list (no pretending) and so remove it from bio_list, and call into __generic_make_request again.

论坛徽章:
0
3 [报告]
发表于 2013-05-03 01:28 |只看该作者
回复 2# firkraag
__generic_xxx() 什么地方会调用 generic_xxx() ?

   

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
4 [报告]
发表于 2013-05-03 09:25 |只看该作者
回复 3# remaper

for stacked block devices(e.g.  md or dm)

论坛徽章:
16
2015亚冠之吉达阿赫利
日期:2015-08-17 11:21:462015年迎新春徽章
日期:2015-03-04 09:58:11酉鸡
日期:2014-12-07 09:06:19水瓶座
日期:2014-11-04 14:23:29天秤座
日期:2014-03-02 08:57:52双鱼座
日期:2014-02-22 13:07:56午马
日期:2014-02-14 11:08:18双鱼座
日期:2014-02-13 11:09:37卯兔
日期:2014-02-06 15:10:34子鼠
日期:2014-01-20 14:48:19戌狗
日期:2013-12-19 09:37:46射手座
日期:2013-12-19 09:33:47
5 [报告]
发表于 2013-05-03 09:27 |只看该作者
回复 4# firkraag


什么是stacked?


   

论坛徽章:
0
6 [报告]
发表于 2013-05-03 10:41 |只看该作者
回复 4# firkraag

请问能指出代码吗?

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
7 [报告]
发表于 2013-05-03 15:50 |只看该作者
回复 6# remaper
google "device mapper"
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP