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
f8911ad8
Commit
f8911ad8
authored
Sep 26, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Check for accounting keys with bversion=0
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
cf49f8a8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
fs/bcachefs/bkey.h
fs/bcachefs/bkey.h
+2
-2
fs/bcachefs/disk_accounting.c
fs/bcachefs/disk_accounting.c
+4
-0
fs/bcachefs/sb-errors_format.h
fs/bcachefs/sb-errors_format.h
+2
-1
No files found.
fs/bcachefs/bkey.h
View file @
f8911ad8
...
@@ -214,9 +214,9 @@ static __always_inline int bversion_cmp(struct bversion l, struct bversion r)
...
@@ -214,9 +214,9 @@ static __always_inline int bversion_cmp(struct bversion l, struct bversion r)
#define ZERO_VERSION ((struct bversion) { .hi = 0, .lo = 0 })
#define ZERO_VERSION ((struct bversion) { .hi = 0, .lo = 0 })
#define MAX_VERSION ((struct bversion) { .hi = ~0, .lo = ~0ULL })
#define MAX_VERSION ((struct bversion) { .hi = ~0, .lo = ~0ULL })
static
__always_inline
int
bversion_zero
(
struct
bversion
v
)
static
__always_inline
bool
bversion_zero
(
struct
bversion
v
)
{
{
return
!
bversion_cmp
(
v
,
ZERO_VERSION
)
;
return
bversion_cmp
(
v
,
ZERO_VERSION
)
==
0
;
}
}
#ifdef CONFIG_BCACHEFS_DEBUG
#ifdef CONFIG_BCACHEFS_DEBUG
...
...
fs/bcachefs/disk_accounting.c
View file @
f8911ad8
...
@@ -134,6 +134,10 @@ int bch2_accounting_validate(struct bch_fs *c, struct bkey_s_c k,
...
@@ -134,6 +134,10 @@ int bch2_accounting_validate(struct bch_fs *c, struct bkey_s_c k,
void
*
end
=
&
acc_k
+
1
;
void
*
end
=
&
acc_k
+
1
;
int
ret
=
0
;
int
ret
=
0
;
bkey_fsck_err_on
(
bversion_zero
(
k
.
k
->
bversion
),
c
,
accounting_key_version_0
,
"accounting key with version=0"
);
switch
(
acc_k
.
type
)
{
switch
(
acc_k
.
type
)
{
case
BCH_DISK_ACCOUNTING_nr_inodes
:
case
BCH_DISK_ACCOUNTING_nr_inodes
:
end
=
field_end
(
acc_k
,
nr_inodes
);
end
=
field_end
(
acc_k
,
nr_inodes
);
...
...
fs/bcachefs/sb-errors_format.h
View file @
f8911ad8
...
@@ -293,7 +293,8 @@ enum bch_fsck_flags {
...
@@ -293,7 +293,8 @@ enum bch_fsck_flags {
x(accounting_key_replicas_nr_devs_0, 278, FSCK_AUTOFIX) \
x(accounting_key_replicas_nr_devs_0, 278, FSCK_AUTOFIX) \
x(accounting_key_replicas_nr_required_bad, 279, FSCK_AUTOFIX) \
x(accounting_key_replicas_nr_required_bad, 279, FSCK_AUTOFIX) \
x(accounting_key_replicas_devs_unsorted, 280, FSCK_AUTOFIX) \
x(accounting_key_replicas_devs_unsorted, 280, FSCK_AUTOFIX) \
x(MAX, 282, 0)
x(accounting_key_version_0, 282, FSCK_AUTOFIX) \
x(MAX, 283, 0)
enum
bch_sb_error_id
{
enum
bch_sb_error_id
{
#define x(t, n, ...) BCH_FSCK_ERR_##t = n,
#define x(t, n, ...) BCH_FSCK_ERR_##t = n,
...
...
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