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
7f93bf8d
Commit
7f93bf8d
authored
Mar 24, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match the extent tree code to btrfs-progs for multi-device merging
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
eb20978f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
52 deletions
+7
-52
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+7
-52
No files found.
fs/btrfs/extent-tree.c
View file @
7f93bf8d
...
@@ -209,27 +209,22 @@ static u64 noinline find_search_start(struct btrfs_root *root,
...
@@ -209,27 +209,22 @@ static u64 noinline find_search_start(struct btrfs_root *root,
last
=
max
(
search_start
,
cache
->
key
.
objectid
);
last
=
max
(
search_start
,
cache
->
key
.
objectid
);
spin_lock_irq
(
&
free_space_cache
->
lock
);
state
=
find_first_extent_bit_state
(
free_space_cache
,
last
,
EXTENT_DIRTY
);
while
(
1
)
{
while
(
1
)
{
if
(
!
state
)
{
ret
=
find_first_extent_bit
(
&
root
->
fs_info
->
free_space_cache
,
last
,
&
start
,
&
end
,
EXTENT_DIRTY
);
if
(
ret
)
{
if
(
!
cache_miss
)
if
(
!
cache_miss
)
cache_miss
=
last
;
cache_miss
=
last
;
spin_unlock_irq
(
&
free_space_cache
->
lock
);
goto
new_group
;
goto
new_group
;
}
}
start
=
max
(
last
,
sta
te
->
sta
rt
);
start
=
max
(
last
,
start
);
last
=
state
->
end
+
1
;
last
=
end
+
1
;
if
(
last
-
start
<
num
)
{
if
(
last
-
start
<
num
)
{
if
(
last
==
cache
->
key
.
objectid
+
cache
->
key
.
offset
)
if
(
last
==
cache
->
key
.
objectid
+
cache
->
key
.
offset
)
cache_miss
=
start
;
cache_miss
=
start
;
do
{
state
=
extent_state_next
(
state
);
}
while
(
state
&&
!
(
state
->
state
&
EXTENT_DIRTY
));
continue
;
continue
;
}
}
spin_unlock_irq
(
&
free_space_cache
->
lock
);
if
(
data
!=
BTRFS_BLOCK_GROUP_MIXED
&&
if
(
data
!=
BTRFS_BLOCK_GROUP_MIXED
&&
start
+
num
>
cache
->
key
.
objectid
+
cache
->
key
.
offset
)
start
+
num
>
cache
->
key
.
objectid
+
cache
->
key
.
offset
)
goto
new_group
;
goto
new_group
;
...
@@ -1485,29 +1480,8 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
...
@@ -1485,29 +1480,8 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
data
=
BTRFS_BLOCK_GROUP_MIXED
;
data
=
BTRFS_BLOCK_GROUP_MIXED
;
}
}
if
(
!
data
)
{
if
(
search_end
==
(
u64
)
-
1
)
last_ptr
=
&
root
->
fs_info
->
last_alloc
;
search_end
=
btrfs_super_total_bytes
(
&
info
->
super_copy
);
empty_cluster
=
128
*
1024
;
}
if
(
data
&&
btrfs_test_opt
(
root
,
SSD
))
{
last_ptr
=
&
root
->
fs_info
->
last_data_alloc
;
empty_cluster
=
2
*
1024
*
1024
;
}
if
(
last_ptr
)
{
if
(
*
last_ptr
)
hint_byte
=
*
last_ptr
;
else
{
hint_byte
=
hint_byte
&
~
((
u64
)
BTRFS_BLOCK_GROUP_SIZE
-
1
);
empty_size
+=
empty_cluster
;
}
search_start
=
max
(
search_start
,
hint_byte
);
}
search_end
=
min
(
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
)
if
(
!
block_group
)
...
@@ -1531,18 +1505,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
...
@@ -1531,18 +1505,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
}
}
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
(
last_ptr
&&
*
last_ptr
&&
search_start
!=
*
last_ptr
)
{
*
last_ptr
=
0
;
if
(
!
empty_size
)
{
empty_size
+=
empty_cluster
;
total_needed
+=
empty_size
;
}
search_start
=
find_search_start
(
root
,
&
block_group
,
search_start
,
total_needed
,
data
);
}
search_start
=
stripe_align
(
root
,
search_start
);
search_start
=
stripe_align
(
root
,
search_start
);
cached_start
=
search_start
;
cached_start
=
search_start
;
btrfs_init_path
(
path
);
btrfs_init_path
(
path
);
...
@@ -1670,13 +1632,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
...
@@ -1670,13 +1632,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
}
}
ins
->
offset
=
num_bytes
;
ins
->
offset
=
num_bytes
;
btrfs_free_path
(
path
);
btrfs_free_path
(
path
);
if
(
last_ptr
)
{
*
last_ptr
=
ins
->
objectid
+
ins
->
offset
;
if
(
*
last_ptr
==
btrfs_super_total_bytes
(
&
root
->
fs_info
->
super_copy
))
{
*
last_ptr
=
0
;
}
}
return
0
;
return
0
;
new_group:
new_group:
...
...
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