Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-3.16/core' into for-3.16/drivers

Pulled in for the blk_mq_tag_to_rq() change, which impacts
mtip32xx.

Signed-off-by: Jens Axboe <axboe@fb.com>

+49 -42
-5
block/blk-core.c
··· 2957 2957 } 2958 2958 EXPORT_SYMBOL(kblockd_schedule_delayed_work_on); 2959 2959 2960 - #define PLUG_MAGIC 0x91827364 2961 - 2962 2960 /** 2963 2961 * blk_start_plug - initialize blk_plug and track it inside the task_struct 2964 2962 * @plug: The &struct blk_plug that needs to be initialized ··· 2975 2977 { 2976 2978 struct task_struct *tsk = current; 2977 2979 2978 - plug->magic = PLUG_MAGIC; 2979 2980 INIT_LIST_HEAD(&plug->list); 2980 2981 INIT_LIST_HEAD(&plug->mq_list); 2981 2982 INIT_LIST_HEAD(&plug->cb_list); ··· 3070 3073 struct request *rq; 3071 3074 LIST_HEAD(list); 3072 3075 unsigned int depth; 3073 - 3074 - BUG_ON(plug->magic != PLUG_MAGIC); 3075 3076 3076 3077 flush_plug_callbacks(plug, from_schedule); 3077 3078
+3 -1
block/blk-flush.c
··· 223 223 struct request *rq, *n; 224 224 unsigned long flags = 0; 225 225 226 - if (q->mq_ops) 226 + if (q->mq_ops) { 227 227 spin_lock_irqsave(&q->mq_flush_lock, flags); 228 + q->flush_rq->cmd_flags = 0; 229 + } 228 230 229 231 running = &q->flush_queue[q->flush_running_idx]; 230 232 BUG_ON(q->flush_pending_idx == q->flush_running_idx);
+21 -7
block/blk-merge.c
··· 13 13 struct bio *bio) 14 14 { 15 15 struct bio_vec bv, bvprv = { NULL }; 16 - int cluster, high, highprv = 1; 16 + int cluster, high, highprv = 1, no_sg_merge; 17 17 unsigned int seg_size, nr_phys_segs; 18 18 struct bio *fbio, *bbio; 19 19 struct bvec_iter iter; ··· 35 35 cluster = blk_queue_cluster(q); 36 36 seg_size = 0; 37 37 nr_phys_segs = 0; 38 + no_sg_merge = test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); 39 + high = 0; 38 40 for_each_bio(bio) { 39 41 bio_for_each_segment(bv, bio, iter) { 40 42 /* 43 + * If SG merging is disabled, each bio vector is 44 + * a segment 45 + */ 46 + if (no_sg_merge) 47 + goto new_segment; 48 + 49 + /* 41 50 * the trick here is making sure that a high page is 42 - * never considered part of another segment, since that 43 - * might change with the bounce page. 51 + * never considered part of another segment, since 52 + * that might change with the bounce page. 44 53 */ 45 54 high = page_to_pfn(bv.bv_page) > queue_bounce_pfn(q); 46 55 if (!high && !highprv && cluster) { ··· 93 84 94 85 void blk_recount_segments(struct request_queue *q, struct bio *bio) 95 86 { 96 - struct bio *nxt = bio->bi_next; 87 + if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags)) 88 + bio->bi_phys_segments = bio->bi_vcnt; 89 + else { 90 + struct bio *nxt = bio->bi_next; 97 91 98 - bio->bi_next = NULL; 99 - bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio); 100 - bio->bi_next = nxt; 92 + bio->bi_next = NULL; 93 + bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio); 94 + bio->bi_next = nxt; 95 + } 96 + 101 97 bio->bi_flags |= (1 << BIO_SEG_VALID); 102 98 } 103 99 EXPORT_SYMBOL(blk_recount_segments);
+21 -20
block/blk-mq.c
··· 199 199 rq->q = q; 200 200 rq->mq_ctx = ctx; 201 201 rq->cmd_flags |= rw_flags; 202 - rq->cmd_type = 0; 203 202 /* do not touch atomic flags, it needs atomic ops against the timer */ 204 203 rq->cpu = -1; 205 - rq->__data_len = 0; 206 - rq->__sector = (sector_t) -1; 207 - rq->bio = NULL; 208 - rq->biotail = NULL; 209 204 INIT_HLIST_NODE(&rq->hash); 210 205 RB_CLEAR_NODE(&rq->rb_node); 211 - memset(&rq->flush, 0, max(sizeof(rq->flush), sizeof(rq->elv))); 212 206 rq->rq_disk = NULL; 213 207 rq->part = NULL; 214 - rq->start_time = jiffies; 215 208 #ifdef CONFIG_BLK_CGROUP 216 209 rq->rl = NULL; 217 210 set_start_time_ns(rq); ··· 214 221 #if defined(CONFIG_BLK_DEV_INTEGRITY) 215 222 rq->nr_integrity_segments = 0; 216 223 #endif 217 - rq->ioprio = 0; 218 224 rq->special = NULL; 219 225 /* tag was already set */ 220 226 rq->errors = 0; 221 - memset(rq->__cmd, 0, sizeof(rq->__cmd)); 222 - rq->cmd = rq->__cmd; 223 - rq->cmd_len = BLK_MAX_CDB; 224 227 225 228 rq->extra_len = 0; 226 229 rq->sense_len = 0; 227 230 rq->resid_len = 0; 228 231 rq->sense = NULL; 229 232 230 - rq->deadline = 0; 231 233 INIT_LIST_HEAD(&rq->timeout_list); 232 - rq->timeout = 0; 233 - rq->retries = 0; 234 234 rq->end_io = NULL; 235 235 rq->end_io_data = NULL; 236 236 rq->next_rq = NULL; ··· 435 449 * complete. So be sure to clear complete again when we start 436 450 * the request, otherwise we'll ignore the completion event. 437 451 */ 438 - set_bit(REQ_ATOM_STARTED, &rq->atomic_flags); 439 - clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); 452 + if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) 453 + set_bit(REQ_ATOM_STARTED, &rq->atomic_flags); 454 + if (test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags)) 455 + clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); 440 456 441 457 if (q->dma_drain_size && blk_rq_bytes(rq)) { 442 458 /* ··· 541 553 } 542 554 EXPORT_SYMBOL(blk_mq_kick_requeue_list); 543 555 544 - struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) 556 + struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx, unsigned int tag) 545 557 { 546 - return tags->rqs[tag]; 558 + struct request_queue *q = hctx->queue; 559 + 560 + if ((q->flush_rq->cmd_flags & REQ_FLUSH_SEQ) && 561 + q->flush_rq->tag == tag) 562 + return q->flush_rq; 563 + 564 + return hctx->tags->rqs[tag]; 547 565 } 548 566 EXPORT_SYMBOL(blk_mq_tag_to_rq); 549 567 ··· 578 584 if (tag >= hctx->tags->nr_tags) 579 585 break; 580 586 581 - rq = blk_mq_tag_to_rq(hctx->tags, tag++); 587 + rq = blk_mq_tag_to_rq(hctx, tag++); 582 588 if (rq->q != hctx->queue) 583 589 continue; 584 590 if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) ··· 1106 1112 static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) 1107 1113 { 1108 1114 init_request_from_bio(rq, bio); 1109 - blk_account_io_start(rq, 1); 1115 + 1116 + if (blk_do_io_stat(rq)) { 1117 + rq->start_time = jiffies; 1118 + blk_account_io_start(rq, 1); 1119 + } 1110 1120 } 1111 1121 1112 1122 static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, ··· 1826 1828 1827 1829 q->mq_ops = set->ops; 1828 1830 q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT; 1831 + 1832 + if (!(set->flags & BLK_MQ_F_SG_MERGE)) 1833 + q->queue_flags |= 1 << QUEUE_FLAG_NO_SG_MERGE; 1829 1834 1830 1835 q->sg_reserved_size = INT_MAX; 1831 1836
-4
block/scsi_ioctl.c
··· 205 205 if (capable(CAP_SYS_RAWIO)) 206 206 return 0; 207 207 208 - /* if there's no filter set, assume we're filtering everything out */ 209 - if (!filter) 210 - return -EPERM; 211 - 212 208 /* Anybody who can open the device can do a read-safe command */ 213 209 if (test_bit(cmd[0], filter->read_ok)) 214 210 return 0;
+1 -3
drivers/block/mtip32xx/mtip32xx.c
··· 193 193 static struct request *mtip_rq_from_tag(struct driver_data *dd, 194 194 unsigned int tag) 195 195 { 196 - struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0]; 197 - 198 - return blk_mq_tag_to_rq(hctx->tags, tag); 196 + return blk_mq_tag_to_rq(dd->queue->queue_hw_ctx[0], tag); 199 197 } 200 198 201 199 static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd,
+2 -1
include/linux/blk-mq.h
··· 129 129 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 130 130 BLK_MQ_F_SHOULD_SORT = 1 << 1, 131 131 BLK_MQ_F_TAG_SHARED = 1 << 2, 132 + BLK_MQ_F_SG_MERGE = 1 << 3, 132 133 133 134 BLK_MQ_S_STOPPED = 0, 134 135 BLK_MQ_S_TAG_ACTIVE = 1, ··· 154 153 bool blk_mq_can_queue(struct blk_mq_hw_ctx *); 155 154 struct request *blk_mq_alloc_request(struct request_queue *q, int rw, 156 155 gfp_t gfp, bool reserved); 157 - struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag); 156 + struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx, unsigned int tag); 158 157 159 158 struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 160 159 struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
+1 -1
include/linux/blkdev.h
··· 510 510 #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 511 511 #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ 512 512 #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ 513 + #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ 513 514 514 515 #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 515 516 (1 << QUEUE_FLAG_STACKABLE) | \ ··· 1070 1069 * schedule() where blk_schedule_flush_plug() is called. 1071 1070 */ 1072 1071 struct blk_plug { 1073 - unsigned long magic; /* detect uninitialized use-cases */ 1074 1072 struct list_head list; /* requests */ 1075 1073 struct list_head mq_list; /* blk-mq requests */ 1076 1074 struct list_head cb_list; /* md requires an unplug callback */