]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librbd/fsx: fix wnbd check 53030/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 17 Aug 2023 06:12:00 +0000 (06:12 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 17 Aug 2023 06:19:32 +0000 (06:19 +0000)
When using WNBD, the IO size must be a multiple of the sector size
(WNBD only supports 512 at the moment).

We're currently checking the "wnbd_operations" variable, however
it's only defined on Windows, leading to a compilation failure
on other platforms.

We'll switch back to a separate boolean variable called "wnbd_disk".

Fixes: https://tracker.ceph.com/issues/62475
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/test/librbd/fsx.cc

index a727bde1ce4882163b0a78cd9f41c37e040df25c..acea8ede270876b3cb041ec0dcbc3549c9810c4c 100644 (file)
@@ -209,6 +209,8 @@ FILE *      fsxlogf = NULL;
 int badoff = -1;
 int closeopen = 0;
 
+bool wnbd_disk = false;
+
 void
 vwarnc(int code, const char *fmt, va_list ap) {
   fprintf(stderr, "fsx: ");
@@ -2269,7 +2271,7 @@ doread(unsigned offset, unsigned size)
        int ret;
 
        offset -= offset % readbdy;
-       if (o_direct || ops == &wnbd_operations)
+       if (o_direct || wnbd_disk)
                size -= size % readbdy;
        if (size == 0) {
                if (!quiet && testcalls > simulatedopcount && !o_direct)
@@ -2359,7 +2361,7 @@ dowrite(unsigned offset, unsigned size)
        off_t newsize;
 
        offset -= offset % writebdy;
-       if (o_direct || ops == &wnbd_operations)
+       if (o_direct || wnbd_disk)
                size -= size % writebdy;
        if (size == 0) {
                if (!quiet && testcalls > simulatedopcount && !o_direct)
@@ -3457,6 +3459,7 @@ main(int argc, char **argv)
                case 'M':
                        prt("rbd-wnbd mode enabled\n");
                        ops = &wnbd_operations;
+                       wnbd_disk = true;
                        break;
 #endif
                case 'L':