type
stringclasses
5 values
content
stringlengths
9
163k
functions
wl_class_t cfqq_class(struct cfq_queue *cfqq) { if (cfq_class_idle(cfqq)) return IDLE_WORKLOAD; if (cfq_class_rt(cfqq)) return RT_WORKLOAD; return BE_WORKLOAD; }
functions
wl_type_t cfqq_type(struct cfq_queue *cfqq) { if (!cfq_cfqq_sync(cfqq)) return ASYNC_WORKLOAD; if (!cfq_cfqq_idle_window(cfqq)) return SYNC_NOIDLE_WORKLOAD; return SYNC_WORKLOAD; }
functions
int cfq_group_busy_queues_wl(enum wl_class_t wl_class, struct cfq_data *cfqd, struct cfq_group *cfqg) { if (wl_class == IDLE_WORKLOAD) return cfqg->service_tree_idle.count; return cfqg->service_trees[wl_class][ASYNC_WORKLOAD].count + cfqg->service_trees[wl_class][SYNC_NOIDLE_WORKLOAD].count + cfqg->s...
functions
int cfqg_busy_async_queues(struct cfq_data *cfqd, struct cfq_group *cfqg) { return cfqg->service_trees[RT_WORKLOAD][ASYNC_WORKLOAD].count + cfqg->service_trees[BE_WORKLOAD][ASYNC_WORKLOAD].count; }
functions
void cic_set_cfqq(struct cfq_io_cq *cic, struct cfq_queue *cfqq, bool is_sync) { cic->cfqq[is_sync] = cfqq; }
functions
bool cfq_bio_sync(struct bio *bio) { return bio_data_dir(bio) == READ || (bio->bi_rw & REQ_SYNC); }
functions
void cfq_schedule_dispatch(struct cfq_data *cfqd) { if (cfqd->busy_queues) { cfq_log(cfqd, "schedule dispatch"); kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work); }
functions
int cfq_prio_slice(struct cfq_data *cfqd, bool sync, unsigned short prio) { const int base_slice = cfqd->cfq_slice[sync]; WARN_ON(prio >= IOPRIO_BE_NR); return base_slice + (base_slice/CFQ_SLICE_SCALE * (4 - prio)); }
functions
int cfq_prio_to_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) { return cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio); }
functions
in range (0, 1]. The * scaling is inversely proportional. * * scaled = charge / vfraction * * The result is also in fixed point w/ CFQ_SERVICE_SHIFT. */ static inline u64 cfqg_scale_charge(unsigned long charge, unsigned int vfraction) { u64 c = charge << CFQ_SERVICE_SHIFT; /* make it fixed point */ /*...
functions
u64 max_vdisktime(u64 min_vdisktime, u64 vdisktime) { s64 delta = (s64)(vdisktime - min_vdisktime); if (delta > 0) min_vdisktime = vdisktime; return min_vdisktime; }
functions
u64 min_vdisktime(u64 min_vdisktime, u64 vdisktime) { s64 delta = (s64)(vdisktime - min_vdisktime); if (delta < 0) min_vdisktime = vdisktime; return min_vdisktime; }
functions
void update_min_vdisktime(struct cfq_rb_root *st) { struct cfq_group *cfqg; if (st->left) { cfqg = rb_entry_cfqg(st->left); st->min_vdisktime = max_vdisktime(st->min_vdisktime, cfqg->vdisktime); }
functions
unsigned cfq_group_get_avg_queues(struct cfq_data *cfqd, struct cfq_group *cfqg, bool rt) { unsigned min_q, max_q; unsigned mult = cfq_hist_divisor - 1; unsigned round = cfq_hist_divisor / 2; unsigned busy = cfq_group_busy_queues_wl(rt, cfqd, cfqg); min_q = min(cfqg->busy_queues_avg[rt], busy); max_q = max...
functions
unsigned cfq_group_slice(struct cfq_data *cfqd, struct cfq_group *cfqg) { return cfqd->cfq_target_latency * cfqg->vfraction >> CFQ_SERVICE_SHIFT; }
functions
unsigned cfq_scaled_cfqq_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) { unsigned slice = cfq_prio_to_slice(cfqd, cfqq); if (cfqd->cfq_latency) { /* * interested queues (we consider only the ones with the same * priority class in the cfq group) */ unsigned iq = cfq_group_get_avg_queues(cfqd, cfqq-...
functions
void cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) { unsigned slice = cfq_scaled_cfqq_slice(cfqd, cfqq); cfqq->slice_start = jiffies; cfqq->slice_end = jiffies + slice; cfqq->allocated_slice = slice; cfq_log_cfqq(cfqd, cfqq, "set_slice=%lu", cfqq->slice_end - jiffies); }
functions
bool cfq_slice_used(struct cfq_queue *cfqq) { if (cfq_cfqq_slice_new(cfqq)) return false; if (time_before(jiffies, cfqq->slice_end)) return false; return true; }
functions
void rb_erase_init(struct rb_node *n, struct rb_root *root) { rb_erase(n, root); RB_CLEAR_NODE(n); }
functions
void cfq_rb_erase(struct rb_node *n, struct cfq_rb_root *root) { if (root->left == n) root->left = NULL; rb_erase_init(n, &root->rb); --root->count; }
functions
long cfq_slice_offset(struct cfq_data *cfqd, struct cfq_queue *cfqq) { /* * just an approximation, should be ok. */ return (cfqq->cfqg->nr_cfqq - 1) * (cfq_prio_slice(cfqd, 1, 0) - cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio)); }
functions
s64 cfqg_key(struct cfq_rb_root *st, struct cfq_group *cfqg) { return cfqg->vdisktime - st->min_vdisktime; }
functions
void __cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) { struct rb_node **node = &st->rb.rb_node; struct rb_node *parent = NULL; struct cfq_group *__cfqg; s64 key = cfqg_key(st, cfqg); int left = 1; while (*node != NULL) { parent = *node; __cfqg = rb_entry_cfqg(parent); if (key ...
functions
void cfq_update_group_weight(struct cfq_group *cfqg) { if (cfqg->new_weight) { cfqg->weight = cfqg->new_weight; cfqg->new_weight = 0; }
functions
void cfq_update_group_leaf_weight(struct cfq_group *cfqg) { BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); if (cfqg->new_leaf_weight) { cfqg->leaf_weight = cfqg->new_leaf_weight; cfqg->new_leaf_weight = 0; }
functions
void cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) { unsigned int vfr = 1 << CFQ_SERVICE_SHIFT; /* start with 1 */ struct cfq_group *pos = cfqg; struct cfq_group *parent; bool propagate; /* add to the service tree */ BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); cfq_update_group_leaf_wei...
functions
void cfq_group_notify_queue_add(struct cfq_data *cfqd, struct cfq_group *cfqg) { struct cfq_rb_root *st = &cfqd->grp_service_tree; struct cfq_group *__cfqg; struct rb_node *n; cfqg->nr_cfqq++; if (!RB_EMPTY_NODE(&cfqg->rb_node)) return; /* * Currently put the group at the end. Later implement something * ...
functions
void cfq_group_service_tree_del(struct cfq_rb_root *st, struct cfq_group *cfqg) { struct cfq_group *pos = cfqg; bool propagate; /* * Undo activation from cfq_group_service_tree_add(). Deactivate * @cfqg and propagate deactivation upwards. */ propagate = !--pos->nr_active; pos->children_weight -= pos->leaf_...
functions
void cfq_group_notify_queue_del(struct cfq_data *cfqd, struct cfq_group *cfqg) { struct cfq_rb_root *st = &cfqd->grp_service_tree; BUG_ON(cfqg->nr_cfqq < 1); cfqg->nr_cfqq--; /* If there are other cfq queues under this group, don't delete it */ if (cfqg->nr_cfqq) return; cfq_log_cfqg(cfqd, cfqg, "del_from_rr...
functions
int cfq_cfqq_slice_usage(struct cfq_queue *cfqq, unsigned int *unaccounted_time) { unsigned int slice_used; /* * Queue got expired before even a single request completed or * got expired immediately after first request completion. */ if (!cfqq->slice_start || cfqq->slice_start == jiffies) { /* * Al...
functions
void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg, struct cfq_queue *cfqq) { struct cfq_rb_root *st = &cfqd->grp_service_tree; unsigned int used_sl, charge, unaccounted_sl = 0; int nr_sync = cfqg->nr_cfqq - cfqg_busy_async_queues(cfqd, cfqg) - cfqg->service_tree_idle.count; unsigned int vfr...
functions
void cfq_init_cfqg_base(struct cfq_group *cfqg) { struct cfq_rb_root *st; int i, j; for_each_cfqg_st(cfqg, i, j, st) *st = CFQ_RB_ROOT; RB_CLEAR_NODE(&cfqg->rb_node); cfqg->ttime.last_end_request = jiffies; }
functions
void cfq_pd_init(struct blkcg_gq *blkg) { struct cfq_group *cfqg = blkg_to_cfqg(blkg); cfq_init_cfqg_base(cfqg); cfqg->weight = blkg->blkcg->cfq_weight; cfqg->leaf_weight = blkg->blkcg->cfq_leaf_weight; }
functions
void cfq_pd_offline(struct blkcg_gq *blkg) { /* * @blkg is going offline and will be ignored by * blkg_[rw]stat_recursive_sum(). Transfer stats to the parent so * that they don't get lost. If IOs complete after this point, the * stats for them will be lost. Oh well... */ cfqg_stats_xfer_dead(blkg_to_cfqg...
functions
u64 cfqg_stat_pd_recursive_sum(struct blkg_policy_data *pd, int off) { u64 sum = 0; sum += blkg_stat_recursive_sum(pd, off); sum += blkg_stat_recursive_sum(pd, off + dead_stats_off_delta); return sum; }
functions
blkg_rwstat cfqg_rwstat_pd_recursive_sum(struct blkg_policy_data *pd, int off) { struct blkg_rwstat a, b; a = blkg_rwstat_recursive_sum(pd, off); b = blkg_rwstat_recursive_sum(pd, off + dead_stats_off_delta); blkg_rwstat_merge(&a, &b); return a; }
functions
void cfq_pd_reset_stats(struct blkcg_gq *blkg) { struct cfq_group *cfqg = blkg_to_cfqg(blkg); cfqg_stats_reset(&cfqg->stats); cfqg_stats_reset(&cfqg->dead_stats); }
functions
void cfq_link_cfqq_cfqg(struct cfq_queue *cfqq, struct cfq_group *cfqg) { /* Currently, all async queues are mapped to root group */ if (!cfq_cfqq_sync(cfqq)) cfqg = cfqq->cfqd->root_group; cfqq->cfqg = cfqg; /* cfqq reference on cfqg */ cfqg_get(cfqg); }
functions
u64 cfqg_prfill_weight_device(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct cfq_group *cfqg = pd_to_cfqg(pd); if (!cfqg->dev_weight) return 0; return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); }
functions
int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), cfqg_prfill_weight_device, &blkcg_policy_cfq, 0, false); return 0; }
functions
u64 cfqg_prfill_leaf_weight_device(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct cfq_group *cfqg = pd_to_cfqg(pd); if (!cfqg->dev_leaf_weight) return 0; return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); }
functions
int cfqg_print_leaf_weight_device(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), cfqg_prfill_leaf_weight_device, &blkcg_policy_cfq, 0, false); return 0; }
functions
int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_weight); return 0; }
functions
int cfq_print_leaf_weight(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_leaf_weight); return 0; }
functions
int __cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, const char *buf, bool is_leaf_weight) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); struct blkg_conf_ctx ctx; struct cfq_group *cfqg; int ret; ret = blkg_conf_prep(blkcg, &blkcg_policy_cfq, buf, &ctx); if (ret) return ret; ret = -...
functions
int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, const char *buf) { return __cfqg_set_weight_device(cgrp, cft, buf, false); }
functions
int cfqg_set_leaf_weight_device(struct cgroup *cgrp, struct cftype *cft, const char *buf) { return __cfqg_set_weight_device(cgrp, cft, buf, true); }
functions
int __cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val, bool is_leaf_weight) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); struct blkcg_gq *blkg; if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) return -EINVAL; spin_lock_irq(&blkcg->lock); if (!is_leaf_weight) blkcg->cfq_weight = val...
functions
int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) { return __cfq_set_weight(cgrp, cft, val, false); }
functions
int cfq_set_leaf_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) { return __cfq_set_weight(cgrp, cft, val, true); }
functions
int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, cft->private, false); return 0; }
functions
int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, cft->private, true); return 0; }
functions
u64 cfqg_prfill_stat_recursive(struct seq_file *sf, struct blkg_policy_data *pd, int off) { u64 sum = cfqg_stat_pd_recursive_sum(pd, off); return __blkg_prfill_u64(sf, pd, sum); }
functions
u64 cfqg_prfill_rwstat_recursive(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct blkg_rwstat sum = cfqg_rwstat_pd_recursive_sum(pd, off); return __blkg_prfill_rwstat(sf, pd, &sum); }
functions
int cfqg_print_stat_recursive(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, &blkcg_policy_cfq, cft->private, false); return 0; }
functions
int cfqg_print_rwstat_recursive(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, &blkcg_policy_cfq, cft->private, true); return 0; }
functions
u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct cfq_group *cfqg = pd_to_cfqg(pd); u64 samples = blkg_stat_read(&cfqg->stats.avg_queue_size_samples); u64 v = 0; if (samples) { v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum); v = div64_u64(v, sampl...
functions
int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft, struct seq_file *sf) { struct blkcg *blkcg = cgroup_to_blkcg(cgrp); blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, &blkcg_policy_cfq, 0, false); return 0; }
functions
void cfq_link_cfqq_cfqg(struct cfq_queue *cfqq, struct cfq_group *cfqg) { cfqq->cfqg = cfqg; }
functions
void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, bool add_front) { struct rb_node **p, *parent; struct cfq_queue *__cfqq; unsigned long rb_key; struct cfq_rb_root *st; int left; int new_cfqq = 1; st = st_for(cfqq->cfqg, cfqq_class(cfqq), cfqq_type(cfqq)); if (cfq_class_idle(cfqq)) ...
functions
else if (!add_front) { /* * Get our rb key offset. Subtract any residual slice * value carried from last service. A negative resid * count indicates slice overrun, and this should position * the next service time further away in the tree. */ rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies; rb_key -...
functions
void cfq_prio_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq) { struct rb_node **p, *parent; struct cfq_queue *__cfqq; if (cfqq->p_root) { rb_erase(&cfqq->p_node, cfqq->p_root); cfqq->p_root = NULL; }
functions
void cfq_resort_rr_list(struct cfq_data *cfqd, struct cfq_queue *cfqq) { /* * Resorting requires the cfqq to be on the RR list already. */ if (cfq_cfqq_on_rr(cfqq)) { cfq_service_tree_add(cfqd, cfqq, 0); cfq_prio_tree_add(cfqd, cfqq); }
functions
void cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) { cfq_log_cfqq(cfqd, cfqq, "add_to_rr"); BUG_ON(cfq_cfqq_on_rr(cfqq)); cfq_mark_cfqq_on_rr(cfqq); cfqd->busy_queues++; if (cfq_cfqq_sync(cfqq)) cfqd->busy_sync_queues++; cfq_resort_rr_list(cfqd, cfqq); }
functions
void cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) { cfq_log_cfqq(cfqd, cfqq, "del_from_rr"); BUG_ON(!cfq_cfqq_on_rr(cfqq)); cfq_clear_cfqq_on_rr(cfqq); if (!RB_EMPTY_NODE(&cfqq->rb_node)) { cfq_rb_erase(&cfqq->rb_node, cfqq->service_tree); cfqq->service_tree = NULL; }
functions
void cfq_del_rq_rb(struct request *rq) { struct cfq_queue *cfqq = RQ_CFQQ(rq); const int sync = rq_is_sync(rq); BUG_ON(!cfqq->queued[sync]); cfqq->queued[sync]--; elv_rb_del(&cfqq->sort_list, rq); if (cfq_cfqq_on_rr(cfqq) && RB_EMPTY_ROOT(&cfqq->sort_list)) { /* * Queue will be deleted from service tree w...
functions
void cfq_add_rq_rb(struct request *rq) { struct cfq_queue *cfqq = RQ_CFQQ(rq); struct cfq_data *cfqd = cfqq->cfqd; struct request *prev; cfqq->queued[rq_is_sync(rq)]++; elv_rb_add(&cfqq->sort_list, rq); if (!cfq_cfqq_on_rr(cfqq)) cfq_add_cfqq_rr(cfqd, cfqq); /* * check if this request is a better next-se...
functions
void cfq_reposition_rq_rb(struct cfq_queue *cfqq, struct request *rq) { elv_rb_del(&cfqq->sort_list, rq); cfqq->queued[rq_is_sync(rq)]--; cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags); cfq_add_rq_rb(rq); cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group, rq->cmd_flags); }
functions
void cfq_activate_request(struct request_queue *q, struct request *rq) { struct cfq_data *cfqd = q->elevator->elevator_data; cfqd->rq_in_driver++; cfq_log_cfqq(cfqd, RQ_CFQQ(rq), "activate rq, drv=%d", cfqd->rq_in_driver); cfqd->last_position = blk_rq_pos(rq) + blk_rq_sectors(rq); }
functions
void cfq_deactivate_request(struct request_queue *q, struct request *rq) { struct cfq_data *cfqd = q->elevator->elevator_data; WARN_ON(!cfqd->rq_in_driver); cfqd->rq_in_driver--; cfq_log_cfqq(cfqd, RQ_CFQQ(rq), "deactivate rq, drv=%d", cfqd->rq_in_driver); }
functions
void cfq_remove_request(struct request *rq) { struct cfq_queue *cfqq = RQ_CFQQ(rq); if (cfqq->next_rq == rq) cfqq->next_rq = cfq_find_next_rq(cfqq->cfqd, cfqq, rq); list_del_init(&rq->queuelist); cfq_del_rq_rb(rq); cfqq->cfqd->rq_queued--; cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags); if (rq->cmd...
functions
int cfq_merge(struct request_queue *q, struct request **req, struct bio *bio) { struct cfq_data *cfqd = q->elevator->elevator_data; struct request *__rq; __rq = cfq_find_rq_fmerge(cfqd, bio); if (__rq && elv_rq_merge_ok(__rq, bio)) { *req = __rq; return ELEVATOR_FRONT_MERGE; }
functions
void cfq_merged_request(struct request_queue *q, struct request *req, int type) { if (type == ELEVATOR_FRONT_MERGE) { struct cfq_queue *cfqq = RQ_CFQQ(req); cfq_reposition_rq_rb(cfqq, req); }
functions
void cfq_bio_merged(struct request_queue *q, struct request *req, struct bio *bio) { cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_rw); }
functions
void cfq_merged_requests(struct request_queue *q, struct request *rq, struct request *next) { struct cfq_queue *cfqq = RQ_CFQQ(rq); struct cfq_data *cfqd = q->elevator->elevator_data; /* * reposition in fifo if next is older than rq */ if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && ...
functions
int cfq_allow_merge(struct request_queue *q, struct request *rq, struct bio *bio) { struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_io_cq *cic; struct cfq_queue *cfqq; /* * Disallow merge of a sync bio into an async request. */ if (cfq_bio_sync(bio) && !rq_is_sync(rq)) return false; /...
functions
void cfq_del_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq) { del_timer(&cfqd->idle_slice_timer); cfqg_stats_update_idle_time(cfqq->cfqg); }
functions
void __cfq_set_active_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) { if (cfqq) { cfq_log_cfqq(cfqd, cfqq, "set_active wl_class:%d wl_type:%d", cfqd->serving_wl_class, cfqd->serving_wl_type); cfqg_stats_update_avg_queue_size(cfqq->cfqg); cfqq->slice_start = 0; cfqq->dispatch_start = jiffies; ...
functions
void __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, bool timed_out) { cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out); if (cfq_cfqq_wait_request(cfqq)) cfq_del_timer(cfqd, cfqq); cfq_clear_cfqq_wait_request(cfqq); cfq_clear_cfqq_wait_busy(cfqq); /* * If this cfqq is share...
functions
void cfq_slice_expired(struct cfq_data *cfqd, bool timed_out) { struct cfq_queue *cfqq = cfqd->active_queue; if (cfqq) __cfq_slice_expired(cfqd, cfqq, timed_out); }
functions
sector_t cfq_dist_from_last(struct cfq_data *cfqd, struct request *rq) { if (blk_rq_pos(rq) >= cfqd->last_position) return blk_rq_pos(rq) - cfqd->last_position; else return cfqd->last_position - blk_rq_pos(rq); }
functions
int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct request *rq) { return cfq_dist_from_last(cfqd, rq) <= CFQQ_CLOSE_THR; }
functions
bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq) { enum wl_class_t wl_class = cfqq_class(cfqq); struct cfq_rb_root *st = cfqq->service_tree; BUG_ON(!st); BUG_ON(!st->count); if (!cfqd->cfq_slice_idle) return false; /* We never do for idle class queues. */ if (wl_class == IDLE_WORKLOAD) ...
functions
void cfq_arm_slice_timer(struct cfq_data *cfqd) { struct cfq_queue *cfqq = cfqd->active_queue; struct cfq_io_cq *cic; unsigned long sl, group_idle = 0; /* * SSD device without seek penalty, disable idling. But only do so * for devices that support queuing, otherwise we still have a problem * with sync vs asy...
functions
void cfq_dispatch_insert(struct request_queue *q, struct request *rq) { struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_queue *cfqq = RQ_CFQQ(rq); cfq_log_cfqq(cfqd, cfqq, "dispatch_insert"); cfqq->next_rq = cfq_find_next_rq(cfqd, cfqq, rq); cfq_remove_request(rq); cfqq->dispatched++; (RQ_CFQG(r...
functions
int cfq_prio_to_maxrq(struct cfq_data *cfqd, struct cfq_queue *cfqq) { const int base_rq = cfqd->cfq_slice_async_rq; WARN_ON(cfqq->ioprio >= IOPRIO_BE_NR); return 2 * base_rq * (IOPRIO_BE_NR - cfqq->ioprio); }
functions
int cfqq_process_refs(struct cfq_queue *cfqq) { int process_refs, io_refs; io_refs = cfqq->allocated[READ] + cfqq->allocated[WRITE]; process_refs = cfqq->ref - io_refs; BUG_ON(process_refs < 0); return process_refs; }
functions
void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq) { int process_refs, new_process_refs; struct cfq_queue *__cfqq; /* * If there are no process references on the new_cfqq, then it is * unsafe to follow the ->new_cfqq chain as other cfqq's in the * chain may have dropped their last refere...
functions
wl_type_t cfq_choose_wl_type(struct cfq_data *cfqd, struct cfq_group *cfqg, enum wl_class_t wl_class) { struct cfq_queue *queue; int i; bool key_valid = false; unsigned long lowest_key = 0; enum wl_type_t cur_best = SYNC_NOIDLE_WORKLOAD; for (i = 0; i <= SYNC_WORKLOAD; ++i) { /* select the one with lowest r...
functions
void choose_wl_class_and_type(struct cfq_data *cfqd, struct cfq_group *cfqg) { unsigned slice; unsigned count; struct cfq_rb_root *st; unsigned group_slice; enum wl_class_t original_class = cfqd->serving_wl_class; /* Choose next priority. RT > BE > IDLE */ if (cfq_group_busy_queues_wl(RT_WORKLOAD, cfqd, cfqg)) ...
functions
void cfq_choose_cfqg(struct cfq_data *cfqd) { struct cfq_group *cfqg = cfq_get_next_cfqg(cfqd); cfqd->serving_group = cfqg; /* Restore the workload type data */ if (cfqg->saved_wl_slice) { cfqd->workload_expires = jiffies + cfqg->saved_wl_slice; cfqd->serving_wl_type = cfqg->saved_wl_type; cfqd->serving_wl_...
functions
int __cfq_forced_dispatch_cfqq(struct cfq_queue *cfqq) { int dispatched = 0; while (cfqq->next_rq) { cfq_dispatch_insert(cfqq->cfqd->queue, cfqq->next_rq); dispatched++; }
functions
int cfq_forced_dispatch(struct cfq_data *cfqd) { struct cfq_queue *cfqq; int dispatched = 0; /* Expire the timeslice of the current active queue first */ cfq_slice_expired(cfqd, 0); while ((cfqq = cfq_get_next_queue_forced(cfqd)) != NULL) { __cfq_set_active_queue(cfqd, cfqq); dispatched += __cfq_forced_dispat...
functions
bool cfq_slice_used_soon(struct cfq_data *cfqd, struct cfq_queue *cfqq) { /* the queue hasn't finished any request, can't estimate */ if (cfq_cfqq_slice_new(cfqq)) return true; if (time_after(jiffies + cfqd->cfq_slice_idle * cfqq->dispatched, cfqq->slice_end)) return true; return false; }
functions
bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq) { unsigned int max_dispatch; if (cfq_cfqq_must_dispatch(cfqq)) return true; /* * Drain async requests before we start sync IO */ if (cfq_should_idle(cfqd, cfqq) && cfqd->rq_in_flight[BLK_RW_ASYNC]) return false; /* * If this is an as...
functions
bool cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq) { struct request *rq; BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list)); rq = cfq_check_fifo(cfqq); if (rq) cfq_mark_cfqq_must_dispatch(cfqq); if (!cfq_may_dispatch(cfqd, cfqq)) return false; /* * follow expired path, else get first next ava...
functions
int cfq_dispatch_requests(struct request_queue *q, int force) { struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_queue *cfqq; if (!cfqd->busy_queues) return 0; if (unlikely(force)) return cfq_forced_dispatch(cfqd); cfqq = cfq_select_queue(cfqd); if (!cfqq) return 0; /* * Dispatch a requ...
functions
void cfq_put_queue(struct cfq_queue *cfqq) { struct cfq_data *cfqd = cfqq->cfqd; struct cfq_group *cfqg; BUG_ON(cfqq->ref <= 0); cfqq->ref--; if (cfqq->ref) return; cfq_log_cfqq(cfqd, cfqq, "put_queue"); BUG_ON(rb_first(&cfqq->sort_list)); BUG_ON(cfqq->allocated[READ] + cfqq->allocated[WRITE]); cfqg = cfq...
functions
void cfq_put_cooperator(struct cfq_queue *cfqq) { struct cfq_queue *__cfqq, *next; /* * If this queue was scheduled to merge with another queue, be * sure to drop the reference taken on that queue (and others in * the merge chain). See cfq_setup_merge and cfq_merge_cfqqs. */ __cfqq = cfqq->new_cfqq; while...
functions
void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) { if (unlikely(cfqq == cfqd->active_queue)) { __cfq_slice_expired(cfqd, cfqq, 0); cfq_schedule_dispatch(cfqd); }