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

Commit 33659ebb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: remove wrappers for request type/flags



Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
struct requests.  This allows much easier grepping for different request
types instead of unwinding through macros.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
parent 7e005f79
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ unsigned blk_ordered_req_seq(struct request *rq)
	 *
	 * http://thread.gmane.org/gmane.linux.kernel/537473
	 */
	if (!blk_fs_request(rq))
	if (rq->cmd_type != REQ_TYPE_FS)
		return QUEUE_ORDSEQ_DRAIN;

	if ((rq->cmd_flags & REQ_ORDERED_COLOR) ==
@@ -236,7 +236,8 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp)
bool blk_do_ordered(struct request_queue *q, struct request **rqp)
{
	struct request *rq = *rqp;
	const int is_barrier = blk_fs_request(rq) && blk_barrier_rq(rq);
	const int is_barrier = rq->cmd_type == REQ_TYPE_FS &&
				(rq->cmd_flags & REQ_HARDBARRIER);

	if (!q->ordseq) {
		if (!is_barrier)
@@ -261,7 +262,7 @@ bool blk_do_ordered(struct request_queue *q, struct request **rqp)
	 */

	/* Special requests are not subject to ordering rules. */
	if (!blk_fs_request(rq) &&
	if (rq->cmd_type != REQ_TYPE_FS &&
	    rq != &q->pre_flush_rq && rq != &q->post_flush_rq)
		return true;

+7 −6
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
	printk(KERN_INFO "  bio %p, biotail %p, buffer %p, len %u\n",
	       rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq));

	if (blk_pc_request(rq)) {
	if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
		printk(KERN_INFO "  cdb: ");
		for (bit = 0; bit < BLK_MAX_CDB; bit++)
			printk("%02x ", rq->cmd[bit]);
@@ -1796,7 +1796,7 @@ struct request *blk_peek_request(struct request_queue *q)
			 * sees this request (possibly after
			 * requeueing).  Notify IO scheduler.
			 */
			if (blk_sorted_rq(rq))
			if (rq->cmd_flags & REQ_SORTED)
				elv_activate_rq(q, rq);

			/*
@@ -1984,10 +1984,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
	 * TODO: tj: This is too subtle.  It would be better to let
	 * low level drivers do what they see fit.
	 */
	if (blk_fs_request(req))
	if (req->cmd_type == REQ_TYPE_FS)
		req->errors = 0;

	if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) {
	if (error && req->cmd_type == REQ_TYPE_FS &&
	    !(req->cmd_flags & REQ_QUIET)) {
		printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n",
				req->rq_disk ? req->rq_disk->disk_name : "?",
				(unsigned long long)blk_rq_pos(req));
@@ -2074,7 +2075,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
	req->buffer = bio_data(req->bio);

	/* update sector only for requests with clear definition of sector */
	if (blk_fs_request(req) || blk_discard_rq(req))
	if (req->cmd_type == REQ_TYPE_FS || (req->cmd_flags & REQ_DISCARD))
		req->__sector += total_bytes >> 9;

	/* mixed attributes always follow the first bio */
@@ -2127,7 +2128,7 @@ static void blk_finish_request(struct request *req, int error)

	BUG_ON(blk_queued_rq(req));

	if (unlikely(laptop_mode) && blk_fs_request(req))
	if (unlikely(laptop_mode) && req->cmd_type == REQ_TYPE_FS)
		laptop_io_completion(&req->q->backing_dev_info);

	blk_delete_timer(req);
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
	__elv_add_request(q, rq, where, 1);
	__generic_unplug_device(q);
	/* the queue is stopped so it won't be plugged+unplugged */
	if (blk_pm_resume_request(rq))
	if (rq->cmd_type == REQ_TYPE_PM_RESUME)
		q->request_fn(q);
	spin_unlock_irq(q->queue_lock);
}
+2 −2
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
{
	unsigned short max_sectors;

	if (unlikely(blk_pc_request(req)))
	if (unlikely(req->cmd_type == REQ_TYPE_BLOCK_PC))
		max_sectors = queue_max_hw_sectors(q);
	else
		max_sectors = queue_max_sectors(q);
@@ -250,7 +250,7 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
{
	unsigned short max_sectors;

	if (unlikely(blk_pc_request(req)))
	if (unlikely(req->cmd_type == REQ_TYPE_BLOCK_PC))
		max_sectors = queue_max_hw_sectors(q);
	else
		max_sectors = queue_max_sectors(q);
+4 −2
Original line number Diff line number Diff line
@@ -161,8 +161,10 @@ static inline int blk_cpu_to_group(int cpu)
 */
static inline int blk_do_io_stat(struct request *rq)
{
	return rq->rq_disk && blk_rq_io_stat(rq) &&
	       (blk_fs_request(rq) || blk_discard_rq(rq));
	return rq->rq_disk &&
	       (rq->cmd_flags & REQ_IO_STAT) &&
	       (rq->cmd_type == REQ_TYPE_FS ||
	        (rq->cmd_flags & REQ_DISCARD));
}

#endif
Loading