From nobody Sun Feb 11 01:54:36 2024 X-Original-To: dev-commits-src-main@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 4TXVyN47dMz596fX; Sun, 11 Feb 2024 01:54:36 +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 4TXVyN28BPz49j2; Sun, 11 Feb 2024 01:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707616476; 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=O+RbGJOY3vaZm50fnPrOOZfaQnsw+GJbiLJe1GRXFV0=; b=hbKV6gzJ7dLO5MHKVvl6RwmucieWeeW0OxLCpMwmNkJZu7T4lRT5pqOQNckLpdJb/x1r/w 7/LxI4UOqFFGTkwBRni5nX+e4XX8Je5/avCu4FWzXt1S9NyJoFB7uy0XNRSM4hS4wvSkZv LsAehgzGcO0zfRhbNv8aOKTL0TB6RL0lwZtsHOSZ6MqzYYfKjUd71tP7cJ99HNRAFS0ofP Yrdz9p8MDTxVS2fQT5M99VjWIPISkOKahY2MrLwtMYwD/uaRWmmQcYKJelaYb4Rto8FCEb fA76dD0GMbWwzL2FUfxJHwmf5ZQSTQUUxCBQeJAUjJ+Y3g28SmsRlxJNUrBF9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707616476; a=rsa-sha256; cv=none; b=UOOIkJAwhAY9MnL70VVrOUmkcy6EFYiELrM6lYfEHl05pF4ranPQxwz5RJ3LME4Fw8CDrb eIxxUww3CsHsLk+1cw6CBUSdTp7SO+ZizL2JsoNVr0zPb4vkAT9wDrhvAqoEC/x5BfQ3d3 7vVdpRfyM2QcZ/2LS0rrccet/Ui07u79NMwsuO8BiRvTpQbiDQ9kTzxYAYugHdkKi6CPBW ZHb8w5MXQ84pEf5WsGLxb37iza8hwxi2Was5dYLENRIK1hAcCsPh+EGTt2BorDW2FEdwph z+3byvD+cXWyTToHUoPW3Af+HdY2gfcZfzeR9VLWm7dZqDHRz/4v50thk9+vmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707616476; 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=O+RbGJOY3vaZm50fnPrOOZfaQnsw+GJbiLJe1GRXFV0=; b=ILXbkGbCWz8ONaOb9mQZKPnr/r1CuIRZjHw2cFKwuXO6xkQHYJSBUE0ciEzOUSo5KZ71fT hvYt0acGf9DanVfs5XpWZ640Kq++sdflADrLBrV/kBURWHZGa/QhW8zJQEkZxGGqrkbZzH S0B2AhwIllLs7whLyCxPOgmwdh8/9AjIZBPH4Le8H4FoO0oZZEFN37bmDbbmZ8GCOzu2uX EXWMeaRgVr/Zo6ptNX179QhU4RGC2Ua2vPKgmJkpCXa1LJP2k46BPsbImg2oBhRXQOMHbR nnym7Bu7GMT5pehG+1dkP5VZ3Rl1TEe+HcLgYbBpOTPtql8Lhepi7u9Kt5giDA== 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 4TXVyN1BTlzgVQ; Sun, 11 Feb 2024 01:54:36 +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 41B1saMD090150; Sun, 11 Feb 2024 01:54:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41B1sagF090147; Sun, 11 Feb 2024 01:54:36 GMT (envelope-from git) Date: Sun, 11 Feb 2024 01:54:36 GMT Message-Id: <202402110154.41B1sagF090147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e4b7bbd6ab77 - main - lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e4b7bbd6ab77e908a60362aa29e518f224a117b0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e4b7bbd6ab77e908a60362aa29e518f224a117b0 commit e4b7bbd6ab77e908a60362aa29e518f224a117b0 Author: Konstantin Belousov AuthorDate: 2024-01-13 19:46:18 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-11 01:53:50 +0000 lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset and use the current file offset instead. Requested by: Vinícius dos Santos Oliveira Reviewed by: jhb Discussed with: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43448 --- lib/libsys/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/libsys/lio_listio.2 b/lib/libsys/lio_listio.2 index 34d2490cca01..bda65c38b1ac 100644 --- a/lib/libsys/lio_listio.2 +++ b/lib/libsys/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 1195d92d54ab..e7302f4b7a9e 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -229,6 +229,9 @@ typedef struct oaiocb { #define KAIOCB_CLEARED 0x10 #define KAIOCB_FINISHED 0x20 +/* ioflags */ +#define KAIOCB_IO_FOFFSET 0x01 + /* * AIO process info */ @@ -789,12 +792,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; @@ -1549,13 +1554,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 */