| Function report | 
| Source Code: fs\aio.c | Create Date:2022-07-28 20:21:12 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:aio_setup_ring
Proto:static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct kioctx * | ctx | |
| unsigned int | nr_events | 
| 470 | nr_events += 2 | 
| 479 | file = aio_private_file(ctx, nr_pages) | 
| 481 | aio_ring_file = NULL | 
| 482 | Return -ENOMEM | 
| 485 | aio_ring_file = file | 
| 489 | ring_pages = internal_pages | 
| 490 | If nr_pages > AIO_RING_PAGES Then | 
| 491 | ring_pages = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 493 | If Not ring_pages Then | 
| 494 | put_aio_ring_file(ctx) | 
| 495 | Return -ENOMEM | 
| 503 | If Not page Then Break | 
| 505 | pr_debug("pid(%d) page[%d]->count=%d\n", pid, i, page_count(page)) | 
| 507 | SetPageUptodate(page) | 
| 510 | ring_pages[i] = page | 
| 514 | If Value for the false possibility is greater at compile time(i != nr_pages) Then | 
| 515 | aio_free_ring(ctx) | 
| 516 | Return -ENOMEM | 
| 522 | If lock for writing Then | 
| 528 | mmap_base = do_mmap_pgoff(aio_ring_file, 0, mmap_size, page can be read | page can be written , Share changes , 0, & unused, NULL) | 
| 543 | ring = kmap_atomic(ring_pages[0]) | 
| 544 | number of io_events = nr_events | 
| 545 | kernel internal index number = ~0U | 
| 547 | magic = AIO_RING_MAGIC | 
| 550 | size of aio_ring = sizeof(structaio_ring) | 
| 551 | Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(ring) | 
| 552 | flush_dcache_page(ring_pages[0]) | 
| 554 | Return 0 | 
| Name | Describe | 
|---|---|
| ioctx_alloc | x_alloc* Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |