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
3858aa42
Commit
3858aa42
authored
Apr 30, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: ptr_stale() -> dev_ptr_stale()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
302c980a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
16 deletions
+18
-16
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+1
-1
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+1
-1
fs/bcachefs/buckets.h
fs/bcachefs/buckets.h
+8
-6
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+2
-2
fs/bcachefs/extents.c
fs/bcachefs/extents.c
+4
-4
fs/bcachefs/io_read.c
fs/bcachefs/io_read.c
+2
-2
No files found.
fs/bcachefs/bcachefs.h
View file @
3858aa42
...
...
@@ -573,7 +573,7 @@ struct bch_dev {
* Buckets:
* Per-bucket arrays are protected by c->mark_lock, bucket_lock and
* gc_lock, for device resize - holding any is sufficient for access:
* Or rcu_read_lock(), but only for ptr_stale():
* Or rcu_read_lock(), but only for
dev_
ptr_stale():
*/
struct
bucket_array
__rcu
*
buckets_gc
;
struct
bucket_gens
__rcu
*
bucket_gens
;
...
...
fs/bcachefs/btree_gc.c
View file @
3858aa42
...
...
@@ -1257,7 +1257,7 @@ static int gc_btree_gens_key(struct btree_trans *trans,
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
struct
bch_dev
*
ca
=
bch2_dev_bkey_exists
(
c
,
ptr
->
dev
);
if
(
ptr_stale
(
ca
,
ptr
)
>
16
)
{
if
(
dev_
ptr_stale
(
ca
,
ptr
)
>
16
)
{
percpu_up_read
(
&
c
->
mark_lock
);
goto
update
;
}
...
...
fs/bcachefs/buckets.h
View file @
3858aa42
...
...
@@ -170,17 +170,19 @@ static inline int gen_after(u8 a, u8 b)
return
r
>
0
?
r
:
0
;
}
static
inline
u8
dev_ptr_stale_rcu
(
struct
bch_dev
*
ca
,
const
struct
bch_extent_ptr
*
ptr
)
{
return
gen_after
(
*
bucket_gen
(
ca
,
PTR_BUCKET_NR
(
ca
,
ptr
)),
ptr
->
gen
);
}
/**
* ptr_stale() - check if a pointer points into a bucket that has been
*
dev_
ptr_stale() - check if a pointer points into a bucket that has been
* invalidated.
*/
static
inline
u8
ptr_stale
(
struct
bch_dev
*
ca
,
const
struct
bch_extent_ptr
*
ptr
)
static
inline
u8
dev_ptr_stale
(
struct
bch_dev
*
ca
,
const
struct
bch_extent_ptr
*
ptr
)
{
u8
ret
;
rcu_read_lock
();
ret
=
gen_after
(
*
bucket_gen
(
ca
,
PTR_BUCKET_NR
(
ca
,
ptr
)),
ptr
->
gen
);
u8
ret
=
dev_ptr_stale_rcu
(
ca
,
ptr
);
rcu_read_unlock
();
return
ret
;
...
...
fs/bcachefs/ec.c
View file @
3858aa42
...
...
@@ -714,7 +714,7 @@ static void ec_block_endio(struct bio *bio)
bch2_blk_status_to_str
(
bio
->
bi_status
)))
clear_bit
(
ec_bio
->
idx
,
ec_bio
->
buf
->
valid
);
if
(
ptr_stale
(
ca
,
ptr
))
{
if
(
dev_
ptr_stale
(
ca
,
ptr
))
{
bch_err_ratelimited
(
ca
->
fs
,
"error %s stripe: stale pointer after io"
,
bio_data_dir
(
bio
)
==
READ
?
"reading from"
:
"writing to"
);
...
...
@@ -738,7 +738,7 @@ static void ec_block_io(struct bch_fs *c, struct ec_stripe_buf *buf,
:
BCH_DATA_parity
;
int
rw
=
op_is_write
(
opf
);
if
(
ptr_stale
(
ca
,
ptr
))
{
if
(
dev_
ptr_stale
(
ca
,
ptr
))
{
bch_err_ratelimited
(
c
,
"error %s stripe: stale pointer"
,
rw
==
READ
?
"reading from"
:
"writing to"
);
...
...
fs/bcachefs/extents.c
View file @
3858aa42
...
...
@@ -132,7 +132,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
if
(
!
ret
&&
!
p
.
ptr
.
cached
)
ret
=
-
EIO
;
if
(
p
.
ptr
.
cached
&&
ptr_stale
(
ca
,
&
p
.
ptr
))
if
(
p
.
ptr
.
cached
&&
dev_
ptr_stale
(
ca
,
&
p
.
ptr
))
continue
;
f
=
failed
?
dev_io_failures
(
failed
,
p
.
ptr
.
dev
)
:
NULL
;
...
...
@@ -874,7 +874,7 @@ bool bch2_bkey_has_target(struct bch_fs *c, struct bkey_s_c k, unsigned target)
bkey_for_each_ptr
(
ptrs
,
ptr
)
if
(
bch2_dev_in_target
(
c
,
ptr
->
dev
,
target
)
&&
(
!
ptr
->
cached
||
!
ptr_stale
(
bch2_dev_bkey_exists
(
c
,
ptr
->
dev
),
ptr
)))
!
dev_
ptr_stale
(
bch2_dev_bkey_exists
(
c
,
ptr
->
dev
),
ptr
)))
return
true
;
return
false
;
...
...
@@ -981,7 +981,7 @@ bool bch2_extent_normalize(struct bch_fs *c, struct bkey_s k)
{
bch2_bkey_drop_ptrs
(
k
,
ptr
,
ptr
->
cached
&&
ptr_stale
(
bch2_dev_bkey_exists
(
c
,
ptr
->
dev
),
ptr
));
dev_
ptr_stale
(
bch2_dev_bkey_exists
(
c
,
ptr
->
dev
),
ptr
));
return
bkey_deleted
(
k
.
k
);
}
...
...
@@ -1005,7 +1005,7 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
prt_str
(
out
,
" cached"
);
if
(
ptr
->
unwritten
)
prt_str
(
out
,
" unwritten"
);
if
(
bucket_valid
(
ca
,
b
)
&&
ptr_stale
(
ca
,
ptr
))
if
(
bucket_valid
(
ca
,
b
)
&&
dev_ptr_stale_rcu
(
ca
,
ptr
))
prt_printf
(
out
,
" stale"
);
}
rcu_read_unlock
();
...
...
fs/bcachefs/io_read.c
View file @
3858aa42
...
...
@@ -697,7 +697,7 @@ static void bch2_read_endio(struct bio *bio)
}
if
(((
rbio
->
flags
&
BCH_READ_RETRY_IF_STALE
)
&&
race_fault
())
||
ptr_stale
(
ca
,
&
rbio
->
pick
.
ptr
))
{
dev_
ptr_stale
(
ca
,
&
rbio
->
pick
.
ptr
))
{
trace_and_count
(
c
,
read_reuse_race
,
&
rbio
->
bio
);
if
(
rbio
->
flags
&
BCH_READ_RETRY_IF_STALE
)
...
...
@@ -841,7 +841,7 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
*/
if
((
flags
&
BCH_READ_IN_RETRY
)
&&
!
pick
.
ptr
.
cached
&&
unlikely
(
ptr_stale
(
ca
,
&
pick
.
ptr
)))
{
unlikely
(
dev_
ptr_stale
(
ca
,
&
pick
.
ptr
)))
{
read_from_stale_dirty_pointer
(
trans
,
k
,
pick
.
ptr
);
bch2_mark_io_failure
(
failed
,
&
pick
);
goto
retry_pick
;
...
...
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