Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
99baa752
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看板
提交
99baa752
编写于
8月 09, 2006
作者:
G
Greg Kroah-Hartman
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://oss.sgi.com:8090/nathans/xfs-rc-2.6
上级
fff64257
0e1edbd9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
49 deletion
+54
-49
fs/xfs/xfs_alloc.c
fs/xfs/xfs_alloc.c
+54
-49
未找到文件。
fs/xfs/xfs_alloc.c
浏览文件 @
99baa752
...
...
@@ -1835,40 +1835,47 @@ xfs_alloc_fix_freelist(
&
agbp
)))
return
error
;
if
(
!
pag
->
pagf_init
)
{
ASSERT
(
flags
&
XFS_ALLOC_FLAG_TRYLOCK
);
ASSERT
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
));
args
->
agbp
=
NULL
;
return
0
;
}
}
else
agbp
=
NULL
;
/* If this is a metadata preferred pag and we are user data
/*
* If this is a metadata preferred pag and we are user data
* then try somewhere else if we are not being asked to
* try harder at this point
*/
if
(
pag
->
pagf_metadata
&&
args
->
userdata
&&
flags
)
{
if
(
pag
->
pagf_metadata
&&
args
->
userdata
&&
(
flags
&
XFS_ALLOC_FLAG_TRYLOCK
))
{
ASSERT
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
));
args
->
agbp
=
NULL
;
return
0
;
}
need
=
XFS_MIN_FREELIST_PAG
(
pag
,
mp
);
delta
=
need
>
pag
->
pagf_flcount
?
need
-
pag
->
pagf_flcount
:
0
;
/*
* If it looks like there isn't a long enough extent, or enough
* total blocks, reject it.
*/
longest
=
(
pag
->
pagf_longest
>
delta
)
?
(
pag
->
pagf_longest
-
delta
)
:
(
pag
->
pagf_flcount
>
0
||
pag
->
pagf_longest
>
0
);
if
(
args
->
minlen
+
args
->
alignment
+
args
->
minalignslop
-
1
>
longest
||
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
)
&&
(
int
)(
pag
->
pagf_freeblks
+
pag
->
pagf_flcount
-
need
-
args
->
total
)
<
(
int
)
args
->
minleft
))
{
if
(
agbp
)
xfs_trans_brelse
(
tp
,
agbp
);
args
->
agbp
=
NULL
;
return
0
;
if
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
))
{
need
=
XFS_MIN_FREELIST_PAG
(
pag
,
mp
);
delta
=
need
>
pag
->
pagf_flcount
?
need
-
pag
->
pagf_flcount
:
0
;
/*
* If it looks like there isn't a long enough extent, or enough
* total blocks, reject it.
*/
longest
=
(
pag
->
pagf_longest
>
delta
)
?
(
pag
->
pagf_longest
-
delta
)
:
(
pag
->
pagf_flcount
>
0
||
pag
->
pagf_longest
>
0
);
if
((
args
->
minlen
+
args
->
alignment
+
args
->
minalignslop
-
1
)
>
longest
||
((
int
)(
pag
->
pagf_freeblks
+
pag
->
pagf_flcount
-
need
-
args
->
total
)
<
(
int
)
args
->
minleft
))
{
if
(
agbp
)
xfs_trans_brelse
(
tp
,
agbp
);
args
->
agbp
=
NULL
;
return
0
;
}
}
/*
* Get the a.g. freespace buffer.
* Can fail if we're not blocking on locks, and it's held.
...
...
@@ -1878,6 +1885,8 @@ xfs_alloc_fix_freelist(
&
agbp
)))
return
error
;
if
(
agbp
==
NULL
)
{
ASSERT
(
flags
&
XFS_ALLOC_FLAG_TRYLOCK
);
ASSERT
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
));
args
->
agbp
=
NULL
;
return
0
;
}
...
...
@@ -1887,22 +1896,24 @@ xfs_alloc_fix_freelist(
*/
agf
=
XFS_BUF_TO_AGF
(
agbp
);
need
=
XFS_MIN_FREELIST
(
agf
,
mp
);
delta
=
need
>
be32_to_cpu
(
agf
->
agf_flcount
)
?
(
need
-
be32_to_cpu
(
agf
->
agf_flcount
))
:
0
;
/*
* If there isn't enough total or single-extent, reject it.
*/
longest
=
be32_to_cpu
(
agf
->
agf_longest
);
longest
=
(
longest
>
delta
)
?
(
longest
-
delta
)
:
(
be32_to_cpu
(
agf
->
agf_flcount
)
>
0
||
longest
>
0
);
if
(
args
->
minlen
+
args
->
alignment
+
args
->
minalignslop
-
1
>
longest
||
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
)
&&
(
int
)(
be32_to_cpu
(
agf
->
agf_freeblks
)
+
be32_to_cpu
(
agf
->
agf_flcount
)
-
need
-
args
->
total
)
<
(
int
)
args
->
minleft
))
{
xfs_trans_brelse
(
tp
,
agbp
);
args
->
agbp
=
NULL
;
return
0
;
if
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
))
{
delta
=
need
>
be32_to_cpu
(
agf
->
agf_flcount
)
?
(
need
-
be32_to_cpu
(
agf
->
agf_flcount
))
:
0
;
longest
=
be32_to_cpu
(
agf
->
agf_longest
);
longest
=
(
longest
>
delta
)
?
(
longest
-
delta
)
:
(
be32_to_cpu
(
agf
->
agf_flcount
)
>
0
||
longest
>
0
);
if
((
args
->
minlen
+
args
->
alignment
+
args
->
minalignslop
-
1
)
>
longest
||
((
int
)(
be32_to_cpu
(
agf
->
agf_freeblks
)
+
be32_to_cpu
(
agf
->
agf_flcount
)
-
need
-
args
->
total
)
<
(
int
)
args
->
minleft
))
{
xfs_trans_brelse
(
tp
,
agbp
);
args
->
agbp
=
NULL
;
return
0
;
}
}
/*
* Make the freelist shorter if it's too long.
...
...
@@ -1950,12 +1961,11 @@ xfs_alloc_fix_freelist(
* on a completely full ag.
*/
if
(
targs
.
agbno
==
NULLAGBLOCK
)
{
if
(
!
(
flags
&
XFS_ALLOC_FLAG_FREEING
))
{
xfs_trans_brelse
(
tp
,
agflbp
);
args
->
agbp
=
NULL
;
return
0
;
}
break
;
if
(
flags
&
XFS_ALLOC_FLAG_FREEING
)
break
;
xfs_trans_brelse
(
tp
,
agflbp
);
args
->
agbp
=
NULL
;
return
0
;
}
/*
* Put each allocated block on the list.
...
...
@@ -2442,31 +2452,26 @@ xfs_free_extent(
xfs_fsblock_t
bno
,
/* starting block number of extent */
xfs_extlen_t
len
)
/* length of extent */
{
#ifdef DEBUG
xfs_agf_t
*
agf
;
/* a.g. freespace header */
#endif
xfs_alloc_arg_t
args
;
/* allocation argument structure */
xfs_alloc_arg_t
args
;
int
error
;
ASSERT
(
len
!=
0
);
memset
(
&
args
,
0
,
sizeof
(
xfs_alloc_arg_t
));
args
.
tp
=
tp
;
args
.
mp
=
tp
->
t_mountp
;
args
.
agno
=
XFS_FSB_TO_AGNO
(
args
.
mp
,
bno
);
ASSERT
(
args
.
agno
<
args
.
mp
->
m_sb
.
sb_agcount
);
args
.
agbno
=
XFS_FSB_TO_AGBNO
(
args
.
mp
,
bno
);
args
.
alignment
=
1
;
args
.
minlen
=
args
.
minleft
=
args
.
minalignslop
=
0
;
down_read
(
&
args
.
mp
->
m_peraglock
);
args
.
pag
=
&
args
.
mp
->
m_perag
[
args
.
agno
];
if
((
error
=
xfs_alloc_fix_freelist
(
&
args
,
XFS_ALLOC_FLAG_FREEING
)))
goto
error0
;
#ifdef DEBUG
ASSERT
(
args
.
agbp
!=
NULL
);
agf
=
XFS_BUF_TO_AGF
(
args
.
agbp
);
ASSERT
(
args
.
agbno
+
len
<=
be32_to_cpu
(
agf
->
agf_length
));
ASSERT
((
args
.
agbno
+
len
)
<=
be32_to_cpu
(
XFS_BUF_TO_AGF
(
args
.
agbp
)
->
agf_length
));
#endif
error
=
xfs_free_ag_extent
(
tp
,
args
.
agbp
,
args
.
agno
,
args
.
agbno
,
len
,
0
);
error
=
xfs_free_ag_extent
(
tp
,
args
.
agbp
,
args
.
agno
,
args
.
agbno
,
len
,
0
);
error0:
up_read
(
&
args
.
mp
->
m_peraglock
);
return
error
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录