On Wed, 2018-09-26 at 17:06 +0200, Johannes Thumshirn wrote:
> On Wed, Sep 26, 2018 at 04:57:32PM +0200, Christoph Hellwig wrote:
> > I don't think this actually works given that rpm_status only exists
> > if CONFIG_PM is set.
>
> I think it'll work as GCC does constant propagation. There are
> actually some places in the kernel that follow this pattern.
This is what gcc on my development system thinks about that proposal:
In file included from ./arch/x86/include/asm/bug.h:83:0,
from ./include/linux/bug.h:5,
from ./include/linux/thread_info.h:12,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from block/blk-core.c:15:
block/blk-core.c: In function ‘elv_next_request’:
block/blk-core.c:2795:44: error: ‘struct request_queue’ has no member named
‘rpm_status’; did you mean ‘stats’?
WARN_ON_ONCE(q->rpm_status == RPM_SUSPENDED);
^
./include/asm-generic/bug.h:69:25: note: in definition of macro ‘WARN_ON_ONCE’
int __ret_warn_on = !!(condition); \
^~~~~~~~~
scripts/Makefile.build:305: recipe for target 'block/blk-core.o' failed
Bart.