Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ea8c2819
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看板
提交
ea8c2819
编写于
8月 04, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Maintain a list of inodes that are delalloc and a way to wait on them
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
d7a029a8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
13 deletion
+60
-13
fs/btrfs/btrfs_inode.h
fs/btrfs/btrfs_inode.h
+2
-0
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+4
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+9
-3
fs/btrfs/file.c
fs/btrfs/file.c
+1
-2
fs/btrfs/inode.c
fs/btrfs/inode.c
+41
-6
fs/btrfs/ioctl.c
fs/btrfs/ioctl.c
+2
-2
未找到文件。
fs/btrfs/btrfs_inode.h
浏览文件 @
ea8c2819
...
...
@@ -42,6 +42,8 @@ struct btrfs_inode {
/* for keeping track of orphaned inodes */
struct
list_head
i_orphan
;
struct
list_head
delalloc_inodes
;
/*
* transid of the trans_handle that last modified this inode
*/
...
...
fs/btrfs/ctree.h
浏览文件 @
ea8c2819
...
...
@@ -551,6 +551,7 @@ struct btrfs_fs_info {
*/
spinlock_t
ordered_extent_lock
;
struct
list_head
ordered_extents
;
struct
list_head
delalloc_inodes
;
/*
* there is a pool of worker threads for checksumming during writes
...
...
@@ -637,6 +638,7 @@ struct btrfs_root {
struct
kobject
root_kobj
;
struct
completion
kobj_unregister
;
struct
mutex
objectid_mutex
;
u64
objectid
;
u64
last_trans
;
...
...
@@ -1651,6 +1653,8 @@ int btrfs_csum_truncate(struct btrfs_trans_handle *trans,
#define PageChecked PageFsMisc
#endif
int
btrfs_start_delalloc_inodes
(
struct
btrfs_root
*
root
);
int
btrfs_set_extent_delalloc
(
struct
inode
*
inode
,
u64
start
,
u64
end
);
int
btrfs_writepages
(
struct
address_space
*
mapping
,
struct
writeback_control
*
wbc
);
int
btrfs_create_subvol_root
(
struct
btrfs_root
*
new_root
,
...
...
fs/btrfs/disk-io.c
浏览文件 @
ea8c2819
...
...
@@ -1234,6 +1234,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
INIT_LIST_HEAD
(
&
fs_info
->
trans_list
);
INIT_LIST_HEAD
(
&
fs_info
->
dead_roots
);
INIT_LIST_HEAD
(
&
fs_info
->
hashers
);
INIT_LIST_HEAD
(
&
fs_info
->
delalloc_inodes
);
spin_lock_init
(
&
fs_info
->
hash_lock
);
spin_lock_init
(
&
fs_info
->
delalloc_lock
);
spin_lock_init
(
&
fs_info
->
new_trans_lock
);
...
...
fs/btrfs/extent-tree.c
浏览文件 @
ea8c2819
...
...
@@ -1230,7 +1230,6 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
found
->
total_bytes
+=
total_bytes
;
found
->
bytes_used
+=
bytes_used
;
found
->
full
=
0
;
WARN_ON
(
found
->
total_bytes
<
found
->
bytes_used
);
*
space_info
=
found
;
return
0
;
}
...
...
@@ -2841,8 +2840,7 @@ static int noinline relocate_inode_pages(struct inode *inode, u64 start,
*/
clear_page_dirty_for_io
(
page
);
set_extent_delalloc
(
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
page_start
,
page_end
);
set_page_dirty
(
page
);
unlock_extent
(
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
...
...
@@ -3319,6 +3317,13 @@ int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 shrink_start)
key
.
type
=
0
;
cur_byte
=
key
.
objectid
;
mutex_unlock
(
&
root
->
fs_info
->
alloc_mutex
);
btrfs_start_delalloc_inodes
(
root
);
btrfs_wait_ordered_extents
(
tree_root
);
mutex_lock
(
&
root
->
fs_info
->
alloc_mutex
);
ret
=
btrfs_search_slot
(
NULL
,
root
,
&
key
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
out
;
...
...
@@ -3401,6 +3406,7 @@ int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 shrink_start)
btrfs_clean_old_snapshots
(
tree_root
);
btrfs_start_delalloc_inodes
(
root
);
btrfs_wait_ordered_extents
(
tree_root
);
trans
=
btrfs_start_transaction
(
tree_root
,
1
);
...
...
fs/btrfs/file.c
浏览文件 @
ea8c2819
...
...
@@ -312,8 +312,7 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans,
* to reset the delalloc bit on things that already have
* extents reserved.
*/
set_extent_delalloc
(
io_tree
,
start_pos
,
end_of_last_block
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
start_pos
,
end_of_last_block
);
for
(
i
=
0
;
i
<
num_pages
;
i
++
)
{
struct
page
*
p
=
pages
[
i
];
SetPageUptodate
(
p
);
...
...
fs/btrfs/inode.c
浏览文件 @
ea8c2819
...
...
@@ -303,6 +303,10 @@ int btrfs_set_bit_hook(struct inode *inode, u64 start, u64 end,
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
;
if
(
list_empty
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
))
{
list_add_tail
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
,
&
root
->
fs_info
->
delalloc_inodes
);
}
spin_unlock_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
...
...
@@ -325,6 +329,10 @@ 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
;
}
if
(
BTRFS_I
(
inode
)
->
delalloc_bytes
==
0
&&
!
list_empty
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
))
{
list_del_init
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
);
}
spin_unlock_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
...
...
@@ -408,6 +416,12 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
return
0
;
}
int
btrfs_set_extent_delalloc
(
struct
inode
*
inode
,
u64
start
,
u64
end
)
{
return
set_extent_delalloc
(
&
BTRFS_I
(
inode
)
->
io_tree
,
start
,
end
,
GFP_NOFS
);
}
struct
btrfs_writepage_fixup
{
struct
page
*
page
;
struct
btrfs_work
work
;
...
...
@@ -453,8 +467,7 @@ void btrfs_writepage_fixup_worker(struct btrfs_work *work)
goto
again
;
}
set_extent_delalloc
(
&
BTRFS_I
(
inode
)
->
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
page_start
,
page_end
);
ClearPageChecked
(
page
);
out:
unlock_extent
(
&
BTRFS_I
(
inode
)
->
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
...
...
@@ -1530,8 +1543,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
goto
again
;
}
set_extent_delalloc
(
&
BTRFS_I
(
inode
)
->
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
page_start
,
page_end
);
ret
=
0
;
if
(
offset
!=
PAGE_CACHE_SIZE
)
{
kaddr
=
kmap
(
page
);
...
...
@@ -1766,6 +1778,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
inode
->
i_mapping
,
GFP_NOFS
);
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
INIT_LIST_HEAD
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
);
btrfs_ordered_inode_tree_init
(
&
BTRFS_I
(
inode
)
->
ordered_tree
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
csum_mutex
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
extent_mutex
);
...
...
@@ -2158,6 +2171,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
btrfs_ordered_inode_tree_init
(
&
BTRFS_I
(
inode
)
->
ordered_tree
);
INIT_LIST_HEAD
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
csum_mutex
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
extent_mutex
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
...
...
@@ -2400,6 +2414,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
inode
->
i_mapping
,
GFP_NOFS
);
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
INIT_LIST_HEAD
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
csum_mutex
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
extent_mutex
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
...
...
@@ -3049,8 +3064,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
goto
again
;
}
set_extent_delalloc
(
&
BTRFS_I
(
inode
)
->
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
page_start
,
page_end
);
ret
=
0
;
/* page is wholly or partially inside EOF */
...
...
@@ -3373,6 +3387,26 @@ static int btrfs_rename(struct inode * old_dir, struct dentry *old_dentry,
return
ret
;
}
int
btrfs_start_delalloc_inodes
(
struct
btrfs_root
*
root
)
{
struct
list_head
*
head
=
&
root
->
fs_info
->
delalloc_inodes
;
struct
btrfs_inode
*
binode
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
while
(
!
list_empty
(
head
))
{
binode
=
list_entry
(
head
->
next
,
struct
btrfs_inode
,
delalloc_inodes
);
atomic_inc
(
&
binode
->
vfs_inode
.
i_count
);
spin_unlock_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
filemap_write_and_wait
(
binode
->
vfs_inode
.
i_mapping
);
iput
(
&
binode
->
vfs_inode
);
spin_lock_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
spin_unlock_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
return
0
;
}
static
int
btrfs_symlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
const
char
*
symname
)
{
...
...
@@ -3436,6 +3470,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
inode
->
i_mapping
,
GFP_NOFS
);
extent_io_tree_init
(
&
BTRFS_I
(
inode
)
->
io_failure_tree
,
inode
->
i_mapping
,
GFP_NOFS
);
INIT_LIST_HEAD
(
&
BTRFS_I
(
inode
)
->
delalloc_inodes
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
csum_mutex
);
mutex_init
(
&
BTRFS_I
(
inode
)
->
extent_mutex
);
BTRFS_I
(
inode
)
->
delalloc_bytes
=
0
;
...
...
fs/btrfs/ioctl.c
浏览文件 @
ea8c2819
...
...
@@ -274,8 +274,7 @@ int btrfs_defrag_file(struct file *file)
*/
clear_page_dirty_for_io
(
page
);
set_extent_delalloc
(
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
btrfs_set_extent_delalloc
(
inode
,
page_start
,
page_end
);
unlock_extent
(
io_tree
,
page_start
,
page_end
,
GFP_NOFS
);
set_page_dirty
(
page
);
...
...
@@ -784,6 +783,7 @@ long btrfs_ioctl(struct file *file, unsigned int
case
BTRFS_IOC_TRANS_END
:
return
btrfs_ioctl_trans_end
(
file
);
case
BTRFS_IOC_SYNC
:
btrfs_start_delalloc_inodes
(
root
);
btrfs_sync_fs
(
file
->
f_dentry
->
d_sb
,
1
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录