aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/ll_rw_blk.c39
-rw-r--r--include/linux/blkdev.h1
2 files changed, 2 insertions, 38 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3b2eff4e83a6..dfe0948ec8b2 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -431,7 +431,6 @@ static void queue_flush(struct request_queue *q, unsigned which)
431static inline struct request *start_ordered(struct request_queue *q, 431static inline struct request *start_ordered(struct request_queue *q,
432 struct request *rq) 432 struct request *rq)
433{ 433{
434 q->bi_size = 0;
435 q->orderr = 0; 434 q->orderr = 0;
436 q->ordered = q->next_ordered; 435 q->ordered = q->next_ordered;
437 q->ordseq |= QUEUE_ORDSEQ_STARTED; 436 q->ordseq |= QUEUE_ORDSEQ_STARTED;
@@ -528,55 +527,21 @@ int blk_do_ordered(struct request_queue *q, struct request **rqp)
528 return 1; 527 return 1;
529} 528}
530 529
531static int flush_dry_bio_endio(struct bio *bio, unsigned int bytes, int error)
532{
533 struct request_queue *q = bio->bi_private;
534
535 /*
536 * This is dry run, restore bio_sector and size. We'll finish
537 * this request again with the original bi_end_io after an
538 * error occurs or post flush is complete.
539 */
540 q->bi_size += bytes;
541
542 if (bio->bi_size)
543 return 1;
544
545 /* Reset bio */
546 set_bit(BIO_UPTODATE, &bio->bi_flags);
547 bio->bi_size = q->bi_size;
548 bio->bi_sector -= (q->bi_size >> 9);
549 q->bi_size = 0;
550
551 return 0;
552}
553
554static int ordered_bio_endio(struct request *rq, struct bio *bio, 530static int ordered_bio_endio(struct request *rq, struct bio *bio,
555 unsigned int nbytes, int error) 531 unsigned int nbytes, int error)
556{ 532{
557 struct request_queue *q = rq->q; 533 struct request_queue *q = rq->q;
558 bio_end_io_t *endio;
559 void *private;
560 534
561 if (&q->bar_rq != rq) 535 if (&q->bar_rq != rq)
562 return 0; 536 return 0;
563 537
564 /* 538 /*
565 * Okay, this is the barrier request in progress, dry finish it. 539 * Okay, this is the barrier request in progress, just
540 * record the error;
566 */ 541 */
567 if (error && !q->orderr) 542 if (error && !q->orderr)
568 q->orderr = error; 543 q->orderr = error;
569 544
570 endio = bio->bi_end_io;
571 private = bio->bi_private;
572 bio->bi_end_io = flush_dry_bio_endio;
573 bio->bi_private = q;
574
575 bio_endio(bio, nbytes, error);
576
577 bio->bi_end_io = endio;
578 bio->bi_private = private;
579
580 return 1; 545 return 1;
581} 546}
582 547
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a0a998140447..95be0ac57e76 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -471,7 +471,6 @@ struct request_queue
471 int orderr, ordcolor; 471 int orderr, ordcolor;
472 struct request pre_flush_rq, bar_rq, post_flush_rq; 472 struct request pre_flush_rq, bar_rq, post_flush_rq;
473 struct request *orig_bar_rq; 473 struct request *orig_bar_rq;
474 unsigned int bi_size;
475 474
476 struct mutex sysfs_lock; 475 struct mutex sysfs_lock;
477 476