2016-06-08 19:29:17 +00:00
|
|
|
import logging
|
|
|
|
from tasks.cephfs.cephfs_test_case import CephFSTestCase
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2016-09-02 12:56:23 +00:00
|
|
|
|
2016-06-08 19:29:17 +00:00
|
|
|
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()
|
2020-04-03 09:26:22 +00:00
|
|
|
self.mount_a.mount_wait()
|
2016-06-08 19:29:17 +00:00
|
|
|
|
2020-11-12 06:18:16 +00:00
|
|
|
initial_op_read = self.mount_a.get_op_read_count()
|
2016-06-08 19:29:17 +00:00
|
|
|
self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"])
|
2020-11-12 06:18:16 +00:00
|
|
|
op_read = self.mount_a.get_op_read_count()
|
2022-05-23 09:15:40 +00:00
|
|
|
self.assertGreaterEqual(op_read, initial_op_read)
|
2020-11-11 02:09:47 +00:00
|
|
|
op_read -= initial_op_read
|
|
|
|
log.info("read operations: {0}".format(op_read))
|
2016-06-08 19:29:17 +00:00
|
|
|
|
|
|
|
# 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
|
2020-11-11 02:09:47 +00:00
|
|
|
if op_read >= 32:
|
2016-06-08 19:29:17 +00:00
|
|
|
raise RuntimeError("readahead not working")
|