| 函数逻辑报告 | 
| Source Code: fs\aio.c | Create Date:2022-07-29 10:53:23 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| 首页 | 函数Tree | 
| 注解内核,赢得工具 | 下载SCCT | English | 
函数名称:x_alloc* Allocates and initializes an ioctx. Returns an ERR_PTR if it failed.
函数原型:static struct kioctx *ioctx_alloc(unsigned nr_events)
返回类型:struct kioctx
参数:
| 类型 | 参数 | 名称 | 
|---|---|---|
| unsigned | nr_events | 
| 722 | nr_events等于两数取大(nr_events, num_possible_cpus() * 4) | 
| 723 | nr_events乘等于2 | 
| 740 | spin_lock_init( & ctx_lock) | 
| 741 | spin_lock_init( & completion_lock) | 
| 742 | mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & ring_lock) | 
| 745 | mutex_lock( & ring_lock) | 
| 746 | init_waitqueue_head( & wait) | 
| 748 | 初始化链表头 | 
| 756 | cpu等于alloc_percpu(structkioctx_cpu) | 
| 760 | err等于aio_setup_ring(ctx, nr_events) | 
| 765 | * For percpu reqs_available, number of slots we move to/from global * counter at a time:等于 Size of ringbuffer, in units of struct io_event 减1的差除num_possible_cpus()乘4 | 
| 766 | 如果* For percpu reqs_available, number of slots we move to/from global * counter at a time:小于1则* For percpu reqs_available, number of slots we move to/from global * counter at a time:等于1 | 
| 770 | 加自旋锁 | 
| 778 | 自旋锁解锁 | 
| 780 | percpu计数引用增 | 
| 781 | percpu计数引用增 | 
| 783 | err等于ioctx_add_table(ctx, mm) | 
| 784 | 如果err则转到:err_cleanup | 
| 790 | pr_debug("allocated ioctx %p[%ld]: mm=%p mask=0x%x\n", ctx, user_id, mm, Size of ringbuffer, in units of struct io_event ) | 
| 792 | 返回:ctx | 
| 794 | err_cleanup : | 
| 796 | err_ctx : | 
| 797 | atomic_set( & dead, 1) | 
| 800 | aio_free_ring(ctx) | 
| 801 | err : | 
| 803 | 释放内存 | 
| 806 | kmem_cache_free(kioctx_cachep, ctx) | 
| 808 | 返回:错误号 | 
| 名称 | 描述 | 
|---|---|
| SYSCALL_DEFINE2 | sys_io_setup:* Create an aio_context capable of receiving at least nr_events | 
| COMPAT_SYSCALL_DEFINE2 | 
| 源代码转换工具 开放的插件接口 | X | 
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |