io_uring_prep_cmd_discard(3) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | SEE ALSO | COLOPHON

io_uring_prep_cmd_discard(3) liburing Manual io_uring_prep_cmd_discard(3)

NAME         top

       io_uring_prep_cmd_discard - prepare a discard command

SYNOPSIS         top

       #include <liburing.h>

       void io_uring_prep_cmd_discard(struct io_uring_sqe *sqe,
                                 int fd,
                                 uint64_t offset,
                                 uint64_t nbytes);

DESCRIPTION         top

       The io_uring_prep_cmd_discard(3) function prepares a discard
       command request. The submission queue entry sqe is setup to use
       the file descriptor fd to start discarding nbytes at the specified
       offset.

       The command is an asynchronous equivalent of
       BLOCK_URING_CMD_DISCARD ioctl with a few differences. It allows
       multiple parallel discards, and it does not exclude concurrent
       writes and reads. As a result, it may lead to races for the data
       on the disk, if the application has IO inflight for the same
       ranges that the discard operates on. It's the user's
       responsibility to account for that.  Furthermore, only best
       efforts are done to invalidate page caches. The user has to make
       sure that no other inflight requests are modifying or reading the
       range(s). If that is the case, it might result in stale page cache
       and data inconsistencies.

       Available since 6.12.

RETURN VALUE         top

       None

ERRORS         top

       The CQE res field will contain the result of the operation. On
       success, this field will be set to 0 .  On error, a negative error
       value is returned. Note that where synchronous system calls will
       return -1 on failure and set errno to the actual error value,
       io_uring never uses errno.  Instead it returns the negated errno
       directly in the CQE res field.

SEE ALSO         top

       io_uring_get_sqe(3), io_uring_submit(3),

COLOPHON         top

       This page is part of the liburing (A library for io_uring)
       project.  Information about the project can be found at 
       ⟨https://github.com/axboe/liburing⟩.  If you have a bug report for
       this manual page, send it to [email protected].  This page
       was obtained from the project's upstream Git repository
       ⟨https://github.com/axboe/liburing⟩ on 2025-02-02.  (At that time,
       the date of the most recent commit that was found in the
       repository was 2025-01-22.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there is
       a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       [email protected]

liburing-2.8                   Oct 13, 2024  io_uring_prep_cmd_discard(3)

Pages that refer to this page: io_uring_prep_cmd_discard(3)