Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
293ffd5f
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
293ffd5f
编写于
3月 20, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
3月 20, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: change dir-test to insert inode_items
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
313a013b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
9 deletion
+43
-9
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+6
-0
fs/btrfs/dir-test.c
fs/btrfs/dir-test.c
+30
-9
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+2
-0
fs/btrfs/print-tree.c
fs/btrfs/print-tree.c
+5
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
293ffd5f
...
...
@@ -219,6 +219,7 @@ struct btrfs_fs_info {
struct
list_head
cache
;
u64
last_inode_alloc
;
u64
last_inode_alloc_dirid
;
u64
generation
;
int
cache_size
;
int
fp
;
struct
btrfs_trans_handle
*
running_transaction
;
...
...
@@ -802,4 +803,9 @@ int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
int
btrfs_lookup_inode_map
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
objectid
,
int
mod
);
int
btrfs_insert_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
u64
objectid
,
struct
btrfs_inode_item
*
inode_item
);
int
btrfs_lookup_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
objectid
,
int
mod
);
#endif
fs/btrfs/dir-test.c
浏览文件 @
293ffd5f
...
...
@@ -39,6 +39,13 @@ static int find_num(struct radix_tree_root *root, unsigned long *num_ret,
return
0
;
}
static
void
initial_inode_init
(
struct
btrfs_root
*
root
,
struct
btrfs_inode_item
*
inode_item
)
{
memset
(
inode_item
,
0
,
sizeof
(
*
inode_item
));
btrfs_set_inode_generation
(
inode_item
,
root
->
fs_info
->
generation
);
}
static
int
ins_one
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
radix_tree_root
*
radix
)
{
...
...
@@ -48,6 +55,7 @@ static int ins_one(struct btrfs_trans_handle *trans, struct btrfs_root *root,
u64
objectid
;
struct
btrfs_path
path
;
struct
btrfs_key
inode_map
;
struct
btrfs_inode_item
inode_item
;
find_num
(
radix
,
&
oid
,
0
);
sprintf
(
buf
,
"str-%lu"
,
oid
);
...
...
@@ -61,6 +69,11 @@ static int ins_one(struct btrfs_trans_handle *trans, struct btrfs_root *root,
inode_map
.
offset
=
0
;
ret
=
btrfs_insert_inode_map
(
trans
,
root
,
objectid
,
&
inode_map
);
if
(
ret
)
goto
error
;
initial_inode_init
(
root
,
&
inode_item
);
ret
=
btrfs_insert_inode
(
trans
,
root
,
objectid
,
&
inode_item
);
if
(
ret
)
goto
error
;
ret
=
btrfs_insert_dir_item
(
trans
,
root
,
buf
,
strlen
(
buf
),
dir_oid
,
...
...
@@ -143,7 +156,6 @@ static int del_dir_item(struct btrfs_trans_handle *trans,
unsigned
long
*
ptr
;
u64
file_objectid
;
struct
btrfs_dir_item
*
di
;
struct
btrfs_path
map_path
;
/* find the inode number of the file */
di
=
btrfs_item_ptr
(
&
path
->
nodes
[
0
]
->
leaf
,
path
->
slots
[
0
],
...
...
@@ -153,20 +165,31 @@ static int del_dir_item(struct btrfs_trans_handle *trans,
/* delete the directory item */
ret
=
btrfs_del_item
(
trans
,
root
,
path
);
if
(
ret
)
goto
out
;
goto
out_release
;
btrfs_release_path
(
root
,
path
);
/* delete the inode */
btrfs_init_path
(
path
);
ret
=
btrfs_lookup_inode
(
trans
,
root
,
path
,
file_objectid
,
-
1
);
if
(
ret
)
goto
out_release
;
ret
=
btrfs_del_item
(
trans
,
root
,
path
);
if
(
ret
)
goto
out_release
;
btrfs_release_path
(
root
,
path
);
/* delete the inode mapping */
btrfs_init_path
(
&
map_
path
);
ret
=
btrfs_lookup_inode_map
(
trans
,
root
,
&
map_
path
,
file_objectid
,
-
1
);
btrfs_init_path
(
path
);
ret
=
btrfs_lookup_inode_map
(
trans
,
root
,
path
,
file_objectid
,
-
1
);
if
(
ret
)
goto
out_release
;
ret
=
btrfs_del_item
(
trans
,
root
->
fs_info
->
inode_root
,
&
map_
path
);
ret
=
btrfs_del_item
(
trans
,
root
->
fs_info
->
inode_root
,
path
);
if
(
ret
)
goto
out_release
;
if
(
root
->
fs_info
->
last_inode_alloc
>
file_objectid
)
root
->
fs_info
->
last_inode_alloc
=
file_objectid
;
btrfs_release_path
(
root
,
&
map_
path
);
btrfs_release_path
(
root
,
path
);
ptr
=
radix_tree_delete
(
radix
,
radix_index
);
if
(
!
ptr
)
{
ret
=
-
5555
;
...
...
@@ -174,7 +197,7 @@ static int del_dir_item(struct btrfs_trans_handle *trans,
}
return
0
;
out_release:
btrfs_release_path
(
root
,
&
map_
path
);
btrfs_release_path
(
root
,
path
);
out:
printf
(
"failed to delete %lu %d
\n
"
,
radix_index
,
ret
);
return
-
1
;
...
...
@@ -201,7 +224,6 @@ static int del_one(struct btrfs_trans_handle *trans, struct btrfs_root *root,
ret
=
del_dir_item
(
trans
,
root
,
radix
,
oid
,
&
path
);
if
(
ret
)
goto
out_release
;
btrfs_release_path
(
root
,
&
path
);
return
ret
;
out_release:
btrfs_release_path
(
root
,
&
path
);
...
...
@@ -312,7 +334,6 @@ static int empty_tree(struct btrfs_trans_handle *trans, struct btrfs_root
found
);
return
-
1
;
}
btrfs_release_path
(
root
,
&
path
);
if
(
!
keep_running
)
break
;
}
...
...
fs/btrfs/disk-io.c
浏览文件 @
293ffd5f
...
...
@@ -226,6 +226,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, struct
ret
=
btrfs_del_root
(
trans
,
root
->
fs_info
->
tree_root
,
&
snap_key
);
BUG_ON
(
ret
);
root
->
fs_info
->
generation
=
root
->
root_key
.
offset
+
1
;
return
ret
;
}
...
...
@@ -328,6 +329,7 @@ struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *super)
root
->
commit_root
=
root
->
node
;
root
->
node
->
count
++
;
root
->
ref_cows
=
1
;
root
->
fs_info
->
generation
=
root
->
root_key
.
offset
+
1
;
return
root
;
}
...
...
fs/btrfs/print-tree.c
浏览文件 @
293ffd5f
...
...
@@ -14,6 +14,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
struct
btrfs_root_item
*
ri
;
struct
btrfs_dir_item
*
di
;
struct
btrfs_inode_map_item
*
mi
;
struct
btrfs_inode_item
*
ii
;
u32
type
;
printf
(
"leaf %Lu total ptrs %d free space %d
\n
"
,
...
...
@@ -32,6 +33,10 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
btrfs_item_size
(
item
));
switch
(
type
)
{
case
BTRFS_INODE_ITEM_KEY
:
ii
=
btrfs_item_ptr
(
l
,
i
,
struct
btrfs_inode_item
);
printf
(
"
\t\t
inode generation %Lu size %Lu
\n
"
,
btrfs_inode_generation
(
ii
),
btrfs_inode_size
(
ii
));
break
;
case
BTRFS_DIR_ITEM_KEY
:
di
=
btrfs_item_ptr
(
l
,
i
,
struct
btrfs_dir_item
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录