Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\aio.c Create Date:2022-07-28 20:21:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:aio_read_events_ring* Pull an event off of the ioctx's event ring. Returns the number of* events fetched

Proto:static long aio_read_events_ring(struct kioctx *ctx, struct io_event __user *event, long nr)

Type:long

Parameter:

TypeParameterName
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  If head == tail Then Go to out
1207  head %= Size of ringbuffer, in units of struct io_event
1208  tail %= Size of ringbuffer, in units of struct io_event
1210  When ret < nr cycle
1215  avail = If head <= tail Then tail Else Size of ringbuffer, in units of struct io_event - head
1216  If head == tail Then Break
1219  pos = head + AIO_EVENTS_OFFSET
1220  page = ring_pages[pos / AIO_EVENTS_PER_PAGE]
1221  pos %= AIO_EVENTS_PER_PAGE
1223  avail = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(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, size of ev * avail)
1229  kunmap(page)
1232  ret = -EFAULT
1233  Go to 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  Return ret
Caller
NameDescribe
aio_read_events