Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
block/bfq-cgroup.c
static ssize_t bfq_io_set_device_weight(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { int ret; struct blkg_conf_ctx ctx; struct blkcg *blkcg = css_to_blkcg(of_css(of)); struct bfq_group *bfqg; u64 v; ret = blkg_conf_prep(blkcg, &blkcg_policy_bf...
[ 1, 0 ]
Linux Kernel
block/bfq-cgroup.c
static u64 bfqg_prfill_rwstat_recursive(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct blkg_rwstat_sample sum; blkg_rwstat_recursive_sum(pd_to_blkg(pd), &blkcg_policy_bfq, off, &sum); return __blkg_prfill_rwstat(sf, pd, &sum); }
[ 0, 0 ]
Linux Kernel
block/bfq-cgroup.c
static u64 bfqg_prfill_stat_recursive(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct blkcg_gq *blkg = pd_to_blkg(pd); struct blkcg_gq *pos_blkg; struct cgroup_subsys_state *pos_css; u64 sum = 0; lockdep_assert_held(&blkg->q->queue_lock); rcu_read...
[ 0, 0 ]
Linux Kernel
block/bfq-cgroup.c
static u64 bfqg_prfill_sectors(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct bfq_group *bfqg = blkg_to_bfqg(pd->blkg); u64 sum = blkg_rwstat_total(&bfqg->stats.bytes); return __blkg_prfill_u64(sf, pd, sum >> 9); }
[ 0, 0 ]
Linux Kernel
block/bfq-cgroup.c
struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node) { int ret; ret = blkcg_activate_policy(bfqd->queue, &blkcg_policy_bfq); if (ret) return NULL; return blkg_to_bfqg(bfqd->queue->root_blkg); }
[ 0, 0 ]
Linux Kernel
block/bfq-cgroup.c
void bfqg_and_blkg_put(struct bfq_group *bfqg) {}
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static struct bfq_io_cq *icq_to_bic(struct io_cq *icq) { return container_of(icq, struct bfq_io_cq, icq); }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_limit_depth(blk_opf_t opf, struct blk_mq_alloc_data *data) { struct bfq_data *bfqd = data->q->elevator->elevator_data; struct bfq_io_cq *bic = bfq_bic_lookup(data->q); struct bfq_queue *bfqq = bic ? bic_to_bfqq(bic, op_is_sync(opf)) : NULL; int depth; unsigned limit = data->q->nr_requests; ...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static bool bfq_too_late_for_merging(struct bfq_queue *bfqq) { return bfqq->service_from_backlogged > 0 && time_is_before_jiffies(bfqq->first_IO_time + bfq_merge_time_limit); }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
void __cold bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq) { struct rb_node **p, *parent; struct bfq_queue *__bfqq; if (bfqq->pos_root) { rb_erase(&bfqq->pos_node, bfqq->pos_root); bfqq->pos_root = NULL; } if (bfqq == &bfqd->oom_bfqq) retur...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static bool bfq_asymmetric_scenario(struct bfq_data *bfqd, struct bfq_queue *bfqq) { bool smallest_weight = bfqq && bfqq->weight_counter && bfqq->weight_counter == container_of(rb_first_cached(&bfqd->queue_weights_tree), struct bfq_weigh...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static struct request *bfq_find_next_rq(struct bfq_data *bfqd, struct bfq_queue *bfqq, struct request *last) { struct rb_node *rbnext = rb_next(&last->rb_node); struct rb_node *rbprev = rb_prev(&last->rb_node); struct request *next, *...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static int bfq_min_budget(struct bfq_data *bfqd) { if (bfqd->budgets_assigned < bfq_stats_min_budgets) return bfq_default_max_budget / 32; else return bfqd->bfq_max_budget / 32; }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static unsigned long bfq_smallest_from_now(void) { return jiffies - MAX_JIFFY_OFFSET; }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static bool bfq_bfqq_higher_class_or_weight(struct bfq_queue *bfqq, struct bfq_queue *in_serv_bfqq) { int bfqq_weight, in_serv_weight; if (bfqq->ioprio_class < in_serv_bfqq->ioprio_class) return true; if (in_serv_bfqq->entity.parent == bfqq->entity.parent) { b...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static sector_t get_sdist(sector_t last_pos, struct request *rq) { if (last_pos) return abs(blk_rq_pos(rq) - last_pos); return 0; }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_requests_merged(struct request_queue *q, struct request *rq, struct request *next) { struct bfq_queue *bfqq = RQ_BFQQ(rq), *next_bfqq = RQ_BFQQ(next); if (!bfqq) goto remove; if (bfqq == next_bfqq && !list_empty(&rq->queuelist) && !list_empty(&next->queu...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_set_budget_timeout(struct bfq_data *bfqd, struct bfq_queue *bfqq) { unsigned int timeout_coeff; if (bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time) timeout_coeff = 1; else timeout_coeff = bfqq->entity.weight / bfqq->entity.orig_weight; bfqd->last_b...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void __bfq_set_in_service_queue(struct bfq_data *bfqd, struct bfq_queue *bfqq) { if (bfqq) { bfq_clear_bfqq_fifo_expire(bfqq); bfqd->budgets_assigned = (bfqd->budgets_assigned * 7 + 256) / 8; if (time_is_before_jiffies(bfqq->last_wr_start_finish) && ...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static struct bfq_queue *bfq_set_in_service_queue(struct bfq_data *bfqd) { struct bfq_queue *bfqq = bfq_get_next_queue(bfqd); __bfq_set_in_service_queue(bfqd, bfqq); return bfqq; }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_arm_slice_timer(struct bfq_data *bfqd) { struct bfq_queue *bfqq = bfqd->in_service_queue; u32 sl; bfq_mark_bfqq_wait_request(bfqq); sl = bfqd->bfq_slice_idle; /* * Unless the queue is being weight-raised or the scenario is * asymmetric, grant only minimum idle time if the queue * is...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_reset_rate_computation(struct bfq_data *bfqd, struct request *rq) { if (rq != NULL) { bfqd->last_dispatch = bfqd->first_dispatch = ktime_get_ns(); bfqd->peak_rate_samples = 1; bfqd->sequential_samples = 0; bfqd->tot_sectors_dispatched = bfqd->last...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_dispatch_remove(struct request_queue *q, struct request *rq) { struct bfq_queue *bfqq = RQ_BFQQ(rq); /* * For consistency, the next instruction should have been * executed after removing the request from the queue and * dispatching it. We execute instead this instruction before * bfq_r...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static unsigned long bfq_bfqq_softrt_next_start(struct bfq_data *bfqd, struct bfq_queue *bfqq) { return max3(bfqq->soft_rt_next_start, bfqq->last_idle_bklogged + HZ * bfqq->service_from_backlogged / bfqd->bfq_wr...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static bool bfq_may_expire_for_budg_timeout(struct bfq_queue *bfqq) { bfq_log_bfqq(bfqq->bfqd, bfqq, "may_budget_timeout: wait_request %d left %d timeout %d", bfq_bfqq_wait_request(bfqq), bfq_bfqq_budget_left(bfqq) >= bfqq->entity.budget / 3, bfq_bfqq_budget...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_exit_icq_bfqq(struct bfq_io_cq *bic, bool is_sync) { struct bfq_queue *bfqq = bic_to_bfqq(bic, is_sync); struct bfq_data *bfqd; if (bfqq) bfqd = bfqq->bfqd; if (bfqq && bfqd) { unsigned long flags; spin_lock_irqsave(&bfqd->lock, flags); bfqq->bic = NULL; bfq_exit_bfqq(bfqd...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_update_io_seektime(struct bfq_data *bfqd, struct bfq_queue *bfqq, struct request *rq) { bfqq->seek_history <<= 1; bfqq->seek_history |= BFQ_RQ_SEEKY(bfqd, bfqq->last_request_pos, rq); if (bfqq->wr_coeff > 1 && bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time &&...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, bool at_head) { struct request_queue *q = hctx->queue; struct bfq_data *bfqd = q->elevator->elevator_data; struct bfq_queue *bfqq; bool idle_timer_disabled = false; blk_opf_t cmd_flags; LIST_HEAD(fr...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx, struct list_head *list, bool at_head) { while (!list_empty(list)) { struct request *rq; rq = list_first_entry(list, struct request, queuelist); list_del_init(&rq->queuelist); bfq_insert_request(hctx, rq, at_h...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_finish_requeue_request(struct request *rq) { struct bfq_queue *bfqq = RQ_BFQQ(rq); struct bfq_data *bfqd; unsigned long flags; if (!rq->elv.icq || !bfqq) return; bfqd = bfqq->bfqd; if (rq->rq_flags & RQF_STARTED) bfqg_stats_update_completion(bfqq_group(bfqq), rq->start_time_ns, ...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_finish_request(struct request *rq) { bfq_finish_requeue_request(rq); if (rq->elv.icq) { put_io_context(rq->elv.icq->ioc); rq->elv.icq = NULL; } }
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static struct bfq_queue *bfq_get_bfqq_handle_split(struct bfq_data *bfqd, struct bfq_io_cq *bic, struct bio *bio, bool split, bool is_sync, ...
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static void __bfq_put_async_bfqq(struct bfq_data *bfqd, struct bfq_queue **bfqq_ptr) { struct bfq_queue *bfqq = *bfqq_ptr; bfq_log(bfqd, "put_async_bfqq: %p", bfqq); if (bfqq) { bfq_bfqq_move(bfqd, bfqq, bfqd->root_group); bfq_log_bfqq(bfqd, bfqq, "put_async_bfqq: putti...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx) { struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; struct blk_mq_tags *tags = hctx->sched_tags; bfq_update_depths(bfqd, &tags->bitmap_tags); sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, 1); }
[ 1, 0 ]
Linux Kernel
block/bfq-iosched.c
static void bfq_exit_queue(struct elevator_queue *e) { struct bfq_data *bfqd = e->elevator_data; struct bfq_queue *bfqq, *n; hrtimer_cancel(&bfqd->idle_slice_timer); spin_lock_irq(&bfqd->lock); list_for_each_entry_safe(bfqq, n, &bfqd->idle_list, bfqq_list) bfq_deactivate_bfqq(bfqd, bfqq, false, false)...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.c
static int __init bfq_init(void) { int ret; #ifdef CONFIG_BFQ_GROUP_IOSCHED ret = blkcg_policy_register(&blkcg_policy_bfq); if (ret) return ret; #endif ret = -ENOMEM; if (bfq_slab_setup()) goto err_pol_unreg; ref_wr_duration[0] = msecs_to_jiffies(7000); /* actually 8 sec */ ref_wr_duration[1] =...
[ 0, 0 ]
Linux Kernel
block/bfq-iosched.h
static inline void bfq_bfqq_name(struct bfq_queue *bfqq, char *str, int len) { char type = bfq_bfqq_sync(bfqq) ? 'S' : 'A'; if (bfqq->pid != -1) snprintf(str, len, "bfq%d%c", bfqq->pid, type); else snprintf(str, len, "bfqSHARED-%c", type); }
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
static bool bfq_update_next_in_service(struct bfq_sched_data *sd, struct bfq_entity *new_entity, bool expiration) { struct bfq_entity *next_in_service = sd->next_in_service; bool parent_sched_may_change = false; bool change_without_look...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_inc_active_entities(struct bfq_entity *entity) { struct bfq_sched_data *sd = entity->sched_data; struct bfq_group *bfqg = container_of(sd, struct bfq_group, sched_data); if (bfqg != bfqg->bfqd->root_group) bfqg->active_entities++; }
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_inc_active_entities(struct bfq_entity *entity) {}
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_idle_extract(struct bfq_service_tree *st, struct bfq_entity *entity) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); struct rb_node *next; if (entity == st->first_idle) { next = rb_next(&entity->rb_node); st->first_idle = bfq_entity_of(next); } if ...
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_update_active_node(struct rb_node *node) { struct bfq_entity *entity = rb_entry(node, struct bfq_entity, rb_node); entity->min_start = entity->start; bfq_update_min(entity, node->rb_right); bfq_update_min(entity, node->rb_left); }
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_active_insert(struct bfq_service_tree *st, struct bfq_entity *entity) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); struct rb_node *node = &entity->rb_node; bfq_insert(&st->active, entity); if (node->rb_left) node = node->rb_left; else if (node->rb_...
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_idle_insert(struct bfq_service_tree *st, struct bfq_entity *entity) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); struct bfq_entity *first_idle = st->first_idle; struct bfq_entity *last_idle = st->last_idle; if (!first_idle || bfq_gt(first_idle->finish, enti...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_forget_idle(struct bfq_service_tree *st) { struct bfq_entity *first_idle = st->first_idle; struct bfq_entity *last_idle = st->last_idle; if (RB_EMPTY_ROOT(&st->active) && last_idle && !bfq_gt(last_idle->finish, st->vtime)) { st->vtime = last_idle->finish; } if (first_idle && !bfq_...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void __bfq_requeue_entity(struct bfq_entity *entity) { struct bfq_sched_data *sd = entity->sched_data; struct bfq_service_tree *st = bfq_entity_service_tree(entity); if (entity == sd->in_service_entity) { bfq_calc_finish(entity, entity->service); entity->start = entity->finish; /* * In a...
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
static void bfq_activate_requeue_entity(struct bfq_entity *entity, bool non_blocking_wait_rq, bool requeue, bool expiration) { for_each_entity(entity) { __bfq_activate_requeue_entity(entity, non_blocking_wait_rq); if (!bfq_update_...
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) { struct bfq_sched_data *sd = entity->sched_data; struct bfq_service_tree *st; bool is_in_service; if (!entity->on_st_or_in_serv) return false; /* * If we get here, then entity is active, whi...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
bool __bfq_bfqd_reset_in_service(struct bfq_data *bfqd) { struct bfq_queue *in_serv_bfqq = bfqd->in_service_queue; struct bfq_entity *in_serv_entity = &in_serv_bfqq->entity; struct bfq_entity *entity = in_serv_entity; bfq_clear_bfqq_wait_request(in_serv_bfqq); hrtimer_try_to_cancel(&bfqd->idle_slice_timer); ...
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, bool ins_into_idle_tree, bool expiration) { struct bfq_entity *entity = &bfqq->entity; bfq_deactivate_entity(entity, ins_into_idle_tree, expiration); }
[ 0, 0 ]
Linux Kernel
block/bfq-wf2q.c
void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq) { struct bfq_entity *entity = &bfqq->entity; if (!entity->in_groups_with_pending_reqs) { entity->in_groups_with_pending_reqs = true; #ifdef CONFIG_BFQ_GROUP_IOSCHED if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++)) bfqq->bf...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq) { struct bfq_entity *entity = &bfqq->entity; if (entity->in_groups_with_pending_reqs) { entity->in_groups_with_pending_reqs = false; #ifdef CONFIG_BFQ_GROUP_IOSCHED if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs)) bfqq->bf...
[ 1, 0 ]
Linux Kernel
block/bfq-wf2q.c
void bfq_add_bfqq_busy(struct bfq_queue *bfqq) { struct bfq_data *bfqd = bfqq->bfqd; bfq_log_bfqq(bfqd, bfqq, "add to busy"); bfq_activate_bfqq(bfqd, bfqq); bfq_mark_bfqq_busy(bfqq); bfqd->busy_queues[bfqq->ioprio_class - 1]++; if (!bfqq->dispatched) { bfq_add_bfqq_in_groups_with_pending_reqs(bfqq);...
[ 1, 0 ]
Linux Kernel
block/bio-integrity.c
static void __bio_integrity_free(struct bio_set *bs, struct bio_integrity_payload *bip) { if (bs && mempool_initialized(&bs->bio_integrity_pool)) { if (bip->bip_vec) bvec_free(&bs->bvec_integrity_pool, bip->bip_vec, bip->bip_max_vcnt); mempool_free(bip, &bs->bio_integri...
[ 0, 0 ]
Linux Kernel
block/bio-integrity.c
static blk_status_t bio_integrity_process(struct bio *bio, struct bvec_iter *proc_iter, integrity_processing_fn *proc_fn) { struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); struct blk_integrity_iter iter; struc...
[ 1, 0 ]
Linux Kernel
block/bio-integrity.c
static void bio_integrity_verify_fn(struct work_struct *work) { struct bio_integrity_payload *bip = container_of(work, struct bio_integrity_payload, bip_work); struct bio *bio = bip->bip_bio; struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); bio->bi_status = bio_integrity_process...
[ 0, 0 ]
Linux Kernel
block/bio-integrity.c
void __init bio_integrity_init(void) { kintegrityd_wq = alloc_workqueue( "kintegrityd", WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_CPU_INTENSIVE, 1); if (!kintegrityd_wq) panic("Failed to create kintegrityd\n"); bip_slab = kmem_cache_create("bio_integrity_payload", sizeof(struct b...
[ 1, 0 ]
Linux Kernel
block/bio.c
static struct biovec_slab *biovec_slab(unsigned short nr_vecs) { switch (nr_vecs) { case 5 ... 16: return &bvec_slabs[0]; case 17 ... 64: return &bvec_slabs[1]; case 65 ... 128: return &bvec_slabs[2]; case 129 ... BIO_MAX_VECS: return &bvec_slabs[3]; default: BUG(); return NULL; }...
[ 0, 0 ]
Linux Kernel
block/bio.c
static struct bio_slab *create_bio_slab(unsigned int size) { struct bio_slab *bslab = kzalloc(sizeof(*bslab), GFP_KERNEL); if (!bslab) return NULL; snprintf(bslab->name, sizeof(bslab->name), "bio-%d", size); bslab->slab = kmem_cache_create(bslab->name, size, ARCH_KMALLOC_MINALIGN, ...
[ 1, 0 ]
Linux Kernel
block/bio.c
static struct kmem_cache *bio_find_or_create_slab(struct bio_set *bs) { unsigned int size = bs_bio_slab_size(bs); struct bio_slab *bslab; mutex_lock(&bio_slab_lock); bslab = xa_load(&bio_slabs, size); if (bslab) bslab->slab_ref++; else bslab = create_bio_slab(size); mutex_unlock(&bio_slab_lock);...
[ 1, 0 ]
Linux Kernel
block/bio.c
struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs, gfp_t gfp_mask) { struct biovec_slab *bvs = biovec_slab(*nr_vecs); if (WARN_ON_ONCE(!bvs)) return NULL; *nr_vecs = bvs->nr_vecs; /* * Try a slab allocation first for all smaller allocations. If that * f...
[ 0, 0 ]
Linux Kernel
block/bio.c
static void bio_free(struct bio *bio) { struct bio_set *bs = bio->bi_pool; void *p = bio; WARN_ON_ONCE(!bs); bio_uninit(bio); bvec_free(&bs->bvec_pool, bio->bi_io_vec, bio->bi_max_vecs); mempool_free(p - bs->front_pad, &bs->bio_pool); }
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf) { bio_uninit(bio); memset(bio, 0, BIO_RESET_BYTES); atomic_set(&bio->__bi_remaining, 1); bio->bi_bdev = bdev; if (bio->bi_bdev) bio_associate_blkg(bio); bio->bi_opf = opf; }
[ 1, 0 ]
Linux Kernel
block/bio.c
struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, unsigned int nr_pages, blk_opf_t opf, gfp_t gfp) { struct bio *new = bio_alloc(bdev, nr_pages, opf, gfp); if (bio) { bio_chain(bio, new); submit_bio(bio); } return new; }
[ 0, 0 ]
Linux Kernel
block/bio.c
static void bio_alloc_rescue(struct work_struct *work) { struct bio_set *bs = container_of(work, struct bio_set, rescue_work); struct bio *bio; while (1) { spin_lock(&bs->rescue_lock); bio = bio_list_pop(&bs->rescue_list); spin_unlock(&bs->rescue_lock); if (!bio) break; submit_bio_no...
[ 0, 0 ]
Linux Kernel
block/bio.c
static void bio_alloc_irq_cache_splice(struct bio_alloc_cache *cache) { unsigned long flags; if (WARN_ON_ONCE(cache->free_list)) return; local_irq_save(flags); cache->free_list = cache->free_list_irq; cache->free_list_irq = NULL; cache->nr += cache->nr_irq; cache->nr_irq = 0; local_irq_restore(fla...
[ 0, 0 ]
Linux Kernel
block/bio.c
static struct bio *bio_alloc_percpu_cache(struct block_device *bdev, unsigned short nr_vecs, blk_opf_t opf, gfp_t gfp, struct bio_set *bs) { struct bio_alloc_cache *cache; struct bio *bio; cache = per_cpu_ptr(bs->cache, get_cpu(...
[ 0, 0 ]
Linux Kernel
block/bio.c
struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask) { struct bio *bio; if (nr_vecs > UIO_MAXIOV) return NULL; return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask); }
[ 0, 0 ]
Linux Kernel
block/bio.c
static int __bio_alloc_cache_prune(struct bio_alloc_cache *cache, unsigned int nr) { unsigned int i = 0; struct bio *bio; while ((bio = cache->free_list) != NULL) { cache->free_list = bio->bi_next; cache->nr--; bio_free(bio); if (++i == nr) break; } r...
[ 1, 0 ]
Linux Kernel
block/bio.c
static void bio_alloc_cache_destroy(struct bio_set *bs) { int cpu; if (!bs->cache) return; cpuhp_state_remove_instance_nocalls(CPUHP_BIO_DEAD, &bs->cpuhp_dead); for_each_possible_cpu(cpu) { struct bio_alloc_cache *cache; cache = per_cpu_ptr(bs->cache, cpu); bio_alloc_cache_prune(cache, -1U);...
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_put(struct bio *bio) { if (unlikely(bio_flagged(bio, BIO_REFFED))) { BUG_ON(!atomic_read(&bio->__bi_cnt)); if (!atomic_dec_and_test(&bio->__bi_cnt)) return; } if (bio->bi_opf & REQ_ALLOC_CACHE) bio_put_percpu_cache(bio); else bio_free(bio); }
[ 0, 0 ]
Linux Kernel
block/bio.c
static inline bool page_is_mergeable(const struct bio_vec *bv, struct page *page, unsigned int len, unsigned int off, bool *same_page) { size_t bv_end = bv->bv_offset + bv->bv_len; phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_en...
[ 1, 0 ]
Linux Kernel
block/bio.c
static bool __bio_try_merge_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off, bool *same_page) { if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED))) return false; if (bio->bi_vcnt > 0) { struct bio_vec *bv = &bio->bi_i...
[ 0, 0 ]
Linux Kernel
block/bio.c
int bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { bool same_page = false; if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { if (bio_full(bio, len)) return 0; __bio_add_page(bio, page, len, offset); } return len; }
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter) { size_t size = iov_iter_count(iter); WARN_ON_ONCE(bio->bi_max_vecs); if (bio_op(bio) == REQ_OP_ZONE_APPEND) { struct request_queue *q = bdev_get_queue(bio->bi_bdev); size_t max_sectors = queue_max_zone_append_sectors(q); size = min(siz...
[ 0, 0 ]
Linux Kernel
block/bio.c
static int bio_iov_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { bool same_page = false; if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { __bio_add_page(bio, page, len, offset); return 0; } if (same_page) put_page...
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_copy_data(struct bio *dst, struct bio *src) { struct bvec_iter src_iter = src->bi_iter; struct bvec_iter dst_iter = dst->bi_iter; while (src_iter.bi_size && dst_iter.bi_size) { struct bio_vec src_bv = bio_iter_iovec(src, src_iter); struct bio_vec dst_bv = bio_iter_iovec(dst, dst_iter); unsig...
[ 1, 0 ]
Linux Kernel
block/bio.c
void bio_free_pages(struct bio *bio) { struct bio_vec *bvec; struct bvec_iter_all iter_all; bio_for_each_segment_all(bvec, bio, iter_all) __free_page(bvec->bv_page); }
[ 0, 0 ]
Linux Kernel
block/bio.c
static void bio_dirty_fn(struct work_struct *work) { struct bio *bio, *next; spin_lock_irq(&bio_dirty_lock); next = bio_dirty_list; bio_dirty_list = NULL; spin_unlock_irq(&bio_dirty_lock); while ((bio = next) != NULL) { next = bio->bi_private; bio_release_pages(bio, true); bio_put(bio); } }
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_check_pages_dirty(struct bio *bio) { struct bio_vec *bvec; unsigned long flags; struct bvec_iter_all iter_all; bio_for_each_segment_all(bvec, bio, iter_all) { if (!PageDirty(bvec->bv_page) && !PageCompound(bvec->bv_page)) goto defer; } bio_release_pages(bio, false); bio_put(bio); r...
[ 0, 0 ]
Linux Kernel
block/bio.c
void bio_trim(struct bio *bio, sector_t offset, sector_t size) { if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS || offset + size > bio_sectors(bio))) return; size <<= 9; if (offset == 0 && size == bio->bi_iter.bi_size) return; bio_advance(bio, offset << 9); bi...
[ 1, 0 ]
Linux Kernel
block/bio.c
int bioset_init(struct bio_set *bs, unsigned int pool_size, unsigned int front_pad, int flags) { bs->front_pad = front_pad; if (flags & BIOSET_NEED_BVECS) bs->back_pad = BIO_INLINE_VECS * sizeof(struct bio_vec); else bs->back_pad = 0; spin_lock_init(&bs->rescue_lock); bio_list_init(&b...
[ 1, 0 ]
Linux Kernel
block/blk-cgroup-rwstat.c
int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) { int i, ret; for (i = 0; i < BLKG_RWSTAT_NR; i++) { ret = percpu_counter_init(&rwstat->cpu_cnt[i], 0, gfp); if (ret) { while (--i >= 0) percpu_counter_destroy(&rwstat->cpu_cnt[i]); return ret; } atomic64_set(&rwstat->...
[ 0, 0 ]
Linux Kernel
block/blk-cgroup-rwstat.c
u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, int off) { struct blkg_rwstat_sample rwstat = {}; blkg_rwstat_read((void *)pd + off, &rwstat); return __blkg_prfill_rwstat(sf, pd, &rwstat); }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup-rwstat.h
static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat) { int i; for (i = 0; i < BLKG_RWSTAT_NR; i++) { percpu_counter_set(&rwstat->cpu_cnt[i], 0); atomic64_set(&rwstat->aux_cnt[i], 0); } }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
static int init_blkcg_llists(struct blkcg *blkcg) { int cpu; blkcg->lhead = alloc_percpu_gfp(struct llist_head, GFP_KERNEL); if (!blkcg->lhead) return -ENOMEM; for_each_possible_cpu(cpu) init_llist_head(per_cpu_ptr(blkcg->lhead, cpu)); return 0; }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
static void __blkg_release(struct rcu_head *rcu) { struct blkcg_gq *blkg = container_of(rcu, struct blkcg_gq, rcu_head); WARN_ON(!bio_list_empty(&blkg->async_bios)); css_put(&blkg->blkcg->css); if (blkg->parent) blkg_put(blkg->parent); blkg_free(blkg); }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio) { if (!bio || !bio->bi_blkg) return NULL; return &bio->bi_blkg->blkcg->css; }
[ 1, 0 ]
Linux Kernel
block/blk-cgroup.c
static void blkg_destroy_all(struct gendisk *disk) { struct request_queue *q = disk->queue; struct blkcg_gq *blkg, *n; int count = BLKG_DESTROY_BATCH_SIZE; restart: spin_lock_irq(&q->queue_lock); list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) { struct blkcg *blkcg = blkg->blkcg; spin_lock(...
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
const char *blkg_dev_name(struct blkcg_gq *blkg) { if (!blkg->q->disk || !blkg->q->disk->bdi->dev) return NULL; return bdi_dev_name(blkg->q->disk->bdi); }
[ 1, 0 ]
Linux Kernel
block/blk-cgroup.c
u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v) { const char *dname = blkg_dev_name(pd->blkg); if (!dname) return 0; seq_printf(sf, "%s %llu\n", dname, (unsigned long long)v); return v; }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src) { int i; for (i = 0; i < BLKG_IOSTAT_NR; i++) { dst->bytes[i] = src->bytes[i]; dst->ios[i] = src->ios[i]; } }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu) { struct blkcg *blkcg = css_to_blkcg(css); struct llist_head *lhead = per_cpu_ptr(blkcg->lhead, cpu); struct llist_node *lnode; struct blkg_iostat_set *bisc, *next_bisc; if (!cgroup_parent(css->cgroup)) return; rcu_read_lock(); ...
[ 1, 0 ]
Linux Kernel
block/blk-cgroup.c
struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css) { return &css_to_blkcg(css)->cgwb_list; } #endif
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css) { struct blkcg *blkcg = css_to_blkcg(blkcg_css); do { if (!refcount_dec_and_test(&blkcg->online_pin)) break; blkcg_destroy_blkgs(blkcg); blkcg = blkcg_parent(blkcg); } while (blkcg); }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
static void blkcg_bind(struct cgroup_subsys_state *root_css) { int i; mutex_lock(&blkcg_pol_mutex); for (i = 0; i < BLKCG_MAX_POLS; i++) { struct blkcg_policy *pol = blkcg_policy[i]; struct blkcg *blkcg; if (!pol || !pol->cpd_bind_fn) continue; list_for_each_entry(blkcg, &all_blkcgs, ...
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
void bio_associate_blkg_from_css(struct bio *bio, struct cgroup_subsys_state *css) { if (bio->bi_blkg) blkg_put(bio->bi_blkg); if (css && css->parent) { bio->bi_blkg = blkg_tryget_closest(bio, css); } else { blkg_get(bdev_get_queue(bio->bi_bdev)->root_blkg); bio->...
[ 1, 0 ]
Linux Kernel
block/blk-cgroup.c
void bio_clone_blkg_association(struct bio *dst, struct bio *src) { if (src->bi_blkg) bio_associate_blkg_from_css(dst, bio_blkcg_css(src)); }
[ 0, 0 ]
Linux Kernel
block/blk-cgroup.c
void blk_cgroup_bio_start(struct bio *bio) { struct blkcg *blkcg = bio->bi_blkg->blkcg; int rwd = blk_cgroup_io_type(bio), cpu; struct blkg_iostat_set *bis; unsigned long flags; cpu = get_cpu(); bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu); flags = u64_stats_update_begin_irqsave(&bis->sync); if (!...
[ 1, 0 ]
Linux Kernel
block/blk-cgroup.c
bool blk_cgroup_congested(void) { struct cgroup_subsys_state *css; bool ret = false; rcu_read_lock(); for (css = blkcg_css(); css; css = css->parent) { if (atomic_read(&css->cgroup->congestion_count)) { ret = true; break; } } rcu_read_unlock(); return ret; }
[ 0, 0 ]