Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
b036b970
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b036b970
编写于
10月 03, 2016
作者:
D
Dave Chinner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'iomap-4.9-misc-fixes-1' into for-next
上级
0d5b0cf2
e43c460d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
87 addition
and
0 deletion
+87
-0
fs/iomap.c
fs/iomap.c
+84
-0
include/linux/iomap.h
include/linux/iomap.h
+3
-0
未找到文件。
fs/iomap.c
浏览文件 @
b036b970
...
...
@@ -252,6 +252,88 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *iter,
}
EXPORT_SYMBOL_GPL
(
iomap_file_buffered_write
);
static
struct
page
*
__iomap_read_page
(
struct
inode
*
inode
,
loff_t
offset
)
{
struct
address_space
*
mapping
=
inode
->
i_mapping
;
struct
page
*
page
;
page
=
read_mapping_page
(
mapping
,
offset
>>
PAGE_SHIFT
,
NULL
);
if
(
IS_ERR
(
page
))
return
page
;
if
(
!
PageUptodate
(
page
))
{
put_page
(
page
);
return
ERR_PTR
(
-
EIO
);
}
return
page
;
}
static
loff_t
iomap_dirty_actor
(
struct
inode
*
inode
,
loff_t
pos
,
loff_t
length
,
void
*
data
,
struct
iomap
*
iomap
)
{
long
status
=
0
;
ssize_t
written
=
0
;
do
{
struct
page
*
page
,
*
rpage
;
unsigned
long
offset
;
/* Offset into pagecache page */
unsigned
long
bytes
;
/* Bytes to write to page */
offset
=
(
pos
&
(
PAGE_SIZE
-
1
));
bytes
=
min_t
(
unsigned
long
,
PAGE_SIZE
-
offset
,
length
);
rpage
=
__iomap_read_page
(
inode
,
pos
);
if
(
IS_ERR
(
rpage
))
return
PTR_ERR
(
rpage
);
status
=
iomap_write_begin
(
inode
,
pos
,
bytes
,
AOP_FLAG_NOFS
|
AOP_FLAG_UNINTERRUPTIBLE
,
&
page
,
iomap
);
put_page
(
rpage
);
if
(
unlikely
(
status
))
return
status
;
WARN_ON_ONCE
(
!
PageUptodate
(
page
));
status
=
iomap_write_end
(
inode
,
pos
,
bytes
,
bytes
,
page
);
if
(
unlikely
(
status
<=
0
))
{
if
(
WARN_ON_ONCE
(
status
==
0
))
return
-
EIO
;
return
status
;
}
cond_resched
();
pos
+=
status
;
written
+=
status
;
length
-=
status
;
balance_dirty_pages_ratelimited
(
inode
->
i_mapping
);
}
while
(
length
);
return
written
;
}
int
iomap_file_dirty
(
struct
inode
*
inode
,
loff_t
pos
,
loff_t
len
,
struct
iomap_ops
*
ops
)
{
loff_t
ret
;
while
(
len
)
{
ret
=
iomap_apply
(
inode
,
pos
,
len
,
IOMAP_WRITE
,
ops
,
NULL
,
iomap_dirty_actor
);
if
(
ret
<=
0
)
return
ret
;
pos
+=
ret
;
len
-=
ret
;
}
return
0
;
}
EXPORT_SYMBOL_GPL
(
iomap_file_dirty
);
static
int
iomap_zero
(
struct
inode
*
inode
,
loff_t
pos
,
unsigned
offset
,
unsigned
bytes
,
struct
iomap
*
iomap
)
{
...
...
@@ -430,6 +512,8 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,
if
(
iomap
->
flags
&
IOMAP_F_MERGED
)
flags
|=
FIEMAP_EXTENT_MERGED
;
if
(
iomap
->
flags
&
IOMAP_F_SHARED
)
flags
|=
FIEMAP_EXTENT_SHARED
;
return
fiemap_fill_next_extent
(
fi
,
iomap
->
offset
,
iomap
->
blkno
!=
IOMAP_NULL_BLOCK
?
iomap
->
blkno
<<
9
:
0
,
...
...
include/linux/iomap.h
浏览文件 @
b036b970
...
...
@@ -22,6 +22,7 @@ struct vm_fault;
* Flags for iomap mappings:
*/
#define IOMAP_F_MERGED 0x01
/* contains multiple blocks/extents */
#define IOMAP_F_SHARED 0x02
/* block shared with another file */
/*
* Magic value for blkno:
...
...
@@ -64,6 +65,8 @@ struct iomap_ops {
ssize_t
iomap_file_buffered_write
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
from
,
struct
iomap_ops
*
ops
);
int
iomap_file_dirty
(
struct
inode
*
inode
,
loff_t
pos
,
loff_t
len
,
struct
iomap_ops
*
ops
);
int
iomap_zero_range
(
struct
inode
*
inode
,
loff_t
pos
,
loff_t
len
,
bool
*
did_zero
,
struct
iomap_ops
*
ops
);
int
iomap_truncate_page
(
struct
inode
*
inode
,
loff_t
pos
,
bool
*
did_zero
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录