Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
bcbfce8a
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看板
提交
bcbfce8a
编写于
4月 22, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Fix the unplug_io_fn to grab a consistent copy of page->mapping
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
e1c4b745
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
7 deletion
+22
-7
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+12
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+10
-6
未找到文件。
fs/btrfs/disk-io.c
浏览文件 @
bcbfce8a
...
...
@@ -936,14 +936,25 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
struct
inode
*
inode
;
struct
extent_map_tree
*
em_tree
;
struct
extent_map
*
em
;
struct
address_space
*
mapping
;
u64
offset
;
/* the generic O_DIRECT read code does this */
if
(
!
page
)
{
__unplug_io_fn
(
bdi
,
page
);
return
;
}
inode
=
page
->
mapping
->
host
;
/*
* page->mapping may change at any time. Get a consistent copy
* and use that for everything below
*/
smp_mb
();
mapping
=
page
->
mapping
;
if
(
!
mapping
)
return
;
inode
=
mapping
->
host
;
offset
=
page_offset
(
page
);
em_tree
=
&
BTRFS_I
(
inode
)
->
extent_tree
;
...
...
fs/btrfs/inode.c
浏览文件 @
bcbfce8a
...
...
@@ -80,6 +80,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
u64
total
=
btrfs_super_total_bytes
(
&
root
->
fs_info
->
super_copy
);
u64
used
=
btrfs_super_bytes_used
(
&
root
->
fs_info
->
super_copy
);
u64
thresh
;
unsigned
long
flags
;
int
ret
=
0
;
if
(
for_del
)
...
...
@@ -89,10 +90,10 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
do_div
(
thresh
,
100
);
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_lock
_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
if
(
used
+
root
->
fs_info
->
delalloc_bytes
+
num_required
>
thresh
)
ret
=
-
ENOSPC
;
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
return
ret
;
}
...
...
@@ -275,12 +276,13 @@ 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
old
,
unsigned
long
bits
)
{
unsigned
long
flags
;
if
(
!
(
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_lock
_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
BTRFS_I
(
inode
)
->
delalloc_bytes
+=
end
-
start
+
1
;
root
->
fs_info
->
delalloc_bytes
+=
end
-
start
+
1
;
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
}
...
...
@@ -290,7 +292,9 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
{
if
((
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
unsigned
long
flags
;
spin_lock_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
if
(
end
-
start
+
1
>
root
->
fs_info
->
delalloc_bytes
)
{
printk
(
"warning: delalloc account %Lu %Lu
\n
"
,
end
-
start
+
1
,
root
->
fs_info
->
delalloc_bytes
);
...
...
@@ -300,7 +304,7 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
root
->
fs_info
->
delalloc_bytes
-=
end
-
start
+
1
;
BTRFS_I
(
inode
)
->
delalloc_bytes
-=
end
-
start
+
1
;
}
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录