Skip to contentSkip to conversation

block: fix a warning when blkdev.h is included for !CONFIG_BLOCK builds

PATCH Applied Christoph Hellwig 2 participants 2 messages May 28, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: fix a warning when blkdev.h is included for !CONFIG_BLOCK builds

disk_start_io_acct and disk_end_io_acct need at least a struct gendisk forward declaration, but for weird historic reasons much of blkdev.h is stubbed out for CONFIG_BLOCK=n. Fix this by stubbing more out for now, but eventually this header will need a massive cleanup.

Fixes 956d510ee78 ("block: add disk/bio-based accounting helpers")
---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
index 6f7ff0fa8fcf8..8fd900998b4e2 100644
@@ -1892,12 +1892,12 @@ static inline void blk_wake_io_task(struct task_struct *waiter)
 		wake_up_process(waiter);
 }
 
+#ifdef CONFIG_BLOCK
 unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
 		unsigned int op);
 void disk_end_io_acct(struct gendisk *disk, unsigned int op,
 		unsigned long start_time);
 
-#ifdef CONFIG_BLOCK
 /**
  * bio_start_io_acct - start I/O accounting for bio based drivers
  * @bio:	bio to start account for
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Christoph Hellwig

disk_start_io_acct and disk_end_io_acct need at least a struct gendisk forward declaration, but for weird historic reasons much of blkdev.h is stubbed out for CONFIG_BLOCK=n. Fix this by stubbing more out for now, but eventually this header will need a massive cleanup.

Applied, thanks.

Signature · 1 line
Jens Axboe