Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
a8a2ee0c
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看板
提交
a8a2ee0c
编写于
3月 16, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
3月 16, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: add a name_len to dir items, reorder key
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
1e1d2701
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
25 deletion
+25
-25
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+4
-4
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+10
-4
fs/btrfs/dir-item.c
fs/btrfs/dir-item.c
+5
-9
fs/btrfs/dir-test.c
fs/btrfs/dir-test.c
+2
-4
fs/btrfs/print-tree.c
fs/btrfs/print-tree.c
+4
-4
未找到文件。
fs/btrfs/ctree.c
浏览文件 @
a8a2ee0c
...
...
@@ -107,14 +107,14 @@ static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
return
1
;
if
(
k1
.
objectid
<
k2
->
objectid
)
return
-
1
;
if
(
k1
.
offset
>
k2
->
offset
)
return
1
;
if
(
k1
.
offset
<
k2
->
offset
)
return
-
1
;
if
(
k1
.
flags
>
k2
->
flags
)
return
1
;
if
(
k1
.
flags
<
k2
->
flags
)
return
-
1
;
if
(
k1
.
offset
>
k2
->
offset
)
return
1
;
if
(
k1
.
offset
<
k2
->
offset
)
return
-
1
;
return
0
;
}
...
...
fs/btrfs/ctree.h
浏览文件 @
a8a2ee0c
...
...
@@ -26,14 +26,14 @@
*/
struct
btrfs_disk_key
{
__le64
objectid
;
__le64
offset
;
__le32
flags
;
__le64
offset
;
}
__attribute__
((
__packed__
));
struct
btrfs_key
{
u64
objectid
;
u64
offset
;
u32
flags
;
u64
offset
;
}
__attribute__
((
__packed__
));
/*
...
...
@@ -166,6 +166,7 @@ struct btrfs_inline_data_item {
struct
btrfs_dir_item
{
__le64
objectid
;
__le16
flags
;
__le16
name_len
;
u8
type
;
}
__attribute__
((
__packed__
));
...
...
@@ -431,9 +432,14 @@ static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val)
d
->
type
=
val
;
}
static
inline
u32
btrfs_dir_name_len
(
struct
btrfs_item
*
i
)
static
inline
u16
btrfs_dir_name_len
(
struct
btrfs_dir_item
*
d
)
{
return
le16_to_cpu
(
d
->
name_len
);
}
static
inline
void
btrfs_set_dir_name_len
(
struct
btrfs_dir_item
*
d
,
u16
val
)
{
return
btrfs_item_size
(
i
)
-
sizeof
(
struct
btrfs_dir_item
);
d
->
name_len
=
cpu_to_le16
(
val
);
}
static
inline
void
btrfs_disk_key_to_cpu
(
struct
btrfs_key
*
cpu
,
...
...
fs/btrfs/dir-item.c
浏览文件 @
a8a2ee0c
...
...
@@ -32,6 +32,7 @@ int btrfs_insert_dir_item(struct btrfs_root *root, char *name, int name_len,
btrfs_set_dir_objectid
(
dir_item
,
objectid
);
btrfs_set_dir_type
(
dir_item
,
type
);
btrfs_set_dir_flags
(
dir_item
,
0
);
btrfs_set_dir_name_len
(
dir_item
,
name_len
);
name_ptr
=
(
char
*
)(
dir_item
+
1
);
memcpy
(
name_ptr
,
name
,
name_len
);
out:
...
...
@@ -59,20 +60,15 @@ int btrfs_lookup_dir_item(struct btrfs_root *root, struct btrfs_path *path,
int
btrfs_match_dir_item_name
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
char
*
name
,
int
name_len
)
{
struct
btrfs_item
*
item
;
struct
btrfs_dir_item
*
dir_item
;
char
*
name_ptr
;
u32
item_len
;
item
=
path
->
nodes
[
0
]
->
leaf
.
items
+
path
->
slots
[
0
];
item_len
=
btrfs_item_size
(
item
);
if
(
item_len
!=
name_len
+
sizeof
(
struct
btrfs_dir_item
))
{
return
0
;
}
dir_item
=
btrfs_item_ptr
(
&
path
->
nodes
[
0
]
->
leaf
,
path
->
slots
[
0
],
struct
btrfs_dir_item
);
if
(
btrfs_dir_name_len
(
dir_item
)
!=
name_len
)
return
0
;
name_ptr
=
(
char
*
)(
dir_item
+
1
);
if
(
memcmp
(
name_ptr
,
name
,
name_len
))
{
if
(
memcmp
(
name_ptr
,
name
,
name_len
))
return
0
;
}
return
1
;
}
fs/btrfs/dir-test.c
浏览文件 @
a8a2ee0c
...
...
@@ -81,8 +81,7 @@ static int ins_one(struct btrfs_root *root, struct radix_tree_root *radix)
di
=
btrfs_item_ptr
(
&
path
.
nodes
[
0
]
->
leaf
,
path
.
slots
[
0
],
struct
btrfs_dir_item
);
found
=
(
char
*
)(
di
+
1
);
found_len
=
btrfs_dir_name_len
(
path
.
nodes
[
0
]
->
leaf
.
items
+
path
.
slots
[
0
]);
found_len
=
btrfs_dir_name_len
(
di
);
btrfs_name_hash
(
buf
,
strlen
(
buf
),
&
myhash
);
btrfs_name_hash
(
found
,
found_len
,
&
foundhash
);
if
(
myhash
!=
foundhash
)
...
...
@@ -227,8 +226,7 @@ static int empty_tree(struct btrfs_root *root, struct radix_tree_root *radix,
slot
=
path
.
slots
[
0
];
di
=
btrfs_item_ptr
(
&
path
.
nodes
[
0
]
->
leaf
,
slot
,
struct
btrfs_dir_item
);
found_len
=
btrfs_dir_name_len
(
path
.
nodes
[
0
]
->
leaf
.
items
+
slot
);
found_len
=
btrfs_dir_name_len
(
di
);
memcpy
(
buf
,
(
char
*
)(
di
+
1
),
found_len
);
BUG_ON
(
found_len
>
128
);
buf
[
found_len
]
=
'\0'
;
...
...
fs/btrfs/print-tree.c
浏览文件 @
a8a2ee0c
...
...
@@ -23,11 +23,11 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
item
=
l
->
items
+
i
;
type
=
btrfs_disk_key_type
(
&
item
->
key
);
printf
(
"
\t
item %d key (%Lu %
Lu %
u) itemoff %d itemsize %d
\n
"
,
printf
(
"
\t
item %d key (%Lu %
u %L
u) itemoff %d itemsize %d
\n
"
,
i
,
btrfs_disk_key_objectid
(
&
item
->
key
),
btrfs_disk_key_offset
(
&
item
->
key
),
btrfs_disk_key_flags
(
&
item
->
key
),
btrfs_disk_key_offset
(
&
item
->
key
),
btrfs_item_offset
(
item
),
btrfs_item_size
(
item
));
switch
(
type
)
{
...
...
@@ -81,11 +81,11 @@ void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t)
(
u32
)
BTRFS_NODEPTRS_PER_BLOCK
(
root
)
-
nr
);
fflush
(
stdout
);
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
printf
(
"
\t
key %d (%Lu %
Lu %
u) block %Lu
\n
"
,
printf
(
"
\t
key %d (%Lu %
u %L
u) block %Lu
\n
"
,
i
,
c
->
ptrs
[
i
].
key
.
objectid
,
c
->
ptrs
[
i
].
key
.
offset
,
c
->
ptrs
[
i
].
key
.
flags
,
c
->
ptrs
[
i
].
key
.
offset
,
btrfs_node_blockptr
(
c
,
i
));
fflush
(
stdout
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录