MCPcopy Index your code
hub / github.com/google/gvisor / enqueueCurOp

Method enqueueCurOp

pkg/sentry/pgalloc/save_restore.go:1453–1477  ·  view source on GitHub ↗

Preconditions: apfl.canEnqueue() == true.

()

Source from the content-addressed store, hash-verified

1451
1452// Preconditions: apfl.canEnqueue() == true.
1453func (apfl *AsyncPagesFileLoad) enqueueCurOp() {
1454 if apfl.qavail <= 0 {
1455 panic("queue full")
1456 }
1457 op := apfl.curOp
1458 if op.total == 0 {
1459 panic("invalid read of 0 bytes")
1460 }
1461 if op.total > apfl.maxReadBytes {
1462 panic(fmt.Sprintf("read of %d bytes exceeds per-read limit of %d bytes", op.total, apfl.maxReadBytes))
1463 }
1464
1465 apfl.qavail--
1466 apfl.curOp = nil
1467 if len(op.frs) == 1 && len(op.iovecs) == 1 {
1468 // Perform a non-vectorized read to save an indirection (and possible
1469 // userspace-to-kernelspace copy) in the AsyncReader implementation.
1470 apfl.ar.AddRead(int(apfl.curOpID), op.off(), op.amfl.df, op.frs[0], stateio.SliceFromIovec(op.iovecs[0]))
1471 } else {
1472 apfl.ar.AddReadv(int(apfl.curOpID), op.off(), op.total, op.amfl.df, op.frs, op.iovecs)
1473 }
1474 if logAwaitedLoads && !op.tempRef {
1475 log.Infof("MemoryFile(%p): awaited opid %d start, read %d bytes: %v", op.amfl.f, apfl.curOpID, op.total, op.frs)
1476 }
1477}
1478
1479// Preconditions:
1480// - apfl.canEnqueue() == true.

Callers 2

enqueueRangeMethod · 0.95
mainMethod · 0.95

Calls 5

SliceFromIovecFunction · 0.92
InfofFunction · 0.92
offMethod · 0.80
AddReadMethod · 0.65
AddReadvMethod · 0.65

Tested by

no test coverage detected