mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
block: reimplement FLUSH/FUA to support merge
The current FLUSH/FUA support has evolved from the implementation which had to perform queue draining. As such, sequencing is done queue-wide one flush request after another. However, with the draining requirement gone, there's no reason to keep the queue-wide sequential approach. This patch reimplements FLUSH/FUA support such that each FLUSH/FUA request is sequenced individually. The actual FLUSH execution is double buffered and whenever a request wants to execute one for either PRE or POSTFLUSH, it queues on the pending queue. Once certain conditions are met, a flush request is issued and on its completion all pending requests proceed to the next sequence. This allows arbitrary merging of different type of flushes. How they are merged can be primarily controlled and tuned by adjusting the above said 'conditions' used to determine when to issue the next flush. This is inspired by Darrick's patches to merge multiple zero-data flushes which helps workloads with highly concurrent fsync requests. * As flush requests are never put on the IO scheduler, request fields used for flush share space with rq->rb_node. rq->completion_data is moved out of the union. This increases the request size by one pointer. As rq->elevator_private* are used only by the iosched too, it is possible to reduce the request size further. However, to do that, we need to modify request allocation path such that iosched data is not allocated for flush requests. * FLUSH/FUA processing happens on insertion now instead of dispatch. - Comments updated as per Vivek and Mike. Signed-off-by: Tejun Heo <[email protected]> Cc: "Darrick J. Wong" <[email protected]> Cc: Shaohua Li <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Mike Snitzer <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
143a87f4c9
commit
ae1b153962
6 changed files with 332 additions and 156 deletions
12
block/blk.h
12
block/blk.h
|
|
@ -51,21 +51,17 @@ static inline void blk_clear_rq_complete(struct request *rq)
|
|||
*/
|
||||
#define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash))
|
||||
|
||||
struct request *blk_do_flush(struct request_queue *q, struct request *rq);
|
||||
void blk_insert_flush(struct request *rq);
|
||||
void blk_abort_flushes(struct request_queue *q);
|
||||
|
||||
static inline struct request *__elv_next_request(struct request_queue *q)
|
||||
{
|
||||
struct request *rq;
|
||||
|
||||
while (1) {
|
||||
while (!list_empty(&q->queue_head)) {
|
||||
if (!list_empty(&q->queue_head)) {
|
||||
rq = list_entry_rq(q->queue_head.next);
|
||||
if (!(rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) ||
|
||||
(rq->cmd_flags & REQ_FLUSH_SEQ))
|
||||
return rq;
|
||||
rq = blk_do_flush(q, rq);
|
||||
if (rq)
|
||||
return rq;
|
||||
return rq;
|
||||
}
|
||||
|
||||
if (!q->elevator->ops->elevator_dispatch_fn(q, 0))
|
||||
|
|
|
|||
Loading…
Reference in a new issue