engines/xnvme: user space vfio based backend
[fio.git] / engines / cmdprio.h
index e3b42182cdac7683b751b995a388efb17255f15c..755da8d0f8fff654bc81c5f0ca04ba02aa79ec1c 100644 (file)
@@ -8,46 +8,53 @@
 
 #include "../fio.h"
 
+/* read and writes only, no trim */
+#define CMDPRIO_RWDIR_CNT 2
+
+enum {
+       CMDPRIO_MODE_NONE,
+       CMDPRIO_MODE_PERC,
+       CMDPRIO_MODE_BSSPLIT,
+};
+
+struct cmdprio_prio {
+       int32_t prio;
+       uint32_t perc;
+       uint16_t clat_prio_index;
+};
+
+struct cmdprio_bsprio {
+       uint64_t bs;
+       uint32_t tot_perc;
+       unsigned int nr_prios;
+       struct cmdprio_prio *prios;
+};
+
+struct cmdprio_bsprio_desc {
+       struct cmdprio_bsprio *bsprios;
+       unsigned int nr_bsprios;
+};
+
+struct cmdprio_options {
+       unsigned int percentage[CMDPRIO_RWDIR_CNT];
+       unsigned int class[CMDPRIO_RWDIR_CNT];
+       unsigned int level[CMDPRIO_RWDIR_CNT];
+       char *bssplit_str;
+};
+
 struct cmdprio {
-       unsigned int percentage[DDIR_RWDIR_CNT];
-       unsigned int class[DDIR_RWDIR_CNT];
-       unsigned int level[DDIR_RWDIR_CNT];
+       struct cmdprio_options *options;
+       struct cmdprio_prio perc_entry[CMDPRIO_RWDIR_CNT];
+       struct cmdprio_bsprio_desc bsprio_desc[CMDPRIO_RWDIR_CNT];
+       unsigned int mode;
 };
 
-static int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio,
-                           bool *has_cmdprio)
-{
-       struct thread_options *to = &td->o;
-       bool has_cmdprio_percentage = false;
-       int i;
-
-       /*
-        * If cmdprio_percentage is set and cmdprio_class is not set,
-        * default to RT priority class.
-        */
-       for (i = 0; i < DDIR_RWDIR_CNT; i++) {
-               if (cmdprio->percentage[i]) {
-                       if (!cmdprio->class[i])
-                               cmdprio->class[i] = IOPRIO_CLASS_RT;
-                       has_cmdprio_percentage = true;
-               }
-       }
-
-       /*
-        * Check for option conflicts
-        */
-       if (has_cmdprio_percentage &&
-           (fio_option_is_set(to, ioprio) ||
-            fio_option_is_set(to, ioprio_class))) {
-               log_err("%s: cmdprio_percentage option and mutually exclusive "
-                       "prio or prioclass option is set, exiting\n",
-                       to->name);
-               return 1;
-       }
-
-       *has_cmdprio = has_cmdprio_percentage;
-
-       return 0;
-}
+bool fio_cmdprio_set_ioprio(struct thread_data *td, struct cmdprio *cmdprio,
+                           struct io_u *io_u);
+
+void fio_cmdprio_cleanup(struct cmdprio *cmdprio);
+
+int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio,
+                    struct cmdprio_options *options);
 
 #endif