Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
eed8b2de
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
eed8b2de
编写于
9月 20, 2005
作者:
A
Anton Altaparmakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NTFS: More runlist handling fixes from Richard Russon and myself.
Signed-off-by:
N
Anton Altaparmakov
<
aia21@cantab.net
>
上级
676d55ae
变更
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
浏览文件 @
eed8b2de
...
...
@@ -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
)
return
TRUE
;
/* 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
;
return
TRUE
;
/* 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,14 +218,15 @@ 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. */
int
marker
;
/* End of the inserted runs. */
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. */
right
=
ntfs_are_rl_mergeable
(
src
+
ssize
-
1
,
dst
+
loc
+
1
);
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. */
dst
=
ntfs_rl_realloc
(
dst
,
dsize
,
dsize
+
ssize
-
right
);
...
...
@@ -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. */
right
=
ntfs_are_rl_mergeable
(
src
+
ssize
-
1
,
dst
+
loc
+
1
);
/* 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录