summaryrefslogtreecommitdiffstats
path: root/block/blk.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-10-04 13:22:24 -0400
committerJens Axboe <axboe@kernel.dk>2017-10-04 13:22:24 -0400
commitfc13457f74dcf054b0d17efb7b94b46fdf17f412 (patch)
treeb7a6a14246cf9e9c9967c7072d96a0010d117164 /block/blk.h
parenta7af0af32171c17d881e3e58b0925c4a44fb5a42 (diff)
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.h')
-rw-r--r--block/blk.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index fda5a4632aba..6ac43dfd68a7 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -122,8 +122,15 @@ void blk_account_io_done(struct request *req);
122 * Internal atomic flags for request handling 122 * Internal atomic flags for request handling
123 */ 123 */
124enum rq_atomic_flags { 124enum rq_atomic_flags {
125 /*
126 * Keep these two bits first - not because we depend on the
127 * value of them, but we do depend on them being in the same
128 * byte of storage to ensure ordering on writes. Keeping them
129 * first will achieve that nicely.
130 */
125 REQ_ATOM_COMPLETE = 0, 131 REQ_ATOM_COMPLETE = 0,
126 REQ_ATOM_STARTED, 132 REQ_ATOM_STARTED,
133
127 REQ_ATOM_POLL_SLEPT, 134 REQ_ATOM_POLL_SLEPT,
128}; 135};
129 136