Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
4529ba49
Commit
4529ba49
authored
Jan 31, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Add data block hints to SSD mode too
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
b0c68f8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+16
-12
fs/btrfs/transaction.c
fs/btrfs/transaction.c
+1
-0
No files found.
fs/btrfs/ctree.h
View file @
4529ba49
...
@@ -354,6 +354,7 @@ struct btrfs_fs_info {
...
@@ -354,6 +354,7 @@ struct btrfs_fs_info {
spinlock_t
new_trans_lock
;
spinlock_t
new_trans_lock
;
u64
delalloc_bytes
;
u64
delalloc_bytes
;
u64
last_alloc
;
u64
last_alloc
;
u64
last_data_alloc
;
};
};
/*
/*
* in ram representation of the tree. extent_root is used for all allocations
* in ram representation of the tree. extent_root is used for all allocations
...
...
fs/btrfs/disk-io.c
View file @
4529ba49
...
@@ -688,6 +688,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
...
@@ -688,6 +688,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
closing
=
0
;
fs_info
->
closing
=
0
;
fs_info
->
total_pinned
=
0
;
fs_info
->
total_pinned
=
0
;
fs_info
->
last_alloc
=
0
;
fs_info
->
last_alloc
=
0
;
fs_info
->
last_data_alloc
=
0
;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
INIT_WORK
(
&
fs_info
->
trans_work
,
btrfs_transaction_cleaner
,
fs_info
);
INIT_WORK
(
&
fs_info
->
trans_work
,
btrfs_transaction_cleaner
,
fs_info
);
...
...
fs/btrfs/extent-tree.c
View file @
4529ba49
...
@@ -1410,6 +1410,7 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
...
@@ -1410,6 +1410,7 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
int
ret
;
int
ret
;
int
slot
=
0
;
int
slot
=
0
;
u64
last_byte
=
0
;
u64
last_byte
=
0
;
u64
*
last_ptr
=
NULL
;
u64
orig_search_start
=
search_start
;
u64
orig_search_start
=
search_start
;
int
start_found
;
int
start_found
;
struct
extent_buffer
*
l
;
struct
extent_buffer
*
l
;
...
@@ -1433,14 +1434,17 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
...
@@ -1433,14 +1434,17 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
/* for SSD, cluster allocations together as much as possible */
/* for SSD, cluster allocations together as much as possible */
if
(
btrfs_test_opt
(
root
,
SSD
))
{
if
(
btrfs_test_opt
(
root
,
SSD
))
{
if
(
!
data
)
{
if
(
data
)
if
(
root
->
fs_info
->
last_alloc
)
last_ptr
=
&
root
->
fs_info
->
last_data_alloc
;
hint_byte
=
root
->
fs_info
->
last_alloc
;
else
else
{
last_ptr
=
&
root
->
fs_info
->
last_alloc
;
hint_byte
=
hint_byte
&
if
(
*
last_ptr
)
{
~
((
u64
)
BTRFS_BLOCK_GROUP_SIZE
-
1
);
hint_byte
=
*
last_ptr
;
empty_size
+=
16
*
1024
*
1024
;
}
}
else
{
hint_byte
=
hint_byte
&
~
((
u64
)
BTRFS_BLOCK_GROUP_SIZE
-
1
);
empty_size
+=
16
*
1024
*
1024
;
}
}
}
}
...
@@ -1470,8 +1474,8 @@ check_failed:
...
@@ -1470,8 +1474,8 @@ check_failed:
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
,
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
,
total_needed
,
data
);
total_needed
,
data
);
if
(
!
data
&&
btrfs_test_opt
(
root
,
SSD
)
&&
info
->
last_alloc
&&
if
(
btrfs_test_opt
(
root
,
SSD
)
&&
*
last_ptr
&&
search_start
!=
info
->
last_alloc
)
{
search_start
!=
*
last_ptr
)
{
info
->
last_alloc
=
0
;
info
->
last_alloc
=
0
;
if
(
!
empty_size
)
{
if
(
!
empty_size
)
{
empty_size
+=
16
*
1024
*
1024
;
empty_size
+=
16
*
1024
*
1024
;
...
@@ -1609,6 +1613,8 @@ check_pending:
...
@@ -1609,6 +1613,8 @@ check_pending:
}
}
ins
->
offset
=
num_bytes
;
ins
->
offset
=
num_bytes
;
btrfs_free_path
(
path
);
btrfs_free_path
(
path
);
if
(
btrfs_test_opt
(
root
,
SSD
))
*
last_ptr
=
ins
->
objectid
+
ins
->
offset
;
return
0
;
return
0
;
new_group:
new_group:
...
@@ -1636,8 +1642,6 @@ enospc:
...
@@ -1636,8 +1642,6 @@ enospc:
error:
error:
btrfs_release_path
(
root
,
path
);
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
btrfs_free_path
(
path
);
if
(
btrfs_test_opt
(
root
,
SSD
)
&&
!
ret
&&
!
data
)
info
->
last_alloc
=
ins
->
objectid
+
ins
->
offset
;
return
ret
;
return
ret
;
}
}
/*
/*
...
...
fs/btrfs/transaction.c
View file @
4529ba49
...
@@ -58,6 +58,7 @@ static int join_transaction(struct btrfs_root *root)
...
@@ -58,6 +58,7 @@ static int join_transaction(struct btrfs_root *root)
root
->
fs_info
->
generation
++
;
root
->
fs_info
->
generation
++
;
root
->
fs_info
->
running_transaction
=
cur_trans
;
root
->
fs_info
->
running_transaction
=
cur_trans
;
root
->
fs_info
->
last_alloc
=
0
;
root
->
fs_info
->
last_alloc
=
0
;
root
->
fs_info
->
last_data_alloc
=
0
;
cur_trans
->
num_writers
=
1
;
cur_trans
->
num_writers
=
1
;
cur_trans
->
num_joined
=
0
;
cur_trans
->
num_joined
=
0
;
cur_trans
->
transid
=
root
->
fs_info
->
generation
;
cur_trans
->
transid
=
root
->
fs_info
->
generation
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment