Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
8fd17795
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看板
提交
8fd17795
编写于
4月 19, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 19, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: early fsync support
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
7e38180e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
62 addition
and
5 deletion
+62
-5
fs/btrfs/TODO
fs/btrfs/TODO
+1
-0
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/root-tree.c
fs/btrfs/root-tree.c
+0
-1
fs/btrfs/super.c
fs/btrfs/super.c
+36
-1
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+22
-3
fs/btrfs/transaction.h
fs/btrfs/transaction.h
+1
-0
未找到文件。
fs/btrfs/TODO
浏览文件 @
8fd17795
...
...
@@ -7,6 +7,7 @@
* Get rid of struct ctree_path, limiting tree levels held at one time
* Add generation number to key pointer in nodes
* Add parent pointer back to extent map.
* Implement real list of pending transactions
* Release
* Do real tree locking
* Add extent mirroring (backup copies of blocks)
...
...
fs/btrfs/ctree.h
浏览文件 @
8fd17795
...
...
@@ -256,6 +256,7 @@ struct btrfs_fs_info {
struct
inode
*
btree_inode
;
struct
mutex
trans_mutex
;
struct
mutex
fs_mutex
;
struct
list_head
trans_list
;
struct
crypto_hash
*
hash_tfm
;
spinlock_t
hash_lock
;
struct
kobject
kobj
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
8fd17795
...
...
@@ -528,6 +528,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
init_bit_radix
(
&
fs_info
->
pending_del_radix
);
INIT_RADIX_TREE
(
&
fs_info
->
fs_roots_radix
,
GFP_NOFS
);
INIT_RADIX_TREE
(
&
fs_info
->
dev_radix
,
GFP_NOFS
);
INIT_LIST_HEAD
(
&
fs_info
->
trans_list
);
sb_set_blocksize
(
sb
,
4096
);
fs_info
->
running_transaction
=
NULL
;
fs_info
->
tree_root
=
tree_root
;
...
...
fs/btrfs/root-tree.c
浏览文件 @
8fd17795
...
...
@@ -100,7 +100,6 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
BUG_ON
(
refs
==
0
);
if
(
refs
==
1
)
{
ret
=
btrfs_del_item
(
trans
,
root
,
path
);
printk
(
"deleting root %Lu %Lu %u
\n
"
,
key
->
objectid
,
key
->
offset
,
key
->
flags
);
}
else
{
btrfs_set_root_refs
(
ri
,
refs
-
1
);
printk
(
"ref now %u root %Lu %Lu %u
\n
"
,
refs
-
1
,
key
->
objectid
,
key
->
offset
,
key
->
flags
);
...
...
fs/btrfs/super.c
浏览文件 @
8fd17795
...
...
@@ -11,6 +11,7 @@
#include <linux/mpage.h>
#include <linux/swap.h>
#include <linux/writeback.h>
#include <linux/statfs.h>
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
...
...
@@ -932,6 +933,26 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return
err
;
}
static
int
btrfs_sync_file
(
struct
file
*
file
,
struct
dentry
*
dentry
,
int
datasync
)
{
struct
inode
*
inode
=
dentry
->
d_inode
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
int
ret
;
struct
btrfs_trans_handle
*
trans
;
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
trans
=
btrfs_start_transaction
(
root
,
1
);
if
(
!
trans
)
{
ret
=
-
ENOMEM
;
goto
out
;
}
ret
=
btrfs_commit_transaction
(
trans
,
root
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
out:
return
ret
>
0
?
EIO
:
ret
;
}
static
int
btrfs_sync_fs
(
struct
super_block
*
sb
,
int
wait
)
{
struct
btrfs_trans_handle
*
trans
;
...
...
@@ -2353,6 +2374,19 @@ static int btrfs_getattr(struct vfsmount *mnt,
return
0
;
}
static
int
btrfs_statfs
(
struct
dentry
*
dentry
,
struct
kstatfs
*
buf
)
{
struct
btrfs_root
*
root
=
btrfs_sb
(
dentry
->
d_sb
);
struct
btrfs_super_block
*
disk_super
=
root
->
fs_info
->
disk_super
;
buf
->
f_namelen
=
BTRFS_NAME_LEN
;
buf
->
f_blocks
=
btrfs_super_total_blocks
(
disk_super
);
buf
->
f_bfree
=
buf
->
f_blocks
-
btrfs_super_blocks_used
(
disk_super
);
buf
->
f_bavail
=
buf
->
f_bfree
;
buf
->
f_bsize
=
dentry
->
d_sb
->
s_blocksize
;
buf
->
f_type
=
BTRFS_SUPER_MAGIC
;
return
0
;
}
static
struct
file_system_type
btrfs_fs_type
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"btrfs"
,
...
...
@@ -2362,7 +2396,6 @@ static struct file_system_type btrfs_fs_type = {
};
static
struct
super_operations
btrfs_super_ops
=
{
.
statfs
=
simple_statfs
,
.
delete_inode
=
btrfs_delete_inode
,
.
put_super
=
btrfs_put_super
,
.
read_inode
=
btrfs_read_locked_inode
,
...
...
@@ -2371,6 +2404,7 @@ static struct super_operations btrfs_super_ops = {
.
write_inode
=
btrfs_write_inode
,
.
alloc_inode
=
btrfs_alloc_inode
,
.
destroy_inode
=
btrfs_destroy_inode
,
.
statfs
=
btrfs_statfs
,
};
static
struct
inode_operations
btrfs_dir_inode_operations
=
{
...
...
@@ -2413,6 +2447,7 @@ static struct file_operations btrfs_file_operations = {
.
mmap
=
generic_file_mmap
,
.
open
=
generic_file_open
,
.
ioctl
=
btrfs_ioctl
,
.
fsync
=
btrfs_sync_file
,
};
static
int
__init
init_btrfs_fs
(
void
)
...
...
fs/btrfs/transaction.c
浏览文件 @
8fd17795
...
...
@@ -19,6 +19,7 @@ static void put_transaction(struct btrfs_transaction *transaction)
if
(
transaction
->
use_count
==
0
)
{
WARN_ON
(
total_trans
==
0
);
total_trans
--
;
list_del_init
(
&
transaction
->
list
);
memset
(
transaction
,
0
,
sizeof
(
*
transaction
));
kmem_cache_free
(
btrfs_transaction_cachep
,
transaction
);
}
...
...
@@ -43,6 +44,7 @@ static int join_transaction(struct btrfs_root *root)
cur_trans
->
in_commit
=
0
;
cur_trans
->
use_count
=
1
;
cur_trans
->
commit_done
=
0
;
list_add_tail
(
&
cur_trans
->
list
,
&
root
->
fs_info
->
trans_list
);
}
cur_trans
->
num_writers
++
;
return
0
;
...
...
@@ -236,6 +238,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
{
int
ret
=
0
;
struct
btrfs_transaction
*
cur_trans
;
struct
btrfs_transaction
*
prev_trans
=
NULL
;
struct
list_head
dirty_fs_roots
;
DEFINE_WAIT
(
wait
);
...
...
@@ -272,13 +275,29 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
BUG_ON
(
ret
);
cur_trans
=
root
->
fs_info
->
running_transaction
;
root
->
fs_info
->
running_transaction
=
NULL
;
btrfs_set_super_generation
(
root
->
fs_info
->
disk_super
,
root
->
fs_info
->
generation
+
1
);
if
(
cur_trans
->
list
.
prev
!=
&
root
->
fs_info
->
trans_list
)
{
prev_trans
=
list_entry
(
cur_trans
->
list
.
prev
,
struct
btrfs_transaction
,
list
);
if
(
prev_trans
->
commit_done
)
prev_trans
=
NULL
;
else
prev_trans
->
use_count
++
;
}
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
ret
=
btrfs_write_and_wait_transaction
(
trans
,
root
);
if
(
prev_trans
)
{
mutex_lock
(
&
root
->
fs_info
->
trans_mutex
);
wait_for_commit
(
root
,
prev_trans
);
put_transaction
(
prev_trans
);
mutex_unlock
(
&
root
->
fs_info
->
trans_mutex
);
}
btrfs_set_super_generation
(
root
->
fs_info
->
disk_super
,
cur_trans
->
transid
);
BUG_ON
(
ret
);
write_ctree_super
(
trans
,
root
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
btrfs_finish_extent_commit
(
trans
,
root
);
mutex_lock
(
&
root
->
fs_info
->
trans_mutex
);
cur_trans
->
commit_done
=
1
;
...
...
fs/btrfs/transaction.h
浏览文件 @
8fd17795
...
...
@@ -8,6 +8,7 @@ struct btrfs_transaction {
int
use_count
;
int
commit_done
;
int
magic
;
struct
list_head
list
;
wait_queue_head_t
writer_wait
;
wait_queue_head_t
commit_wait
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录