From patchwork Tue Oct 7 23:20:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 5046831 Return-Path: X-Original-To: patchwork-fstests@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 86C02C11AB for ; Tue, 7 Oct 2014 15:21:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97EF120166 for ; Tue, 7 Oct 2014 15:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E0BF20148 for ; Tue, 7 Oct 2014 15:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753520AbaJGPVg (ORCPT ); Tue, 7 Oct 2014 11:21:36 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:47547 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754108AbaJGPVg (ORCPT ); Tue, 7 Oct 2014 11:21:36 -0400 Received: by mail-pd0-f178.google.com with SMTP id y10so5166009pdj.23 for ; Tue, 07 Oct 2014 08:21:35 -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=zgzCP6Ne+ozCDCIk8byqTYPq+WYX8Wx743pRd2bA+Q0=; b=lDVhqAnL20SSV830A8nI/iFbQOWs+2EjXgI2ea1g5an5K9F/QvuQn5B5emerj9uyAK 8Z559dwTUpZq7xALrklPlRZaRje8YBiwM7YtQ+GNtmGHVGH2OYbxuK/eioqfzT+nr0vn p5Iu4G7XIax1fDT7RDkEA0XUmjjqhQo4vqrQHO84qJTmntqQyr3CNEzgZ+ZOhJ1ZetZY 2LFAyR98wW7F/SRPuy/ZXresehlN6C2axPk+u0FK5L8LPGLuHiFK+GSWG8TJYVb2wBfR 3D+/VgDuMU9vgrEIsbUq/yyOnzaK2L1KSSBimT2YljIHZ8x0KIfxFjp23LscqtDjBKGX rtsg== X-Received: by 10.68.68.162 with SMTP id x2mr4345493pbt.40.1412695295840; Tue, 07 Oct 2014 08:21:35 -0700 (PDT) Received: from vm01.localdomain ([112.0.61.175]) by mx.google.com with ESMTPSA id fb5sm16599472pab.23.2014.10.07.08.21.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 08:21:35 -0700 (PDT) From: Wang Shilong To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH] xfstests: add regression for inode bad compression ratio detection Date: Tue, 7 Oct 2014 19:20:49 -0400 Message-Id: <1412724049-50613-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@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=ham 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 --- Test is a little relying on btrfs now 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 ^_^. --- tests/btrfs/060 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/060.out | 3 +++ tests/btrfs/group | 1 + 3 files changed, 76 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..6ef2e0f --- /dev/null +++ b/tests/btrfs/060 @@ -0,0 +1,72 @@ +#! /bin/bash +# FS QA Test No. btrfs/060 +# +# Regression test for btrfs incorrection 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 + +# 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 + +filefrag $SCRATCH_MNT/data | $AWK_PROG '{print $2}' + +$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 +filefrag $SCRATCH_MNT/data | $AWK_PROG '{print $2}' + +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