diff options
author | Tejun Heo <tj@kernel.org> | 2011-01-25 06:43:54 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-01-25 06:43:54 -0500 |
commit | ae1b1539622fb46e51b4d13b3f9e5f4c713f86ae (patch) | |
tree | c5cb540141003a3ec7ebf0b8c6e01653ab6aaef5 /block/elevator.c | |
parent | 143a87f4c9c629067afea5b6703d66ea88c82f8e (diff) |
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 <tj@kernel.org>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>
Cc: Shaohua Li <shli@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/block/elevator.c b/block/elevator.c index 2569512830d3..270e0972eb9f 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -673,6 +673,11 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) | |||
673 | q->elevator->ops->elevator_add_req_fn(q, rq); | 673 | q->elevator->ops->elevator_add_req_fn(q, rq); |
674 | break; | 674 | break; |
675 | 675 | ||
676 | case ELEVATOR_INSERT_FLUSH: | ||
677 | rq->cmd_flags |= REQ_SOFTBARRIER; | ||
678 | blk_insert_flush(rq); | ||
679 | break; | ||
680 | |||
676 | default: | 681 | default: |
677 | printk(KERN_ERR "%s: bad insertion point %d\n", | 682 | printk(KERN_ERR "%s: bad insertion point %d\n", |
678 | __func__, where); | 683 | __func__, where); |
@@ -785,6 +790,8 @@ void elv_abort_queue(struct request_queue *q) | |||
785 | { | 790 | { |
786 | struct request *rq; | 791 | struct request *rq; |
787 | 792 | ||
793 | blk_abort_flushes(q); | ||
794 | |||
788 | while (!list_empty(&q->queue_head)) { | 795 | while (!list_empty(&q->queue_head)) { |
789 | rq = list_entry_rq(q->queue_head.next); | 796 | rq = list_entry_rq(q->queue_head.next); |
790 | rq->cmd_flags |= REQ_QUIET; | 797 | rq->cmd_flags |= REQ_QUIET; |