···29572957}29582958EXPORT_SYMBOL(kblockd_schedule_delayed_work_on);2959295929602960-#define PLUG_MAGIC 0x9182736429612961-29622960/**29632961 * blk_start_plug - initialize blk_plug and track it inside the task_struct29642962 * @plug: The &struct blk_plug that needs to be initialized···29752977{29762978 struct task_struct *tsk = current;2977297929782978- plug->magic = PLUG_MAGIC;29792980 INIT_LIST_HEAD(&plug->list);29802981 INIT_LIST_HEAD(&plug->mq_list);29812982 INIT_LIST_HEAD(&plug->cb_list);···30703073 struct request *rq;30713074 LIST_HEAD(list);30723075 unsigned int depth;30733073-30743074- BUG_ON(plug->magic != PLUG_MAGIC);3075307630763077 flush_plug_callbacks(plug, from_schedule);30773078
+3-1
block/blk-flush.c
···223223 struct request *rq, *n;224224 unsigned long flags = 0;225225226226- if (q->mq_ops)226226+ if (q->mq_ops) {227227 spin_lock_irqsave(&q->mq_flush_lock, flags);228228+ q->flush_rq->cmd_flags = 0;229229+ }228230229231 running = &q->flush_queue[q->flush_running_idx];230232 BUG_ON(q->flush_pending_idx == q->flush_running_idx);
+21-7
block/blk-merge.c
···1313 struct bio *bio)1414{1515 struct bio_vec bv, bvprv = { NULL };1616- int cluster, high, highprv = 1;1616+ int cluster, high, highprv = 1, no_sg_merge;1717 unsigned int seg_size, nr_phys_segs;1818 struct bio *fbio, *bbio;1919 struct bvec_iter iter;···3535 cluster = blk_queue_cluster(q);3636 seg_size = 0;3737 nr_phys_segs = 0;3838+ no_sg_merge = test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);3939+ high = 0;3840 for_each_bio(bio) {3941 bio_for_each_segment(bv, bio, iter) {4042 /*4343+ * If SG merging is disabled, each bio vector is4444+ * a segment4545+ */4646+ if (no_sg_merge)4747+ goto new_segment;4848+4949+ /*4150 * the trick here is making sure that a high page is4242- * never considered part of another segment, since that4343- * might change with the bounce page.5151+ * never considered part of another segment, since5252+ * that might change with the bounce page.4453 */4554 high = page_to_pfn(bv.bv_page) > queue_bounce_pfn(q);4655 if (!high && !highprv && cluster) {···93849485void blk_recount_segments(struct request_queue *q, struct bio *bio)9586{9696- struct bio *nxt = bio->bi_next;8787+ if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags))8888+ bio->bi_phys_segments = bio->bi_vcnt;8989+ else {9090+ struct bio *nxt = bio->bi_next;97919898- bio->bi_next = NULL;9999- bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);100100- bio->bi_next = nxt;9292+ bio->bi_next = NULL;9393+ bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);9494+ bio->bi_next = nxt;9595+ }9696+10197 bio->bi_flags |= (1 << BIO_SEG_VALID);10298}10399EXPORT_SYMBOL(blk_recount_segments);
+21-20
block/blk-mq.c
···199199 rq->q = q;200200 rq->mq_ctx = ctx;201201 rq->cmd_flags |= rw_flags;202202- rq->cmd_type = 0;203202 /* do not touch atomic flags, it needs atomic ops against the timer */204203 rq->cpu = -1;205205- rq->__data_len = 0;206206- rq->__sector = (sector_t) -1;207207- rq->bio = NULL;208208- rq->biotail = NULL;209204 INIT_HLIST_NODE(&rq->hash);210205 RB_CLEAR_NODE(&rq->rb_node);211211- memset(&rq->flush, 0, max(sizeof(rq->flush), sizeof(rq->elv)));212206 rq->rq_disk = NULL;213207 rq->part = NULL;214214- rq->start_time = jiffies;215208#ifdef CONFIG_BLK_CGROUP216209 rq->rl = NULL;217210 set_start_time_ns(rq);···214221#if defined(CONFIG_BLK_DEV_INTEGRITY)215222 rq->nr_integrity_segments = 0;216223#endif217217- rq->ioprio = 0;218224 rq->special = NULL;219225 /* tag was already set */220226 rq->errors = 0;221221- memset(rq->__cmd, 0, sizeof(rq->__cmd));222222- rq->cmd = rq->__cmd;223223- rq->cmd_len = BLK_MAX_CDB;224227225228 rq->extra_len = 0;226229 rq->sense_len = 0;227230 rq->resid_len = 0;228231 rq->sense = NULL;229232230230- rq->deadline = 0;231233 INIT_LIST_HEAD(&rq->timeout_list);232232- rq->timeout = 0;233233- rq->retries = 0;234234 rq->end_io = NULL;235235 rq->end_io_data = NULL;236236 rq->next_rq = NULL;···435449 * complete. So be sure to clear complete again when we start436450 * the request, otherwise we'll ignore the completion event.437451 */438438- set_bit(REQ_ATOM_STARTED, &rq->atomic_flags);439439- clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);452452+ if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))453453+ set_bit(REQ_ATOM_STARTED, &rq->atomic_flags);454454+ if (test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags))455455+ clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);440456441457 if (q->dma_drain_size && blk_rq_bytes(rq)) {442458 /*···541553}542554EXPORT_SYMBOL(blk_mq_kick_requeue_list);543555544544-struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)556556+struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx, unsigned int tag)545557{546546- return tags->rqs[tag];558558+ struct request_queue *q = hctx->queue;559559+560560+ if ((q->flush_rq->cmd_flags & REQ_FLUSH_SEQ) &&561561+ q->flush_rq->tag == tag)562562+ return q->flush_rq;563563+564564+ return hctx->tags->rqs[tag];547565}548566EXPORT_SYMBOL(blk_mq_tag_to_rq);549567···578584 if (tag >= hctx->tags->nr_tags)579585 break;580586581581- rq = blk_mq_tag_to_rq(hctx->tags, tag++);587587+ rq = blk_mq_tag_to_rq(hctx, tag++);582588 if (rq->q != hctx->queue)583589 continue;584590 if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))···11061112static void blk_mq_bio_to_request(struct request *rq, struct bio *bio)11071113{11081114 init_request_from_bio(rq, bio);11091109- blk_account_io_start(rq, 1);11151115+11161116+ if (blk_do_io_stat(rq)) {11171117+ rq->start_time = jiffies;11181118+ blk_account_io_start(rq, 1);11191119+ }11101120}1111112111121122static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx,···1826182818271829 q->mq_ops = set->ops;18281830 q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT;18311831+18321832+ if (!(set->flags & BLK_MQ_F_SG_MERGE))18331833+ q->queue_flags |= 1 << QUEUE_FLAG_NO_SG_MERGE;1829183418301835 q->sg_reserved_size = INT_MAX;18311836
-4
block/scsi_ioctl.c
···205205 if (capable(CAP_SYS_RAWIO))206206 return 0;207207208208- /* if there's no filter set, assume we're filtering everything out */209209- if (!filter)210210- return -EPERM;211211-212208 /* Anybody who can open the device can do a read-safe command */213209 if (test_bit(cmd[0], filter->read_ok))214210 return 0;