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
6fb076e6
Commit
6fb076e6
authored
May 14, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix spurious inconsistency in recovery
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
ed8413fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+6
-2
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+4
-1
fs/bcachefs/buckets.h
fs/bcachefs/buckets.h
+1
-0
No files found.
fs/bcachefs/alloc_background.c
View file @
6fb076e6
...
@@ -232,7 +232,9 @@ int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys)
...
@@ -232,7 +232,9 @@ int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys)
bch2_trans_init
(
&
trans
,
c
);
bch2_trans_init
(
&
trans
,
c
);
for_each_btree_key
(
&
trans
,
iter
,
BTREE_ID_ALLOC
,
POS_MIN
,
0
,
k
,
ret
)
for_each_btree_key
(
&
trans
,
iter
,
BTREE_ID_ALLOC
,
POS_MIN
,
0
,
k
,
ret
)
bch2_mark_key
(
c
,
k
,
true
,
0
,
NULL
,
0
,
0
);
bch2_mark_key
(
c
,
k
,
true
,
0
,
NULL
,
0
,
BCH_BUCKET_MARK_NOATOMIC
|
BCH_BUCKET_MARK_ALLOC_READ
);
ret
=
bch2_trans_exit
(
&
trans
)
?:
ret
;
ret
=
bch2_trans_exit
(
&
trans
)
?:
ret
;
if
(
ret
)
{
if
(
ret
)
{
...
@@ -243,7 +245,9 @@ int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys)
...
@@ -243,7 +245,9 @@ int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys)
for_each_journal_key
(
*
journal_keys
,
j
)
for_each_journal_key
(
*
journal_keys
,
j
)
if
(
j
->
btree_id
==
BTREE_ID_ALLOC
)
if
(
j
->
btree_id
==
BTREE_ID_ALLOC
)
bch2_mark_key
(
c
,
bkey_i_to_s_c
(
j
->
k
),
bch2_mark_key
(
c
,
bkey_i_to_s_c
(
j
->
k
),
true
,
0
,
NULL
,
0
,
0
);
true
,
0
,
NULL
,
0
,
BCH_BUCKET_MARK_NOATOMIC
|
BCH_BUCKET_MARK_ALLOC_READ
);
percpu_down_write
(
&
c
->
mark_lock
);
percpu_down_write
(
&
c
->
mark_lock
);
bch2_dev_usage_from_buckets
(
c
);
bch2_dev_usage_from_buckets
(
c
);
...
...
fs/bcachefs/buckets.c
View file @
6fb076e6
...
@@ -657,7 +657,7 @@ static int bch2_mark_alloc(struct bch_fs *c, struct bkey_s_c k,
...
@@ -657,7 +657,7 @@ static int bch2_mark_alloc(struct bch_fs *c, struct bkey_s_c k,
g
=
__bucket
(
ca
,
k
.
k
->
p
.
offset
,
gc
);
g
=
__bucket
(
ca
,
k
.
k
->
p
.
offset
,
gc
);
u
=
bch2_alloc_unpack
(
k
);
u
=
bch2_alloc_unpack
(
k
);
old
=
bucket_
data_cmpxchg
(
c
,
ca
,
fs_usage
,
g
,
m
,
({
old
=
bucket_
cmpxchg
(
g
,
m
,
({
m
.
gen
=
u
.
gen
;
m
.
gen
=
u
.
gen
;
m
.
data_type
=
u
.
data_type
;
m
.
data_type
=
u
.
data_type
;
m
.
dirty_sectors
=
u
.
dirty_sectors
;
m
.
dirty_sectors
=
u
.
dirty_sectors
;
...
@@ -669,6 +669,9 @@ static int bch2_mark_alloc(struct bch_fs *c, struct bkey_s_c k,
...
@@ -669,6 +669,9 @@ static int bch2_mark_alloc(struct bch_fs *c, struct bkey_s_c k,
}
}
}));
}));
if
(
!
(
flags
&
BCH_BUCKET_MARK_ALLOC_READ
))
bch2_dev_usage_update
(
c
,
ca
,
fs_usage
,
old
,
m
,
gc
);
g
->
io_time
[
READ
]
=
u
.
read_time
;
g
->
io_time
[
READ
]
=
u
.
read_time
;
g
->
io_time
[
WRITE
]
=
u
.
write_time
;
g
->
io_time
[
WRITE
]
=
u
.
write_time
;
g
->
oldest_gen
=
u
.
oldest_gen
;
g
->
oldest_gen
=
u
.
oldest_gen
;
...
...
fs/bcachefs/buckets.h
View file @
6fb076e6
...
@@ -251,6 +251,7 @@ void bch2_mark_metadata_bucket(struct bch_fs *, struct bch_dev *,
...
@@ -251,6 +251,7 @@ void bch2_mark_metadata_bucket(struct bch_fs *, struct bch_dev *,
#define BCH_BUCKET_MARK_GC (1 << 0)
#define BCH_BUCKET_MARK_GC (1 << 0)
#define BCH_BUCKET_MARK_NOATOMIC (1 << 1)
#define BCH_BUCKET_MARK_NOATOMIC (1 << 1)
#define BCH_BUCKET_MARK_ALLOC_READ (1 << 2)
int
bch2_mark_key_locked
(
struct
bch_fs
*
,
struct
bkey_s_c
,
int
bch2_mark_key_locked
(
struct
bch_fs
*
,
struct
bkey_s_c
,
bool
,
s64
,
struct
bch_fs_usage
*
,
bool
,
s64
,
struct
bch_fs_usage
*
,
...
...
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