Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
e18e4809
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e18e4809
编写于
1月 18, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Add mount -o ssd, which includes optimizations for seek free storage
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
04005cc7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
2 deletion
+47
-2
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+2
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+3
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+30
-1
fs/btrfs/super.c
fs/btrfs/super.c
+8
-1
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+1
-0
fs/btrfs/tree-defrag.c
fs/btrfs/tree-defrag.c
+3
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
e18e4809
...
...
@@ -351,6 +351,7 @@ struct btrfs_fs_info {
spinlock_t
delalloc_lock
;
spinlock_t
new_trans_lock
;
u64
delalloc_bytes
;
u64
last_alloc
;
};
/*
* in ram representation of the tree. extent_root is used for all allocations
...
...
@@ -444,6 +445,7 @@ struct btrfs_root {
#define BTRFS_MOUNT_NODATASUM (1 << 0)
#define BTRFS_MOUNT_NODATACOW (1 << 1)
#define BTRFS_MOUNT_NOBARRIER (1 << 2)
#define BTRFS_MOUNT_SSD (1 << 3)
#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
...
...
fs/btrfs/disk-io.c
浏览文件 @
e18e4809
...
...
@@ -193,6 +193,7 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
}
eb
=
alloc_extent_buffer
(
tree
,
start
,
len
,
page
,
GFP_NOFS
);
read_extent_buffer_pages
(
tree
,
eb
,
start
+
PAGE_CACHE_SIZE
,
1
);
btrfs_clear_buffer_defrag
(
eb
);
found_start
=
btrfs_header_bytenr
(
eb
);
if
(
found_start
!=
start
)
{
printk
(
"warning: eb start incorrect %Lu buffer %Lu len %lu
\n
"
,
...
...
@@ -676,6 +677,8 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
do_barriers
=
1
;
fs_info
->
closing
=
0
;
fs_info
->
total_pinned
=
0
;
fs_info
->
last_alloc
=
0
;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
INIT_WORK
(
&
fs_info
->
trans_work
,
btrfs_transaction_cleaner
,
fs_info
);
#else
...
...
fs/btrfs/extent-tree.c
浏览文件 @
e18e4809
...
...
@@ -1431,6 +1431,19 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
data
=
BTRFS_BLOCK_GROUP_MIXED
;
}
/* for SSD, cluster allocations together as much as possible */
if
(
btrfs_test_opt
(
root
,
SSD
))
{
if
(
!
data
)
{
if
(
root
->
fs_info
->
last_alloc
)
hint_byte
=
root
->
fs_info
->
last_alloc
;
else
{
hint_byte
=
hint_byte
&
~
((
u64
)
BTRFS_BLOCK_GROUP_SIZE
-
1
);
empty_size
+=
16
*
1024
*
1024
;
}
}
}
search_end
=
min
(
search_end
,
btrfs_super_total_bytes
(
&
info
->
super_copy
));
if
(
hint_byte
)
{
...
...
@@ -1456,6 +1469,19 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
}
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
,
total_needed
,
data
);
if
(
!
data
&&
btrfs_test_opt
(
root
,
SSD
)
&&
info
->
last_alloc
&&
search_start
!=
info
->
last_alloc
)
{
info
->
last_alloc
=
0
;
if
(
!
empty_size
)
{
empty_size
+=
16
*
1024
*
1024
;
total_needed
+=
empty_size
;
}
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
,
total_needed
,
data
);
}
search_start
=
stripe_align
(
root
,
search_start
);
cached_start
=
search_start
;
btrfs_init_path
(
path
);
...
...
@@ -1610,6 +1636,8 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
error:
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
if
(
btrfs_test_opt
(
root
,
SSD
)
&&
!
ret
&&
!
data
)
info
->
last_alloc
=
ins
->
objectid
+
ins
->
offset
;
return
ret
;
}
/*
...
...
@@ -1778,7 +1806,8 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
buf
->
start
,
buf
->
start
+
buf
->
len
-
1
,
EXTENT_CSUM
,
GFP_NOFS
);
buf
->
flags
|=
EXTENT_CSUM
;
btrfs_set_buffer_defrag
(
buf
);
if
(
!
btrfs_test_opt
(
root
,
SSD
))
btrfs_set_buffer_defrag
(
buf
);
trans
->
blocks_used
++
;
return
buf
;
}
...
...
fs/btrfs/super.c
浏览文件 @
e18e4809
...
...
@@ -64,7 +64,7 @@ static void btrfs_put_super (struct super_block * sb)
enum
{
Opt_subvol
,
Opt_nodatasum
,
Opt_nodatacow
,
Opt_max_extent
,
Opt_alloc_start
,
Opt_nobarrier
,
Opt_err
,
Opt_alloc_start
,
Opt_nobarrier
,
Opt_
ssd
,
Opt_
err
,
};
static
match_table_t
tokens
=
{
...
...
@@ -74,6 +74,7 @@ static match_table_t tokens = {
{
Opt_nobarrier
,
"nobarrier"
},
{
Opt_max_extent
,
"max_extent=%s"
},
{
Opt_alloc_start
,
"alloc_start=%s"
},
{
Opt_ssd
,
"ssd"
},
{
Opt_err
,
NULL
}
};
...
...
@@ -149,6 +150,12 @@ static int parse_options (char * options,
btrfs_set_opt
(
info
->
mount_opt
,
NODATASUM
);
}
break
;
case
Opt_ssd
:
if
(
info
)
{
printk
(
"btrfs: use ssd allocation scheme
\n
"
);
btrfs_set_opt
(
info
->
mount_opt
,
SSD
);
}
break
;
case
Opt_nobarrier
:
if
(
info
)
{
printk
(
"btrfs: turning off barriers
\n
"
);
...
...
fs/btrfs/transaction.c
浏览文件 @
e18e4809
...
...
@@ -57,6 +57,7 @@ static int join_transaction(struct btrfs_root *root)
BUG_ON
(
!
cur_trans
);
root
->
fs_info
->
generation
++
;
root
->
fs_info
->
running_transaction
=
cur_trans
;
root
->
fs_info
->
last_alloc
=
0
;
cur_trans
->
num_writers
=
1
;
cur_trans
->
num_joined
=
0
;
cur_trans
->
transid
=
root
->
fs_info
->
generation
;
...
...
fs/btrfs/tree-defrag.c
浏览文件 @
e18e4809
...
...
@@ -179,6 +179,9 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
if
(
root
->
ref_cows
==
0
&&
!
is_extent
)
goto
out
;
if
(
btrfs_test_opt
(
root
,
SSD
))
goto
out
;
path
=
btrfs_alloc_path
();
if
(
!
path
)
return
-
ENOMEM
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录