Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,12 @@ type Blocker interface {
BlockWithTimeoutOn(waiter.Waitable, waiter.EventMask, time.Duration) (time.Duration, bool)

// UninterruptibleSleepStart indicates the beginning of an uninterruptible
// sleep state (equivalent to Linux's TASK_UNINTERRUPTIBLE). If deactivate
// is true and the Context represents a Task, the Task's AddressSpace is
// deactivated.
UninterruptibleSleepStart(deactivate bool)
// sleep state (equivalent to Linux's TASK_UNINTERRUPTIBLE).
UninterruptibleSleepStart()

// UninterruptibleSleepFinish indicates the end of an uninterruptible sleep
// state that was begun by a previous call to UninterruptibleSleepStart. If
// activate is true and the Context represents a Task, the Task's
// AddressSpace is activated. Normally activate is the same value as the
// deactivate parameter passed to UninterruptibleSleepStart.
UninterruptibleSleepFinish(activate bool)
// state that was begun by a previous call to UninterruptibleSleepStart.
UninterruptibleSleepFinish()
}

// NoTask is an implementation of Blocker that does not block.
Expand Down Expand Up @@ -155,10 +150,10 @@ func (nt *NoTask) BlockWithTimeoutOn(w waiter.Waitable, mask waiter.EventMask, d
}

// UninterruptibleSleepStart implmenents Blocker.UninterruptedSleepStart.
func (*NoTask) UninterruptibleSleepStart(bool) {}
func (*NoTask) UninterruptibleSleepStart() {}

// UninterruptibleSleepFinish implmenents Blocker.UninterruptibleSleepFinish.
func (*NoTask) UninterruptibleSleepFinish(bool) {}
func (*NoTask) UninterruptibleSleepFinish() {}

// Context represents a thread of execution (hereafter "goroutine" to reflect
// Go idiosyncrasy). It carries state associated with the goroutine across API
Expand Down
4 changes: 2 additions & 2 deletions pkg/devutil/devutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type GoferClient struct {
// NewGoferClient establishes the LISAFS connection to the dev gofer server.
// It takes ownership of fd. contName is the owning container name.
func NewGoferClient(ctx context.Context, contName string, fd int) (*GoferClient, error) {
ctx.UninterruptibleSleepStart(false)
defer ctx.UninterruptibleSleepFinish(false)
ctx.UninterruptibleSleepStart()
defer ctx.UninterruptibleSleepFinish()

sock, err := unet.NewSocket(fd)
if err != nil {
Expand Down
12 changes: 12 additions & 0 deletions pkg/hostarch/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ func (v Addr) ToRange(length uint64) (AddrRange, bool) {
return AddrRange{v, end}, ok
}

// MustToRange is equivalent to ToRange, but panics if the end of the range
// wraps around.
//
//go:nosplit
func (v Addr) MustToRange(length uint64) AddrRange {
ar, ok := v.ToRange(length)
if !ok {
panic("hostarch.Addr.ToRange() wraps")
}
return ar
}

// IsPageAligned returns true if ar.Start.IsPageAligned() and
// ar.End.IsPageAligned().
func (ar AddrRange) IsPageAligned() bool {
Expand Down
8 changes: 4 additions & 4 deletions pkg/lisafs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ func (c *Client) CloseFD(ctx context.Context, fd FDID, flush bool) {

req := CloseReq{FDs: toClose}
var resp CloseResp
ctx.UninterruptibleSleepStart(false)
ctx.UninterruptibleSleepStart()
err := c.SndRcvMessage(Close, uint32(req.SizeBytes()), req.MarshalBytes, resp.CheckedUnmarshal, nil, req.String, resp.String)
ctx.UninterruptibleSleepFinish(false)
ctx.UninterruptibleSleepFinish()
if err != nil {
log.Warningf("lisafs: batch closing FDs returned error: %v", err)
}
Expand All @@ -305,9 +305,9 @@ func (c *Client) SyncFDs(ctx context.Context, fds []FDID) error {
}
req := FsyncReq{FDs: fds}
var resp FsyncResp
ctx.UninterruptibleSleepStart(false)
ctx.UninterruptibleSleepStart()
err := c.SndRcvMessage(FSync, uint32(req.SizeBytes()), req.MarshalBytes, resp.CheckedUnmarshal, nil, req.String, resp.String)
ctx.UninterruptibleSleepFinish(false)
ctx.UninterruptibleSleepFinish()
return err
}

Expand Down
Loading