From 3de4e9ff6a1fbdca54a8be13164da1b46716f487 Mon Sep 17 00:00:00 2001 From: sageweil Date: Wed, 5 Dec 2007 22:44:43 +0000 Subject: [PATCH] fixed git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2177 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/test/test_seek_read.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/trunk/ceph/test/test_seek_read.c b/trunk/ceph/test/test_seek_read.c index 988ff1dcec88d..f25aa7ea93fe8 100644 --- a/trunk/ceph/test/test_seek_read.c +++ b/trunk/ceph/test/test_seek_read.c @@ -1,7 +1,9 @@ #include "include/types.h" #include "common/Clock.h" +#include #include +#include #include #include #include @@ -11,7 +13,15 @@ int main(int argc, char **argv) { char *fn = argv[1]; - uint64_t numblocks = atoll(argv[2]) / 4096; + + int fd = ::open(fn, O_RDWR|O_DIRECT);//|O_SYNC|O_DIRECT); + if (fd < 0) return 1; + + uint64_t bytes = 0; + int r = ioctl(fd, BLKGETSIZE64, &bytes); + uint64_t numblocks = bytes / 4096; + + //uint64_t numblocks = atoll(argv[2]) * 4;// / 4096; int count = 400; cout << "fn " << fn << endl; @@ -19,8 +29,6 @@ int main(int argc, char **argv) int blocks = 1; while (blocks <= 1024) { - int fd = ::open(fn, O_RDWR|O_DIRECT);//|O_SYNC|O_DIRECT); - if (fd < 0) return 1; //cout << "fd is " << fd << endl; void *buf; @@ -30,10 +38,12 @@ int main(int argc, char **argv) utime_t start = g_clock.now(); for (int i=0; i