Skip to contentSkip to conversation

fs/ocfs2/dlmglue: lockdep_keys defined but not used

PATCH In review Anders Roxell 4 participants 6 messages Jul 4, 2018 – Oct 9, 2018 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ocfs2/dlmglue: lockdep_keys defined but not used

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
---
 fs/ocfs2/dlmglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
index 040ddb6e7dab..160e0b224367 100644
@@ -96,7 +96,7 @@ struct ocfs2_unblock_ctl {
 };
 
 /* Lockdep class keys */
-static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
+static struct lock_class_key __maybe_unused lockdep_keys[OCFS2_NUM_LOCK_TYPES];
 
 static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
 					int new_level);
Signature · 1 line
2.18.0
#1 lore raw
Quoted 29 lines · Anders Roxell

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
---
 fs/ocfs2/dlmglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -2
index 040ddb6e7dab..160e0b224367 100644
@@ -96,7 +96,7 @@ struct ocfs2_unblock_ctl {
 };
 
 /* Lockdep class keys */
-static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
+static struct lock_class_key __maybe_unused lockdep_keys[OCFS2_NUM_LOCK_TYPES];
 
 static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
                                        int new_level);
--
Quoted 2 lines

2.18.0

Ping.

Acked-by on v1 1/1
#2 lore raw
In reply to Anders Roxell

Hi Anders,

Quoted 7 lines · Anders Roxell

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ?lockdep_keys? defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Thanks for your patcj!

Quoted 1 line
Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
Fixes 480bd56485b77c36 ("ocfs2: make several functions and variables

static (and some const)")

Presumably the branch got rebased?

Quoted 1 line

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw
Quoted 12 lines · Geert Uytterhoeven

Hi Anders,

Quoted 7 lines · Anders Roxell

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Quoted 6 lines

Thanks for your patcj!

Quoted 1 line
Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
Fixes 480bd56485b77c36 ("ocfs2: make several functions and variables

static (and some const)")

Thanks, thats correct.

Quoted 2 lines

Presumably the branch got rebased?

probably.

Mark, Joel, do you want me to send a new patch where I correct the sha in the "Fixes" part of the changelog or can you fix that?

Cheers,
Anders

Quoted 15 lines
Quoted 2 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw
Quoted 23 lines · Anders Roxell
Quoted 12 lines · Geert Uytterhoeven

Hi Anders,

Quoted 7 lines · Anders Roxell

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Quoted 6 lines

Thanks for your patcj!

Quoted 1 line
Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
Fixes 480bd56485b77c36 ("ocfs2: make several functions and variables

static (and some const)")

Thanks, thats correct.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Presumably the branch got rebased?

probably.

Mark, Joel, do you want me to send a new patch where I correct the sha in the "Fixes" part of the changelog or can you fix that?

FWIW, I'm still seeing this in randconfig builds here.

Adding akpm in case no one picks this up.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#5 lore raw
Quoted 26 lines · On Tue, 9 Oct 2018 20:22:17 +0200 Borislav Petkov <[email protected]> wrote:
Quoted 25 lines · Anders Roxell
Quoted 12 lines · Geert Uytterhoeven

Hi Anders,

Quoted 7 lines · Anders Roxell

When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ?lockdep_keys? defined but not used
[-Wunused-variable]

 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~

Adding __maybe_unused to the declaration hids the warning.

Quoted 6 lines

Thanks for your patcj!

Quoted 1 line
Fixes 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
Fixes 480bd56485b77c36 ("ocfs2: make several functions and variables

static (and some const)")

Thanks, thats correct.

Quoted 2 lines

Presumably the branch got rebased?

Quoted 9 lines
Quoted 4 lines

probably.

Mark, Joel, do you want me to send a new patch where I correct the sha in the "Fixes" part of the changelog or can you fix that?

FWIW, I'm still seeing this in randconfig builds here.

Adding akpm in case no one picks this up.

https://urldefense.proofpoint.com/v2/url?u=https-3A__ozlabs.org_-7Eakpm_mmots_broken-2Dout_ocfs2-2Dfix-2Da-2Dgcc-2Dcompiled-2Dwarning.patch&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=C7gAd4uDxlAvTdc0vmU6X8CMk6L2iDY8-HD0qT6Fo7Y&m=ZgrEA8A7Y3uhOY_9E-LiO-1D-nKZBJFblr7eFxH1PJQ&s=oPfnKW2LN9kXYh_vXc6gAoA7ts1TUH1WtFmKVdZ4Kjw&e=
is queued for 4.20-rc1. I'll see if we can squeeze it into 4.19.