[Devel] [PATCH vz7] Check queue_flags size at compile time

Alexander Atanasov alexander.atanasov at virtuozzo.com
Thu Jan 5 19:50:09 MSK 2023


QUEUE_STANDBY_EN flag made the used bits more than 31 so it is now
required that queue_flags is a 64 bits. Add compile time check to
ensure it is.

https://jira.sw.ru/browse/PSBM-144163
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/block/ploop/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 32f4a394e4b8..4e06123f4f14 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3623,6 +3623,9 @@ static int ploop_replace_delta(struct ploop_device * plo, unsigned long arg)
 	spin_lock_irq(plo->queue->queue_lock);
 	queue_flag_clear(QUEUE_FLAG_STANDBY, plo->queue);
 	spin_unlock_irq(plo->queue->queue_lock);
+	BUILD_BUG_ON_MSG(sizeof(plo->queue->queue_flags) * 8 < BITS_PER_LONG ||
+					 BITS_PER_LONG < 64,
+			"queue_flags require 64 bit storage variable");
 
 	ploop_relax(plo);
 
-- 
2.31.1



More information about the Devel mailing list