IO 上下文 io_context
来源:互联网 发布:如何用qq注册淘宝账号 编辑:程序博客网 时间:2024/06/14 08:31
此结构用于跟踪进程的IO处理,此结构可在多个进程之间共享。
/* * I/O subsystem state of the associated processes. It is refcounted * and kmalloc'ed. These could be shared between processes. */struct io_context {atomic_long_t refcount;atomic_t active_ref;atomic_t nr_tasks;/* all the fields below are protected by this lock */spinlock_t lock;unsigned short ioprio;/* * For request batching */int nr_batch_requests; /* Number of requests left in the batch */unsigned long last_waited; /* Time last woken after wait for request */struct radix_tree_rooticq_tree;struct io_cq __rcu*icq_hint;struct hlist_headicq_list;struct work_struct release_work;};
函数create_task_io_context()用于创建io_context
int create_task_io_context(struct task_struct *task, gfp_t gfp_flags, int node){struct io_context *ioc;int ret;ioc = kmem_cache_alloc_node(iocontext_cachep, gfp_flags |
__GFP_ZERO,node);if (unlikely(!ioc))return -ENOMEM;/* initialize */atomic_long_set(&ioc->refcount, 1);atomic_set(&ioc->nr_tasks, 1);atomic_set(&ioc->active_ref, 1);spin_lock_init(&ioc->lock);INIT_RADIX_TREE(&ioc->icq_tree, GFP_ATOMIC | __GFP_HIGH);INIT_HLIST_HEAD(&ioc->icq_list);INIT_WORK(&ioc->release_work, ioc_release_fn);/* * Try to install. ioc shouldn't be installed if someone else * already did or @task, which isn't %current, is exiting. Note * that we need to allow ioc creation on exiting %current as exit * path may issue IOs from e.g. exit_files(). The exit path is * responsible for not issuing IO after exit_io_context(). */task_lock(task);if (!task->io_context && (task == current || !(task->flags & PF_EXITING)))task->io_context = ioc;elsekmem_cache_free(iocontext_cachep, ioc);ret = task->io_context ? 0 : -EBUSY;task_unlock(task);return ret;}
static struct kmem_cache *iocontext_cachep;
create_task_io_context()
void ioc_release_fn(struct work_struct *work)
int __init blk_ioc_init(void){iocontext_cachep = kmem_cache_create("blkdev_ioc",sizeof(struct io_context), 0, SLAB_PANIC, NULL);return 0;}subsys_initcall(blk_ioc_init);
get_task_io_context
create_task_io_context
set_task_ioprio:ioprio_set, ext4_fill_super, ext4_remount
copy_io:fork
0 0
- IO 上下文 io_context
- 上下文
- 上下文
- 进程上下文,中断上下文
- 进程上下文&中断上下文
- 进程上下文 & 中断上下文
- 进程上下文 & 中断上下文
- 中断上下文、进程上下文
- 进程上下文、中断上下文
- 进程上下文 & 中断上下文
- 进程上下文 中断上下文
- 中断上下文、进程上下文
- 进程上下文 & 中断上下文
- 应用上下文&请求上下文
- 进程上下文、中断上下文及原子上下文
- 进程上下文、中断上下文及原子上下文
- web上下文,spring上下文,springmvc上下文
- 关于上下文
- Linux常用命令
- submit_bio
- docker 安装和常用命令
- blk_init_queue
- struct io_cq
- IO 上下文 io_context
- 区zone的水位检查__zone_watermark_ok
- Workspace in use or cannot be created, choose a different one.--错误解决办法
- [leetcode 406]Queue Reconstruction by Height
- 嵌入式软件设计(2)--ARM体系结构
- llinux系统头文件、C标准库头文件简介
- 设计模式
- linux命令 grep
- js实现获取当前时间是本月第几周的方法