Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c90eef84
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
c90eef84
编写于
9月 20, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6
上级
9600c11b
eed8b2de
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
33 addition
and
22 deletion
+33
-22
fs/ntfs/runlist.c
fs/ntfs/runlist.c
+33
-22
未找到文件。
fs/ntfs/runlist.c
浏览文件 @
c90eef84
...
...
@@ -158,17 +158,21 @@ static inline BOOL ntfs_are_rl_mergeable(runlist_element *dst,
BUG_ON
(
!
dst
);
BUG_ON
(
!
src
);
if
((
dst
->
lcn
<
0
)
||
(
src
->
lcn
<
0
))
{
/* Are we merging holes?
*/
if
(
dst
->
lcn
==
LCN_HOLE
&&
src
->
lcn
==
LCN_HOLE
)
/* We can merge unmapped regions even if they are misaligned.
*/
if
((
dst
->
lcn
==
LCN_RL_NOT_MAPPED
)
&&
(
src
->
lcn
==
LCN_RL_NOT_MAPPED
)
)
return
TRUE
;
/* If the runs are misaligned, we cannot merge them. */
if
((
dst
->
vcn
+
dst
->
length
)
!=
src
->
vcn
)
return
FALSE
;
}
if
((
dst
->
lcn
+
dst
->
length
)
!=
src
->
lcn
)
/* Are the runs contiguous? */
return
FALSE
;
if
((
dst
->
vcn
+
dst
->
length
)
!=
src
->
vcn
)
/* Are the runs misaligned? */
return
FALSE
;
/* If both runs are non-sparse and contiguous, we can merge them. */
if
((
dst
->
lcn
>=
0
)
&&
(
src
->
lcn
>=
0
)
&&
((
dst
->
lcn
+
dst
->
length
)
==
src
->
lcn
))
return
TRUE
;
/* If we are merging two holes, we can merge them. */
if
((
dst
->
lcn
==
LCN_HOLE
)
&&
(
src
->
lcn
==
LCN_HOLE
))
return
TRUE
;
/* Cannot merge. */
return
FALSE
;
}
/**
...
...
@@ -214,13 +218,14 @@ static inline void __ntfs_rl_merge(runlist_element *dst, runlist_element *src)
static
inline
runlist_element
*
ntfs_rl_append
(
runlist_element
*
dst
,
int
dsize
,
runlist_element
*
src
,
int
ssize
,
int
loc
)
{
BOOL
right
;
/* Right end of @src needs merging. */
BOOL
right
=
FALSE
;
/* Right end of @src needs merging. */
int
marker
;
/* End of the inserted runs. */
BUG_ON
(
!
dst
);
BUG_ON
(
!
src
);
/* First, check if the right hand end needs merging. */
if
((
loc
+
1
)
<
dsize
)
right
=
ntfs_are_rl_mergeable
(
src
+
ssize
-
1
,
dst
+
loc
+
1
);
/* Space required: @dst size + @src size, less one if we merged. */
...
...
@@ -377,20 +382,21 @@ static inline runlist_element *ntfs_rl_replace(runlist_element *dst,
int
dsize
,
runlist_element
*
src
,
int
ssize
,
int
loc
)
{
BOOL
left
=
FALSE
;
/* Left end of @src needs merging. */
BOOL
right
;
/* Right end of @src needs merging. */
BOOL
right
=
FALSE
;
/* Right end of @src needs merging. */
int
tail
;
/* Start of tail of @dst. */
int
marker
;
/* End of the inserted runs. */
BUG_ON
(
!
dst
);
BUG_ON
(
!
src
);
/* First, merge the left and right ends, if necessary. */
/* First, see if the left and right ends need merging. */
if
((
loc
+
1
)
<
dsize
)
right
=
ntfs_are_rl_mergeable
(
src
+
ssize
-
1
,
dst
+
loc
+
1
);
if
(
loc
>
0
)
left
=
ntfs_are_rl_mergeable
(
dst
+
loc
-
1
,
src
);
/*
* Allocate some space. We will need less if the left, right, or both
* ends
were
merged.
* ends
get
merged.
*/
dst
=
ntfs_rl_realloc
(
dst
,
dsize
,
dsize
+
ssize
-
left
-
right
);
if
(
IS_ERR
(
dst
))
...
...
@@ -399,21 +405,26 @@ static inline runlist_element *ntfs_rl_replace(runlist_element *dst,
* We are guaranteed to succeed from here so can start modifying the
* original runlists.
*/
/* First, merge the left and right ends, if necessary. */
if
(
right
)
__ntfs_rl_merge
(
src
+
ssize
-
1
,
dst
+
loc
+
1
);
if
(
left
)
__ntfs_rl_merge
(
dst
+
loc
-
1
,
src
);
/*
* First run of @dst that needs to be moved out of the way to make
* space for the runs to be copied from @src, i.e. the first run of the
* tail of @dst.
* Offset of the tail of @dst. This needs to be moved out of the way
* to make space for the runs to be copied from @src, i.e. the first
* run of the tail of @dst.
* Nominally, @tail equals @loc + 1, i.e. location, skipping the
* replaced run. However, if @right, then one of @dst's runs is
* already merged into @src.
*/
tail
=
loc
+
right
+
1
;
/*
* First run after the @src runs that have been inserted, i.e. where
* the tail of @dst needs to be moved to.
* Nominally, marker equals @loc + @ssize, i.e. location + number of
* runs in @src
)
. However, if @left, then the first run in @src has
* Nominally,
@
marker equals @loc + @ssize, i.e. location + number of
* runs in @src. However, if @left, then the first run in @src has
* been merged with one in @dst.
*/
marker
=
loc
+
ssize
-
left
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录