git: 4605a99b51ab - main - aio: remove write-only jobid & kernelinfo
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 15 Nov 2024 15:49:09 UTC
The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=4605a99b51ab72351d7554fbadbb24985f4667b1 commit 4605a99b51ab72351d7554fbadbb24985f4667b1 Author: Andrew Gallatin <gallatin@FreeBSD.org> AuthorDate: 2024-11-15 15:41:34 +0000 Commit: Andrew Gallatin <gallatin@FreeBSD.org> CommitDate: 2024-11-15 15:47:46 +0000 aio: remove write-only jobid & kernelinfo The jobid (which was stored in kernelinfo) was used to look up jobs until 1ce9182407f6, where it became essentially write only. Remove it to simplify the code and pave the way for future work to make aio scale better. Note this has been slated for removal "soon" for 18 years. Suggested by: jhb Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D47583 --- sys/kern/vfs_aio.c | 42 +----------------------------------------- sys/sys/aio.h | 2 +- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index e7302f4b7a9e..eb08716fbeda 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -71,12 +71,6 @@ #include <vm/uma.h> #include <sys/aio.h> -/* - * Counter for allocating reference ids to new jobs. Wrapped to 1 on - * overflow. (XXX will be removed soon.) - */ -static u_long jobrefid; - /* * Counter for aio_fsync. */ @@ -297,7 +291,6 @@ struct aiocb_ops { long (*fetch_error)(struct aiocb *ujob); int (*store_status)(struct aiocb *ujob, long status); int (*store_error)(struct aiocb *ujob, long error); - int (*store_kernelinfo)(struct aiocb *ujob, long jobref); int (*store_aiocb)(struct aiocb **ujobp, struct aiocb *ujob); }; @@ -418,7 +411,6 @@ aio_onceonly(void) aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); aiod_lifetime = AIOD_LIFETIME_DEFAULT; - jobrefid = 1; p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO); p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); @@ -1455,13 +1447,6 @@ aiocb_store_error(struct aiocb *ujob, long error) return (suword(&ujob->_aiocb_private.error, error)); } -static int -aiocb_store_kernelinfo(struct aiocb *ujob, long jobref) -{ - - return (suword(&ujob->_aiocb_private.kernelinfo, jobref)); -} - static int aiocb_store_aiocb(struct aiocb **ujobp, struct aiocb *ujob) { @@ -1475,7 +1460,6 @@ static struct aiocb_ops aiocb_ops = { .fetch_error = aiocb_fetch_error, .store_status = aiocb_store_status, .store_error = aiocb_store_error, - .store_kernelinfo = aiocb_store_kernelinfo, .store_aiocb = aiocb_store_aiocb, }; @@ -1486,7 +1470,6 @@ static struct aiocb_ops aiocb_ops_osigevent = { .fetch_error = aiocb_fetch_error, .store_status = aiocb_store_status, .store_error = aiocb_store_error, - .store_kernelinfo = aiocb_store_kernelinfo, .store_aiocb = aiocb_store_aiocb, }; #endif @@ -1507,7 +1490,6 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, int opcode; int error; int fd, kqfd; - int jid; u_short evflags; if (p->p_aioinfo == NULL) @@ -1517,7 +1499,6 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, ops->store_status(ujob, -1); ops->store_error(ujob, 0); - ops->store_kernelinfo(ujob, -1); if (num_queue_count >= max_queue_count || ki->kaio_count >= max_aio_queue_per_proc) { @@ -1630,16 +1611,8 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, job->fd_file = fp; mtx_lock(&aio_job_mtx); - jid = jobrefid++; job->seqno = jobseqno++; mtx_unlock(&aio_job_mtx); - error = ops->store_kernelinfo(ujob, jid); - if (error) { - error = EINVAL; - goto err3; - } - job->uaiocb._aiocb_private.kernelinfo = (void *)(intptr_t)jid; - if (opcode == LIO_NOP) { fdrop(fp, td); MPASS(job->uiop == &job->uio || job->uiop == NULL); @@ -2728,7 +2701,7 @@ filt_lio(struct knote *kn, long hint) struct __aiocb_private32 { int32_t status; int32_t error; - uint32_t kernelinfo; + uint32_t spare; }; #ifdef COMPAT_FREEBSD6 @@ -2807,7 +2780,6 @@ aiocb32_copyin_old_sigevent(struct aiocb *ujob, struct kaiocb *kjob, CP(job32, *kcb, aio_reqprio); CP(job32, *kcb, _aiocb_private.status); CP(job32, *kcb, _aiocb_private.error); - PTRIN_CP(job32, *kcb, _aiocb_private.kernelinfo); return (convert_old_sigevent32(&job32.aio_sigevent, &kcb->aio_sigevent)); } @@ -2844,7 +2816,6 @@ aiocb32_copyin(struct aiocb *ujob, struct kaiocb *kjob, int type) CP(job32, *kcb, aio_reqprio); CP(job32, *kcb, _aiocb_private.status); CP(job32, *kcb, _aiocb_private.error); - PTRIN_CP(job32, *kcb, _aiocb_private.kernelinfo); error = convert_sigevent32(&job32.aio_sigevent, &kcb->aio_sigevent); return (error); @@ -2886,15 +2857,6 @@ aiocb32_store_error(struct aiocb *ujob, long error) return (suword32(&ujob32->_aiocb_private.error, error)); } -static int -aiocb32_store_kernelinfo(struct aiocb *ujob, long jobref) -{ - struct aiocb32 *ujob32; - - ujob32 = (struct aiocb32 *)ujob; - return (suword32(&ujob32->_aiocb_private.kernelinfo, jobref)); -} - static int aiocb32_store_aiocb(struct aiocb **ujobp, struct aiocb *ujob) { @@ -2908,7 +2870,6 @@ static struct aiocb_ops aiocb32_ops = { .fetch_error = aiocb32_fetch_error, .store_status = aiocb32_store_status, .store_error = aiocb32_store_error, - .store_kernelinfo = aiocb32_store_kernelinfo, .store_aiocb = aiocb32_store_aiocb, }; @@ -2919,7 +2880,6 @@ static struct aiocb_ops aiocb32_ops_osigevent = { .fetch_error = aiocb32_fetch_error, .store_status = aiocb32_store_status, .store_error = aiocb32_store_error, - .store_kernelinfo = aiocb32_store_kernelinfo, .store_aiocb = aiocb32_store_aiocb, }; #endif diff --git a/sys/sys/aio.h b/sys/sys/aio.h index 919a6180b130..e979e0105e68 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -97,7 +97,7 @@ struct __aiocb_private { long status; long error; - void *kernelinfo; + void *spare; }; /*