From patchwork Wed Nov 27 04:27:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirjhar Roy X-Patchwork-Id: 13886534 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 485B21946B; Wed, 27 Nov 2024 04:28: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=1732681721; cv=none; b=KnpWdwQUgjBbKUzSG4iYa88Ttpq1O6yzNZtp39kZuR9UwENWTqzUgprVXjjmYwjazCIi7UDfn+qv3KpCh9PfZzenc40hKs0VGmDeW1UU/HU/HKgyBPwJd4iq/a0A2pZlvQZ3ehmofjYaBpAAONER6E2PvJS1jmXQ1b0j+KMoUEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732681721; c=relaxed/simple; bh=hNEB5pFoibFN5nR8pa0CbpLafYkLhM3CKqOIaBiPjeE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lRK1CCN5exlzEijWKYg79DW9tV3SgkxYS7PzhuK7Oj3EXbrJQrHjRKCF6v8IK1oy/WjrecqPRVOj2VfRbRwAEHJr9BCjzEk0FiNoAZQ6odcvQVL9ita8K6U28KaJ9bR7N8Z4dAdTg0r7A6if0amQ2y/4RjLZShpURh8IQK7uNrY= 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=M8YY3JOF; 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="M8YY3JOF" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AR1hH0K029192; Wed, 27 Nov 2024 04:28:37 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=7oWLQ8di2FfB9SYs3 BOnVABV0K1McxWbsA/JneXFo6Q=; b=M8YY3JOFGLldlmbT+NHZrI/Jnc+2LKKIZ PQUT1mj9+pXhg7MuAWXknIhHlbe1M44NZ02DBw0BcOCdb5lJqfto698sjJIF2Xv1 Ki3SE1MDnxaahux+QpTHP9Rd6RWVDtEYnQ4qYGm5KdCc8MIpC2MUIHrHLLMIq9Qh 08wKkQNHazmEJ9E/9F8awJImEolPE5vP5KwyBArUHzWDxdM52Q1UHYvTJySF1w3D 3T/nDUBgws3qQzOXT4ETCzqoGAAEgUZtvvclSPo0Psu6bROlqoy+Ooqij+3BK4po DGAdsXhiYyI1HcXlCi/JHS+kM5Xf1OOBApLvHYOGXyeVf0NwmrP3w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43386nhsy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:37 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4AR4Sb02023338; Wed, 27 Nov 2024 04:28:37 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 43386nhsxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:37 +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 4AR3lhpV005727; Wed, 27 Nov 2024 04:28:36 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 433ukj5pxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:36 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4AR4SXTt34210338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Nov 2024 04:28:33 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E51BF2004B; Wed, 27 Nov 2024 04:28:32 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F35720040; Wed, 27 Nov 2024 04:28:31 +0000 (GMT) Received: from li-5d80d4cc-2782-11b2-a85c-bed59fe4c9e5.ibm.com.com (unknown [9.39.20.219]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 27 Nov 2024 04:28:31 +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, nirjhar@linux.ibm.com Subject: [PATCH v5 1/3] common/rc,xfs/207: Add a common helper function to check xflag bits Date: Wed, 27 Nov 2024 09:57:59 +0530 Message-ID: <92c333d56d48065707de7d0a29fed9ab8fd6c654.1732681064.git.nirjhar@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MMwR9psuRI-2HcmCbMkt7igTKxGAdNCd X-Proofpoint-ORIG-GUID: plVQ4Sn3PNWkNAJgPPIRpmF-ahrNik_l 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 priorityscore=1501 mlxscore=0 mlxlogscore=759 suspectscore=0 impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411270035 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 an upcoming patch for checking extsize (e) flag. Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Ojaswin Mujoo Signed-off-by: Nirjhar Roy --- common/rc | 7 +++++++ tests/xfs/207 | 15 ++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/rc b/common/rc index 2ee46e51..f94bee5e 100644 --- a/common/rc +++ b/common/rc @@ -41,6 +41,13 @@ _md5_checksum() md5sum $1 | cut -d ' ' -f1 } +# Check whether a fsxattr xflags name ($2) field is set on a given file ($1). +# e.g, fsxattr.xflags = 0x80000800 [extsize, has-xattr] +_test_fsxattr_xflag() +{ + grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1") +} + # Write a byte into a range of a file _pwrite_byte() { local pattern="$1" diff --git a/tests/xfs/207 b/tests/xfs/207 index bbe21307..394e7e55 100755 --- a/tests/xfs/207 +++ b/tests/xfs/207 @@ -21,15 +21,6 @@ _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 +56,16 @@ 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_fsxattr_xflag "$testdir/file3" "cowextsize" && 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_fsxattr_xflag "$testdir/file3" "cowextsize" && echo "C flag set" || \ + echo "C flag unset" $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch status=0 From patchwork Wed Nov 27 04:28:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirjhar Roy X-Patchwork-Id: 13886537 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 A576B1946B; Wed, 27 Nov 2024 04:28:51 +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=1732681733; cv=none; b=ir12pYgSN5qC5cTmpJ3X+2a/j92OntJd2Tkn/5XSWYXo6FZzg/ZByzt0Pn2owTIN8fSW+DkXlJLfX5JA9mNCEq6odro8Y2tBPW3zVlUc6vzKfDBMYN+7kF4AoWquXQpc2HSUvEWj6fXfdmdzBdJ4iuW9koK4eHq7I5dJBlGX6JE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732681733; c=relaxed/simple; bh=zIZUtccjQaXuP1DNrGBbAlK0knIHTFq1Wi6GDqRu/iA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WYSsZ1CLJ2Sg2n9/Nbasf+aW2g4EKNDvVVtdHKmbrNy5oamye7aJJ9GjIkMy2Un/L6JBepTFhJrHYsVxxk8XusETppmwSVp9L07xRdBXTXBjgjEClrMHzRBHa5UhF9MmYyqtMaTeh5Azu/Q7mNqiZtdiLp0m3msC1GNa9ymCRt4= 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=YtccUxTo; 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="YtccUxTo" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AR1hA8C010828; Wed, 27 Nov 2024 04:28:48 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=lyn5ZLAQU9i3GjR0R e6XvqZfaGJ+de974m+KxoDH57o=; b=YtccUxTogS9LsXvbDBuXgM/VvAvR4UTIi DkxducslMDQ7RwX10CJaKIvx2P+a0ZpigavvvhcEP5Nldq2jfdok6WsPQQdQmxrR 2megdgmyBOO2Hy2G3QrK06az/lLhbESA0uHsvz1IavYirwbYgYn4O0dj1b/opmve vrRzKCg+U30gnvZUEbYg3DlyC55iC+vsR+tzRz9FpgXYDl+kfIzuw0lXueLSbhwI oOzGsY0n1qaV7+3mnMbrcLGCv0c+sdjm0qmwXSiSdEk0Z4H/K+3BIqaichfyFkfR x0ytmDjUzWBONy5LHbZctpbA3lTEdXxb31b0qhjVqOJIqXGLfG2Uw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43386k1bmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:48 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4AR4SlRw032157; Wed, 27 Nov 2024 04:28:47 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 43386k1bmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:47 +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 4AR15eYB026351; Wed, 27 Nov 2024 04:28:47 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 433v30wm95-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:46 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4AR4Shl113959626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Nov 2024 04:28:43 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DB982004B; Wed, 27 Nov 2024 04:28:43 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D68B820043; Wed, 27 Nov 2024 04:28:41 +0000 (GMT) Received: from li-5d80d4cc-2782-11b2-a85c-bed59fe4c9e5.ibm.com.com (unknown [9.39.20.219]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 27 Nov 2024 04:28:41 +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, nirjhar@linux.ibm.com Subject: [PATCH v5 2/3] common/rc: Add a new _require_scratch_extsize helper function Date: Wed, 27 Nov 2024 09:58:00 +0530 Message-ID: X-Mailer: git-send-email 2.43.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZNX7PZgBj2G9z9LCTOj9rUofZryeQ8fd X-Proofpoint-GUID: bTPwXHm5bKdFVjFwCO4KAPX7Ow2uonHr 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 bulkscore=0 malwarescore=0 mlxlogscore=867 spamscore=0 suspectscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411270035 _require_scratch_extsize helper function will be used in the the next patch to make the test run only on filesystems with extsize support. Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Reviewed-by: Ojaswin Mujoo Signed-off-by: Nirjhar Roy Reviewed-by: Ritesh Harjani (IBM) --- common/rc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/common/rc b/common/rc index f94bee5e..e6c6047d 100644 --- a/common/rc +++ b/common/rc @@ -48,6 +48,23 @@ _test_fsxattr_xflag() grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1") } +# This test requires extsize support on the filesystem +_require_scratch_extsize() +{ + _require_scratch + _require_xfs_io_command "extsize" + _scratch_mkfs > /dev/null + _scratch_mount + local filename=$SCRATCH_MNT/$RANDOM + local blksz=$(_get_block_size $SCRATCH_MNT) + local extsz=$(( blksz*2 )) + local res=$($XFS_IO_PROG -c "open -f $filename" -c "extsize $extsz" \ + -c "extsize") + _scratch_unmount + grep -q "\[$extsz\] $filename" <(echo $res) || \ + _notrun "this test requires extsize support on the filesystem" +} + # Write a byte into a range of a file _pwrite_byte() { local pattern="$1" From patchwork Wed Nov 27 04:28:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirjhar Roy X-Patchwork-Id: 13886538 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 A3EEE1946B; Wed, 27 Nov 2024 04:29:00 +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=1732681742; cv=none; b=spebLV6on+tjb52SlvATD5s8IsjjNz0gW7w/dlPScIqva3Drh/KKKY7TM7GU1lUBcItYKFbqV8R+qONEjLANIIjE6ytnFBjpy+sIlHDSSoylivcPfBv6nXdmyy1KbptBfdHbnBh0TNZBDM9dH8WXz9dqmOKxOAnJn75bPl4AVro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732681742; c=relaxed/simple; bh=zH+PYlOdq8bcYGzyNN/Ln9Z/WnvXcvgkzChe5svZpJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WG+kQZuwuafkmCjBETJspn7ibIJmnZV9QO+Ktb1Wf5att4Buiw2wUQGu8xfuiAyNnj5E9GsblYLVSzO4DHiIZoWvbKnPaV9j6hbChHTBOiHUPRFwKS7uBiSINeOxDh/pCQ3FeCMGAISzFatlR91+BFXPS/YYvSFbh1idTBOW9GY= 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=ZNcCDN40; 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="ZNcCDN40" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AR1h9Gl010586; Wed, 27 Nov 2024 04:28:57 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=pZfhMKryS4H4Yta8H gHbHaz6s0sC8cEmtXxw/av1EbU=; b=ZNcCDN4024CdoDvFawgSjn6prQNtlo16h MOvddyAs5q2fRp3tMw95QY7+zrBl95zW59U0sFJR4Kk22pq8iAwwXLaPvXqagGW2 OyqZsSCY03MRzD2VUNaF2D7fovE/fk7Xb9KonEJNY7XMl1CO73cP4cHweR749XOe 7OWww8RMkSlDg4UiUtDVcEhGm9rVGw6shUIiUmvCGuHQjatRcMfcOYZHeCkqIqZe jhXyfMEHdPiba/5Jp/g4s6VV+9p9MAp9G7k0Vf2hGq+tnDHJ0B8G+Y8CaQ3ZF5Tk zkAP5rm+BTjMEBavB2LCVLsavYpAo6KRAa7XvY6KT+cVImdnVZgJA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43386k1bnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:57 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4AR4NXDC022322; Wed, 27 Nov 2024 04:28:56 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43386k1bnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:56 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4AR33cEn024887; Wed, 27 Nov 2024 04:28:56 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 433tvkj2wm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Nov 2024 04:28:56 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4AR4Sq0M65405398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Nov 2024 04:28:52 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 525D22004B; Wed, 27 Nov 2024 04:28:52 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4C1120043; Wed, 27 Nov 2024 04:28:50 +0000 (GMT) Received: from li-5d80d4cc-2782-11b2-a85c-bed59fe4c9e5.ibm.com.com (unknown [9.39.20.219]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 27 Nov 2024 04:28:50 +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, nirjhar@linux.ibm.com Subject: [PATCH v5 3/3] generic: Addition of new tests for extsize hints Date: Wed, 27 Nov 2024 09:58:01 +0530 Message-ID: X-Mailer: git-send-email 2.43.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ieqHzQBQTjRopkF8enM2EBdGyeO0IR4W X-Proofpoint-GUID: JG0MoEt_-WIAxVubX7Q4PGJbnXc0PimG 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 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411270035 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/ Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Reviewed-by Ritesh Harjani (IBM) Reviewed-by: Ojaswin Mujoo Suggested-by: Ojaswin Mujoo Signed-off-by: Nirjhar Roy --- tests/generic/367 | 174 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/367.out | 26 +++++++ 2 files changed, 200 insertions(+) create mode 100755 tests/generic/367 create mode 100644 tests/generic/367.out diff --git a/tests/generic/367 b/tests/generic/367 new file mode 100755 index 00000000..7cf90695 --- /dev/null +++ b/tests/generic/367 @@ -0,0 +1,174 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Nirjhar Roy (nirjhar@linux.ibm.com). All Rights Reserved. +# +# FS QA Test 367 +# +# 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 + +_begin_fstest ioctl quick + +_fixed_by_kernel_commit 2a492ff66673 \ + "xfs: Check for delayed allocations before setting extsize" + +_require_scratch_extsize + +FILE_DATA_SIZE=1M + +get_default_extsize() +{ + if [ -z $1 ] || [ ! -d $1 ]; then + echo "Missing mount point argument for get_default_extsize" + exit 1 + fi + $XFS_IO_PROG -c "extsize" "$1" | sed 's/^\[\([0-9]\+\)\].*/\1/' +} + +filter_extsz() +{ + sed "s/\[$1\]/\[EXTSIZE\]/g" +} + +setup() +{ + _scratch_mkfs >> "$seqres.full" 2>&1 + _scratch_mount >> "$seqres.full" 2>&1 + BLKSZ=`_get_block_size $SCRATCH_MNT` + DEFAULT_EXTSIZE=`get_default_extsize $SCRATCH_MNT` + EXTSIZE=$(( BLKSZ*2 )) + # Make sure the new extsize is not the same as the default + # extsize so that we can observe it changing + [[ "$DEFAULT_EXTSIZE" -eq "$EXTSIZE" ]] && EXTSIZE=$(( BLKSZ*4 )) +} + +read_file_extsize() +{ + $XFS_IO_PROG -c "extsize" $1 | _filter_scratch | filter_extsz $2 +} + +check_extsz_and_xflag() +{ + local filename=$1 + local extsize=$2 + read_file_extsize $filename $extsize + _test_fsxattr_xflag $filename "extsize" && echo "e flag set" || \ + echo "e flag unset" +} + +check_extsz_xflag_across_remount() +{ + local filename=$1 + local extsize=$2 + _scratch_cycle_mount + check_extsz_and_xflag $filename $extsize +} + +# 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 "0" +} + +check_extsz_xflag_before_and_after_reset() +{ + local filename=$1 + local extsize=$2 + check_extsz_xflag_across_remount $filename $extsize + 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 $EXTSIZE + 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 + + echo "test for default extsize setting if any" + read_file_extsize $filename $DEFAULT_EXTSIZE + 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 + + echo "test for default extsize setting if any" + read_file_extsize $filename $DEFAULT_EXTSIZE + 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 $EXTSIZE + 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 $EXTSIZE + echo +} + +setup +echo -e "EXTSIZE = $EXTSIZE DEFAULT_EXTSIZE = $DEFAULT_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/367.out b/tests/generic/367.out new file mode 100644 index 00000000..f94e8545 --- /dev/null +++ b/tests/generic/367.out @@ -0,0 +1,26 @@ +QA output created by 367 +TEST: Set extsize on empty file +[EXTSIZE] SCRATCH_MNT/new-file-00 +e flag set +Re-setting extsize hint to 0 +[EXTSIZE] 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 +test for default extsize setting if any +[EXTSIZE] SCRATCH_MNT/new-file-01 + +TEST: Set extsize on non-empty file with allocated extents +xfs_io: FS_IOC_FSSETXATTR SCRATCH_MNT/new-file-02: Invalid argument +test for default extsize setting if any +[EXTSIZE] SCRATCH_MNT/new-file-02 + +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 +