We can't just set the ioprio value, we always have to set a class
as well. If no class is given, just assume it's the default best
effort class we want.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
static int str_prioclass_cb(void *data, unsigned int *val)
{
struct thread_data *td = data;
+ unsigned short mask;
+
+ /*
+ * mask off old class bits, str_prio_cb() may have set a default class
+ */
+ mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
+ td->ioprio &= mask;
td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
return 0;
struct thread_data *td = data;
td->ioprio |= *val;
+
+ /*
+ * If no class is set, assume BE
+ */
+ if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
+ td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
+
return 0;
}
#endif
}
#endif /* FIO_HAVE_SYSLET */
+enum {
+ IOPRIO_CLASS_NONE,
+ IOPRIO_CLASS_RT,
+ IOPRIO_CLASS_BE,
+ IOPRIO_CLASS_IDLE,
+};
+
enum {
IOPRIO_WHO_PROCESS = 1,
IOPRIO_WHO_PGRP,
IOPRIO_WHO_USER,
};
+#define IOPRIO_BITS 16
#define IOPRIO_CLASS_SHIFT 13
#ifndef BLKGETSIZE64