Skip to content

Commit 7334ee0

Browse files
committed
libct/configs: rm IOPrioClassMapping
This is an internal implementation detail and should not be either public or visible. Amend setIOPriority to do own class conversion. Fixes: bfbd030 ("Add I/O priority") Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 5d3942e commit 7334ee0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

libcontainer/configs/config.go

-6
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ func ToSchedAttr(scheduler *Scheduler) (*unix.SchedAttr, error) {
286286
}, nil
287287
}
288288

289-
var IOPrioClassMapping = map[specs.IOPriorityClass]int{
290-
specs.IOPRIO_CLASS_RT: 1,
291-
specs.IOPRIO_CLASS_BE: 2,
292-
specs.IOPRIO_CLASS_IDLE: 3,
293-
}
294-
295289
type IOPriority = specs.LinuxIOPriority
296290

297291
type (

libcontainer/init_linux.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,15 @@ func setupIOPriority(config *configs.Config) error {
685685
if ioprio == nil {
686686
return nil
687687
}
688-
class, ok := configs.IOPrioClassMapping[ioprio.Class]
689-
if !ok {
688+
class := 0
689+
switch ioprio.Class {
690+
case specs.IOPRIO_CLASS_RT:
691+
class = 1
692+
case specs.IOPRIO_CLASS_BE:
693+
class = 2
694+
case specs.IOPRIO_CLASS_IDLE:
695+
class = 3
696+
default:
690697
return fmt.Errorf("invalid io priority class: %s", ioprio.Class)
691698
}
692699

0 commit comments

Comments
 (0)