]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - block/blk-map.c
block: fold cmd_type into the REQ_OP_ space
[mirror_ubuntu-artful-kernel.git] / block / blk-map.c
index 0acb6640ead708ef8450a32cb7ff6b0aee350515..2f18c2a0be1b22680472972c03f93b598dc7cb12 100644 (file)
@@ -16,8 +16,6 @@
 int blk_rq_append_bio(struct request *rq, struct bio *bio)
 {
        if (!rq->bio) {
-               rq->cmd_flags &= REQ_OP_MASK;
-               rq->cmd_flags |= (bio->bi_opf & REQ_OP_MASK);
                blk_rq_bio_prep(rq->q, rq, bio);
        } else {
                if (!ll_back_merge_fn(rq->q, rq, bio))
@@ -62,6 +60,9 @@ static int __blk_rq_map_user_iov(struct request *rq,
        if (IS_ERR(bio))
                return PTR_ERR(bio);
 
+       bio->bi_opf &= ~REQ_OP_MASK;
+       bio->bi_opf |= req_op(rq);
+
        if (map_data && map_data->null_mapped)
                bio_set_flag(bio, BIO_NULL_MAPPED);
 
@@ -90,7 +91,7 @@ static int __blk_rq_map_user_iov(struct request *rq,
 }
 
 /**
- * blk_rq_map_user_iov - map user data to a request, for REQ_TYPE_BLOCK_PC usage
+ * blk_rq_map_user_iov - map user data to a request, for passthrough requests
  * @q:         request queue where request should be inserted
  * @rq:                request to map data to
  * @map_data:   pointer to the rq_map_data holding pages (if necessary)
@@ -199,7 +200,7 @@ int blk_rq_unmap_user(struct bio *bio)
 EXPORT_SYMBOL(blk_rq_unmap_user);
 
 /**
- * blk_rq_map_kern - map kernel data to a request, for REQ_TYPE_BLOCK_PC usage
+ * blk_rq_map_kern - map kernel data to a request, for passthrough requests
  * @q:         request queue where request should be inserted
  * @rq:                request to fill
  * @kbuf:      the kernel buffer
@@ -234,8 +235,8 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
        if (IS_ERR(bio))
                return PTR_ERR(bio);
 
-       if (!reading)
-               bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+       bio->bi_opf &= ~REQ_OP_MASK;
+       bio->bi_opf |= req_op(rq);
 
        if (do_copy)
                rq->rq_flags |= RQF_COPY_USER;