Commit 3140c3cf authored by Omar Sandoval's avatar Omar Sandoval Committed by Jens Axboe

block: update comments to reflect REQ_FLUSH -> REQ_PREFLUSH rename

Normally I wouldn't bother with this, but in my opinion the comments are
the most important part of this whole file since without them no one
would have any clue how this insanity works.
Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6a934bb8
/* /*
* Functions to sequence FLUSH and FUA writes. * Functions to sequence PREFLUSH and FUA writes.
* *
* Copyright (C) 2011 Max Planck Institute for Gravitational Physics * Copyright (C) 2011 Max Planck Institute for Gravitational Physics
* Copyright (C) 2011 Tejun Heo <tj@kernel.org> * Copyright (C) 2011 Tejun Heo <tj@kernel.org>
* *
* This file is released under the GPLv2. * This file is released under the GPLv2.
* *
* REQ_{FLUSH|FUA} requests are decomposed to sequences consisted of three * REQ_{PREFLUSH|FUA} requests are decomposed to sequences consisted of three
* optional steps - PREFLUSH, DATA and POSTFLUSH - according to the request * optional steps - PREFLUSH, DATA and POSTFLUSH - according to the request
* properties and hardware capability. * properties and hardware capability.
* *
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
* REQ_FUA means that the data must be on non-volatile media on request * REQ_FUA means that the data must be on non-volatile media on request
* completion. * completion.
* *
* If the device doesn't have writeback cache, FLUSH and FUA don't make any * If the device doesn't have writeback cache, PREFLUSH and FUA don't make any
* difference. The requests are either completed immediately if there's no * difference. The requests are either completed immediately if there's no data
* data or executed as normal requests otherwise. * or executed as normal requests otherwise.
* *
* If the device has writeback cache and supports FUA, REQ_PREFLUSH is * If the device has writeback cache and supports FUA, REQ_PREFLUSH is
* translated to PREFLUSH but REQ_FUA is passed down directly with DATA. * translated to PREFLUSH but REQ_FUA is passed down directly with DATA.
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* fq->flush_queue[fq->flush_pending_idx]. Once certain criteria are met, a * fq->flush_queue[fq->flush_pending_idx]. Once certain criteria are met, a
* REQ_OP_FLUSH is issued and the pending_idx is toggled. When the flush * REQ_OP_FLUSH is issued and the pending_idx is toggled. When the flush
* completes, all the requests which were pending are proceeded to the next * completes, all the requests which were pending are proceeded to the next
* step. This allows arbitrary merging of different types of FLUSH/FUA * step. This allows arbitrary merging of different types of PREFLUSH/FUA
* requests. * requests.
* *
* Currently, the following conditions are used to determine when to issue * Currently, the following conditions are used to determine when to issue
...@@ -47,19 +47,19 @@ ...@@ -47,19 +47,19 @@
* C3. The second condition is ignored if there is a request which has * C3. The second condition is ignored if there is a request which has
* waited longer than FLUSH_PENDING_TIMEOUT. This is to avoid * waited longer than FLUSH_PENDING_TIMEOUT. This is to avoid
* starvation in the unlikely case where there are continuous stream of * starvation in the unlikely case where there are continuous stream of
* FUA (without FLUSH) requests. * FUA (without PREFLUSH) requests.
* *
* For devices which support FUA, it isn't clear whether C2 (and thus C3) * For devices which support FUA, it isn't clear whether C2 (and thus C3)
* is beneficial. * is beneficial.
* *
* Note that a sequenced FLUSH/FUA request with DATA is completed twice. * Note that a sequenced PREFLUSH/FUA request with DATA is completed twice.
* Once while executing DATA and again after the whole sequence is * Once while executing DATA and again after the whole sequence is
* complete. The first completion updates the contained bio but doesn't * complete. The first completion updates the contained bio but doesn't
* finish it so that the bio submitter is notified only after the whole * finish it so that the bio submitter is notified only after the whole
* sequence is complete. This is implemented by testing RQF_FLUSH_SEQ in * sequence is complete. This is implemented by testing RQF_FLUSH_SEQ in
* req_bio_endio(). * req_bio_endio().
* *
* The above peculiarity requires that each FLUSH/FUA request has only one * The above peculiarity requires that each PREFLUSH/FUA request has only one
* bio attached to it, which is guaranteed as they aren't allowed to be * bio attached to it, which is guaranteed as they aren't allowed to be
* merged in the usual way. * merged in the usual way.
*/ */
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
#include "blk-mq-tag.h" #include "blk-mq-tag.h"
#include "blk-mq-sched.h" #include "blk-mq-sched.h"
/* FLUSH/FUA sequences */ /* PREFLUSH/FUA sequences */
enum { enum {
REQ_FSEQ_PREFLUSH = (1 << 0), /* pre-flushing in progress */ REQ_FSEQ_PREFLUSH = (1 << 0), /* pre-flushing in progress */
REQ_FSEQ_DATA = (1 << 1), /* data write in progress */ REQ_FSEQ_DATA = (1 << 1), /* data write in progress */
...@@ -148,7 +148,7 @@ static bool blk_flush_queue_rq(struct request *rq, bool add_front) ...@@ -148,7 +148,7 @@ static bool blk_flush_queue_rq(struct request *rq, bool add_front)
/** /**
* blk_flush_complete_seq - complete flush sequence * blk_flush_complete_seq - complete flush sequence
* @rq: FLUSH/FUA request being sequenced * @rq: PREFLUSH/FUA request being sequenced
* @fq: flush queue * @fq: flush queue
* @seq: sequences to complete (mask of %REQ_FSEQ_*, can be zero) * @seq: sequences to complete (mask of %REQ_FSEQ_*, can be zero)
* @error: whether an error occurred * @error: whether an error occurred
...@@ -406,7 +406,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error) ...@@ -406,7 +406,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error)
} }
/** /**
* blk_insert_flush - insert a new FLUSH/FUA request * blk_insert_flush - insert a new PREFLUSH/FUA request
* @rq: request to insert * @rq: request to insert
* *
* To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions. * To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment