.. | .. |
---|
793 | 793 | rq->elv.priv[0] = NULL; |
---|
794 | 794 | } |
---|
795 | 795 | |
---|
| 796 | +static bool dd_has_write_work(struct blk_mq_hw_ctx *hctx) |
---|
| 797 | +{ |
---|
| 798 | + struct deadline_data *dd = hctx->queue->elevator->elevator_data; |
---|
| 799 | + enum dd_prio p; |
---|
| 800 | + |
---|
| 801 | + for (p = 0; p <= DD_PRIO_MAX; p++) |
---|
| 802 | + if (!list_empty_careful(&dd->per_prio[p].fifo_list[DD_WRITE])) |
---|
| 803 | + return true; |
---|
| 804 | + |
---|
| 805 | + return false; |
---|
| 806 | +} |
---|
| 807 | + |
---|
796 | 808 | /* |
---|
797 | 809 | * Callback from inside blk_mq_free_request(). |
---|
798 | 810 | * |
---|
.. | .. |
---|
816 | 828 | struct dd_blkcg *blkcg = rq->elv.priv[0]; |
---|
817 | 829 | const u8 ioprio_class = dd_rq_ioclass(rq); |
---|
818 | 830 | const enum dd_prio prio = ioprio_class_to_prio[ioprio_class]; |
---|
819 | | - struct dd_per_prio *per_prio = &dd->per_prio[prio]; |
---|
820 | 831 | |
---|
821 | 832 | dd_count(dd, completed, prio); |
---|
822 | 833 | ddcg_count(blkcg, completed, ioprio_class); |
---|
.. | .. |
---|
826 | 837 | |
---|
827 | 838 | spin_lock_irqsave(&dd->zone_lock, flags); |
---|
828 | 839 | blk_req_zone_write_unlock(rq); |
---|
829 | | - if (!list_empty(&per_prio->fifo_list[DD_WRITE])) |
---|
830 | | - blk_mq_sched_mark_restart_hctx(rq->mq_hctx); |
---|
831 | 840 | spin_unlock_irqrestore(&dd->zone_lock, flags); |
---|
| 841 | + |
---|
| 842 | + if (dd_has_write_work(rq->mq_hctx)) |
---|
| 843 | + blk_mq_sched_mark_restart_hctx(rq->mq_hctx); |
---|
832 | 844 | } |
---|
833 | 845 | } |
---|
834 | 846 | |
---|