]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_librbd_fsx: make resizes sector-size aligned
authorIlya Dryomov <ilya.dryomov@inktank.com>
Thu, 1 May 2014 12:08:03 +0000 (16:08 +0400)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Wed, 7 May 2014 13:30:05 +0000 (17:30 +0400)
In preparation for krbd mode support, change check_trunc_hack() to
resize to a sector-size aligned value.  The kernel will not work with
images whose size is not sector-size aligned.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
src/test/librbd/fsx.c

index f5a76939fca48790bc0d1b60ccb1a0f84fbfac8f..e4774e08a6217bfc09a2eb05734f6844baa713f9 100644 (file)
@@ -464,20 +464,21 @@ check_size(void)
        }
 }
 
+#define TRUNC_HACK_SIZE        (200ULL << 9)   /* 512-byte aligned for krbd */
 
 void
 check_trunc_hack(void)
 {
        rbd_image_info_t statbuf;
 
-       rbd_resize(image, (off_t)0);
-       rbd_resize(image, (off_t)100000);
+       rbd_resize(image, 0ULL);
+       rbd_resize(image, TRUNC_HACK_SIZE);
        rbd_stat(image, &statbuf, sizeof(statbuf));
-       if (statbuf.size != (off_t)100000) {
+       if (statbuf.size != TRUNC_HACK_SIZE) {
                prt("no extend on truncate! not posix!\n");
                exit(130);
        }
-       rbd_resize(image, (off_t)0);
+       rbd_resize(image, 0ULL);
 }
 
 int