函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\aio.c Create Date:2022-07-29 10:53:26
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:aio_read_events_ring* Pull an event off of the ioctx's event ring. Returns the number of* events fetched

函数原型:static long aio_read_events_ring(struct kioctx *ctx, struct io_event __user *event, long nr)

返回类型:long

参数:

类型参数名称
struct kioctx *ctx
struct io_event __user *event
longnr
1178  ret等于0
1187  sched_annotate_sleep()
1188  mutex_lock( & ring_lock)
1191  ring等于kmap_atomic(ring_pages[0])
1192  head等于 Written to by userland or under ring_lock * mutex by aio_read_events_ring().
1193  tail等于tail
1194  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)
1200  smp_rmb()
1202  pr_debug("h%u t%u m%u\n", head, tail, Size of ringbuffer, in units of struct io_event )
1204  如果head恒等于tail则转到:out
1207  head取模等于 Size of ringbuffer, in units of struct io_event
1208  tail取模等于 Size of ringbuffer, in units of struct io_event
1210 ret小于nr循环
1215  avail等于如果head小于等于tailtail否则 Size of ringbuffer, in units of struct io_event head
1216  如果head恒等于tail退出
1219  pos等于headAIO_EVENTS_OFFSET
1220  page等于ring_pages[pos / AIO_EVENTS_PER_PAGE]
1221  pos取模等于AIO_EVENTS_PER_PAGE
1223  avail等于两数取小(avail, nr - ret)
1224  avail等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(long, avail, AIO_EVENTS_PER_PAGE - pos)
1226  ev等于kmap(page)
1227  copy_ret等于copy_to_user(event + ret, ev + pos, ev的长度 * avail)
1229  kunmap(page)
1232  ret等于负EFAULT
1233  转到:out
1236  ret加等于avail
1237  head加等于avail
1238  head取模等于 Size of ringbuffer, in units of struct io_event
1241  ring等于kmap_atomic(ring_pages[0])
1242  Written to by userland or under ring_lock * mutex by aio_read_events_ring(). 等于head
1243  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)
1244  flush_dcache_page(ring_pages[0])
1246  pr_debug("%li h%u t%u\n", ret, head, tail)
1247  out :
1248  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1250  返回:ret
调用者
名称描述
aio_read_events