Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
bae45de0
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bae45de0
编写于
4月 04, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 04, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: add dir inode index
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
b1a4d965
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
33 addition
and
9 deletion
+33
-9
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+8
-7
fs/btrfs/dir-item.c
fs/btrfs/dir-item.c
+19
-0
fs/btrfs/super.c
fs/btrfs/super.c
+2
-2
fs/btrfs/sysfs.c
fs/btrfs/sysfs.c
+4
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
bae45de0
...
...
@@ -282,41 +282,42 @@ struct btrfs_root {
* for every name in a directory.
*/
#define BTRFS_DIR_ITEM_KEY 2
#define BTRFS_DIR_INDEX_KEY 3
/*
* inline data is file data that fits in the btree.
*/
#define BTRFS_INLINE_DATA_KEY
3
#define BTRFS_INLINE_DATA_KEY
4
/*
* extent data is for data that can't fit in the btree. It points to
* a (hopefully) huge chunk of disk
*/
#define BTRFS_EXTENT_DATA_KEY
4
#define BTRFS_EXTENT_DATA_KEY
5
/*
* csum items have the checksums for data in the extents
*/
#define BTRFS_CSUM_ITEM_KEY
5
#define BTRFS_CSUM_ITEM_KEY
6
/*
* root items point to tree roots. There are typically in the root
* tree used by the super block to find all the other trees
*/
#define BTRFS_ROOT_ITEM_KEY
6
#define BTRFS_ROOT_ITEM_KEY
7
/*
* extent items are in the extent map tree. These record which blocks
* are used, and how many references there are to each block
*/
#define BTRFS_EXTENT_ITEM_KEY
7
#define BTRFS_EXTENT_ITEM_KEY
8
/*
* the inode map records which inode numbers are in use and where
* they actually live on disk
*/
#define BTRFS_INODE_MAP_ITEM_KEY
8
#define BTRFS_INODE_MAP_ITEM_KEY
9
/*
* string items are for debugging. They just store a short string of
* data in the FS
*/
#define BTRFS_STRING_ITEM_KEY
9
#define BTRFS_STRING_ITEM_KEY
10
static
inline
u64
btrfs_inode_generation
(
struct
btrfs_inode_item
*
i
)
{
...
...
fs/btrfs/dir-item.c
浏览文件 @
bae45de0
...
...
@@ -37,6 +37,25 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
name_ptr
=
(
char
*
)(
dir_item
+
1
);
btrfs_memcpy
(
root
,
path
->
nodes
[
0
]
->
b_data
,
name_ptr
,
name
,
name_len
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
btrfs_release_path
(
root
,
path
);
btrfs_set_key_type
(
&
key
,
BTRFS_DIR_INDEX_KEY
);
key
.
offset
=
objectid
;
ret
=
btrfs_insert_empty_item
(
trans
,
root
,
path
,
&
key
,
data_size
);
// FIXME clear the dirindex bit
if
(
ret
)
goto
out
;
dir_item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
->
nodes
[
0
]),
path
->
slots
[
0
],
struct
btrfs_dir_item
);
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
);
btrfs_memcpy
(
root
,
path
->
nodes
[
0
]
->
b_data
,
name_ptr
,
name
,
name_len
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
out:
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
...
...
fs/btrfs/super.c
浏览文件 @
bae45de0
...
...
@@ -447,7 +447,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
key
.
objectid
=
inode
->
i_ino
;
key
.
flags
=
0
;
btrfs_set_key_type
(
&
key
,
BTRFS_DIR_I
TEM
_KEY
);
btrfs_set_key_type
(
&
key
,
BTRFS_DIR_I
NDEX
_KEY
);
key
.
offset
=
filp
->
f_pos
;
path
=
btrfs_alloc_path
();
btrfs_init_path
(
path
);
...
...
@@ -477,7 +477,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
item
=
leaf
->
items
+
slot
;
if
(
btrfs_disk_key_objectid
(
&
item
->
key
)
!=
key
.
objectid
)
break
;
if
(
btrfs_disk_key_type
(
&
item
->
key
)
!=
BTRFS_DIR_I
TEM
_KEY
)
if
(
btrfs_disk_key_type
(
&
item
->
key
)
!=
BTRFS_DIR_I
NDEX
_KEY
)
continue
;
if
(
btrfs_disk_key_offset
(
&
item
->
key
)
<
filp
->
f_pos
)
continue
;
...
...
fs/btrfs/sysfs.c
0 → 100644
浏览文件 @
bae45de0
#include <linux/module.h>
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录