From 367973b0151526bd2a7f75b4b4437f314e78bcb7 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 8 Jun 2016 15:29:17 -0400 Subject: [PATCH] cephfs: test readahead is working Test case for: https://github.com/ceph/ceph/pull/9374 Issue: http://tracker.ceph.com/issues/16024 Signed-off-by: Patrick Donnelly --- suites/fs/recovery/tasks/client-readahad.yaml | 4 +++ tasks/cephfs/test_readahead.py | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 suites/fs/recovery/tasks/client-readahad.yaml create mode 100644 tasks/cephfs/test_readahead.py diff --git a/suites/fs/recovery/tasks/client-readahad.yaml b/suites/fs/recovery/tasks/client-readahad.yaml new file mode 100644 index 0000000000000..1d178e5286d6e --- /dev/null +++ b/suites/fs/recovery/tasks/client-readahad.yaml @@ -0,0 +1,4 @@ +tasks: + - cephfs_test_runner: + modules: + - tasks.cephfs.test_readahead diff --git a/tasks/cephfs/test_readahead.py b/tasks/cephfs/test_readahead.py new file mode 100644 index 0000000000000..39f4fb88ce14d --- /dev/null +++ b/tasks/cephfs/test_readahead.py @@ -0,0 +1,26 @@ +import logging +from tasks.cephfs.cephfs_test_case import CephFSTestCase + +log = logging.getLogger(__name__) + +class TestReadahead(CephFSTestCase): + def test_flush(self): + # Create 32MB file + self.mount_a.run_shell(["dd", "if=/dev/urandom", "of=foo", "bs=1M", "count=32"]) + + # Unmount and remount the client to flush cache + self.mount_a.umount_wait() + self.mount_a.mount() + self.mount_a.wait_until_mounted() + + initial_op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r'] + self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"]) + op_r = self.mount_a.admin_socket(['perf', 'dump', 'objecter'])['objecter']['op_r'] + assert op_r >= initial_op_r + op_r -= initial_op_r + log.info("read operations: {0}".format(op_r)) + + # with exponentially increasing readahead, we should see fewer than 10 operations + # but this test simply checks if the client is doing a remote read for each local read + if op_r >= 32: + raise RuntimeError("readahead not working") -- 2.39.5