mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
libct: simplify setIOPriority/setupScheduler calls
Move the nil check inside, simplifying the callers. Fixes:bfbd0305("Add I/O priority") Fixes:770728e1("Support `process.scheduler`") Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -166,10 +166,8 @@ type setnsProcess struct {
|
||||
func (p *setnsProcess) start() (retErr error) {
|
||||
defer p.comm.closeParent()
|
||||
|
||||
if p.process.IOPriority != nil {
|
||||
if err := setIOPriority(p.process.IOPriority); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := setIOPriority(p.process.IOPriority); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// get the "before" value of oom kill count
|
||||
@@ -912,6 +910,9 @@ func (p *Process) InitializeIO(rootuid, rootgid int) (i *IO, err error) {
|
||||
func setIOPriority(ioprio *configs.IOPriority) error {
|
||||
const ioprioWhoPgrp = 1
|
||||
|
||||
if ioprio == nil {
|
||||
return nil
|
||||
}
|
||||
class, ok := configs.IOPrioClassMapping[ioprio.Class]
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid io priority class: %s", ioprio.Class)
|
||||
|
||||
Reference in New Issue
Block a user