From nobody Sun Feb 18 10:02:22 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Td1Ry5Mm4z5C7St; Sun, 18 Feb 2024 10:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Td1Ry3YPGz47Lt; Sun, 18 Feb 2024 10:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708250542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HPGpsmVWlGEDhrT0xeV/uV9b82ETGipKTtucjOKULGI=; b=NkzSpcanr7HpWGD4SKndtig8uItyULP7IlpdiSVZTvQdq6iWFLZ/6BieMLD4xw/V84x9A6 1q4zMaJG4y6vx6ZY4GY18+o3jmzTqy0fLIkNkldezDQV470h8Sra7gWg1HSbYSb4yTv7ud uaWM86U71Ad4vX1evML+/J+hrdFoLHX1oEHkXMqidkgdw3Np0ExkWBx/ZSN72BYtC4R0Lc zWlqmnV+AVst9coNoAu4GWKFFjxMjq4ATNTlR9qmggQzNml3HCNa27buj/tUJTEYj0/V82 gRkS1M6WorRx/B92g6VUdpmjB3QDxySi0cYeeESE0bCM103LM0Ol3PVL2obxUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708250542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HPGpsmVWlGEDhrT0xeV/uV9b82ETGipKTtucjOKULGI=; b=vtXp0fVdPwWK/EXkTNQYKlprn4KeZlOlarGG0C3uXA1XwRJSqOOUBxA355cmL2L1VWb1AX JH16s8Nz4b5KKCs46V8SDVS31+yDoDNaY7CUEmjyd812epsW5zWolAW6lvHqsnRbt9rV7l I+QjcXom7kCri/mIVAZmt94TbRIEBMo5eYX1oFHZRQ2O1qZ9Tqerc+FZJFcWVitoSNJhp5 inKW7bc/hNYWmkrAn+GAQ385xgrNjjhVeTziGWcukZKWacfsbRNbnGDWCWfdv3J0bL2TJl qpAXvVoOXReJu3Ppu3vCVAea1ceZ+k4vFeYSyxdwyhjRp03ZvhhH/w+hOgUleA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708250542; a=rsa-sha256; cv=none; b=xQs6LpaW6UsTR/ZEUo+Ss3r5Jw9RK2lK/NXk9+ZyGwMHIr+fAYReWIjH49pPn18yWoEbzx jT+8cMgC37CTvpQbyf+DV8/R8q9OwxSeCVC7QeDPpCrjNdrNsH503EkWs6Q4/osc0uin/o +ahY+/q4H0PcJaYf1QhG0CzIAp6d9kcc3civXwiefTHSHgDb1ApQXMqCXV3BNmqPkT9pJv jz8UqMLk6BrEuGjuEz210TK0+qUQfsjC5bHQWn29UMHsNveG5aWB/9kmuPKhQq4spfFF1F grduNr0CtBJsP3cDff/CTiXNFtjgXdR0Te4i0B9RvqS96MA+pfk3M3qDxyp0zA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Td1Ry2dV0zmkP; Sun, 18 Feb 2024 10:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41IA2MXL084460; Sun, 18 Feb 2024 10:02:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41IA2MJ8084457; Sun, 18 Feb 2024 10:02:22 GMT (envelope-from git) Date: Sun, 18 Feb 2024 10:02:22 GMT Message-Id: <202402181002.41IA2MJ8084457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1298ecb6ba13 - stable/14 - lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1298ecb6ba138d8e1d256816ed68fea00b17bbec Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1298ecb6ba138d8e1d256816ed68fea00b17bbec commit 1298ecb6ba138d8e1d256816ed68fea00b17bbec Author: Konstantin Belousov AuthorDate: 2024-01-13 19:46:18 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-18 10:01:46 +0000 lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset (cherry picked from commit e4b7bbd6ab77e908a60362aa29e518f224a117b0) --- lib/libc/sys/lio_listio.2 | 15 ++++++++++++++- sys/kern/vfs_aio.c | 17 ++++++++++++----- sys/sys/aio.h | 4 ++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/libc/sys/lio_listio.2 b/lib/libc/sys/lio_listio.2 index 34d2490cca01..bda65c38b1ac 100644 --- a/lib/libc/sys/lio_listio.2 +++ b/lib/libc/sys/lio_listio.2 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 22, 2021 +.Dd January 13, 2024 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -78,6 +78,19 @@ Write data as if by a call to .El .Pp If the +.Dv LIO_READ , +.Dv LIO_READV , +.Dv LIO_WRITE , +.Dv LIO_WRITEV +opcodes are or-ed with the +.Dv LIO_FOFFSET +flag, the corresponding read or write operation uses the current file +descriptor offset instead of +.Va aio_offset +from +.Vt aiocb . +.Pp +If the .Fa mode argument is .Dv LIO_WAIT , diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 8a0375a9f002..45f912a7cc2d 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -230,6 +230,9 @@ typedef struct oaiocb { #define KAIOCB_CLEARED 0x10 #define KAIOCB_FINISHED 0x20 +/* ioflags */ +#define KAIOCB_IO_FOFFSET 0x01 + /* * AIO process info */ @@ -790,12 +793,14 @@ aio_process_rw(struct kaiocb *job) if (job->uiop->uio_resid == 0) error = 0; else - error = fo_read(fp, job->uiop, fp->f_cred, FOF_OFFSET, - td); + error = fo_read(fp, job->uiop, fp->f_cred, + (job->ioflags & KAIOCB_IO_FOFFSET) != 0 ? 0 : + FOF_OFFSET, td); } else { if (fp->f_type == DTYPE_VNODE) bwillwrite(); - error = fo_write(fp, job->uiop, fp->f_cred, FOF_OFFSET, td); + error = fo_write(fp, job->uiop, fp->f_cred, (job->ioflags & + KAIOCB_IO_FOFFSET) != 0 ? 0 : FOF_OFFSET, td); } msgrcv_end = td->td_ru.ru_msgrcv; msgsnd_end = td->td_ru.ru_msgsnd; @@ -1550,13 +1555,15 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, /* Get the opcode. */ if (type == LIO_NOP) { - switch (job->uaiocb.aio_lio_opcode) { + switch (job->uaiocb.aio_lio_opcode & ~LIO_FOFFSET) { case LIO_WRITE: case LIO_WRITEV: case LIO_NOP: case LIO_READ: case LIO_READV: - opcode = job->uaiocb.aio_lio_opcode; + opcode = job->uaiocb.aio_lio_opcode & ~LIO_FOFFSET; + if ((job->uaiocb.aio_lio_opcode & LIO_FOFFSET) != 0) + job->ioflags |= KAIOCB_IO_FOFFSET; break; default: error = EINVAL; diff --git a/sys/sys/aio.h b/sys/sys/aio.h index a1aa96efed09..f987f1e1dbd4 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -51,6 +51,9 @@ #define LIO_DSYNC (0x10 | LIO_SYNC) #define LIO_MLOCK 0x20 #endif +#if __BSD_VISIBLE +#define LIO_FOFFSET 0x40 +#endif /* * LIO modes @@ -129,6 +132,7 @@ struct kaiocb { TAILQ_ENTRY(kaiocb) plist; /* (a) lists of pending / done jobs */ TAILQ_ENTRY(kaiocb) allist; /* (a) list of all jobs in proc */ int jobflags; /* (a) job flags */ + int ioflags; /* (*) io flags */ int inblock; /* (*) input blocks */ int outblock; /* (*) output blocks */ int msgsnd; /* (*) messages sent */