From patchwork Wed Oct 8 10:28:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 5051011 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ACC2FC11AB for ; Wed, 8 Oct 2014 02:29:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D21A620200 for ; Wed, 8 Oct 2014 02:29:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFD9C201FA for ; Wed, 8 Oct 2014 02:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752368AbaJHC3d (ORCPT ); Tue, 7 Oct 2014 22:29:33 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:52875 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbaJHC3c (ORCPT ); Tue, 7 Oct 2014 22:29:32 -0400 Received: by mail-pa0-f51.google.com with SMTP id lj1so8257009pab.38 for ; Tue, 07 Oct 2014 19:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=R2LJZBtmz/KGSIvpIRQbqnFYyb7jeT5DfdnxJk7nYKo=; b=WqYiDZimYHhyDVbQ5QMGRswX4Ey4mUuj349mHk9DvCH+9OxQVt63N9pkvupB9l1wQy Ed43AgzH1+7BmJgL+kSJf0BHiO1DtZqKOPs0MDZv993KEYzdGggFRS8GG4juWL1SBzIY tve068HPf4Pe45lPboe8scbihle68gjXS+yYizsuI9UUnV7XRo/VJrHy/my0wm883UoB DOoF1qobnMeXExhK0H2Uhpd61B5IxxrOeYviD+wsxBlpD1yS0R78V1SPZSnc0hhORbh8 XxY3LS2q/2A7uOXuVxPhqW1TpMHUf9p+Iirw8tsL/F2uk1DElwH5vZbGkx7IIpAPJAP1 hlDA== X-Received: by 10.69.26.74 with SMTP id iw10mr7230047pbd.137.1412735371506; Tue, 07 Oct 2014 19:29:31 -0700 (PDT) Received: from vm01.localdomain ([221.181.146.136]) by mx.google.com with ESMTPSA id rj8sm14969231pdb.55.2014.10.07.19.29.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 19:29:30 -0700 (PDT) From: Wang Shilong To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v2] xfstests: add regression for inode bad compression ratio detection Date: Wed, 8 Oct 2014 06:28:43 -0400 Message-Id: <1412764123-15702-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test add a regression test to make sure btrfs dosen't set inode NOCOMPRESS flag when a small write(<=blocksize) happens. Signed-off-by: Wang Shilong --- v1->v2: switch _extent_count() helper. Test relies on btrfs have a max 128k limit write, not sure whether it is good since it is possible we may change it in the future. let me know if you have better idea here. ^_^ --- tests/btrfs/060 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/060.out | 3 +++ tests/btrfs/group | 1 + 3 files changed, 78 insertions(+) create mode 100644 tests/btrfs/060 create mode 100644 tests/btrfs/060.out diff --git a/tests/btrfs/060 b/tests/btrfs/060 new file mode 100644 index 0000000..3ff4055 --- /dev/null +++ b/tests/btrfs/060 @@ -0,0 +1,74 @@ +#! /bin/bash +# FS QA Test No. btrfs/060 +# +# Regression test for btrfs incorrect inode ratio detection. +# This was fixed in the following linux kernel patch: +# +# Btrfs: fix incorrect compression ratio detection +# +#----------------------------------------------------------------------- +# Copyright (c) 2014 Wang Shilong. 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" + +here=`pwd` +tmp=/tmp/$$ + +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -fr $tmp +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/defrag + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_test +_require_scratch +_need_to_be_root + +rm -f $seqres.full + +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount "-o compress=lzo" + +$XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ + $SCRATCH_MNT/data >> $seqres.full 2>&1 + +_extent_count $SCRATCH_MNT/data + +$XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \ + $SCRATCH_MNT/data >> $seqres.full 2>&1 + +$XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ + $SCRATCH_MNT/data >> $seqres.full 2>&1 + +_extent_count $SCRATCH_MNT/data + +status=0 +exit diff --git a/tests/btrfs/060.out b/tests/btrfs/060.out new file mode 100644 index 0000000..1c306d2 --- /dev/null +++ b/tests/btrfs/060.out @@ -0,0 +1,3 @@ +QA output created by 060 +80 +80 diff --git a/tests/btrfs/group b/tests/btrfs/group index 68b5c79..d06c163 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -62,3 +62,4 @@ 057 auto quick 058 auto quick 059 auto quick +060 auto quick