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
nexedi
linux
Commits
e011599b
Commit
e011599b
authored
Jun 19, 2007
by
Chris Mason
Committed by
David Woodhouse
Jun 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: reada while dropping snapshots
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
85e55b13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+30
-1
No files found.
fs/btrfs/extent-tree.c
View file @
e011599b
...
@@ -940,7 +940,6 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -940,7 +940,6 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
int
wrapped
=
0
;
int
wrapped
=
0
;
u64
limit
;
u64
limit
;
path
=
btrfs_alloc_path
();
ins
->
flags
=
0
;
ins
->
flags
=
0
;
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
...
@@ -974,6 +973,8 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -974,6 +973,8 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
data
,
1
);
data
,
1
);
}
}
path
=
btrfs_alloc_path
();
check_failed:
check_failed:
if
(
!
block_group
->
data
)
if
(
!
block_group
->
data
)
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
=
find_search_start
(
root
,
&
block_group
,
...
@@ -1355,6 +1356,28 @@ static int drop_leaf_ref(struct btrfs_trans_handle *trans,
...
@@ -1355,6 +1356,28 @@ static int drop_leaf_ref(struct btrfs_trans_handle *trans,
return
0
;
return
0
;
}
}
static
void
reada_walk_down
(
struct
btrfs_root
*
root
,
struct
btrfs_node
*
node
)
{
int
i
;
u32
nritems
;
u64
blocknr
;
int
ret
;
u32
refs
;
nritems
=
btrfs_header_nritems
(
&
node
->
header
);
for
(
i
=
0
;
i
<
nritems
;
i
++
)
{
blocknr
=
btrfs_node_blockptr
(
node
,
i
);
ret
=
lookup_extent_ref
(
NULL
,
root
,
blocknr
,
1
,
&
refs
);
BUG_ON
(
ret
);
if
(
refs
!=
1
)
continue
;
ret
=
readahead_tree_block
(
root
,
blocknr
);
if
(
ret
)
break
;
}
}
/*
/*
* helper function for drop_snapshot, this walks down the tree dropping ref
* helper function for drop_snapshot, this walks down the tree dropping ref
* counts as it goes.
* counts as it goes.
...
@@ -1375,6 +1398,7 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -1375,6 +1398,7 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
BUG_ON
(
ret
);
BUG_ON
(
ret
);
if
(
refs
>
1
)
if
(
refs
>
1
)
goto
out
;
goto
out
;
/*
/*
* walk down to the last node level and free all the leaves
* walk down to the last node level and free all the leaves
*/
*/
...
@@ -1382,8 +1406,13 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -1382,8 +1406,13 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
WARN_ON
(
*
level
<
0
);
WARN_ON
(
*
level
<
0
);
WARN_ON
(
*
level
>=
BTRFS_MAX_LEVEL
);
WARN_ON
(
*
level
>=
BTRFS_MAX_LEVEL
);
cur
=
path
->
nodes
[
*
level
];
cur
=
path
->
nodes
[
*
level
];
if
(
*
level
>
0
&&
path
->
slots
[
*
level
]
==
0
)
reada_walk_down
(
root
,
btrfs_buffer_node
(
cur
));
if
(
btrfs_header_level
(
btrfs_buffer_header
(
cur
))
!=
*
level
)
if
(
btrfs_header_level
(
btrfs_buffer_header
(
cur
))
!=
*
level
)
WARN_ON
(
1
);
WARN_ON
(
1
);
if
(
path
->
slots
[
*
level
]
>=
if
(
path
->
slots
[
*
level
]
>=
btrfs_header_nritems
(
btrfs_buffer_header
(
cur
)))
btrfs_header_nritems
(
btrfs_buffer_header
(
cur
)))
break
;
break
;
...
...
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