summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-10-04 11:22:24 -0600
committerJens Axboe <axboe@kernel.dk>2017-10-04 11:22:24 -0600
commitfc13457f74dcf054b0d17efb7b94b46fdf17f412 (patch)
treeb7a6a14246cf9e9c9967c7072d96a0010d117164 /block/blk-mq.c
parenta7af0af32171c17d881e3e58b0925c4a44fb5a42 (diff)
downloadop-kernel-dev-fc13457f74dcf054b0d17efb7b94b46fdf17f412.zip
op-kernel-dev-fc13457f74dcf054b0d17efb7b94b46fdf17f412.tar.gz
blk-mq: document the need to have STARTED and COMPLETED share a byte
For memory ordering guarantees on stores, we need to ensure that these two bits share the same byte of storage in the unsigned long. Add a comment as to why, and a BUILD_BUG_ON() to ensure that we don't violate this requirement. Suggested-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a7b46b7..076cbab 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2923,6 +2923,12 @@ EXPORT_SYMBOL_GPL(blk_mq_poll);
static int __init blk_mq_init(void)
{
+ /*
+ * See comment in block/blk.h rq_atomic_flags enum
+ */
+ BUILD_BUG_ON((REQ_ATOM_STARTED / BITS_PER_BYTE) !=
+ (REQ_ATOM_COMPLETE / BITS_PER_BYTE));
+
cpuhp_setup_state_multi(CPUHP_BLK_MQ_DEAD, "block/mq:dead", NULL,
blk_mq_hctx_notify_dead);
return 0;
OpenPOWER on IntegriCloud