From patchwork Wed May 2 20:33:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10376447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8103C60384 for ; Wed, 2 May 2018 20:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DBF728F9F for ; Wed, 2 May 2018 20:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 620C329007; Wed, 2 May 2018 20:34:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 932B128F9F for ; Wed, 2 May 2018 20:34:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75B4C6B0011; Wed, 2 May 2018 16:34:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 70B6C6B0012; Wed, 2 May 2018 16:34:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D3D46B0022; Wed, 2 May 2018 16:34:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id 013F46B0011 for ; Wed, 2 May 2018 16:34:03 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id x7-v6so8821683wrn.13 for ; Wed, 02 May 2018 13:34:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:references:mime-version:content-disposition:in-reply-to :user-agent; bh=sl1PT0BjMmnwjObNbZMxCltseEqDgo4JcWJWC67nKbc=; b=QWTIYtfRh3CY5qrIpGIOMT6F3KJTFrAt+L7DfuIib8WuXG3Co5zTFy304/om+GAA35 mbd9w1UTN0+99A1Kf0sc1cdqtCUCiESbksiqy/ptfRNm637ZGtpzZ9MUMyp0Tbf+KvLp 0NwGcYTcCyIocDh/q8shCJOa7Nf/YJwYrLtEvJFMlIxXj05LVIUo79+lqfiPmBXtmhZL S/MhCpBHKH4NR63Yv+hztVhEOiU4b17v2tTeksenHgd0BSx0SL1+82LSjkl8dd/iejI6 iRj8hzARoZHoGWl1X/09XdRncDvaSWk9UA8kjrr97TaySTfjcg41E/zaOwlGbEfnMU3+ Cu3g== X-Gm-Message-State: ALQs6tDha/l1Xt7yyy0svvvBHFZf2jPPQhDJMs6ZbfomPiDOdw8IkcBL 08Q+HytWt5SL8pfYkih3n1xXXI42L+pD/eZmSOTv8So6QjZMurIr4oybrvGDldRi6dv5ZFRCI5F GcXh5JBV4UWKoXdwEGPyhEfBT3UudcawrcuSZltQHk3RW+fzj/Pfdc+NERicMhp6X6A== X-Received: by 2002:a50:cd8d:: with SMTP id p13-v6mr8979765edi.159.1525293242524; Wed, 02 May 2018 13:34:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqlB7bQ2NEhC48KnD0j+Fc7XQ5+GwatMnp4XajnP3fFRpCgPzi89JoU5/tDmhOC7ZaIdPzT X-Received: by 2002:a50:cd8d:: with SMTP id p13-v6mr8979720edi.159.1525293241649; Wed, 02 May 2018 13:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525293241; cv=none; d=google.com; s=arc-20160816; b=j6D8bj54yM4WdtmmBWW37qE4/KXbEUEhHHzuJf6pccdkiAakQHsY48Hp/YR6x6wFPV 1raqO22Frh2Bz7eDZbLVCifSBFp1JO4tL1DWbGgSTEtEgwJyreZyQ6VNotW1/xBUvxTL UShfuaekQIJH7X8h2/fd3SUxgKIrmtsjhX/Ut92XXgtB5fffkUNRXVFTwjYM8vPjsmws BAtvWql41gKimCRtPTLmcm6V5bqjTP+BO3WgUUCjT8QDhbF1htkpyvzSI/8z8iSr8uw0 ++M1hn1z2dIK9dRigyNgP6Z44QSRfAyreUNa/I3bkEeFLmnIVNhBL1bj1JfxPHUQPbjC 55rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=sl1PT0BjMmnwjObNbZMxCltseEqDgo4JcWJWC67nKbc=; b=wX/agO3RAZE5J31nBRtGrDy8KT9O9qT1wGqs9y49viWn21TK06GA9A1Z856FiHwo4j Tkap75AA3QquiqFZhyxT5lfK1npxgAdF3MkW+vz66m9zhCCHp9HV0/lvHOkmv0ShAxtg Col0fUfvWZAMnxuD7F2lAtJFPuFbx4uXWsKZIWJgRyr6C3QjwVvU6TqpA7PDjGRotUOK MOhmIDdJSMm9WT3fROazje52gRWtydnnB5y3oNXXjp/fpwU9IRfXbqHDu6NFkxlGQv9y si/pth3bBpn1GDoS23uenPiLhGXlfCGxAzAyOxO9g0r2mGIEDQnoGAHTGGdy4UrFzJbH cPZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RL/jmBOP; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id k23-v6si5504565ede.31.2018.05.02.13.34.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 May 2018 13:34:01 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RL/jmBOP; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w42KVeSG013167; Wed, 2 May 2018 20:33:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=sl1PT0BjMmnwjObNbZMxCltseEqDgo4JcWJWC67nKbc=; b=RL/jmBOPZC86hifpux4Y8nwQ/x2VG7Gn1DUA3RDJl0oQSZ42OCwZ5M7UAQnVMj9875zy Ou9j6xCLcqGlC6ZYENDnCZi8+VX9cBWBjiMcDYPWCNozWcz2giVT7RKOOn/2tSA8RRgj QU5sGc7nvYRvchEXOEarQhjrCkas9iGMAJlo5gMJhl9jKM7QPUoeF4rBVPVaTkH4MVsO u2W7Ac962YjRsc4PJ7FwRFY0wwnlUF3wJMtk8HKmFxlr2bhn1OVqLuYQ1xU9+wo1e4x7 Q0DnNTv0QHzeDkZhBcNddEEGJjyl3QgEM8zvJd8/Qsn/5ND+JDCnDjaA/3mwTjtjJYJk tA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2hmgxfxwyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 May 2018 20:33:43 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w42KXg7a024836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 May 2018 20:33:42 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w42KXgP3015918; Wed, 2 May 2018 20:33:42 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 May 2018 13:33:41 -0700 Date: Wed, 2 May 2018 13:33:38 -0700 From: "Darrick J. Wong" To: xfs , linux-fsdevel , linux-mm@kvack.org, darrick.wong@oracle.com Cc: hch@infradead.org, cyberax@amazon.com, jack@suse.cz, osandov@osandov.com, Eryu Guan Subject: [PATCH 2/2] generic: test swapfile creation, activation, and deactivation Message-ID: <20180502203338.GB4141@magnolia> References: <20180502203228.GA4141@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180502203228.GA4141@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8881 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805020172 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Test swapfile activation and deactivation. Signed-off-by: Darrick J. Wong --- tests/generic/708 | 120 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/708.out | 9 ++++ tests/generic/group | 1 3 files changed, 130 insertions(+) create mode 100755 tests/generic/708 create mode 100644 tests/generic/708.out diff --git a/tests/generic/708 b/tests/generic/708 new file mode 100755 index 00000000..49be8111 --- /dev/null +++ b/tests/generic/708 @@ -0,0 +1,120 @@ +#! /bin/bash +# FS QA Test No. 708 +# +# Test various swapfile activation oddities. +# +#----------------------------------------------------------------------- +# Copyright (c) 2018 Oracle. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $testfile +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch_swapfile + +rm -f $seqres.full +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount >>$seqres.full 2>&1 + +swapfile=$SCRATCH_MNT/swap +len=$((2 * 1048576)) + +swapfile_cycle() { + local swapfile="$1" + + mkswap $swapfile >> $seqres.full + filefrag -v $swapfile >> $seqres.full + swapon $swapfile 2>&1 | _filter_scratch + swapon -v --bytes >> $seqres.full + swapoff $swapfile 2>> $seeqres.full + rm -f $swapfile +} + +# Create a sparse swap file +echo "sparse swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "truncate $len" $swapfile >> $seqres.full +swapfile_cycle $swapfile + +# Create a regular swap file +echo "regular swap" | tee -a $seqres.full +_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full +swapfile_cycle $swapfile + +# Create a fallocated swap file +echo "fallocate swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full +swapfile_cycle $swapfile + +# Create a swap file with a little too much junk on the end +echo "too long swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $((len + 3))" $swapfile >> $seqres.full +swapfile_cycle $swapfile + +# Create a swap file with a large discontiguous range(?) +echo "large discontig swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $((len * 2))" $swapfile >> $seqres.full +old_sz="$(stat -c '%s' $swapfile)" +$XFS_IO_PROG -c "fcollapse $((len / 2)) $len" $swapfile >> $seqres.full 2>&1 +new_sz="$(stat -c '%s' $swapfile)" +if [ $old_sz -gt $new_sz ]; then + swapfile_cycle $swapfile +fi +rm -f $swapfile + +# Create a swap file with a small discontiguous range(?) +echo "small discontig swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $((len + 1024))" $swapfile >> $seqres.full +old_sz="$(stat -c '%s' $swapfile)" +$XFS_IO_PROG -c "fcollapse 66560 1024" $swapfile >> $seqres.full 2>&1 +new_sz="$(stat -c '%s' $swapfile)" +if [ $old_sz -gt $new_sz ]; then + swapfile_cycle $swapfile +fi +rm -f $swapfile + +# Create a fallocated swap file and touch every other $PAGE_SIZE to create +# a mess of written/unwritten extent records +echo "mixed swap" | tee -a $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full +page_size=$(get_page_size) +seq $page_size $((page_size * 2)) $len | while read offset; do + _pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full +done +swapfile_cycle $swapfile + +status=0 +exit diff --git a/tests/generic/708.out b/tests/generic/708.out new file mode 100644 index 00000000..bc7b05d1 --- /dev/null +++ b/tests/generic/708.out @@ -0,0 +1,9 @@ +QA output created by 708 +sparse swap +swapon: SCRATCH_MNT/swap: skipping - it appears to have holes. +regular swap +fallocate swap +too long swap +large discontig swap +small discontig swap +mixed swap diff --git a/tests/generic/group b/tests/generic/group index 49f5cbe1..94cbcee9 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -489,3 +489,4 @@ 484 auto quick 600 auto quick insert 706 auto quick attr +708 auto quick swapfile