Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
01f46658
Commit
01f46658
authored
Dec 21, 2007
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Less aggressive readahead on deletes
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
879c1cfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+11
-9
No files found.
fs/btrfs/ctree.c
View file @
01f46658
...
@@ -987,9 +987,10 @@ static int push_nodes_for_insert(struct btrfs_trans_handle *trans,
...
@@ -987,9 +987,10 @@ static int push_nodes_for_insert(struct btrfs_trans_handle *trans,
* readahead one full node of leaves
* readahead one full node of leaves
*/
*/
static
void
reada_for_search
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
static
void
reada_for_search
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
level
,
int
slot
)
int
level
,
int
slot
,
u64
objectid
)
{
{
struct
extent_buffer
*
node
;
struct
extent_buffer
*
node
;
struct
btrfs_disk_key
disk_key
;
u32
nritems
;
u32
nritems
;
u64
search
;
u64
search
;
u64
lowest_read
;
u64
lowest_read
;
...
@@ -1031,6 +1032,11 @@ static void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
...
@@ -1031,6 +1032,11 @@ static void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
if
(
nr
>=
nritems
)
if
(
nr
>=
nritems
)
break
;
break
;
}
}
if
(
path
->
reada
<
0
&&
objectid
)
{
btrfs_node_key
(
node
,
&
disk_key
,
nr
);
if
(
btrfs_disk_key_objectid
(
&
disk_key
)
!=
objectid
)
break
;
}
search
=
btrfs_node_blockptr
(
node
,
nr
);
search
=
btrfs_node_blockptr
(
node
,
nr
);
if
((
search
>=
lowest_read
&&
search
<=
highest_read
)
||
if
((
search
>=
lowest_read
&&
search
<=
highest_read
)
||
(
search
<
lowest_read
&&
lowest_read
-
search
<=
32768
)
||
(
search
<
lowest_read
&&
lowest_read
-
search
<=
32768
)
||
...
@@ -1136,7 +1142,8 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -1136,7 +1142,8 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
bytenr
=
btrfs_node_blockptr
(
b
,
slot
);
bytenr
=
btrfs_node_blockptr
(
b
,
slot
);
ptr_gen
=
btrfs_node_ptr_generation
(
b
,
slot
);
ptr_gen
=
btrfs_node_ptr_generation
(
b
,
slot
);
if
(
should_reada
)
if
(
should_reada
)
reada_for_search
(
root
,
p
,
level
,
slot
);
reada_for_search
(
root
,
p
,
level
,
slot
,
key
->
objectid
);
b
=
read_tree_block
(
root
,
bytenr
,
b
=
read_tree_block
(
root
,
bytenr
,
btrfs_level_size
(
root
,
level
-
1
));
btrfs_level_size
(
root
,
level
-
1
));
if
(
ptr_gen
!=
btrfs_header_generation
(
b
))
{
if
(
ptr_gen
!=
btrfs_header_generation
(
b
))
{
...
@@ -2671,9 +2678,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
...
@@ -2671,9 +2678,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
if
(
next
)
if
(
next
)
free_extent_buffer
(
next
);
free_extent_buffer
(
next
);
if
(
path
->
reada
<
0
)
reada_for_search
(
root
,
path
,
level
,
slot
);
next
=
read_tree_block
(
root
,
bytenr
,
next
=
read_tree_block
(
root
,
bytenr
,
btrfs_level_size
(
root
,
level
-
1
));
btrfs_level_size
(
root
,
level
-
1
));
break
;
break
;
...
@@ -2687,8 +2691,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
...
@@ -2687,8 +2691,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
path
->
slots
[
level
]
=
0
;
path
->
slots
[
level
]
=
0
;
if
(
!
level
)
if
(
!
level
)
break
;
break
;
if
(
path
->
reada
)
reada_for_search
(
root
,
path
,
level
,
0
);
next
=
read_tree_block
(
root
,
btrfs_node_blockptr
(
next
,
0
),
next
=
read_tree_block
(
root
,
btrfs_node_blockptr
(
next
,
0
),
btrfs_level_size
(
root
,
level
-
1
));
btrfs_level_size
(
root
,
level
-
1
));
}
}
...
@@ -2726,7 +2728,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
...
@@ -2726,7 +2728,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
free_extent_buffer
(
next
);
free_extent_buffer
(
next
);
if
(
path
->
reada
)
if
(
path
->
reada
)
reada_for_search
(
root
,
path
,
level
,
slot
);
reada_for_search
(
root
,
path
,
level
,
slot
,
0
);
next
=
read_tree_block
(
root
,
bytenr
,
next
=
read_tree_block
(
root
,
bytenr
,
btrfs_level_size
(
root
,
level
-
1
));
btrfs_level_size
(
root
,
level
-
1
));
...
@@ -2742,7 +2744,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
...
@@ -2742,7 +2744,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
if
(
!
level
)
if
(
!
level
)
break
;
break
;
if
(
path
->
reada
)
if
(
path
->
reada
)
reada_for_search
(
root
,
path
,
level
,
0
);
reada_for_search
(
root
,
path
,
level
,
0
,
0
);
next
=
read_tree_block
(
root
,
btrfs_node_blockptr
(
next
,
0
),
next
=
read_tree_block
(
root
,
btrfs_node_blockptr
(
next
,
0
),
btrfs_level_size
(
root
,
level
-
1
));
btrfs_level_size
(
root
,
level
-
1
));
}
}
...
...
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