From 817985b4ddccf78dec358d93e75f71faa2268693 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Wed, 7 May 2014 17:19:53 +0400 Subject: [PATCH] test_librbd_fsx: align temporary buffers allocated in check_clone() check_clone() allocates temporary good_buf and temp_buf with malloc(), which is not good enough for krbd with O_DIRECT. Signed-off-by: Ilya Dryomov --- src/test/librbd/fsx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/librbd/fsx.c b/src/test/librbd/fsx.c index b83bfb71dec2..20106e02c1c4 100644 --- a/src/test/librbd/fsx.c +++ b/src/test/librbd/fsx.c @@ -1381,8 +1381,19 @@ check_clone(int clonenum) exit(169); } - good_buf = malloc(file_info.st_size); - temp_buf = malloc(file_info.st_size); + ret = posix_memalign((void **)&good_buf, MAX(writebdy, sizeof(void *)), + file_info.st_size); + if (ret > 0) { + prterrcode("check_clone: posix_memalign(good_buf)", -ret); + exit(96); + } + + ret = posix_memalign((void **)&temp_buf, MAX(readbdy, sizeof(void *)), + file_info.st_size); + if (ret > 0) { + prterrcode("check_clone: posix_memalign(temp_buf)", -ret); + exit(97); + } if ((ret = pread(fd, good_buf, file_info.st_size, 0)) < 0) { simple_err("check_clone: pread", -errno); -- 2.47.3