Move to code generation rather than reflection for io_uring offsets.

This avoids the cost at startup time and allows the resulting function to
be more effectively inlined to call sites. Although these are not widely
used at the moment, this change may also be used as an example for code
generation in similar cases.

PiperOrigin-RevId: 477597333
This commit is contained in:
Adin Scannell
2022-09-28 17:53:21 -07:00
committed by gVisor bot
parent c4249a0e79
commit 2928c19239
4 changed files with 57 additions and 41 deletions
+2 -2
View File
@@ -137,7 +137,7 @@ func New(ctx context.Context, vfsObj *vfs.VirtualFilesystem, entries uint32, par
return nil, linuxerr.EOVERFLOW
}
params.SqOff = linux.PreComputedIOSqRingOffsets
params.SqOff = linux.PreComputedIOSqRingOffsets()
params.SqOff.Array = uint32(arrayOffset)
cqesOffset := uint64(hostarch.Addr((*linux.IORings)(nil).SizeBytes()))
@@ -146,7 +146,7 @@ func New(ctx context.Context, vfsObj *vfs.VirtualFilesystem, entries uint32, par
return nil, linuxerr.EOVERFLOW
}
params.CqOff = linux.PreComputedIOCqRingOffsets
params.CqOff = linux.PreComputedIOCqRingOffsets()
params.CqOff.Cqes = uint32(cqesOffset)
// Set features supported by the current IO_URING implementation.