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
0f1ebbd1
Commit
0f1ebbd1
authored
Oct 15, 2007
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Large block related defrag optimizations
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
19c00ddc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+1
-3
fs/btrfs/tree-defrag.c
fs/btrfs/tree-defrag.c
+22
-1
No files found.
fs/btrfs/ctree.c
View file @
0f1ebbd1
...
...
@@ -217,11 +217,9 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
root
->
fs_info
->
generation
);
WARN_ON
(
1
);
}
if
(
btrfs_buffer_defrag_done
(
parent
))
return
0
;
parent_level
=
btrfs_header_level
(
parent
);
parent_nritems
=
btrfs_header_nritems
(
parent
);
parent_level
=
btrfs_header_level
(
parent
);
blocksize
=
btrfs_level_size
(
root
,
parent_level
-
1
);
start_slot
=
0
;
...
...
fs/btrfs/tree-defrag.c
View file @
0f1ebbd1
...
...
@@ -118,7 +118,6 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans,
WARN_ON
(
*
level
>=
BTRFS_MAX_LEVEL
);
btrfs_clear_buffer_defrag
(
path
->
nodes
[
*
level
]);
btrfs_clear_buffer_defrag_done
(
path
->
nodes
[
*
level
]);
free_extent_buffer
(
path
->
nodes
[
*
level
]);
path
->
nodes
[
*
level
]
=
NULL
;
...
...
@@ -148,6 +147,26 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans,
root
->
defrag_level
=
i
;
return
0
;
}
else
{
if
(
*
level
>
1
&&
path
->
nodes
[
*
level
]
!=
root
->
node
)
{
struct
extent_buffer
*
next
;
u64
last
;
int
ret
;
ret
=
btrfs_cow_block
(
trans
,
root
,
path
->
nodes
[
*
level
],
path
->
nodes
[
*
level
+
1
],
path
->
slots
[
*
level
+
1
],
&
next
);
BUG_ON
(
ret
);
path
->
nodes
[
*
level
]
=
next
;
last
=
next
->
start
;
ret
=
btrfs_realloc_node
(
trans
,
root
,
next
,
cache_only
,
&
last
);
BUG_ON
(
ret
);
if
(
root
==
root
->
fs_info
->
extent_root
)
btrfs_extent_post_op
(
trans
,
root
);
}
btrfs_clear_buffer_defrag
(
path
->
nodes
[
*
level
]);
btrfs_clear_buffer_defrag_done
(
path
->
nodes
[
*
level
]);
free_extent_buffer
(
path
->
nodes
[
*
level
]);
...
...
@@ -183,9 +202,11 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
level
=
btrfs_header_level
(
root
->
node
);
orig_level
=
level
;
if
(
level
==
0
)
{
goto
out
;
}
if
(
root
->
defrag_progress
.
objectid
==
0
)
{
extent_buffer_get
(
root
->
node
);
ret
=
btrfs_cow_block
(
trans
,
root
,
root
->
node
,
NULL
,
0
,
&
tmp
);
...
...
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