Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
3c12ac72
Commit
3c12ac72
authored
Apr 21, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Simplify device selection for mirrored reads
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
f2d8d74d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
20 deletions
+11
-20
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+4
-4
fs/btrfs/volumes.c
fs/btrfs/volumes.c
+7
-16
No files found.
fs/btrfs/extent-tree.c
View file @
3c12ac72
...
...
@@ -640,7 +640,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
if
(
!
path
)
return
-
ENOMEM
;
path
->
reada
=
0
;
path
->
reada
=
1
;
key
.
objectid
=
bytenr
;
btrfs_set_key_type
(
&
key
,
BTRFS_EXTENT_ITEM_KEY
);
key
.
offset
=
num_bytes
;
...
...
@@ -660,7 +660,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
btrfs_release_path
(
root
->
fs_info
->
extent_root
,
path
);
path
->
reada
=
0
;
path
->
reada
=
1
;
ret
=
btrfs_insert_extent_backref
(
trans
,
root
->
fs_info
->
extent_root
,
path
,
bytenr
,
root_objectid
,
ref_generation
,
owner
,
owner_offset
);
...
...
@@ -692,7 +692,7 @@ static int lookup_extent_ref(struct btrfs_trans_handle *trans,
WARN_ON
(
num_bytes
<
root
->
sectorsize
);
path
=
btrfs_alloc_path
();
path
->
reada
=
0
;
path
->
reada
=
1
;
key
.
objectid
=
bytenr
;
key
.
offset
=
num_bytes
;
btrfs_set_key_type
(
&
key
,
BTRFS_EXTENT_ITEM_KEY
);
...
...
@@ -1328,7 +1328,7 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
if
(
!
path
)
return
-
ENOMEM
;
path
->
reada
=
0
;
path
->
reada
=
1
;
ret
=
lookup_extent_backref
(
trans
,
extent_root
,
path
,
bytenr
,
root_objectid
,
ref_generation
,
...
...
fs/btrfs/volumes.c
View file @
3c12ac72
...
...
@@ -1029,19 +1029,8 @@ again:
else
if
(
mirror_num
)
{
stripe_index
=
mirror_num
-
1
;
}
else
{
int
i
;
u64
least
=
(
u64
)
-
1
;
struct
btrfs_device
*
cur
;
for
(
i
=
0
;
i
<
map
->
num_stripes
;
i
++
)
{
cur
=
map
->
stripes
[
i
].
dev
;
spin_lock
(
&
cur
->
io_lock
);
if
(
cur
->
total_ios
<
least
)
{
least
=
cur
->
total_ios
;
stripe_index
=
i
;
}
spin_unlock
(
&
cur
->
io_lock
);
}
u64
orig_stripe_nr
=
stripe_nr
;
stripe_index
=
do_div
(
orig_stripe_nr
,
num_stripes
);
}
}
else
if
(
map
->
type
&
BTRFS_BLOCK_GROUP_DUP
)
{
if
(
rw
&
(
1
<<
BIO_RW
))
...
...
@@ -1050,7 +1039,6 @@ again:
stripe_index
=
mirror_num
-
1
;
}
else
if
(
map
->
type
&
BTRFS_BLOCK_GROUP_RAID10
)
{
int
factor
=
map
->
num_stripes
/
map
->
sub_stripes
;
int
orig_stripe_nr
=
stripe_nr
;
stripe_index
=
do_div
(
stripe_nr
,
factor
);
stripe_index
*=
map
->
sub_stripes
;
...
...
@@ -1059,8 +1047,11 @@ again:
num_stripes
=
map
->
sub_stripes
;
else
if
(
mirror_num
)
stripe_index
+=
mirror_num
-
1
;
else
stripe_index
+=
orig_stripe_nr
%
map
->
sub_stripes
;
else
{
u64
orig_stripe_nr
=
stripe_nr
;
stripe_index
+=
do_div
(
orig_stripe_nr
,
map
->
sub_stripes
);
}
}
else
{
/*
* after this do_div call, stripe_nr is the number of stripes
...
...
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