From patchwork Mon Oct 10 08:06:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoguang Wang X-Patchwork-Id: 9369093 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 996E5607D2 for ; Mon, 10 Oct 2016 08:12:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C76529111 for ; Mon, 10 Oct 2016 08:12:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 811FD2911F; Mon, 10 Oct 2016 08:12:18 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04CA129111 for ; Mon, 10 Oct 2016 08:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbcJJIMN (ORCPT ); Mon, 10 Oct 2016 04:12:13 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:25939 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752126AbcJJIMM (ORCPT ); Mon, 10 Oct 2016 04:12:12 -0400 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="888590" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 10 Oct 2016 16:12:03 +0800 Received: from localhost.localdomain (unknown [10.167.226.107]) by cn.fujitsu.com (Postfix) with ESMTP id 210664004912; Mon, 10 Oct 2016 16:12:02 +0800 (CST) From: Wang Xiaoguang To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v2] generic: make 17[1-4] work well when btrfs compression is enabled Date: Mon, 10 Oct 2016 16:06:17 +0800 Message-Id: <20161010080617.10139-1-wangxg.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 210664004912.AE48B X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wangxg.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When enabling btrfs compression, original codes can not fill fs correctly, fix this. Signed-off-by: Wang Xiaoguang --- V2: In common/, I did't find an existing function suitable for these 4 test cases to fill fs, so I still use _pwrite_byte() with a big enough file length fo fill fs. Note, for btrfs, metadata space still is not full, only data space is full, but it's OK for these 4 test cases. All these 4 cases pass in xfs and btrfs(without compression), if btrfs has compression enabled, these 4 cases will fail for false enospc error, I have sent kernel patches to fix this bug. --- tests/generic/171 | 7 ++++--- tests/generic/172 | 6 ++++-- tests/generic/173 | 7 ++++--- tests/generic/174 | 7 ++++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/generic/171 b/tests/generic/171 index f391685..2d7f683 100755 --- a/tests/generic/171 +++ b/tests/generic/171 @@ -75,9 +75,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile sync echo "Allocate the rest of the space" -nr_free=$(stat -f -c '%f' $testdir) -touch $testdir/file0 $testdir/file1 -_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1 +# here we try to write big enough data in case some fs support +# compression, such as btrfs. +len=$((2 ** 36)) +_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1 sync echo "CoW the big file" diff --git a/tests/generic/172 b/tests/generic/172 index 8192290..63637bd 100755 --- a/tests/generic/172 +++ b/tests/generic/172 @@ -72,8 +72,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile sync echo "Allocate the rest of the space" -touch $testdir/file0 $testdir/file1 -_pwrite_byte 0x61 0 $fs_size $testdir/eat_my_space >> $seqres.full 2>&1 +# here we try to write big enough data in case some fs support +# compression, such as btrfs. +len=$((2 ** 36)) +_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1 sync echo "CoW the big file" diff --git a/tests/generic/173 b/tests/generic/173 index c5fac9e..c8525c1 100755 --- a/tests/generic/173 +++ b/tests/generic/173 @@ -75,9 +75,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile sync echo "Allocate the rest of the space" -nr_free=$(stat -f -c '%f' $testdir) -touch $testdir/file0 $testdir/file1 -_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1 +# here we try to write big enough data in case some fs support +# compression, such as btrfs. +len=$((2 ** 36)) +_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1 sync echo "mmap CoW the big file" diff --git a/tests/generic/174 b/tests/generic/174 index 8077d76..7fca339 100755 --- a/tests/generic/174 +++ b/tests/generic/174 @@ -76,9 +76,10 @@ _cp_reflink $testdir/bigfile $testdir/clonefile sync echo "Allocate the rest of the space" -nr_free=$(stat -f -c '%f' $testdir) -touch $testdir/file0 $testdir/file1 -_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1 +# here we try to write big enough data in case some fs support +# compression, such as btrfs. +len=$((2 ** 36)) +_pwrite_byte 0x61 0 $len $testdir/eat_my_space >> $seqres.full 2>&1 sync echo "CoW the big file"