Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40cbbb78 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

block: implement and use [__]blk_end_request_all()



There are many [__]blk_end_request() call sites which call it with
full request length and expect full completion.  Many of them ensure
that the request actually completes by doing BUG_ON() the return
value, which is awkward and error-prone.

This patch adds [__]blk_end_request_all() which takes @rq and @error
and fully completes the request.  BUG_ON() is added to to ensure that
this actually happens.

Most conversions are simple but there are a few noteworthy ones.

* cdrom/viocd: viocd_end_request() replaced with direct calls to
  __blk_end_request_all().

* s390/block/dasd: dasd_end_request() replaced with direct calls to
  __blk_end_request_all().

* s390/char/tape_block: tapeblock_end_request() replaced with direct
  calls to blk_end_request_all().

[ Impact: cleanup ]

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
parent b243ddcb
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -192,8 +192,7 @@ static void mbox_tx_work(struct work_struct *work)
		}

		spin_lock(q->queue_lock);
		if (__blk_end_request(rq, 0, 0))
			BUG();
		__blk_end_request_all(rq, 0);
		spin_unlock(q->queue_lock);
	}
}
@@ -224,10 +223,7 @@ static void mbox_rx_work(struct work_struct *work)
			break;

		msg = (mbox_msg_t) rq->data;

		if (blk_end_request(rq, 0, 0))
			BUG();

		blk_end_request_all(rq, 0);
		mbox->rxq->callback((void *)msg);
	}
}
@@ -337,8 +333,7 @@ omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)

		*p = (mbox_msg_t) rq->data;

		if (blk_end_request(rq, 0, 0))
			BUG();
		blk_end_request_all(rq, 0);

		if (unlikely(mbox_seq_test(mbox, *p))) {
			pr_info("mbox: Illegal seq bit!(%08x) ignored\n", *p);
+2 −7
Original line number Diff line number Diff line
@@ -106,10 +106,7 @@ bool blk_ordered_complete_seq(struct request_queue *q, unsigned seq, int error)
	 */
	q->ordseq = 0;
	rq = q->orig_bar_rq;

	if (__blk_end_request(rq, q->orderr, blk_rq_bytes(rq)))
		BUG();

	__blk_end_request_all(rq, q->orderr);
	return true;
}

@@ -252,9 +249,7 @@ bool blk_do_ordered(struct request_queue *q, struct request **rqp)
			 * with prejudice.
			 */
			elv_dequeue_request(q, rq);
			if (__blk_end_request(rq, -EOPNOTSUPP,
					      blk_rq_bytes(rq)))
				BUG();
			__blk_end_request_all(rq, -EOPNOTSUPP);
			*rqp = NULL;
			return false;
		}
+1 −1
Original line number Diff line number Diff line
@@ -1780,7 +1780,7 @@ struct request *elv_next_request(struct request_queue *q)
			break;
		} else if (ret == BLKPREP_KILL) {
			rq->cmd_flags |= REQ_QUIET;
			__blk_end_request(rq, -EIO, blk_rq_bytes(rq));
			__blk_end_request_all(rq, -EIO);
		} else {
			printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
			break;
+1 −1
Original line number Diff line number Diff line
@@ -810,7 +810,7 @@ void elv_abort_queue(struct request_queue *q)
		rq = list_entry_rq(q->queue_head.next);
		rq->cmd_flags |= REQ_QUIET;
		trace_block_rq_abort(q, rq);
		__blk_end_request(rq, -EIO, blk_rq_bytes(rq));
		__blk_end_request_all(rq, -EIO);
	}
}
EXPORT_SYMBOL(elv_abort_queue);
+1 −2
Original line number Diff line number Diff line
@@ -1024,8 +1024,7 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
				cmd->req.sg[i].size, ddir);

	DBGPX(printk("Done with %p\n", rq););
	if (__blk_end_request(rq, error, blk_rq_bytes(rq)))
		BUG();
	__blk_end_request_all(rq, error);
}

/*
Loading