Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213182
b: refs/heads/master
c: cde4c40
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Sep 10, 2010
1 parent fba25a8 commit 8da8009
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e87901e189c8f01750d67485009fe3827c691bf
refs/heads/master: cde4c406d8fb051c5aafc917643adbb9dbd0abc2
26 changes: 10 additions & 16 deletions trunk/block/blk-flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,46 +74,40 @@ static void post_flush_end_io(struct request *rq, int error)
blk_flush_complete_seq(rq->q, QUEUE_FSEQ_POSTFLUSH, error);
}

static void queue_flush(struct request_queue *q, struct request *rq,
rq_end_io_fn *end_io)
static void init_flush_request(struct request *rq, struct gendisk *disk)
{
blk_rq_init(q, rq);
rq->cmd_type = REQ_TYPE_FS;
rq->cmd_flags = REQ_FLUSH;
rq->rq_disk = q->orig_flush_rq->rq_disk;
rq->end_io = end_io;

elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
rq->rq_disk = disk;
}

static struct request *queue_next_fseq(struct request_queue *q)
{
struct request *orig_rq = q->orig_flush_rq;
struct request *rq = &q->flush_rq;

blk_rq_init(q, rq);

switch (blk_flush_cur_seq(q)) {
case QUEUE_FSEQ_PREFLUSH:
queue_flush(q, rq, pre_flush_end_io);
init_flush_request(rq, orig_rq->rq_disk);
rq->end_io = pre_flush_end_io;
break;

case QUEUE_FSEQ_DATA:
/* initialize proxy request, inherit FLUSH/FUA and queue it */
blk_rq_init(q, rq);
init_request_from_bio(rq, orig_rq->bio);
rq->cmd_flags &= ~(REQ_FLUSH | REQ_FUA);
rq->cmd_flags |= orig_rq->cmd_flags & (REQ_FLUSH | REQ_FUA);
rq->end_io = flush_data_end_io;

elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
break;

case QUEUE_FSEQ_POSTFLUSH:
queue_flush(q, rq, post_flush_end_io);
init_flush_request(rq, orig_rq->rq_disk);
rq->end_io = post_flush_end_io;
break;

default:
BUG();
}

elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
return rq;
}

Expand Down

0 comments on commit 8da8009

Please sign in to comment.