当前位置: 首页>>代码示例>>C++>>正文


C++ put_io_context函数代码示例

本文整理汇总了C++中put_io_context函数的典型用法代码示例。如果您正苦于以下问题:C++ put_io_context函数的具体用法?C++ put_io_context怎么用?C++ put_io_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了put_io_context函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_task_ioprio

int set_task_ioprio(struct task_struct *task, int ioprio)
{
	int err;
	struct io_context *ioc;
	const struct cred *cred = current_cred(), *tcred;

	rcu_read_lock();
	tcred = __task_cred(task);
	if (!uid_eq(tcred->uid, cred->euid) &&
	    !uid_eq(tcred->uid, cred->uid) && !capable(CAP_SYS_NICE)) {
		rcu_read_unlock();
		return -EPERM;
	}
	rcu_read_unlock();

	err = security_task_setioprio(task, ioprio);
	if (err)
		return err;

	ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE);
	if (ioc) {
		ioc->ioprio = ioprio;
		put_io_context(ioc);
	}

	return err;
}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:27,代码来源:ioprio.c

示例2: ioband_cgroup

static int ioband_cgroup(struct bio *bio)
{
	struct io_context *ioc = get_bio_cgroup_iocontext(bio);
	int id = 0;
	if (ioc) {
		id = ioc->id;
		put_io_context(ioc);
	}
	return id;
}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:10,代码来源:dm-ioband-type.c

示例3: exit_io_context

/* Called by the exiting task */
void exit_io_context(struct task_struct *task)
{
	struct io_context *ioc;

	task_lock(task);
	ioc = task->io_context;
	task->io_context = NULL;
	task_unlock(task);

	atomic_dec(&ioc->nr_tasks);
	put_io_context(ioc, NULL);
}
开发者ID:DevSwift,项目名称:LT22-kernel,代码行数:13,代码来源:blk-ioc.c

示例4: exit_io_context

/* Called by the exiting task */
void exit_io_context(struct task_struct *task)
{
	struct io_context *ioc;

	task_lock(task);
	ioc = task->io_context;
	task->io_context = NULL;
	task_unlock(task);

	if (atomic_dec_and_test(&ioc->nr_tasks))
	hlist_sched_exit(ioc, &ioc->cic_list);
	hlist_sched_exit(ioc, &ioc->bfq_cic_list);
	put_io_context(ioc);
}
开发者ID:WildfireDEV,项目名称:android_kernel_htc_msm8660_3.0_ion,代码行数:15,代码来源:blk-ioc.c

示例5: exit_io_context

/* Called by the exiting task */
void exit_io_context(struct task_struct *task)
{
	struct io_context *ioc;

	task_lock(task);
	ioc = task->io_context;
	task->io_context = NULL;
	task_unlock(task);

	if (atomic_dec_and_test(&ioc->nr_tasks))
		cfq_exit(ioc);

	put_io_context(ioc);
}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:15,代码来源:blk-ioc.c

示例6: __bfq_exit_single_io_context

/**
 * __bfq_exit_single_io_context - deassociate @cic from any running task.
 * @bfqd: bfq_data on which @cic is valid.
 * @cic: the cic being exited.
 *
 * Whenever no more tasks are using @cic or @bfqd is deallocated we
 * need to invalidate its entry in the radix tree hash table and to
 * release the queues it refers to.
 *
 * Called under the queue lock.
 */
static void __bfq_exit_single_io_context(struct bfq_data *bfqd,
        struct cfq_io_context *cic)
{
    struct io_context *ioc = cic->ioc;

    list_del_init(&cic->queue_list);

    /*
     * Make sure dead mark is seen for dead queues
     */
    smp_wmb();
    rcu_assign_pointer(cic->key, bfqd_dead_key(bfqd));

    /*
     * No write-side locking as no task is using @ioc (they're exited
     * or bfqd is being deallocated.
     */
    rcu_read_lock();
    if (rcu_dereference(ioc->ioc_data) == cic) {
        rcu_read_unlock();
        spin_lock(&ioc->lock);
        rcu_assign_pointer(ioc->ioc_data, NULL);
        spin_unlock(&ioc->lock);
    } else
        rcu_read_unlock();

    if (cic->cfqq[BLK_RW_ASYNC] != NULL) {
        bfq_exit_bfqq(bfqd, cic->cfqq[BLK_RW_ASYNC]);
        cic->cfqq[BLK_RW_ASYNC] = NULL;
    }

    spin_lock(&bfqd->eqm_lock);
    if (cic->cfqq[BLK_RW_SYNC] != NULL) {
        /*
         * If the bic is using a shared queue, put the reference
         * taken on the io_context when the bic started using a
         * shared bfq_queue.
         */
        if (bfq_bfqq_coop(cic->cfqq[BLK_RW_SYNC]))
            put_io_context(ioc);
        bfq_exit_bfqq(bfqd, cic->cfqq[BLK_RW_SYNC]);
        cic->cfqq[BLK_RW_SYNC] = NULL;
    }
    spin_unlock(&bfqd->eqm_lock);
}
开发者ID:Neves4,项目名称:DatKernel,代码行数:56,代码来源:bfq-ioc.c

示例7: is_rt

static inline int is_rt(struct fuse_conn *fc)
{
	/*
	* Returns 1 if a process is RT class.
	*/
	struct io_context *ioc = NULL;
	int ret = 0;

	if (!fc)
		return 0;
	if (!(fc->flags & FUSE_HANDLE_RT_CLASS)) /* Don't handle RT class */
		return 0;

	get_io_context(ioc);
	if(!ioc)
		return 0;

	if(IOPRIO_PRIO_CLASS(ioc->ioprio) == IOPRIO_CLASS_RT)
		ret = 1;

	put_io_context(ioc);
	return ret;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:23,代码来源:dev.c

示例8: ERR_PTR


//.........这里部分代码省略.........
		p->parent_exec_id = current->parent_exec_id;
	} else {
		p->real_parent = current;
		p->parent_exec_id = current->self_exec_id;
	}

	spin_lock(&current->sighand->siglock);

	/*
	 * Process group and session signals need to be delivered to just the
	 * parent before the fork or both the parent and the child after the
	 * fork. Restart if a signal comes in before we add the new process to
	 * it's process group.
	 * A fatal signal pending means that current will exit, so the new
	 * thread can't slip out of an OOM kill (or normal SIGKILL).
 	 */
	recalc_sigpending();
	if (signal_pending(current)) {
		spin_unlock(&current->sighand->siglock);
		write_unlock_irq(&tasklist_lock);
		retval = -ERESTARTNOINTR;
		goto bad_fork_free_pid;
	}

	if (clone_flags & CLONE_THREAD) {
		atomic_inc(&current->signal->count);
		atomic_inc(&current->signal->live);
		p->group_leader = current->group_leader;
		list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
	}

	if (likely(p->pid)) {
		list_add_tail(&p->sibling, &p->real_parent->children);
		tracehook_finish_clone(p, clone_flags, trace);

		if (thread_group_leader(p)) {
			if (clone_flags & CLONE_NEWPID)
				p->nsproxy->pid_ns->child_reaper = p;

			p->signal->leader_pid = pid;
			tty_kref_put(p->signal->tty);
			p->signal->tty = tty_kref_get(current->signal->tty);
			attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
			attach_pid(p, PIDTYPE_SID, task_session(current));
			list_add_tail_rcu(&p->tasks, &init_task.tasks);
			__get_cpu_var(process_counts)++;
		}
		attach_pid(p, PIDTYPE_PID, pid);
		nr_threads++;
	}

	total_forks++;
	spin_unlock(&current->sighand->siglock);
	write_unlock_irq(&tasklist_lock);
	proc_fork_connector(p);
	cgroup_post_fork(p);
	perf_event_fork(p);
	return p;

bad_fork_free_pid:
	if (pid != &init_struct_pid)
		free_pid(pid);
bad_fork_cleanup_io:
	put_io_context(p->io_context);
bad_fork_cleanup_namespaces:
	exit_task_namespaces(p);
bad_fork_cleanup_mm:
	if (p->mm)
		mmput(p->mm);
bad_fork_cleanup_signal:
	if (!(clone_flags & CLONE_THREAD))
		__cleanup_signal(p->signal);
bad_fork_cleanup_sighand:
	__cleanup_sighand(p->sighand);
bad_fork_cleanup_fs:
	exit_fs(p); /* blocking */
bad_fork_cleanup_files:
	exit_files(p); /* blocking */
bad_fork_cleanup_semundo:
	exit_sem(p);
bad_fork_cleanup_audit:
	audit_free(p);
bad_fork_cleanup_policy:
	perf_event_free_task(p);
#ifdef CONFIG_NUMA
	mpol_put(p->mempolicy);
bad_fork_cleanup_cgroup:
#endif
	cgroup_exit(p, cgroup_callbacks_done);
	delayacct_tsk_free(p);
	module_put(task_thread_info(p)->exec_domain->module);
bad_fork_cleanup_count:
	atomic_dec(&p->cred->user->processes);
	anoubis_task_destroy(p);
	exit_creds(p);
bad_fork_free:
	free_task(p);
fork_out:
	return ERR_PTR(retval);
}
开发者ID:genua,项目名称:anoubis_os,代码行数:101,代码来源:fork.c


注:本文中的put_io_context函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。