Re: [PATCH 1/2] bcache: Fix undeclared symbol warning for bcache_is_reboot
From: Gabriel Shahrouzi
Date: Tue Apr 08 2025 - 01:43:14 EST
On Tue, Apr 8, 2025 at 12:55 AM Coly Li <colyli@xxxxxxxxxx> wrote:
>
> On Mon, Apr 07, 2025 at 11:33:21PM +0800, Gabriel Shahrouzi wrote:
> > Add extern declaration for bcache_is_reboot to bcache.h. Ensure proper
> > visibility for use across multiple files (super.c, sysfs.c) and follow
> > the declaration pattern for other forward declarations.
> >
> > Signed-off-by: Gabriel Shahrouzi <gshahrouzi@xxxxxxxxx>
> > ---
> > drivers/md/bcache/bcache.h | 1 +
> > drivers/md/bcache/sysfs.c | 2 --
> > 2 files changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
> > index 785b0d9008fac..531933351b8b8 100644
> > --- a/drivers/md/bcache/bcache.h
> > +++ b/drivers/md/bcache/bcache.h
> > @@ -1007,6 +1007,7 @@ extern struct workqueue_struct *bch_journal_wq;
> > extern struct workqueue_struct *bch_flush_wq;
> > extern struct mutex bch_register_lock;
> > extern struct list_head bch_cache_sets;
> > +extern bool bcache_is_reboot;
> >
>
> NACK. It is uncessary to make more .c files to be aware of
> bcache_is_reboot. Current code is in better form IMHO.
Ah I see. It's only used in sysfs.c and super.c compared to the other
forward declarations. Limiting the scope to only those files makes the
most sense instead of including it in the header file.
>
>
> > extern const struct kobj_type bch_cached_dev_ktype;
> > extern const struct kobj_type bch_flash_dev_ktype;
> > diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> > index e8f696cb58c05..47ef0167b9d23 100644
> > --- a/drivers/md/bcache/sysfs.c
> > +++ b/drivers/md/bcache/sysfs.c
> > @@ -17,8 +17,6 @@
> > #include <linux/sort.h>
> > #include <linux/sched/clock.h>
> >
> > -extern bool bcache_is_reboot;
> > -
> > /* Default is 0 ("writethrough") */
> > static const char * const bch_cache_modes[] = {
> > "writethrough",
> > --
> > 2.43.0
> >
>
> --
> Coly Li