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
1a2b2ac7
Commit
1a2b2ac7
authored
Dec 04, 2007
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Fix extent allocation for btree blocks as the disk fills
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
87ee04eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+17
-11
No files found.
fs/btrfs/extent-tree.c
View file @
1a2b2ac7
...
@@ -172,9 +172,7 @@ static u64 find_search_start(struct btrfs_root *root,
...
@@ -172,9 +172,7 @@ static u64 find_search_start(struct btrfs_root *root,
int
wrapped
=
0
;
int
wrapped
=
0
;
if
(
!
cache
)
{
if
(
!
cache
)
{
cache
=
btrfs_lookup_block_group
(
root
->
fs_info
,
search_start
);
goto
out
;
if
(
!
cache
)
return
search_start
;
}
}
again:
again:
ret
=
cache_block_group
(
root
,
cache
);
ret
=
cache_block_group
(
root
,
cache
);
...
@@ -205,6 +203,13 @@ static u64 find_search_start(struct btrfs_root *root,
...
@@ -205,6 +203,13 @@ static u64 find_search_start(struct btrfs_root *root,
return
start
;
return
start
;
}
}
out:
out:
cache
=
btrfs_lookup_block_group
(
root
->
fs_info
,
search_start
);
if
(
!
cache
)
{
printk
(
"Unable to find block group for %Lu
\n
"
,
search_start
);
WARN_ON
(
1
);
return
search_start
;
}
return
search_start
;
return
search_start
;
new_group:
new_group:
...
@@ -219,15 +224,14 @@ static u64 find_search_start(struct btrfs_root *root,
...
@@ -219,15 +224,14 @@ static u64 find_search_start(struct btrfs_root *root,
data
=
BTRFS_BLOCK_GROUP_MIXED
;
data
=
BTRFS_BLOCK_GROUP_MIXED
;
goto
wrapped
;
goto
wrapped
;
}
}
return
search_star
t
;
goto
ou
t
;
}
}
if
(
cache_miss
&&
!
cache
->
cached
)
{
if
(
cache_miss
&&
!
cache
->
cached
)
{
cache_block_group
(
root
,
cache
);
cache_block_group
(
root
,
cache
);
last
=
cache_miss
;
last
=
cache_miss
;
cache
=
btrfs_lookup_block_group
(
root
->
fs_info
,
last
);
cache
=
btrfs_lookup_block_group
(
root
->
fs_info
,
last
);
}
}
if
(
!
full_scan
)
cache
=
btrfs_find_block_group
(
root
,
cache
,
last
,
data
,
0
);
cache
=
btrfs_find_block_group
(
root
,
cache
,
last
,
data
,
0
);
if
(
!
cache
)
if
(
!
cache
)
goto
no_cache
;
goto
no_cache
;
*
cache_ret
=
cache
;
*
cache_ret
=
cache
;
...
@@ -985,12 +989,14 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -985,12 +989,14 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
search_end
=
btrfs_super_total_bytes
(
&
info
->
super_copy
);
search_end
=
btrfs_super_total_bytes
(
&
info
->
super_copy
);
if
(
hint_byte
)
{
if
(
hint_byte
)
{
block_group
=
btrfs_lookup_block_group
(
info
,
hint_byte
);
block_group
=
btrfs_lookup_block_group
(
info
,
hint_byte
);
if
(
!
block_group
)
hint_byte
=
search_start
;
block_group
=
btrfs_find_block_group
(
root
,
block_group
,
block_group
=
btrfs_find_block_group
(
root
,
block_group
,
hint_byte
,
data
,
1
);
hint_byte
,
data
,
1
);
}
else
{
}
else
{
block_group
=
btrfs_find_block_group
(
root
,
block_group
=
btrfs_find_block_group
(
root
,
trans
->
block_group
,
0
,
trans
->
block_group
,
data
,
1
);
search_start
,
data
,
1
);
}
}
total_needed
+=
empty_size
;
total_needed
+=
empty_size
;
...
@@ -1159,14 +1165,14 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -1159,14 +1165,14 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
if
(
!
full_scan
)
if
(
!
full_scan
)
total_needed
-=
empty_size
;
total_needed
-=
empty_size
;
full_scan
=
1
;
full_scan
=
1
;
data
=
BTRFS_BLOCK_GROUP_MIXED
;
}
else
}
else
wrapped
=
1
;
wrapped
=
1
;
}
}
block_group
=
btrfs_lookup_block_group
(
info
,
search_start
);
block_group
=
btrfs_lookup_block_group
(
info
,
search_start
);
cond_resched
();
cond_resched
();
if
(
!
full_scan
)
block_group
=
btrfs_find_block_group
(
root
,
block_group
,
block_group
=
btrfs_find_block_group
(
root
,
block_group
,
search_start
,
data
,
0
);
search_start
,
data
,
0
);
goto
check_failed
;
goto
check_failed
;
error:
error:
...
...
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