-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zfs-2.1.3/module/zfs/arc.c:1208:17: error: unused variable ‘hdr’ #13194
Comments
Hi! I am running into the same issue on gentoo x86_64, x86_64-pc-linux-gnu-11.2.1. |
A quick fix to get things building: --- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -1206,7 +1206,7 @@ hdr_l2only_dest(void *vbuf, void *unused)
{
(void) unused;
arc_buf_hdr_t *hdr = vbuf;
-
+ (void) hdr;
ASSERT(HDR_EMPTY(hdr));
arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS);
} |
works for me. Thanks @TheUbuntuGuy |
This explodes as -Wunused-variable on GCC 8.5.0, despite it being used, just not in an evaulated context Closes openzfs#13194 Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Heh. I'd say that GCC is wrong to say this, since |
tried your patch @nabijaczleweli but
|
The patch is for the v2.1.3 release, not master. The file offset is wrong and it's patching the wrong function. |
I've run into this on FreeBSD as well. I'm working on a PR against zfs-2.1-release. |
Please try this patch: diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 9984c2d27..47b58b6c2 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -1205,7 +1205,7 @@ static void
hdr_l2only_dest(void *vbuf, void *unused)
{
(void) unused;
- arc_buf_hdr_t *hdr = vbuf;
+ arc_buf_hdr_t *hdr __maybe_unused = vbuf;
ASSERT(HDR_EMPTY(hdr));
arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); |
Ah right there was already a working patch posted here. I'm sure this will work then. |
Oh, yeah #13195 is a different thing, I hadn't realised 2.1.x still has non-void-casted ASSERTs. In that case |
This is a direct commit to zfs-2.1-release to fix release builds that error out on an unused variable. The issue is avoided on master by a huge series of commits that change how the ASSERT macros work, but that is not feasible to backport. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Igor Kozhukhov <igor@dilos.org> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #13194 Closes #13196
Thanks! Your patch works in Gentoo, for zfs-2.1.3. |
Compiling on Centos 8 Stream with latest elrep kernel-ml 5.16.13-1.el8.elrepo.x86_64 fails
System information
Distribution Name | Centos-Stream
Distribution Version | 8
Kernel Version | 5.16.13-1.el8.elrepo.x86_64
Architecture | x886_64
OpenZFS Version | 2.1.3
The text was updated successfully, but these errors were encountered: