[4.9.1] Compiler warnings in bcache
Subsystems (2)
When compiling kernel 4.9.1, I'm seeing the following warnings:
In file included from ./include/linux/bio.h:23:0,
from drivers/md/bcache/bcache.h:181,
from drivers/md/bcache/writeback.c:9:drivers/md/bcache/writeback.c: In Funktion »bch_cached_dev_writeback_init«:./include/linux/ioprio.h:15:73: Warnung: Klammern um Arithmetik in Operand von »|« empfohlen [-Wparentheses]
#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
^
drivers/md/bcache/writeback.c:515:25: Anmerkung: bei Substitution des Makros »IOPRIO_PRIO_VALUE«
dc->ioprio_bypass = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NR-1);
^It suggests to put parentheses around the expression with the "|" operand. No other kernel source files show warnings for me, so maybe it should be fixed.
I would create a patch myself but I'm not sure if it would be correct and sufficient to put parenthesis around "data" like this:
#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | (data))
Signature · 4 lines
Regards, Kai Replies to list-only preferred.
Quoted 13 lines · Kai Krakow
When compiling kernel 4.9.1, I'm seeing the following warnings:
In file included from
./include/linux/bio.h:23:0,
fromdrivers/md/bcache/bcache.h:181,
fromdrivers/md/bcache/writeback.c:9:drivers/md/bcache/writeback.c: In Funktion »bch_cached_dev_writeback_init«:./include/linux/ioprio.h:15:73: Warnung: Klammern um Arithmetik in Operand von »|« empfohlen [-Wparentheses]#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) ^ drivers/md/bcache/writeback.c:515:25: Anmerkung: bei Substitution des Makros »IOPRIO_PRIO_VALUE« dc->ioprio_bypass = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NR-1); ^
Quoted 9 lines
It suggests to put parentheses around the expression with the "|" operand. No other kernel source files show warnings for me, so maybe it should be fixed.
I would create a patch myself but I'm not sure if it would be correct and sufficient to put parenthesis around "data" like this:
#define
IOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | (data))
Hi Kai Krakow,
This fix is necessary, please send a patch to IOPRIO_PRIO_VALUE().
BTW, I don't see dc->ioprio_bypass from upstream kernel source, is it from a development tree ?
Signature · 1 line
Coly Li
Am Tue, 10 Jan 2017 13:41:25 +0800
schrieb Coly Li <[email protected]>:
Quoted 25 lines · Kai Krakow
Quoted 18 lines
When compiling kernel 4.9.1, I'm seeing the following warnings:
In file included from
./include/linux/bio.h:23:0,
fromdrivers/md/bcache/bcache.h:181, fromdrivers/md/bcache/writeback.c:9:drivers/md/bcache/writeback.c: In Funktion »bch_cached_dev_writeback_init«:./include/linux/ioprio.h:15:73:
Warnung: Klammern um Arithmetik in Operand von »|« empfohlen [-Wparentheses] #defineIOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | data) ^drivers/md/bcache/writeback.c:515:25:
Anmerkung: bei Substitution des Makros »IOPRIO_PRIO_VALUE«dc->ioprio_bypass= IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE,
IOPRIO_BE_NR-1); ^It suggests to put parentheses around the expression with the "|" operand. No other kernel source files show warnings for me, so maybe it should be fixed.
Quoted 5 lines
I would create a patch myself but I'm not sure if it would be correct and sufficient to put parenthesis around "data" like this:
#define
IOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | (data))
Quoted 6 lines
Hi Kai Krakow,
This fix is necessary, please send a patch to
IOPRIO_PRIO_VALUE().BTW, I don't see
dc->ioprio_bypassfrom upstream kernel source, is it from a development tree ?
Ahhh... This is from Erics ioprio bypass patches. I'm still using the 4.8 patchset with 4.9. Maybe it has been updated meanwhile?
Signature · 4 lines
Regards, Kai Replies to list-only preferred.
Quoted 30 lines · Kai Krakow
Am Tue, 10 Jan 2017 13:41:25 +0800
schrieb Coly Li <[email protected]>:Quoted 27 lines · Kai Krakow
Quoted 18 lines
When compiling kernel 4.9.1, I'm seeing the following warnings:
In file included from
./include/linux/bio.h:23:0,
fromdrivers/md/bcache/bcache.h:181, fromdrivers/md/bcache/writeback.c:9:drivers/md/bcache/writeback.c: In Funktion »bch_cached_dev_writeback_init«:./include/linux/ioprio.h:15:73:
Warnung: Klammern um Arithmetik in Operand von »|« empfohlen [-Wparentheses] #defineIOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | data) ^drivers/md/bcache/writeback.c:515:25:
Anmerkung: bei Substitution des Makros »IOPRIO_PRIO_VALUE«dc->ioprio_bypass= IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE,
IOPRIO_BE_NR-1); ^It suggests to put parentheses around the expression with the "|" operand. No other kernel source files show warnings for me, so maybe it should be fixed.
Quoted 5 lines
I would create a patch myself but I'm not sure if it would be correct and sufficient to put parenthesis around "data" like this:
#define
IOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | (data))Hi Kai Krakow,
Quoted 8 lines
Quoted 4 lines
This fix is necessary, please send a patch to
IOPRIO_PRIO_VALUE().BTW, I don't see
dc->ioprio_bypassfrom upstream kernel source, is it from a development tree ?Ahhh... This is from Erics ioprio bypass patches. I'm still using the 4.8 patchset with 4.9. Maybe it has been updated meanwhile?
Understand. Please compose a patch for this fix, thank you in advance :-)
Signature · 1 line
Coly Li
IOPRIO_PRIO_VALUE needs parens around (data) (was: [4.9.1] Compiler warnings in bcache)
In reply to Coly LiQuoted 14 lines · Coly Li
Quoted 13 lines · Kai Krakow
When compiling kernel 4.9.1, I'm seeing the following warnings:
In file included from
./include/linux/bio.h:23:0,
fromdrivers/md/bcache/bcache.h:181,
fromdrivers/md/bcache/writeback.c:9:drivers/md/bcache/writeback.c: In Funktion »bch_cached_dev_writeback_init«:./include/linux/ioprio.h:15:73: Warnung: Klammern um Arithmetik in Operand von »|« empfohlen [-Wparentheses]#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) ^ drivers/md/bcache/writeback.c:515:25: Anmerkung: bei Substitution des Makros »IOPRIO_PRIO_VALUE« dc->ioprio_bypass = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NR-1); ^
Quoted 8 lines
Quoted 8 lines
It suggests to put parentheses around the expression with the "|" operand. No other kernel source files show warnings for me, so maybe it should be fixed.
I would create a patch myself but I'm not sure if it would be correct and sufficient to put parenthesis around "data" like this:
#define
IOPRIO_PRIO_VALUE(class, data)(((class) <<IOPRIO_CLASS_SHIFT) | (data))
I caught that before submitting to Jens, so its in 4.10. I agree with Coly, however, that (data) should be added but I'm unable to do that at the moment.
--
Eric Wheeler
Quoted 17 lines
Quoted 1 line
Hi Kai Krakow,
This fix is necessary, please send a patch to
IOPRIO_PRIO_VALUE().BTW, I don't see
dc->ioprio_bypassfrom upstream kernel source, is it from a development tree ?Signature · 5 lines
Coly Li -- To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html