From d63808ed09412c947d1242f0abded6e267bb8e50 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Thu, 1 May 2014 16:08:03 +0400 Subject: [PATCH] test_librbd_fsx: make resizes sector-size aligned 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 --- src/test/librbd/fsx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/librbd/fsx.c b/src/test/librbd/fsx.c index f5a76939fca48..e4774e08a6217 100644 --- a/src/test/librbd/fsx.c +++ b/src/test/librbd/fsx.c @@ -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 -- 2.39.5