Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
83157223
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83157223
编写于
10月 24, 2011
作者:
J
Jens Axboe
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-linus' into for-3.2/core
上级
9562ad9a
f992ae80
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
115 deletion
+26
-115
block/blk-core.c
block/blk-core.c
+2
-0
block/blk-flush.c
block/blk-flush.c
+1
-2
drivers/block/loop.c
drivers/block/loop.c
+23
-112
include/linux/loop.h
include/linux/loop.h
+0
-1
未找到文件。
block/blk-core.c
浏览文件 @
83157223
...
...
@@ -1769,6 +1769,8 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
where
=
ELEVATOR_INSERT_FLUSH
;
add_acct_request
(
q
,
rq
,
where
);
if
(
where
==
ELEVATOR_INSERT_FLUSH
)
__blk_run_queue
(
q
);
spin_unlock_irqrestore
(
q
->
queue_lock
,
flags
);
return
0
;
...
...
block/blk-flush.c
浏览文件 @
83157223
...
...
@@ -320,7 +320,7 @@ void blk_insert_flush(struct request *rq)
return
;
}
BUG_ON
(
!
rq
->
bio
||
rq
->
bio
!=
rq
->
biotail
);
BUG_ON
(
rq
->
bio
!=
rq
->
biotail
);
/*assumes zero or single bio rq */
/*
* If there's data but flush is not necessary, the request can be
...
...
@@ -330,7 +330,6 @@ void blk_insert_flush(struct request *rq)
if
((
policy
&
REQ_FSEQ_DATA
)
&&
!
(
policy
&
(
REQ_FSEQ_PREFLUSH
|
REQ_FSEQ_POSTFLUSH
)))
{
list_add_tail
(
&
rq
->
queuelist
,
&
q
->
queue_head
);
blk_run_queue_async
(
q
);
return
;
}
...
...
drivers/block/loop.c
浏览文件 @
83157223
...
...
@@ -202,74 +202,6 @@ lo_do_transfer(struct loop_device *lo, int cmd,
return
lo
->
transfer
(
lo
,
cmd
,
rpage
,
roffs
,
lpage
,
loffs
,
size
,
rblock
);
}
/**
* do_lo_send_aops - helper for writing data to a loop device
*
* This is the fast version for backing filesystems which implement the address
* space operations write_begin and write_end.
*/
static
int
do_lo_send_aops
(
struct
loop_device
*
lo
,
struct
bio_vec
*
bvec
,
loff_t
pos
,
struct
page
*
unused
)
{
struct
file
*
file
=
lo
->
lo_backing_file
;
/* kudos to NFsckingS */
struct
address_space
*
mapping
=
file
->
f_mapping
;
pgoff_t
index
;
unsigned
offset
,
bv_offs
;
int
len
,
ret
;
mutex_lock
(
&
mapping
->
host
->
i_mutex
);
index
=
pos
>>
PAGE_CACHE_SHIFT
;
offset
=
pos
&
((
pgoff_t
)
PAGE_CACHE_SIZE
-
1
);
bv_offs
=
bvec
->
bv_offset
;
len
=
bvec
->
bv_len
;
while
(
len
>
0
)
{
sector_t
IV
;
unsigned
size
,
copied
;
int
transfer_result
;
struct
page
*
page
;
void
*
fsdata
;
IV
=
((
sector_t
)
index
<<
(
PAGE_CACHE_SHIFT
-
9
))
+
(
offset
>>
9
);
size
=
PAGE_CACHE_SIZE
-
offset
;
if
(
size
>
len
)
size
=
len
;
ret
=
pagecache_write_begin
(
file
,
mapping
,
pos
,
size
,
0
,
&
page
,
&
fsdata
);
if
(
ret
)
goto
fail
;
file_update_time
(
file
);
transfer_result
=
lo_do_transfer
(
lo
,
WRITE
,
page
,
offset
,
bvec
->
bv_page
,
bv_offs
,
size
,
IV
);
copied
=
size
;
if
(
unlikely
(
transfer_result
))
copied
=
0
;
ret
=
pagecache_write_end
(
file
,
mapping
,
pos
,
size
,
copied
,
page
,
fsdata
);
if
(
ret
<
0
||
ret
!=
copied
)
goto
fail
;
if
(
unlikely
(
transfer_result
))
goto
fail
;
bv_offs
+=
copied
;
len
-=
copied
;
offset
=
0
;
index
++
;
pos
+=
copied
;
}
ret
=
0
;
out:
mutex_unlock
(
&
mapping
->
host
->
i_mutex
);
return
ret
;
fail:
ret
=
-
1
;
goto
out
;
}
/**
* __do_lo_send_write - helper for writing data to a loop device
*
...
...
@@ -297,10 +229,8 @@ static int __do_lo_send_write(struct file *file,
/**
* do_lo_send_direct_write - helper for writing data to a loop device
*
* This is the fast, non-transforming version for backing filesystems which do
* not implement the address space operations write_begin and write_end.
* It uses the write file operation which should be present on all writeable
* filesystems.
* This is the fast, non-transforming version that does not need double
* buffering.
*/
static
int
do_lo_send_direct_write
(
struct
loop_device
*
lo
,
struct
bio_vec
*
bvec
,
loff_t
pos
,
struct
page
*
page
)
...
...
@@ -316,15 +246,9 @@ static int do_lo_send_direct_write(struct loop_device *lo,
/**
* do_lo_send_write - helper for writing data to a loop device
*
* This is the slow, transforming version for filesystems which do not
* implement the address space operations write_begin and write_end. It
* uses the write file operation which should be present on all writeable
* filesystems.
*
* Using fops->write is slower than using aops->{prepare,commit}_write in the
* transforming case because we need to double buffer the data as we cannot do
* the transformations in place as we do not have direct access to the
* destination pages of the backing file.
* This is the slow, transforming version that needs to double buffer the
* data as it cannot do the transformations in place without having direct
* access to the destination pages of the backing file.
*/
static
int
do_lo_send_write
(
struct
loop_device
*
lo
,
struct
bio_vec
*
bvec
,
loff_t
pos
,
struct
page
*
page
)
...
...
@@ -350,17 +274,16 @@ static int lo_send(struct loop_device *lo, struct bio *bio, loff_t pos)
struct
page
*
page
=
NULL
;
int
i
,
ret
=
0
;
do_lo_send
=
do_lo_send_aops
;
if
(
!
(
lo
->
lo_flags
&
LO_FLAGS_USE_AOPS
))
{
if
(
lo
->
transfer
!=
transfer_none
)
{
page
=
alloc_page
(
GFP_NOIO
|
__GFP_HIGHMEM
);
if
(
unlikely
(
!
page
))
goto
fail
;
kmap
(
page
);
do_lo_send
=
do_lo_send_write
;
}
else
{
do_lo_send
=
do_lo_send_direct_write
;
if
(
lo
->
transfer
!=
transfer_none
)
{
page
=
alloc_page
(
GFP_NOIO
|
__GFP_HIGHMEM
);
if
(
unlikely
(
!
page
))
goto
fail
;
kmap
(
page
);
do_lo_send
=
do_lo_send_write
;
}
}
bio_for_each_segment
(
bvec
,
bio
,
i
)
{
ret
=
do_lo_send
(
lo
,
bvec
,
pos
,
page
);
if
(
ret
<
0
)
...
...
@@ -848,35 +771,23 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
mapping
=
file
->
f_mapping
;
inode
=
mapping
->
host
;
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
lo_flags
|=
LO_FLAGS_READ_ONLY
;
error
=
-
EINVAL
;
if
(
S_ISREG
(
inode
->
i_mode
)
||
S_ISBLK
(
inode
->
i_mode
))
{
const
struct
address_space_operations
*
aops
=
mapping
->
a_ops
;
if
(
aops
->
write_begin
)
lo_flags
|=
LO_FLAGS_USE_AOPS
;
if
(
!
(
lo_flags
&
LO_FLAGS_USE_AOPS
)
&&
!
file
->
f_op
->
write
)
lo_flags
|=
LO_FLAGS_READ_ONLY
;
if
(
!
S_ISREG
(
inode
->
i_mode
)
&&
!
S_ISBLK
(
inode
->
i_mode
))
goto
out_putf
;
lo_blocksize
=
S_ISBLK
(
inode
->
i_mode
)
?
inode
->
i_bdev
->
bd_block_size
:
PAGE_SIZE
;
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
)
||
!
(
mode
&
FMODE_WRITE
)
||
!
file
->
f_op
->
write
)
lo_flags
|=
LO_FLAGS_READ_ONLY
;
error
=
0
;
}
else
{
goto
out_putf
;
}
lo_blocksize
=
S_ISBLK
(
inode
->
i_mode
)
?
inode
->
i_bdev
->
bd_block_size
:
PAGE_SIZE
;
error
=
-
EFBIG
;
size
=
get_loop_size
(
lo
,
file
);
if
((
loff_t
)(
sector_t
)
size
!=
size
)
{
error
=
-
EFBIG
;
if
((
loff_t
)(
sector_t
)
size
!=
size
)
goto
out_putf
;
}
if
(
!
(
mode
&
FMODE_WRITE
))
lo_flags
|=
LO_FLAGS_READ_ONLY
;
error
=
0
;
set_device_ro
(
bdev
,
(
lo_flags
&
LO_FLAGS_READ_ONLY
)
!=
0
);
...
...
include/linux/loop.h
浏览文件 @
83157223
...
...
@@ -73,7 +73,6 @@ struct loop_device {
*/
enum
{
LO_FLAGS_READ_ONLY
=
1
,
LO_FLAGS_USE_AOPS
=
2
,
LO_FLAGS_AUTOCLEAR
=
4
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录