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
465bf6f4
Commit
465bf6f4
authored
May 03, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bch2_dev_get_ioref2(); io_read.c
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
91ffdecf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
fs/bcachefs/io_read.c
fs/bcachefs/io_read.c
+9
-5
No files found.
fs/bcachefs/io_read.c
View file @
465bf6f4
...
@@ -800,7 +800,6 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -800,7 +800,6 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
struct
bch_fs
*
c
=
trans
->
c
;
struct
bch_fs
*
c
=
trans
->
c
;
struct
extent_ptr_decoded
pick
;
struct
extent_ptr_decoded
pick
;
struct
bch_read_bio
*
rbio
=
NULL
;
struct
bch_read_bio
*
rbio
=
NULL
;
struct
bch_dev
*
ca
=
NULL
;
struct
promote_op
*
promote
=
NULL
;
struct
promote_op
*
promote
=
NULL
;
bool
bounce
=
false
,
read_full
=
false
,
narrow_crcs
=
false
;
bool
bounce
=
false
,
read_full
=
false
,
narrow_crcs
=
false
;
struct
bpos
data_pos
=
bkey_start_pos
(
k
.
k
);
struct
bpos
data_pos
=
bkey_start_pos
(
k
.
k
);
...
@@ -831,7 +830,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -831,7 +830,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
goto
err
;
goto
err
;
}
}
ca
=
bch2_dev_bkey_exists
(
c
,
pick
.
ptr
.
dev
);
struct
bch_dev
*
ca
=
bch2_dev_get_ioref2
(
c
,
pick
.
ptr
.
dev
,
READ
);
/*
/*
* Stale dirty pointers are treated as IO errors, but @failed isn't
* Stale dirty pointers are treated as IO errors, but @failed isn't
...
@@ -841,9 +840,11 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -841,9 +840,11 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
*/
*/
if
((
flags
&
BCH_READ_IN_RETRY
)
&&
if
((
flags
&
BCH_READ_IN_RETRY
)
&&
!
pick
.
ptr
.
cached
&&
!
pick
.
ptr
.
cached
&&
ca
&&
unlikely
(
dev_ptr_stale
(
ca
,
&
pick
.
ptr
)))
{
unlikely
(
dev_ptr_stale
(
ca
,
&
pick
.
ptr
)))
{
read_from_stale_dirty_pointer
(
trans
,
ca
,
k
,
pick
.
ptr
);
read_from_stale_dirty_pointer
(
trans
,
ca
,
k
,
pick
.
ptr
);
bch2_mark_io_failure
(
failed
,
&
pick
);
bch2_mark_io_failure
(
failed
,
&
pick
);
percpu_ref_put
(
&
ca
->
io_ref
);
goto
retry_pick
;
goto
retry_pick
;
}
}
...
@@ -858,8 +859,11 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -858,8 +859,11 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
* can happen if we retry, and the extent we were going to read
* can happen if we retry, and the extent we were going to read
* has been merged in the meantime:
* has been merged in the meantime:
*/
*/
if
(
pick
.
crc
.
compressed_size
>
orig
->
bio
.
bi_vcnt
*
PAGE_SECTORS
)
if
(
pick
.
crc
.
compressed_size
>
orig
->
bio
.
bi_vcnt
*
PAGE_SECTORS
)
{
if
(
ca
)
percpu_ref_put
(
&
ca
->
io_ref
);
goto
hole
;
goto
hole
;
}
iter
.
bi_size
=
pick
.
crc
.
compressed_size
<<
9
;
iter
.
bi_size
=
pick
.
crc
.
compressed_size
<<
9
;
goto
get_bio
;
goto
get_bio
;
...
@@ -964,7 +968,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -964,7 +968,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
rbio
->
bvec_iter
=
iter
;
rbio
->
bvec_iter
=
iter
;
rbio
->
offset_into_extent
=
offset_into_extent
;
rbio
->
offset_into_extent
=
offset_into_extent
;
rbio
->
flags
=
flags
;
rbio
->
flags
=
flags
;
rbio
->
have_ioref
=
pick_ret
>
0
&&
bch2_dev_get_ioref
(
ca
,
READ
)
;
rbio
->
have_ioref
=
ca
!=
NULL
;
rbio
->
narrow_crcs
=
narrow_crcs
;
rbio
->
narrow_crcs
=
narrow_crcs
;
rbio
->
hole
=
0
;
rbio
->
hole
=
0
;
rbio
->
retry
=
0
;
rbio
->
retry
=
0
;
...
@@ -994,7 +998,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
...
@@ -994,7 +998,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
* If it's being moved internally, we don't want to flag it as a cache
* If it's being moved internally, we don't want to flag it as a cache
* hit:
* hit:
*/
*/
if
(
pick
.
ptr
.
cached
&&
!
(
flags
&
BCH_READ_NODECODE
))
if
(
ca
&&
pick
.
ptr
.
cached
&&
!
(
flags
&
BCH_READ_NODECODE
))
bch2_bucket_io_time_reset
(
trans
,
pick
.
ptr
.
dev
,
bch2_bucket_io_time_reset
(
trans
,
pick
.
ptr
.
dev
,
PTR_BUCKET_NR
(
ca
,
&
pick
.
ptr
),
READ
);
PTR_BUCKET_NR
(
ca
,
&
pick
.
ptr
),
READ
);
...
...
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