From patchwork Tue Oct 22 19:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirjhar Roy X-Patchwork-Id: 13846066 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14C80145A1C; Tue, 22 Oct 2024 19:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625198; cv=none; b=RGdFj38hMm5YS+NjWZ+4BZoAhA4ppDnFLd5TX4GbhgibY91nIyAfFz1uZ6OOHRnwK5FpNe9YyNCy2SpJ3XPPGhhiWswAfjU+dXD4dDp36hBMCfz88Ji2my4jmMQ0kHmsErjbLeNfW1Y4l5SIUleroqeyE+DeCqWheRj7QVK5Ioo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625198; c=relaxed/simple; bh=phbILsG2JeioBUL62i1rkn/spWpJxGlo8OU+0cDYwhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bNnKDhk4OJXRx9bw5n/ViUf144fxuHZj8iZZ3BzETiYkb6Pp2jManq5dBV8Mb4bvtRqQ3WhOsuDoMbP4OhUmFH2cxYEJEG2LDbtSaTtpP5RzrlRpASoqQvqnVmgghj8ip7t1RLErhTjY1afjPV686xyKDGHB/gGcNKFDCZ9hrJQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=AWQzp8KF; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="AWQzp8KF" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49MFm7T1004806; Tue, 22 Oct 2024 19:26:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=cDH0L0bsb1qLazu8S KIld++0u7+2tBFHacW9JNGFwEY=; b=AWQzp8KFHD9lMPF60jxnGky1A1ISqRdRh H79zjRPgpPGVEIiMwd0q5Jn4Zj2V0CqM4aZsVjnOE++SXXvgzLs/infdAlhZdCAw 4aaCynGmgXNXZhSmwt90oPhsxC3jX9bJ1UxC66GbLILJ/6gwS8q8WrE7MP+WIopH eCGzhXn/Zab6nBiU0MkCrOEku2pnfospJiVUU52uRs0joUvlHe+UrO/AbicTGNqS HMXhLFNWCSW+7UAaOT7BlNrq27MKnfUFM4iOFxYS0yi49uznJdtDaw47zgFE6OwQ IullLaOEFsQ6UONrHQwD/O00QxFioc5VGdaSJ7EeSPoDHbQoveLpQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42e4xfknfq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:33 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 49MJQW3v027380; Tue, 22 Oct 2024 19:26:32 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42e4xfknfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:32 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49MIXPmw018655; Tue, 22 Oct 2024 19:26:32 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 42csajcj10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:32 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49MJQU5833423854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2024 19:26:30 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 711A82004B; Tue, 22 Oct 2024 19:26:30 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 087DE2004D; Tue, 22 Oct 2024 19:26:29 +0000 (GMT) Received: from li-5d80d4cc-2782-11b2-a85c-bed59fe4c9e5.ibm.com.com (unknown [9.39.26.25]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 22 Oct 2024 19:26:28 +0000 (GMT) From: Nirjhar Roy To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, ritesh.list@gmail.com, ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org Subject: [PATCH 1/2] common/xfs,xfs/207: Adding a common helper function to check xflag bits on a given file Date: Wed, 23 Oct 2024 00:56:19 +0530 Message-ID: <6ba7f682af7e0bc99a8baeccc0d7aa4e5062a433.1729624806.git.nirjhar@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: hmT8PEWnrYuiOLula7lr9Gu29dB5VY0c X-Proofpoint-ORIG-GUID: cuHix2Rslp8iKoXqM0gZZg4yH12hg7Lc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=946 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410220125 This patch defines a common helper function to test whether any of fsxattr xflags field is set or not. We will use this helper in the next patch for checking extsize (e) flag. Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Ojaswin Mujoo Signed-off-by: Nirjhar Roy --- common/xfs | 9 +++++++++ tests/xfs/207 | 14 +++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common/xfs b/common/xfs index 62e3100e..7340ccbf 100644 --- a/common/xfs +++ b/common/xfs @@ -13,6 +13,15 @@ __generate_xfs_report_vars() { REPORT_ENV_LIST_OPT+=("TEST_XFS_REPAIR_REBUILD" "TEST_XFS_SCRUB_REBUILD") } +# Check whether a fsxattr xflags character field is set on a given file. +# e.g. fsxattr.xflags = 0x0 [--------------C-] +# Returns 0 if passed flag character is set, otherwise returns 1 +_test_xfs_xflags_field() +{ + $XFS_IO_PROG -c "stat" "$1" | grep "fsxattr.xflags" | grep -q "\[.*$2.*\]" \ + && return 0 || return 1 +} + _setup_large_xfs_fs() { fs_size=$1 diff --git a/tests/xfs/207 b/tests/xfs/207 index bbe21307..adb925df 100755 --- a/tests/xfs/207 +++ b/tests/xfs/207 @@ -15,21 +15,13 @@ _begin_fstest auto quick clone fiemap # Import common functions. . ./common/filter . ./common/reflink +. ./common/xfs _require_scratch_reflink _require_cp_reflink _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" -# Takes the fsxattr.xflags line, -# i.e. fsxattr.xflags = 0x0 [--------------C-] -# and tests whether a flag character is set -test_xflag() -{ - local flg=$1 - grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset" -} - echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1 @@ -65,14 +57,14 @@ echo "Set cowextsize and check flag" $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch _scratch_cycle_mount -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C" +_test_xfs_xflags_field "$testdir/file3" "C" && echo "C flag set" || echo "C flag unset" $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch echo "Unset cowextsize and check flag" $XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch _scratch_cycle_mount -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C" +_test_xfs_xflags_field "$testdir/file3" "C" && echo "C flag set" || echo "C flag unset" $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch status=0 From patchwork Tue Oct 22 19:26:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirjhar Roy X-Patchwork-Id: 13846067 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF2AD145A1C; Tue, 22 Oct 2024 19:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625202; cv=none; b=CFaLkV940DdzeztJl9fRxLX3+YeDsidj9viIVBEUFML2edFSN/6vu7c5+xDyd9SSI5YhHOqHeujpzO9DC7DZOH54a1LfAbqktegOfJu/zWPEw+o06k7jNgiBYMVworOTvpSn+4bzStnFSKIoCcPUjUbl30STsgJl5noKtBRmM+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625202; c=relaxed/simple; bh=6KaZFQagWlS+eaYwfw0exX6BXpLjCxzHxwQsoNYLWR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cN1cbf46KTqXCQSH6xjUqDq15+rhHtsAGhCDTVARoVIfOUsJSTwiYSmjmoDtKoMZN5EkWnuJM1X6WL1Gn8Lq+0TgTQWy5x8VNDdMVrqBKZKrIWDw8EpTvSS7akaJoqZ0qbM5AVAU0BjiqkwkU8YtQsFPnj5Aq3ITi6GdrBO79Mk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=XZ8tdX8g; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="XZ8tdX8g" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49MG9o9s009345; Tue, 22 Oct 2024 19:26:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=xr8NS17tD14JGIIQ7 tavOnzD/L6j5OkeFwMeo/geND8=; b=XZ8tdX8gMOVC+YqNXBvHNtkdD2TB+ZUl+ 89tJMi2JSfB+MmYItuSqU0R4UxbXpq8N8N16qYJijjOcPL1dPxpItczEmFe715iB BMlKfx36pOGTiave09/wCJeZSsDvzoH6lY36vkIdA2HMG7s/6seOdrpWfkojm9Lz aUmLZY+69obkK8eQxboU0z3RvHPxD2Zj+OotVCoov91LOVB9vaAiys8I2q/H/nwr y/gDERbicTXFR/nw6tvzwMwVw0G7c7imAzPePdKOu/AiATeQF3/7pODhLpYrUr9U tXSOCYT0+vFn5WcuOzdMLlTZenCMfDhnxkAoexb0APjfkGQIy+WAg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5hmgh8d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:37 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 49MJQbk8013830; Tue, 22 Oct 2024 19:26:37 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5hmgh8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:37 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49MJBljI023829; Tue, 22 Oct 2024 19:26:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 42cst14fp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Oct 2024 19:26:36 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49MJQYxA57475360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2024 19:26:34 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0E452004B; Tue, 22 Oct 2024 19:26:34 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48E9920043; Tue, 22 Oct 2024 19:26:33 +0000 (GMT) Received: from li-5d80d4cc-2782-11b2-a85c-bed59fe4c9e5.ibm.com.com (unknown [9.39.26.25]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 22 Oct 2024 19:26:33 +0000 (GMT) From: Nirjhar Roy To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, ritesh.list@gmail.com, ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org Subject: [PATCH 2/2] generic: Addition of new tests for extsize hints Date: Wed, 23 Oct 2024 00:56:20 +0530 Message-ID: <5cac327a9ee44c42035d9702b3a146aebc95e28c.1729624806.git.nirjhar@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: J48lVJJ-M9ngwz4fCDdjtaoiT1ovhYY2 X-Proofpoint-GUID: dh7m7iZi8qGxVfOdw7DrK4zDb9b1mckE X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 phishscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410220125 This commit adds new tests that checks the behaviour of xfs/ext4 filesystems when extsize hint is set on file with inode size as 0, non-empty files with allocated and delalloc extents and so on. Although currently this test is placed under tests/generic, it only runs on xfs and there is an ongoing patch series[1] to enable extsize hints for ext4 as well. [1] https://lore.kernel.org/linux-ext4/cover.1726034272.git.ojaswin@linux.ibm.com/ Suggested-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Ojaswin Mujoo Signed-off-by: Nirjhar Roy --- tests/generic/365 | 156 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/365.out | 26 +++++++ 2 files changed, 182 insertions(+) create mode 100755 tests/generic/365 create mode 100644 tests/generic/365.out diff --git a/tests/generic/365 b/tests/generic/365 new file mode 100755 index 00000000..85a7ce9a --- /dev/null +++ b/tests/generic/365 @@ -0,0 +1,156 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Nirjhar Roy (nirjhar@linux.ibm.com). All Rights Reserved. +# +# FS QA Test 365 +# +# This test verifies that extent allocation hint setting works correctly on files with +# no extents allocated and non-empty files which are truncated. It also checks that the +# extent hints setting fails with non-empty file i.e, with any file with allocated +# extents or delayed allocation. We also check if the extsize value and the +# xflag bit actually got reflected after setting/re-setting the extsize value. + +. ./common/config +. ./common/filter +. ./common/preamble +. ./common/xfs + +_begin_fstest ioctl quick + +_supported_fs xfs + +_fixed_by_kernel_commit XXXXXXXXXXXX \ + "xfs: Check for delayed allocations before setting extsize", + +_require_scratch + +FILE_DATA_SIZE=1M + +filter_extsz() +{ + sed "s/$EXTSIZE/EXTSIZE/g" +} + +setup() +{ + _scratch_mkfs >> "$seqres.full" 2>&1 + _scratch_mount >> "$seqres.full" 2>&1 + BLKSZ=`_get_block_size $SCRATCH_MNT` + EXTSIZE=$(( BLKSZ*2 )) +} + +read_file_extsize() +{ + $XFS_IO_PROG -c "extsize" $1 | _filter_scratch | filter_extsz +} + +check_extsz_and_xflag() +{ + local filename=$1 + read_file_extsize $filename + _test_xfs_xflags_field $filename "e" && echo "e flag set" || echo "e flag unset" +} + +check_extsz_xflag_across_remount() +{ + local filename=$1 + _scratch_cycle_mount + check_extsz_and_xflag $filename +} + +# Extsize flag should be cleared when extsize is reset, so this function +# checks that this behavior is followed. +reset_extsz_and_recheck_extsz_xflag() +{ + local filename=$1 + echo "Re-setting extsize hint to 0" + $XFS_IO_PROG -c "extsize 0" $filename + check_extsz_xflag_across_remount $filename +} + +check_extsz_xflag_before_and_after_reset() +{ + local filename=$1 + check_extsz_xflag_across_remount $filename + reset_extsz_and_recheck_extsz_xflag $filename +} + +test_empty_file() +{ + echo "TEST: Set extsize on empty file" + local filename=$1 + $XFS_IO_PROG \ + -c "open -f $filename" \ + -c "extsize $EXTSIZE" \ + + check_extsz_xflag_before_and_after_reset $filename + echo +} + +test_data_delayed() +{ + echo "TEST: Set extsize on non-empty file with delayed allocation" + local filename=$1 + $XFS_IO_PROG \ + -c "open -f $filename" \ + -c "pwrite -q 0 $FILE_DATA_SIZE" \ + -c "extsize $EXTSIZE" | _filter_scratch + + check_extsz_xflag_across_remount $filename + echo +} + +test_data_allocated() +{ + echo "TEST: Set extsize on non-empty file with allocated extents" + local filename=$1 + $XFS_IO_PROG \ + -c "open -f $filename" \ + -c "pwrite -qW 0 $FILE_DATA_SIZE" \ + -c "extsize $EXTSIZE" | _filter_scratch + + check_extsz_xflag_across_remount $filename + echo +} + +test_truncate_allocated() +{ + echo "TEST: Set extsize after truncating a file with allocated extents" + local filename=$1 + $XFS_IO_PROG \ + -c "open -f $filename" \ + -c "pwrite -qW 0 $FILE_DATA_SIZE" \ + -c "truncate 0" \ + -c "extsize $EXTSIZE" \ + + check_extsz_xflag_across_remount $filename + echo +} + +test_truncate_delayed() +{ + echo "TEST: Set extsize after truncating a file with delayed allocation" + local filename=$1 + $XFS_IO_PROG \ + -c "open -f $filename" \ + -c "pwrite -q 0 $FILE_DATA_SIZE" \ + -c "truncate 0" \ + -c "extsize $EXTSIZE" \ + + check_extsz_xflag_across_remount $filename + echo +} + +setup +echo -e "EXTSIZE = $EXTSIZE BLOCKSIZE = $BLKSZ\n" >> "$seqres.full" + +NEW_FILE_NAME_PREFIX=$SCRATCH_MNT/new-file- + +test_empty_file "$NEW_FILE_NAME_PREFIX"00 +test_data_delayed "$NEW_FILE_NAME_PREFIX"01 +test_data_allocated "$NEW_FILE_NAME_PREFIX"02 +test_truncate_allocated "$NEW_FILE_NAME_PREFIX"03 +test_truncate_delayed "$NEW_FILE_NAME_PREFIX"04 + +status=0 +exit diff --git a/tests/generic/365.out b/tests/generic/365.out new file mode 100644 index 00000000..38cd0885 --- /dev/null +++ b/tests/generic/365.out @@ -0,0 +1,26 @@ +QA output created by 365 +TEST: Set extsize on empty file +[EXTSIZE] SCRATCH_MNT/new-file-00 +e flag set +Re-setting extsize hint to 0 +[0] SCRATCH_MNT/new-file-00 +e flag unset + +TEST: Set extsize on non-empty file with delayed allocation +xfs_io: FS_IOC_FSSETXATTR SCRATCH_MNT/new-file-01: Invalid argument +[0] SCRATCH_MNT/new-file-01 +e flag unset + +TEST: Set extsize on non-empty file with allocated extents +xfs_io: FS_IOC_FSSETXATTR SCRATCH_MNT/new-file-02: Invalid argument +[0] SCRATCH_MNT/new-file-02 +e flag unset + +TEST: Set extsize after truncating a file with allocated extents +[EXTSIZE] SCRATCH_MNT/new-file-03 +e flag set + +TEST: Set extsize after truncating a file with delayed allocation +[EXTSIZE] SCRATCH_MNT/new-file-04 +e flag set +