Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:io_uring_create

Proto:static int io_uring_create(unsigned entries, struct io_uring_params *p)

Type:int

Parameter:

TypeParameterName
unsignedentries
struct io_uring_params *p
5318  struct user_struct * user = NULL
5323  If Not entries || entries > IORING_MAX_ENTRIES Then Return -EINVAL
5334  sq_entries = undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data(entries)
5335  If flags & app defines CQ size Then
5341  If cq_entries < sq_entries || cq_entries > IORING_MAX_CQ_ENTRIES Then Return -EINVAL
5343  cq_entries = undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data(cq_entries)
5344  Else
5345  cq_entries = 2 * sq_entries
5348  user = get_uid(current_user())
5349  account_mem = Not Check operation authority
5351  If account_mem Then
5352  ret = io_account_mem(user, ring_pages(sq_entries, cq_entries))
5354  If ret Then
5355  free_uid(user)
5356  Return ret
5360  ctx = io_ring_ctx_alloc(p)
5361  If Not ctx Then
5362  If account_mem Then io_unaccount_mem(user, ring_pages(sq_entries, cq_entries))
5365  free_uid(user)
5366  Return -ENOMEM
5368  compat = in_compat_syscall()
5369  account_mem = account_mem
5370  user = user
5371  creds = get_current_cred - Get the current task's subjective credentials* Get the subjective credentials of the current task, pinning them so that* they can't go away. Accessing the current task's credentials directly is* not permitted.()
5373  ret = io_allocate_scq_urings(ctx, p)
5374  If ret Then Go to err
5377  ret = io_sq_offload_start(ctx, p)
5378  If ret Then Go to err
5381  memset( & sq_off, 0, size of sq_off )
5382  head = offsetof(structio_rings, head)
5383  tail = offsetof(structio_rings, tail)
5384  ring_mask = offsetof(structio_rings, sq_ring_mask)
5385  ring_entries = offsetof(structio_rings, sq_ring_entries)
5386  flags = offsetof(structio_rings, sq_flags)
5387  dropped = offsetof(structio_rings, sq_dropped)
5388  array = * Ring buffer of indices into array of io_uring_sqe, which is * mmapped by the application using the IORING_OFF_SQES offset. * This indirection could e.g. be used to assign fixed * io_uring_sqe entries to operations and only submit them to * the queue when - rings
5390  memset( & cq_off, 0, size of cq_off )
5391  head = offsetof(structio_rings, head)
5392  tail = offsetof(structio_rings, tail)
5393  ring_mask = offsetof(structio_rings, cq_ring_mask)
5394  ring_entries = offsetof(structio_rings, cq_ring_entries)
5395  overflow = offsetof(structio_rings, cq_overflow)
5396  cqes = offsetof(structio_rings, cqes)
5402  ret = Allocate an anonymous fd, this is what constitutes the application* visible backing of an io_uring instance. The application mmaps this* fd to gain access to the SQ/CQ ring details. If UNIX sockets are enabled,
5403  If ret < 0 Then Go to err
5406  features = _uring_params->features flags | IORING_FEAT_NODROP | IORING_FEAT_SUBMIT_STABLE
5408  _uring_create - called after a new io_uring context was prepared*@fd: corresponding file descriptor*@ctx: pointer to a ring context structure*@sq_entries: actual SQ size*@cq_entries: actual CQ size*@flags: SQ ring flags, provided to io_uring_setup(2)*
5409  Return ret
5410  err :
5411  io_ring_ctx_wait_and_kill(ctx)
5412  Return ret
Caller
NameDescribe
io_uring_setupSets up an aio uring context, and returns the fd. Applications asks for a* ring size, we return the actual sq/cq ring sizes (among other things) in the* params structure passed in.