* [PATCH] bcachefs: Kill duplicate error code
@ 2025-08-23 18:41 Alan Huang
2025-09-01 22:42 ` Kent Overstreet
0 siblings, 1 reply; 4+ messages in thread
From: Alan Huang @ 2025-08-23 18:41 UTC (permalink / raw)
To: kent.overstreet; +Cc: linux-bcachefs, Alan Huang
btree_node_read_error is duplicate of btree_node_read_err, which impacts
repair path if misused.
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
fs/bcachefs/btree_io.c | 2 +-
fs/bcachefs/errcode.h | 1 -
fs/bcachefs/sb-errors_format.h | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 2e3dd9bacac5..3d594c4ae9d8 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1902,7 +1902,7 @@ static int __bch2_btree_root_read(struct btree_trans *trans, enum btree_id id,
scoped_guard(mutex, &c->btree_cache.lock)
bch2_btree_node_hash_remove(&c->btree_cache, b);
- ret = bch_err_throw(c, btree_node_read_error);
+ ret = bch_err_throw(c, btree_node_read_err);
goto err;
}
diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
index adc1f9315eab..7106d72fca80 100644
--- a/fs/bcachefs/errcode.h
+++ b/fs/bcachefs/errcode.h
@@ -295,7 +295,6 @@
x(BCH_ERR_btree_node_read_err, btree_node_read_err_cached) \
x(EIO, sb_not_downgraded) \
x(EIO, btree_node_write_all_failed) \
- x(EIO, btree_node_read_error) \
x(EIO, btree_need_topology_repair) \
x(EIO, bucket_ref_update) \
x(EIO, trigger_alloc) \
diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
index aa0ea1ec9f10..483358588abc 100644
--- a/fs/bcachefs/sb-errors_format.h
+++ b/fs/bcachefs/sb-errors_format.h
@@ -73,7 +73,7 @@ enum bch_fsck_flags {
x(btree_root_read_error, 59, FSCK_AUTOFIX) \
x(btree_root_bad_min_key, 60, 0) \
x(btree_root_bad_max_key, 61, 0) \
- x(btree_node_read_error, 62, FSCK_AUTOFIX) \
+ x(btree_node_read_err, 62, FSCK_AUTOFIX) \
x(btree_node_topology_bad_min_key, 63, FSCK_AUTOFIX) \
x(btree_node_topology_bad_max_key, 64, FSCK_AUTOFIX) \
x(btree_node_topology_bad_root_min_key, 323, FSCK_AUTOFIX) \
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] bcachefs: Kill duplicate error code
2025-08-23 18:41 [PATCH] bcachefs: Kill duplicate error code Alan Huang
@ 2025-09-01 22:42 ` Kent Overstreet
2025-09-02 0:54 ` Alan Huang
0 siblings, 1 reply; 4+ messages in thread
From: Kent Overstreet @ 2025-09-01 22:42 UTC (permalink / raw)
To: Alan Huang; +Cc: linux-bcachefs
On Sun, Aug 24, 2025 at 02:41:32AM +0800, Alan Huang wrote:
> btree_node_read_error is duplicate of btree_node_read_err, which impacts
> repair path if misused.
>
> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> ---
> fs/bcachefs/btree_io.c | 2 +-
> fs/bcachefs/errcode.h | 1 -
> fs/bcachefs/sb-errors_format.h | 2 +-
> 3 files changed, 2 insertions(+), 3 deletions(-)
So the patch builds, but this still doesn't make sense, because
>
> diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
> index 2e3dd9bacac5..3d594c4ae9d8 100644
> --- a/fs/bcachefs/btree_io.c
> +++ b/fs/bcachefs/btree_io.c
> @@ -1902,7 +1902,7 @@ static int __bch2_btree_root_read(struct btree_trans *trans, enum btree_id id,
> scoped_guard(mutex, &c->btree_cache.lock)
> bch2_btree_node_hash_remove(&c->btree_cache, b);
>
> - ret = bch_err_throw(c, btree_node_read_error);
> + ret = bch_err_throw(c, btree_node_read_err);
this references an errcode.h error
> goto err;
> }
>
> diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
> index adc1f9315eab..7106d72fca80 100644
> --- a/fs/bcachefs/errcode.h
> +++ b/fs/bcachefs/errcode.h
> @@ -295,7 +295,6 @@
> x(BCH_ERR_btree_node_read_err, btree_node_read_err_cached) \
> x(EIO, sb_not_downgraded) \
> x(EIO, btree_node_write_all_failed) \
> - x(EIO, btree_node_read_error) \
which you delete
> x(EIO, btree_need_topology_repair) \
> x(EIO, bucket_ref_update) \
> x(EIO, trigger_alloc) \
> diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
> index aa0ea1ec9f10..483358588abc 100644
> --- a/fs/bcachefs/sb-errors_format.h
> +++ b/fs/bcachefs/sb-errors_format.h
> @@ -73,7 +73,7 @@ enum bch_fsck_flags {
> x(btree_root_read_error, 59, FSCK_AUTOFIX) \
> x(btree_root_bad_min_key, 60, 0) \
> x(btree_root_bad_max_key, 61, 0) \
> - x(btree_node_read_error, 62, FSCK_AUTOFIX) \
> + x(btree_node_read_err, 62, FSCK_AUTOFIX) \
and rename the persistent error?
> x(btree_node_topology_bad_min_key, 63, FSCK_AUTOFIX) \
> x(btree_node_topology_bad_max_key, 64, FSCK_AUTOFIX) \
> x(btree_node_topology_bad_root_min_key, 323, FSCK_AUTOFIX) \
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] bcachefs: Kill duplicate error code
2025-09-01 22:42 ` Kent Overstreet
@ 2025-09-02 0:54 ` Alan Huang
2025-09-02 1:09 ` Kent Overstreet
0 siblings, 1 reply; 4+ messages in thread
From: Alan Huang @ 2025-09-02 0:54 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs
On Sep 2, 2025, at 06:42, Kent Overstreet <kent.overstreet@linux.dev> wrote:
>
> On Sun, Aug 24, 2025 at 02:41:32AM +0800, Alan Huang wrote:
>> btree_node_read_error is duplicate of btree_node_read_err, which impacts
>> repair path if misused.
>>
>> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
>> ---
>> fs/bcachefs/btree_io.c | 2 +-
>> fs/bcachefs/errcode.h | 1 -
>> fs/bcachefs/sb-errors_format.h | 2 +-
>> 3 files changed, 2 insertions(+), 3 deletions(-)
>
> So the patch builds, but this still doesn't make sense, because
>
>>
>> diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
>> index 2e3dd9bacac5..3d594c4ae9d8 100644
>> --- a/fs/bcachefs/btree_io.c
>> +++ b/fs/bcachefs/btree_io.c
>> @@ -1902,7 +1902,7 @@ static int __bch2_btree_root_read(struct btree_trans *trans, enum btree_id id,
>> scoped_guard(mutex, &c->btree_cache.lock)
>> bch2_btree_node_hash_remove(&c->btree_cache, b);
>>
>> - ret = bch_err_throw(c, btree_node_read_error);
>> + ret = bch_err_throw(c, btree_node_read_err);
>
> this references an errcode.h error
>
>> goto err;
>> }
>>
>> diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
>> index adc1f9315eab..7106d72fca80 100644
>> --- a/fs/bcachefs/errcode.h
>> +++ b/fs/bcachefs/errcode.h
>> @@ -295,7 +295,6 @@
>> x(BCH_ERR_btree_node_read_err, btree_node_read_err_cached) \
>> x(EIO, sb_not_downgraded) \
>> x(EIO, btree_node_write_all_failed) \
>> - x(EIO, btree_node_read_error) \
>
> which you delete
>
>> x(EIO, btree_need_topology_repair) \
>> x(EIO, bucket_ref_update) \
>> x(EIO, trigger_alloc) \
>> diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
>> index aa0ea1ec9f10..483358588abc 100644
>> --- a/fs/bcachefs/sb-errors_format.h
>> +++ b/fs/bcachefs/sb-errors_format.h
>> @@ -73,7 +73,7 @@ enum bch_fsck_flags {
>> x(btree_root_read_error, 59, FSCK_AUTOFIX) \
>> x(btree_root_bad_min_key, 60, 0) \
>> x(btree_root_bad_max_key, 61, 0) \
>> - x(btree_node_read_error, 62, FSCK_AUTOFIX) \
>> + x(btree_node_read_err, 62, FSCK_AUTOFIX) \
>
> and rename the persistent error?
The persistent error is never used, renaming it to the same as the error in errcode.h makes sense.
>
>> x(btree_node_topology_bad_min_key, 63, FSCK_AUTOFIX) \
>> x(btree_node_topology_bad_max_key, 64, FSCK_AUTOFIX) \
>> x(btree_node_topology_bad_root_min_key, 323, FSCK_AUTOFIX) \
>> --
>> 2.49.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] bcachefs: Kill duplicate error code
2025-09-02 0:54 ` Alan Huang
@ 2025-09-02 1:09 ` Kent Overstreet
0 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2025-09-02 1:09 UTC (permalink / raw)
To: Alan Huang; +Cc: linux-bcachefs
On Tue, Sep 02, 2025 at 08:54:14AM +0800, Alan Huang wrote:
> On Sep 2, 2025, at 06:42, Kent Overstreet <kent.overstreet@linux.dev> wrote:
> >
> > On Sun, Aug 24, 2025 at 02:41:32AM +0800, Alan Huang wrote:
> >> btree_node_read_error is duplicate of btree_node_read_err, which impacts
> >> repair path if misused.
> >>
> >> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> >> ---
> >> fs/bcachefs/btree_io.c | 2 +-
> >> fs/bcachefs/errcode.h | 1 -
> >> fs/bcachefs/sb-errors_format.h | 2 +-
> >> 3 files changed, 2 insertions(+), 3 deletions(-)
> >
> > So the patch builds, but this still doesn't make sense, because
> >
> >>
> >> diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
> >> index 2e3dd9bacac5..3d594c4ae9d8 100644
> >> --- a/fs/bcachefs/btree_io.c
> >> +++ b/fs/bcachefs/btree_io.c
> >> @@ -1902,7 +1902,7 @@ static int __bch2_btree_root_read(struct btree_trans *trans, enum btree_id id,
> >> scoped_guard(mutex, &c->btree_cache.lock)
> >> bch2_btree_node_hash_remove(&c->btree_cache, b);
> >>
> >> - ret = bch_err_throw(c, btree_node_read_error);
> >> + ret = bch_err_throw(c, btree_node_read_err);
> >
> > this references an errcode.h error
> >
> >> goto err;
> >> }
> >>
> >> diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
> >> index adc1f9315eab..7106d72fca80 100644
> >> --- a/fs/bcachefs/errcode.h
> >> +++ b/fs/bcachefs/errcode.h
> >> @@ -295,7 +295,6 @@
> >> x(BCH_ERR_btree_node_read_err, btree_node_read_err_cached) \
> >> x(EIO, sb_not_downgraded) \
> >> x(EIO, btree_node_write_all_failed) \
> >> - x(EIO, btree_node_read_error) \
> >
> > which you delete
> >
> >> x(EIO, btree_need_topology_repair) \
> >> x(EIO, bucket_ref_update) \
> >> x(EIO, trigger_alloc) \
> >> diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
> >> index aa0ea1ec9f10..483358588abc 100644
> >> --- a/fs/bcachefs/sb-errors_format.h
> >> +++ b/fs/bcachefs/sb-errors_format.h
> >> @@ -73,7 +73,7 @@ enum bch_fsck_flags {
> >> x(btree_root_read_error, 59, FSCK_AUTOFIX) \
> >> x(btree_root_bad_min_key, 60, 0) \
> >> x(btree_root_bad_max_key, 61, 0) \
> >> - x(btree_node_read_error, 62, FSCK_AUTOFIX) \
> >> + x(btree_node_read_err, 62, FSCK_AUTOFIX) \
> >
> > and rename the persistent error?
>
> The persistent error is never used, renaming it to the same as the error in errcode.h makes sense.
We probably want to hook it up then...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-02 1:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-23 18:41 [PATCH] bcachefs: Kill duplicate error code Alan Huang
2025-09-01 22:42 ` Kent Overstreet
2025-09-02 0:54 ` Alan Huang
2025-09-02 1:09 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox