From: Ilya Dryomov Date: Wed, 7 May 2014 13:19:53 +0000 (+0400) Subject: test_librbd_fsx: align temporary buffers allocated in check_clone() X-Git-Tag: v0.81~48^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=817985b4ddccf78dec358d93e75f71faa2268693;p=ceph.git 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 --- 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);