1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or https://opensource.org/licenses/CDDL-1.0. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright (c) 2023 by Lawrence Livermore National Security, LLC. 25# 26 27. $STF_SUITE/include/libtest.shlib 28. $STF_SUITE/tests/functional/mmap/mmap.cfg 29 30# 31# DESCRIPTION: 32# Verify mixed buffered and mmap IO. 33# 34# STRATEGY: 35# 1. Create an empty file. 36# 2. Start a background buffered read/write fio to the file. 37# 3. Start a background mmap read/write fio to the file. 38# 39 40verify_runnable "global" 41 42function cleanup 43{ 44 log_must rm -f "$tmp_file" 45} 46 47log_assert "Verify mixed buffered and mmap IO" 48 49log_onexit cleanup 50 51mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) 52tmp_file=$mntpnt/file 53bs=$((128 * 1024)) 54blocks=64 55size=$((bs * blocks)) 56runtime=60 57 58log_must dd if=/dev/zero of=$tmp_file bs=$bs count=$blocks 59 60# Buffered IO writes 61log_must eval "fio --filename=$tmp_file --name=buffer-write \ 62 --rw=randwrite --size=$size --bs=$bs --direct=0 --numjobs=1 \ 63 --ioengine=sync --fallocate=none --group_reporting --minimal \ 64 --runtime=$runtime --time_based --norandommap &" 65 66# Buffered IO reads 67log_must eval "fio --filename=$tmp_file --name=buffer-read \ 68 --rw=randread --size=$size --bs=$bs --direct=0 --numjobs=1 \ 69 --ioengine=sync --fallocate=none --group_reporting --minimal \ 70 --runtime=$runtime --time_based --norandommap &" 71 72# mmap IO writes 73log_must eval "fio --filename=$tmp_file --name=mmap-write \ 74 --rw=randwrite --size=$size --bs=$bs --numjobs=1 \ 75 --ioengine=mmap --fallocate=none --group_reporting --minimal \ 76 --runtime=$runtime --time_based --norandommap &" 77 78# mmap IO reads 79log_must eval "fio --filename=$tmp_file --name=mmap-read \ 80 --rw=randread --size=$size --bs=$bs --numjobs=1 \ 81 --ioengine=mmap --fallocate=none --group_reporting --minimal \ 82 --runtime=$runtime --time_based --norandommap &" 83 84log_must wait 85 86log_pass "Verfied mixed buffered and mmap IO" 87