Unify max split zone support
authorJens Axboe <axboe@kernel.dk>
Thu, 30 Nov 2017 03:51:09 +0000 (20:51 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Nov 2017 03:51:09 +0000 (20:51 -0700)
We have two different defines, use the one from the networking
protocol. Add a compile time check that bssplit and zones
have the same max, so we don't inadvertently add an overflow
condition if we change one of them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
libfio.c
options.c

index d9900add8549e03e12dcafe6cfc7f5bbc52fd15c..c9bb8f3f1e5494aa91b40e9566dab12a74aa6a7d 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -366,6 +366,7 @@ int initialize_fio(char *envp[])
        compiletime_assert((offsetof(struct jobs_eta, m_rate) % 8) == 0, "m_rate");
 
        compiletime_assert(__TD_F_LAST <= TD_ENG_FLAG_SHIFT, "TD_ENG_FLAG_SHIFT");
        compiletime_assert((offsetof(struct jobs_eta, m_rate) % 8) == 0, "m_rate");
 
        compiletime_assert(__TD_F_LAST <= TD_ENG_FLAG_SHIFT, "TD_ENG_FLAG_SHIFT");
+       compiletime_assert(BSSPLIT_MAX == ZONESPLIT_MAX, "bsssplit/zone max");
 
        err = endian_check();
        if (err) {
 
        err = endian_check();
        if (err) {
index d979f804d76c7f694e746956af3fd48e55cb2ac4..2a530226f399b21585fc345b2a9766f05220a838 100644 (file)
--- a/options.c
+++ b/options.c
@@ -54,12 +54,10 @@ static int bs_cmp(const void *p1, const void *p2)
        return (int) bsp1->perc - (int) bsp2->perc;
 }
 
        return (int) bsp1->perc - (int) bsp2->perc;
 }
 
-#define SPLIT_MAX_ENTRY        100
-
 struct split {
        unsigned int nr;
 struct split {
        unsigned int nr;
-       unsigned int val1[SPLIT_MAX_ENTRY];
-       unsigned long long val2[SPLIT_MAX_ENTRY];
+       unsigned int val1[ZONESPLIT_MAX];
+       unsigned long long val2[ZONESPLIT_MAX];
 };
 
 static int split_parse_ddir(struct thread_options *o, struct split *split,
 };
 
 static int split_parse_ddir(struct thread_options *o, struct split *split,
@@ -111,7 +109,7 @@ static int split_parse_ddir(struct thread_options *o, struct split *split,
                split->val1[i] = val;
                split->val2[i] = perc;
                i++;
                split->val1[i] = val;
                split->val2[i] = perc;
                i++;
-               if (i == SPLIT_MAX_ENTRY)
+               if (i == ZONESPLIT_MAX)
                        break;
        }
 
                        break;
        }