Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FengXiao2002
Linux Imx
提交
b0c68f8b
L
Linux Imx
项目概览
FengXiao2002
/
Linux Imx
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Linux Imx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0c68f8b
编写于
1月 31, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Enable delalloc accounting
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
0181e58f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
14 deletion
+26
-14
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+4
-0
fs/btrfs/extent_io.c
fs/btrfs/extent_io.c
+7
-7
fs/btrfs/extent_io.h
fs/btrfs/extent_io.h
+2
-2
fs/btrfs/inode.c
fs/btrfs/inode.c
+13
-5
未找到文件。
fs/btrfs/disk-io.c
浏览文件 @
b0c68f8b
...
...
@@ -861,6 +861,10 @@ int close_ctree(struct btrfs_root *root)
write_ctree_super
(
NULL
,
root
);
mutex_unlock
(
&
fs_info
->
fs_mutex
);
if
(
fs_info
->
delalloc_bytes
)
{
printk
(
"btrfs: at unmount delalloc count %Lu
\n
"
,
fs_info
->
delalloc_bytes
);
}
if
(
fs_info
->
extent_root
->
node
)
free_extent_buffer
(
fs_info
->
extent_root
->
node
);
...
...
fs/btrfs/extent_io.c
浏览文件 @
b0c68f8b
...
...
@@ -262,7 +262,7 @@ static void set_state_cb(struct extent_io_tree *tree,
{
if
(
tree
->
ops
&&
tree
->
ops
->
set_bit_hook
)
{
tree
->
ops
->
set_bit_hook
(
tree
->
mapping
->
host
,
state
->
start
,
state
->
end
,
bits
);
state
->
end
,
state
->
state
,
bits
);
}
}
...
...
@@ -272,7 +272,7 @@ static void clear_state_cb(struct extent_io_tree *tree,
{
if
(
tree
->
ops
&&
tree
->
ops
->
set_bit_hook
)
{
tree
->
ops
->
clear_bit_hook
(
tree
->
mapping
->
host
,
state
->
start
,
state
->
end
,
bits
);
state
->
end
,
state
->
state
,
bits
);
}
}
...
...
@@ -298,10 +298,10 @@ static int insert_state(struct extent_io_tree *tree,
}
if
(
bits
&
EXTENT_DIRTY
)
tree
->
dirty_bytes
+=
end
-
start
+
1
;
set_state_cb
(
tree
,
state
,
bits
);
state
->
state
|=
bits
;
state
->
start
=
start
;
state
->
end
=
end
;
set_state_cb
(
tree
,
state
,
bits
);
node
=
tree_insert
(
&
tree
->
state
,
end
,
&
state
->
rb_node
);
if
(
node
)
{
struct
extent_state
*
found
;
...
...
@@ -369,8 +369,8 @@ static int clear_state_bit(struct extent_io_tree *tree,
WARN_ON
(
range
>
tree
->
dirty_bytes
);
tree
->
dirty_bytes
-=
range
;
}
state
->
state
&=
~
bits
;
clear_state_cb
(
tree
,
state
,
bits
);
state
->
state
&=
~
bits
;
if
(
wake
)
wake_up
(
&
state
->
wq
);
if
(
delete
||
state
->
state
==
0
)
{
...
...
@@ -574,8 +574,8 @@ static void set_state_bits(struct extent_io_tree *tree,
u64
range
=
state
->
end
-
state
->
start
+
1
;
tree
->
dirty_bytes
+=
range
;
}
state
->
state
|=
bits
;
set_state_cb
(
tree
,
state
,
bits
);
state
->
state
|=
bits
;
}
/*
...
...
@@ -997,8 +997,8 @@ search_again:
free_extent_state
(
state
);
goto
search_again
;
}
state
->
state
|=
EXTENT_LOCKED
;
set_state_cb
(
tree
,
state
,
EXTENT_LOCKED
);
state
->
state
|=
EXTENT_LOCKED
;
if
(
!
found
)
*
start
=
state
->
start
;
found
++
;
...
...
@@ -1497,8 +1497,8 @@ static int end_bio_extent_readpage(struct bio *bio,
}
else
{
state
=
NULL
;
}
clear
->
state
|=
EXTENT_UPTODATE
;
set_state_cb
(
tree
,
clear
,
EXTENT_UPTODATE
);
clear
->
state
|=
EXTENT_UPTODATE
;
clear_state_bit
(
tree
,
clear
,
EXTENT_LOCKED
,
1
,
0
);
if
(
cur
==
start
)
...
...
fs/btrfs/extent_io.h
浏览文件 @
b0c68f8b
...
...
@@ -34,9 +34,9 @@ struct extent_io_ops {
void
(
*
writepage_end_io_hook
)(
struct
page
*
page
,
u64
start
,
u64
end
,
struct
extent_state
*
state
);
int
(
*
set_bit_hook
)(
struct
inode
*
inode
,
u64
start
,
u64
end
,
unsigned
long
bits
);
unsigned
long
old
,
unsigned
long
bits
);
int
(
*
clear_bit_hook
)(
struct
inode
*
inode
,
u64
start
,
u64
end
,
unsigned
long
bits
);
unsigned
long
old
,
unsigned
long
bits
);
};
struct
extent_io_tree
{
...
...
fs/btrfs/inode.c
浏览文件 @
b0c68f8b
...
...
@@ -260,9 +260,9 @@ static int run_delalloc_range(struct inode *inode, u64 start, u64 end)
}
int
btrfs_set_bit_hook
(
struct
inode
*
inode
,
u64
start
,
u64
end
,
unsigned
long
bits
)
unsigned
long
old
,
unsigned
long
bits
)
{
if
((
bits
&
EXTENT_DELALLOC
))
{
if
(
!
(
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
root
->
fs_info
->
delalloc_bytes
+=
end
-
start
+
1
;
...
...
@@ -272,12 +272,18 @@ int btrfs_set_bit_hook(struct inode *inode, u64 start, u64 end,
}
int
btrfs_clear_bit_hook
(
struct
inode
*
inode
,
u64
start
,
u64
end
,
unsigned
long
bits
)
unsigned
long
old
,
unsigned
long
bits
)
{
if
((
bits
&
EXTENT_DELALLOC
))
{
if
((
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
root
->
fs_info
->
delalloc_bytes
-=
end
-
start
+
1
;
if
(
end
-
start
+
1
>
root
->
fs_info
->
delalloc_bytes
)
{
printk
(
"warning: delalloc account %Lu %Lu
\n
"
,
end
-
start
+
1
,
root
->
fs_info
->
delalloc_bytes
);
root
->
fs_info
->
delalloc_bytes
=
0
;
}
else
{
root
->
fs_info
->
delalloc_bytes
-=
end
-
start
+
1
;
}
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
}
return
0
;
...
...
@@ -3002,6 +3008,8 @@ static struct extent_io_ops btrfs_extent_io_ops = {
.
writepage_io_hook
=
btrfs_writepage_io_hook
,
.
readpage_io_hook
=
btrfs_readpage_io_hook
,
.
readpage_end_io_hook
=
btrfs_readpage_end_io_hook
,
.
set_bit_hook
=
btrfs_set_bit_hook
,
.
clear_bit_hook
=
btrfs_clear_bit_hook
,
};
static
struct
address_space_operations
btrfs_aops
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录