From patchwork Thu Dec 7 09:03:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482971 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="DZ3T+Uz7" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDCA819A; Thu, 7 Dec 2023 01:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939816; x=1733475816; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=vH5ll84B3/EfTeO+vugCYebs+7bGkX44oA4L317bX/A=; b=DZ3T+Uz7AvrswvH4vSpIrc0aqQVih5exmTiefTXx+5gv9qL/94yy89hI pesBSZGn/7twaw8A/R/toh2tuKrAAm/LmGt00VIq/qjqONhJIGYJo+5q2 hFuFrwu2Smqr8hmY7ZNaWDoMi36x8ehPj7RCqshZIbscYMb3dvmTmzV7Q aIaTmgjJkuSNHQE9SHVUcLUkxNJqbjUrcJGbErEoBkAp3Tb1unR+Zd/Wn ug5GfAmurtrI8TGkuxp1nnjb5CJMv8nGUWP0hHCLt4yh3sB+JR9w082Kq 9OpOTQrGSvRpIQF3R1zte+rW7sIji9opmNPftLUozdxMtVF4YZO1tV8xC Q==; X-CSE-ConnectionGUID: RvBSzxVNS9OUfRF66t7BCg== X-CSE-MsgGUID: EY2mzXmJRxiAP36T15T1aQ== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272767" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:35 +0800 IronPort-SDR: 6dw4cDUNbaJl3fx4MrkeOdZyg4EIz0IcufI6c/R9AySknN1b8scolw+Knq0r/wzyN4SbnSKGCz CIC6D/9t18cw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:35 -0800 IronPort-SDR: 8hgs9KZbW9q179/gmQ3R3ryc0jJjXW9Sqk83HCJEtOAp551oVF3fuvG5f2tp/aFOgfXGxkWTCg zonLRWXzaFRQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:33 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:28 -0800 Subject: [PATCH v5 1/9] fstests: doc: add new raid-stripe-tree group Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-1-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=705; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=vH5ll84B3/EfTeO+vugCYebs+7bGkX44oA4L317bX/A=; b=Vgk0HKTRPpi7DQFc9M++IYMrdQsI4Mh96CkeGohE06KT7/XgbXVTByjcUH9tcacjDQe0cclkh S3O9XSdCqx6DKD0387hLbM1ZruXqKd6Nio0SA3d5mEs474Aj0mP9OiA X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Add a new test group for testing the raid-stripe-tree feature of btrfs with fstests. Signed-off-by: Johannes Thumshirn --- doc/group-names.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/group-names.txt b/doc/group-names.txt index c3dcca375537..9c1624868518 100644 --- a/doc/group-names.txt +++ b/doc/group-names.txt @@ -94,6 +94,7 @@ punch fallocate FALLOC_FL_PUNCH_HOLE qgroup btrfs qgroup feature quota filesystem usage quotas raid btrfs RAID +raid-stripe-tree btrfs raid-stripe-tree feature read_repair btrfs error correction on read failure realtime XFS realtime volumes recoveryloop crash recovery loops From patchwork Thu Dec 7 09:03:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482973 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="nw+vVDra" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186C91AD; Thu, 7 Dec 2023 01:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939817; x=1733475817; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0vFVxyKpqAp7DKayL6Ik1UXOmUX6REN6nOAs9orTBSo=; b=nw+vVDraCk/INGL01jr1RyGRSGnwamyW/IuULV/vUd6jix4yvGU626ke cxRxlAPES1ifnrk7SLLDIM1BASJXKtqaTrjakidu+NcdhvPatpSNtZg2a UJylBfn5/xniYV460jdsFpRN6Bz1mIQD6a2lnTAoDMm2dNEOjHLr7xUPx KZfCAfBtUDdBObe/578ObKm8eEqh2PQbXHR6WMY1Gngc9rR9plBbd321R 5tHChmoI22Qo1f3p1XbaNhBN2FXzQX0TlYrUfKE/jNGhdDhgP6hLvP3UJ GKk//I8xuW97vA0B0kgHMIBLctmVvD6PCfJQzqQ3xTPVF/RkfxlzSGiTY g==; X-CSE-ConnectionGUID: CwlxlzevSSuzO6mA9HwhvA== X-CSE-MsgGUID: SpXvHt3GSQGtygJGLAKMxw== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272768" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:35 +0800 IronPort-SDR: 4B/iUxFFCKP2v5AJVBVGU1Wtsc2M/+k5x8nN+SytVgODMyd6NVQiO6a3ynxn0qSn5ytIGNI4LT ifQVtz30/C1g== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:35 -0800 IronPort-SDR: KU1m3L/PXGy47AsenK6ylmVSlMmg/KTiBJz9Xsr+CV1kX7uX+SCWEVUn/rFV8FY4OT9dmrLkdI EIzydUBrh2FQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:34 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:29 -0800 Subject: [PATCH v5 2/9] common: add filter for btrfs raid-stripe dump Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-2-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=1491; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=0vFVxyKpqAp7DKayL6Ik1UXOmUX6REN6nOAs9orTBSo=; b=LPpQjcxYTD+IH+jwsx46OyY1hy3CXKQxkjcMpcPAeVnFYFylY49ZG+LadQWx8LucEL5qg+Xnm yk/EGl/48ZOAs0nIh3+em4Bal/WRZ9tX8cw+zQ0kfEeMqPucYJ5qhb+ X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Signed-off-by: Johannes Thumshirn --- common/filter.btrfs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/filter.btrfs b/common/filter.btrfs index 02c6b92dfa94..2003ba7b7015 100644 --- a/common/filter.btrfs +++ b/common/filter.btrfs @@ -125,5 +125,19 @@ _filter_btrfs_cloner_error() sed -e "s/\(clone failed:\) Operation not supported/\1 Invalid argument/g" } +# filter output of "btrfs inspect-internal dump-tree -t raid-stripe" +_filter_stripe_tree() +{ + sed -E -e "s/leaf [0-9]+ items [0-9]+ free space [0-9]+ generation [0-9]+ owner RAID_STRIPE_TREE/leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE/" \ + -e "s/leaf [0-9]+ flags 0x1\(WRITTEN\) backref revision 1/leaf XXXXXXXXX flags 0x1\(WRITTEN\) backref revision 1/" \ + -e "s/checksum stored [0-9a-f]+/checksum stored /" \ + -e "s/checksum calced [0-9a-f]+/checksum calced /" \ + -e "s/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}//" \ + -e "s/item ([0-9]+) key \([0-9]+ RAID_STRIPE ([0-9]+)\) itemoff [0-9]+ itemsize ([0-9]+)/item \1 key \(XXXXXX RAID_STRIPE \2\) itemoff XXXXX itemsize \3/" \ + -e "s/stripe ([0-9]+) devid ([0-9]+) physical [0-9]+/stripe \1 devid \2 physical XXXXXXXXX/" \ + -e "s/total bytes [0-9]+/total bytes XXXXXXXX/" \ + -e "s/bytes used [0-9]+/bytes used XXXXXX/" +} + # make sure this script returns success /bin/true From patchwork Thu Dec 7 09:03:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482972 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="iIahbUY2" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE17D4A; Thu, 7 Dec 2023 01:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939817; x=1733475817; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=/PZsmw0zyU4nAM+H32DiGBfJFTVkJfKctQwr8KH9gZg=; b=iIahbUY2mntVk42lC26+mN/ZuaRoWIMd+7jf8J3zk1r6QpeAhNAgbc1Z HUWO77wium6Y1651DwFqDTt9gHyDHi2xAiEccEiTfk0ahsaVP9pEg0Fng Wf65SwpoRYGdjagj4F3my0ku3IrPGF/rYdYHI2u6Q2fOK8PiChoSRX3ZR CKqmOWIouj6G+H6btPDeqB+BRWdpSIKjDRwaYGRFOFr5FabrVMnpk9ywL 0VQ21X3hRJhiJE+sfwJpWT1UUWqz1P3Lagm+VgzM34oCP5GVsi/kOodU1 vt5f3v5DqNUXDSc4Pjt5FTtNHwvmfMQWYUwI7AvOheQHFHo5RgryozFd9 g==; X-CSE-ConnectionGUID: grqKFKCeSLa7bzwcx5flnw== X-CSE-MsgGUID: lnXgttUgTAWDNkeoKrShgg== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272774" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:36 +0800 IronPort-SDR: M48Bj6RYuJGiB2u6nY85HIWKdYJr24n9M9uScIfzmd7lDkJUFpMjqSejnqOKx2Idu9dr72RmRi urRJvLe9Vvmg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:37 -0800 IronPort-SDR: 6fbVWwHwVvg1pha5B+4C+3i2oFWu752Fo4UA5YA9FxaDrVQGPuREFvV4OaGtf81a1WD5FvGvNV rgmdzF+Enl0w== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:36 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:30 -0800 Subject: [PATCH v5 3/9] common: add _require_btrfs_no_nodatacow helper Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-3-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=590; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=/PZsmw0zyU4nAM+H32DiGBfJFTVkJfKctQwr8KH9gZg=; b=IC4vn/SyDQCfGeXuGFXF2ktQRHye67skzSgU06AzECN/1pLvE/JC7tVfPXQWJRMe9/NbiFvrc OZBRFDwr3ofDYenieZ2DU3xV/nOasDGIm80EWjHUqXX1V5M44s72Ro8 X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Signed-off-by: Johannes Thumshirn --- common/btrfs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/btrfs b/common/btrfs index e3ccb4fa07d4..bf69bcee158b 100644 --- a/common/btrfs +++ b/common/btrfs @@ -120,6 +120,13 @@ _require_btrfs_no_compress() fi } +_require_btrfs_no_nodatacow() +{ + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatacow"; then + _notrun "This test requires no nodatacow enabled" + fi +} + _require_btrfs_no_block_group_tree() { _scratch_mkfs > /dev/null 2>&1 From patchwork Thu Dec 7 09:03:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482974 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="TstjjkRl" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4470D53; Thu, 7 Dec 2023 01:03:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939818; x=1733475818; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=rATPhERYyunlfOBEUNyI4hcJ3o86Yremm7GSLR2lMKw=; b=TstjjkRlINUNCjlgCZk4I1e6IPL3x1mWPip4mbwFn4IN3q8ja5D+q1Uz MCdu1WcYfLwNDXTl1FzlxHW5rZ3LydoHoWc9fytM7ztnK41wrN8DRPwr/ T0aSrbfnZGqh+4i/6Dy/9dRcqvsjLHOWmMnYQA/ul8z5OrsZ8wyIWi3vY o+ZVO/A/V89N7HG9WUL/BMQAA+Y8P2miNF4evOCo7Yl2Xigv6mxeyOccM Kn/VAsFH9DqGYO7Pbg+tjhflBSCp07+AYSISPzs/0I6yaYuvKPkIuuliW 9aT7T3XBUpxjhpMvG5TFwq9XqHQs+kdhszpu9y7OM1biXNx1aiMYDyv4V A==; X-CSE-ConnectionGUID: WjgvveiJQESgxZvWdn7BLw== X-CSE-MsgGUID: rUfJRpmrT8aHsYswrXqJ6g== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272776" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:38 +0800 IronPort-SDR: ud0VF/Dbyb5UbTHff9sXXYvBv8D2SZvMgA8UiFCnW6PKgJc1G2QQz7SoyWg3uJpblX2YGUs/AU 5SOsOotL/omA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:38 -0800 IronPort-SDR: 8+L/iOPXot5y5boZ4r8tXZ+3F3S5ZVD6uG2mOMzcEwKbVth7z24noYkMDMKctvyF28WHPp2IPk jr2reDtRWeEQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:37 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:31 -0800 Subject: [PATCH v5 4/9] common: add _require_btrfs_free_space_tree Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-4-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=637; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=rATPhERYyunlfOBEUNyI4hcJ3o86Yremm7GSLR2lMKw=; b=dVvopVIn6PQJ6Flr4uSo3IMKUrAGqhKM2f+pFNHtoJvaQwkU7Zl4OY6yb6g5Tx2Yz4c9Lwsn4 I8tay/3w8X4C6oUW1Zr3qCtDaY+XNCYL3Oj5QBLwWxc5L3qV8iNkZ+F X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Signed-off-by: Johannes Thumshirn --- common/btrfs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/btrfs b/common/btrfs index bf69bcee158b..95e46726a801 100644 --- a/common/btrfs +++ b/common/btrfs @@ -137,6 +137,16 @@ _require_btrfs_no_block_group_tree() fi } +_require_btrfs_free_space_tree() +{ + _scratch_mkfs > /dev/null 2>&1 + if ! $BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | \ + grep -q "FREE_SPACE_TREE" + then + _notrun "This test requires a free-space-tree" + fi +} + _check_btrfs_filesystem() { device=$1 From patchwork Thu Dec 7 09:03:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482975 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="DV+WgIpx" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F20C10B; Thu, 7 Dec 2023 01:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939820; x=1733475820; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=JKyzbkyBQxpoPUlEiTlUYHc8QByvt8/ka9+9zx7dhk8=; b=DV+WgIpxypHZVvda4HZ8loPXpMT6UxcmCg4Bj4D/5xiuEcJBvRgt9IDE 9hDILADOG5n2DgghpiWNAr1E8eW3f2DdaUrSkVYVid7ofQMsYl5aUS/oP gZlWP+8rvNlUTxpO7kXgGicfknrbQYzq6XYwLAxFEuQQaXtHiJaBAQ83x RjAAM04Jyu2J3NivjQJMIQQz1Rhalq4OjASpe965cBtUFYG9BCHEinujV IaGBAjJe2ILLoBhNrBXgsIGVf64qgBprOcQDoAJM4EUfzmG8KdYv/Eryj FoOpQuxXkOmmH9IYCdRG7nGNS7nE90PSLlOEdSveiygcHJbUIUI9Arjeg g==; X-CSE-ConnectionGUID: X+wBNUERT0SqGaKXN1t+/w== X-CSE-MsgGUID: 9vC2SDvCSZeZ1D+S/p6W3w== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272778" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:39 +0800 IronPort-SDR: 7xEZM6/N0kqG/K4sB53/lp/15tS/AX10gYWmcenUx+SYTXqHIv1hASuUz3juT06ROkt944CgBO qWkS+WGIxKLg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:40 -0800 IronPort-SDR: bb80HUguoGYh2yP125t0CGVSLdlvdf3JzhoekTiRLAEt7YpFuy/QSA943fOooEla7b5pmASzFk t0qSTWzXYbhw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:39 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:32 -0800 Subject: [PATCH v5 5/9] btrfs: add fstest for stripe-tree metadata with 4k write Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-5-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=4208; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=JKyzbkyBQxpoPUlEiTlUYHc8QByvt8/ka9+9zx7dhk8=; b=MhnwMgLUHbbsdnchLEEBC+o8Z7pKPhmMmeFR8Y97scDB9rnSEfn0UThZDzK2nNgw+X9wBccrI EmA64Ylrb8WBdGtFRTjyzFGLrRUkSvqc4md7WFys0aeLOYGiUbRZfB6 X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Test a simple 4k write on all RAID profiles currently supported with the raid-stripe-tree. Signed-off-by: Johannes Thumshirn --- tests/btrfs/304 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/304.out | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/tests/btrfs/304 b/tests/btrfs/304 new file mode 100755 index 000000000000..7774a1bd74d0 --- /dev/null +++ b/tests/btrfs/304 @@ -0,0 +1,56 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Western Digital Cooperation. All Rights Reserved. +# +# FS QA Test 304 +# +# Test on-disk layout of RAID Stripe Tree Metadata writing 4k to a new file on +# a pristine file system. +# +. ./common/preamble +_begin_fstest auto quick raid remount volume raid-stripe-tree + +. ./common/filter +. ./common/filter.btrfs + +_supported_fs btrfs +_require_btrfs_command inspect-internal dump-tree +_require_btrfs_mkfs_feature "raid-stripe-tree" +_require_scratch_dev_pool 4 +_require_btrfs_fs_feature "raid_stripe_tree" +_require_btrfs_fs_feature "free_space_tree" +_require_btrfs_free_space_tree +_require_btrfs_no_compress + +test_4k_write() +{ + local profile=$1 + local ndevs=$2 + + _scratch_dev_pool_get $ndevs + + echo "==== Testing $profile ====" + _scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree + _scratch_mount + + $XFS_IO_PROG -fc "pwrite 0 4k" "$SCRATCH_MNT/foo" | _filter_xfs_io + + _scratch_cycle_mount + md5sum "$SCRATCH_MNT/foo" | _filter_scratch + + _scratch_unmount + + $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\ + _filter_btrfs_version | _filter_stripe_tree + + _scratch_dev_pool_put +} + +echo "= Test basic 4k write =" +test_4k_write raid0 2 +test_4k_write raid1 2 +test_4k_write raid10 4 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/304.out b/tests/btrfs/304.out new file mode 100644 index 000000000000..48036efbf0cf --- /dev/null +++ b/tests/btrfs/304.out @@ -0,0 +1,58 @@ +QA output created by 304 += Test basic 4k write = +==== Testing raid0 ==== +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +5fed275e7617a806f94c173746a2a723 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid1 ==== +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +5fed275e7617a806f94c173746a2a723 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid10 ==== +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +5fed275e7617a806f94c173746a2a723 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid From patchwork Thu Dec 7 09:03:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482976 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NE9AY+Xs" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E60137; Thu, 7 Dec 2023 01:03:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939821; x=1733475821; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=t8dCyWWC7xAZUQhzWr4IjVYXy3dHXATj5/yYhqVe9mA=; b=NE9AY+Xs+W89v54+399L64nf9KM5dsaNI2Zu4Z/ZIP3GG5Lq1DvFDGv2 b6eAACAJ77gvPTQ/Li3VH0cOil3agekFkCg3WIqWNeON0C1Ljc+KJ/2fd tmOMuKUxEOHgSR82qQIv++m6DouELJ/v0gMimFdTFcjtKbfyJJSZw67OM 4iyCy9a1SGcSjh2/kuMkQ6zUCcTtLwENhZ+MMjsBweRBCDpcjYkXkbnZS R0DZ9J0f5SJrKrRLLWj9knACpgFEn/FDDGE+0iOJLkBijAbEfEYr6vhNa xzt2YsfqQDa7HHNIyia8PXIJvZSktzptrKfVQksB52Af9fRovZ3P3d3+C g==; X-CSE-ConnectionGUID: lv0PElHKQJKFcI0pXFrZHg== X-CSE-MsgGUID: JTCf0ALvT2OVktNFOKf9dw== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272781" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:41 +0800 IronPort-SDR: tKnmhdZ/kgimG3ETGV94k+fapamnJM5itkyAEMqAyzWajA88FQb6uTFWf0LnShqJMNnUCVWp2j niL7KvoWVJHA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:41 -0800 IronPort-SDR: idUsRYYqEyfPx+QJpW2xBkYfhwxctvyD09jkLxxqwCntwiT5D6qivk9Pjg1e1uKkGFDlhsz3cx 3kTFM20uJ3IQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:40 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:33 -0800 Subject: [PATCH v5 6/9] btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-6-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=5710; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=t8dCyWWC7xAZUQhzWr4IjVYXy3dHXATj5/yYhqVe9mA=; b=BhUr8u/ISEzj3RQfDrUSLHOT1At1WA7m+HobFrYBoeBE/LlfnIkbvg3JyNDHLsN1lqeXSiCd1 Qq3nSxf7lfCCFPgcw2huVicvdMQfIFPO8OYxxORcLXIh62P6I459B/o X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Add a test-case writing 8k to a raid-stripe-tree formatted filesystem with one stripe pre-filled to 60k so the 8k are split into a 4k write finishing stripe 1 and a 4k write starting the next stripe. Signed-off-by: Johannes Thumshirn --- tests/btrfs/305 | 61 +++++++++++++++++++++++++++++++++++++++ tests/btrfs/305.out | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/tests/btrfs/305 b/tests/btrfs/305 new file mode 100755 index 000000000000..df8a12ab9a6a --- /dev/null +++ b/tests/btrfs/305 @@ -0,0 +1,61 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Western Digital Cooperation. All Rights Reserved. +# +# FS QA Test 305 +# +# Test on-disk layout of RAID Stripe Tree Metadata by writing 8k to a new file +# with a filesystem prepropulated, so that 4k of the write are written to the +# 1st stripe and 4k start a new stripe. +# +. ./common/preamble +_begin_fstest auto quick raid remount volume raid-stripe-tree + +. ./common/filter +. ./common/filter.btrfs + +_supported_fs btrfs +_require_btrfs_command inspect-internal dump-tree +_require_btrfs_mkfs_feature "raid-stripe-tree" +_require_scratch_dev_pool 4 +_require_btrfs_fs_feature "raid_stripe_tree" +_require_btrfs_fs_feature "free_space_tree" +_require_btrfs_free_space_tree +_require_btrfs_no_compress + +test_8k_new_stripe() +{ + local profile=$1 + local ndevs=$2 + + _scratch_dev_pool_get $ndevs + + echo "==== Testing $profile ====" + _scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree + _scratch_mount + + # Fill the first stripe up to 64k - 4k + $XFS_IO_PROG -fc "pwrite 0 60k" -c fsync "$SCRATCH_MNT/bar" | _filter_xfs_io + + # The actual 8k write + $XFS_IO_PROG -fc "pwrite 0 8k" "$SCRATCH_MNT/foo" | _filter_xfs_io + + _scratch_cycle_mount + md5sum "$SCRATCH_MNT/foo" | _filter_scratch + + _scratch_unmount + + $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\ + _filter_btrfs_version | _filter_stripe_tree + + _scratch_dev_pool_put +} + +echo "= Test 8k write to a new file so that 4k start a new stripe =" +test_8k_new_stripe raid0 2 +test_8k_new_stripe raid1 2 +test_8k_new_stripe raid10 4 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/305.out b/tests/btrfs/305.out new file mode 100644 index 000000000000..7460501ef40b --- /dev/null +++ b/tests/btrfs/305.out @@ -0,0 +1,82 @@ +QA output created by 305 += Test 8k write to a new file so that 4k start a new stripe = +==== Testing raid0 ==== +wrote 61440/61440 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +9d3940adb41dd525e008a847e01b15f4 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 61440) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 2 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid1 ==== +wrote 61440/61440 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +9d3940adb41dd525e008a847e01b15f4 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 61440) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid10 ==== +wrote 61440/61440 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +9d3940adb41dd525e008a847e01b15f4 SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 61440) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 2 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 3 physical XXXXXXXXX + stripe 1 devid 4 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid From patchwork Thu Dec 7 09:03:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482977 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NOBQWuar" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C648C19A; Thu, 7 Dec 2023 01:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939824; x=1733475824; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=x9xYVBRvVqgHm711gNxw3MzaP0voh7Soz6RTYx+3UsQ=; b=NOBQWuarE7y5bHcywA+hThuQNTOrRPoQZkU9zDoFaZaZjFM1VJg0BMQ8 56ODZOr0VME5BZyhC6/SjGSOCfxisnWvx/vzcybKya6ZsS8yus90sqCDr 7dY/PgLnAg31X3bfL3cMcN10w8s+U57E1w6uz4P+z0szwTZkWwCs7gtIB w2E+q2h6l1H4mqyuT0QtbiBUw7ReriiWEAJG9C5rbrYILAHVO4ECrJWhB /2Ze3Xf8rh3twoiXIlBG9NeA/TIlbifStbYJntsH7BDuBjHrhckK/cP49 7w4+pehPfucNZKO8rdVZWNeQdMlbtg2QD0/In3bVd/LMHDQxt/AL6nX4X w==; X-CSE-ConnectionGUID: utjFoGNaTvmNV1/8iBqCWQ== X-CSE-MsgGUID: jFEzbG+nSy6Y82UFv6r28g== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272785" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:44 +0800 IronPort-SDR: VIoPLfs3sAvfvZpon9TyEQW04a0PsPleg5tqp2KFSCcX4gw4TpfHIDJ3Su4j/Xc601lpO5JK7q /QSLokiGVsjQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:44 -0800 IronPort-SDR: SVowiawgBDz1DG2TFrujb31n8HVLLZElzEE5klcq0CC/62x/FIhgP1wvVvYoEWQbBwD39jJVKt Yn3Y9m+UT02Q== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:42 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:34 -0800 Subject: [PATCH v5 7/9] btrfs: add fstest for writing to a file at an offset with RST Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-7-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=5312; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=x9xYVBRvVqgHm711gNxw3MzaP0voh7Soz6RTYx+3UsQ=; b=jQp5nhq/qYLym2+HW1bsoQNZ41RAuJxS0YyK8xwll4k3K2KVLHAQ0VS/Gdc+E6yrQIq1Nt8qM ybqNMCNcVPeDUvhhv/RswmcYqt1KOP+qoyPw7Hjup8Q3UqZ1gslkPoE X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Add a fstest writing 4k at offset 64k to a file with one RAID tripe already pre-filled for a raid-stripe-tree formatted file system. Signed-off-by: Johannes Thumshirn --- tests/btrfs/306 | 59 +++++++++++++++++++++++++++++++++++++++++ tests/btrfs/306.out | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) diff --git a/tests/btrfs/306 b/tests/btrfs/306 new file mode 100755 index 000000000000..72c066aa6940 --- /dev/null +++ b/tests/btrfs/306 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Western Digital Cooperation. All Rights Reserved. +# +# FS QA Test 306 +# +# Test on-disk layout of RAID Stripe Tree Metadata by writing 4k to an emppty +# file at offset 64k with one stripe pre-filled on an otherwise pristine +# filesystem. +# +. ./common/preamble +_begin_fstest auto quick raid remount volume raid-stripe-tree + +. ./common/filter +. ./common/filter.btrfs + +_supported_fs btrfs +_require_btrfs_command inspect-internal dump-tree +_require_btrfs_mkfs_feature "raid-stripe-tree" +_require_scratch_dev_pool 4 +_require_btrfs_fs_feature "raid_stripe_tree" +_require_btrfs_fs_feature "free_space_tree" +_require_btrfs_free_space_tree +_require_btrfs_no_compress + +test_4k_write_64koff() +{ + local profile=$1 + local ndevs=$2 + + _scratch_dev_pool_get $ndevs + + echo "==== Testing $profile ====" + _scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree + _scratch_mount + + # precondition one stripe + $XFS_IO_PROG -fc "pwrite 0 64k" "$SCRATCH_MNT/bar" | _filter_xfs_io + + $XFS_IO_PROG -fc "pwrite 64k 4k" "$SCRATCH_MNT/foo" | _filter_xfs_io + + _scratch_cycle_mount + md5sum "$SCRATCH_MNT/foo" | _filter_scratch + + _scratch_unmount + + $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\ + _filter_btrfs_version | _filter_stripe_tree + + _scratch_dev_pool_put +} +echo "= Test 4k write to an empty file at offset 64k with one stripe prefilled =" +test_4k_write_64koff raid0 2 +test_4k_write_64koff raid1 2 +test_4k_write_64koff raid10 4 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/306.out b/tests/btrfs/306.out new file mode 100644 index 000000000000..8031cddb79f7 --- /dev/null +++ b/tests/btrfs/306.out @@ -0,0 +1,75 @@ +QA output created by 306 += Test 4k write to an empty file at offset 64k with one stripe prefilled = +==== Testing raid0 ==== +wrote 65536/65536 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 4096/4096 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +381b0e7d72cb4f75286fe2b445e8d92a SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid1 ==== +wrote 65536/65536 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 4096/4096 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +381b0e7d72cb4f75286fe2b445e8d92a SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid10 ==== +wrote 65536/65536 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 4096/4096 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +381b0e7d72cb4f75286fe2b445e8d92a SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 3 physical XXXXXXXXX + stripe 1 devid 4 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid From patchwork Thu Dec 7 09:03:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482978 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="HnAu0sYe" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E61E137; Thu, 7 Dec 2023 01:03:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939825; x=1733475825; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=PFil+s0O/RJFujkKBtonNDbt5dvr/G7hThp7JSzg1Bs=; b=HnAu0sYetEFGdemffSlGq3NiSdTPoldmsvPQTadUvmGrX4lFGch2jl0l f6oD1TXosqqPG6yShxYtrEL2BgdgVGKgXbkwhtQD7zATRSbrq0cobRB0q zNZNDwYgpydQM5j9bh1Mz9U3fHmdnwVewEeFXB1R/zia/NzqZrGMzmoSD oPS5q5Lv/qUS3Xd2CLeXsqnJAN1/qJIg4WQFAIi3IDWuJlWTtrsRIop7m t69/rqjLV6UFGVb0eJtDx/tD/uPoRMitwLOn5ljolrCZXri8e2whfJCn9 UuNAfILOJq3rOsD+tUCIczibV50S1ZzxyG//qxS0BcpFuZlXnQ/WA8jNi g==; X-CSE-ConnectionGUID: so11sJ8aRBylT0WZUXjbAw== X-CSE-MsgGUID: 9AFvZF+zS2mGm4VjCsRm4g== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272787" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:44 +0800 IronPort-SDR: XLagAM1C/c+uLJKF9TUxdEsWYS7DK1+LA8hzYzdLqtcTSoX10IWZ+YAPAdu7WOU2qLgP/yesC0 4MmKa3Ye8xow== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:45 -0800 IronPort-SDR: 78Ae1sEji0aFHfKPTa5WeD+FakRsMj7XSZulrtmZDGsqldXYX+vNqP7HDbLkJb79JEJyRIqni0 Az0PirsUscVQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:44 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:35 -0800 Subject: [PATCH v5 8/9] btrfs: add fstests to write 128k to a RST filesystem Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-8-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=4553; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=PFil+s0O/RJFujkKBtonNDbt5dvr/G7hThp7JSzg1Bs=; b=VBRv6NuVJigdehnUh6ckHjNTUUEZdaA4vSLxnasaDZ3pHyt3HjXBvwaA99xcRQMfDjcZxie04 SN7l13Ja0tnCLczaEV2zsepTjjPf0ymFjYEQCVNceG84QlC5YnYurTH X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Add a test writing 128k to a file on an empty filesystem formatted with a raid-stripe-tree. Signed-off-by: Johannes Thumshirn --- tests/btrfs/307 | 56 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/307.out | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/tests/btrfs/307 b/tests/btrfs/307 new file mode 100755 index 000000000000..9509019b50cc --- /dev/null +++ b/tests/btrfs/307 @@ -0,0 +1,56 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Western Digital Cooperation. All Rights Reserved. +# +# FS QA Test 307 +# +# Test on-disk layout of RAID Stripe Tree Metadata by writing 128k to a new +# file on a pristine filesystem +# +. ./common/preamble +_begin_fstest auto quick raid remount volume raid-stripe-tree + +. ./common/filter +. ./common/filter.btrfs + +_supported_fs btrfs +_require_btrfs_command inspect-internal dump-tree +_require_btrfs_mkfs_feature "raid-stripe-tree" +_require_scratch_dev_pool 4 +_require_btrfs_fs_feature "raid_stripe_tree" +_require_btrfs_fs_feature "free_space_tree" +_require_btrfs_free_space_tree +_require_btrfs_no_compress + +test_128k_write() +{ + local profile=$1 + local ndevs=$2 + + _scratch_dev_pool_get $ndevs + + echo "==== Testing $profile ====" + _scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree + _scratch_mount + + $XFS_IO_PROG -fc "pwrite 0 128k" "$SCRATCH_MNT/foo" | _filter_xfs_io + + _scratch_cycle_mount + md5sum "$SCRATCH_MNT/foo" | _filter_scratch + + _scratch_unmount + + $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\ + _filter_btrfs_version | _filter_stripe_tree + + _scratch_dev_pool_put +} + +echo "= Test 128k write to empty file =" +test_128k_write raid0 2 +test_128k_write raid1 2 +test_128k_write raid10 4 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/307.out b/tests/btrfs/307.out new file mode 100644 index 000000000000..b39f3162bff6 --- /dev/null +++ b/tests/btrfs/307.out @@ -0,0 +1,65 @@ +QA output created by 307 += Test 128k write to empty file = +==== Testing raid0 ==== +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid1 ==== +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 131072) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid10 ==== +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 3 physical XXXXXXXXX + stripe 1 devid 4 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid From patchwork Thu Dec 7 09:03:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13482979 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NZnTOIqt" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB23D4A; Thu, 7 Dec 2023 01:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1701939827; x=1733475827; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=XB+uBvH02Qk5vOSklnybT2yfKhnChBAe5ceI2GSy2co=; b=NZnTOIqt8UqwJjx1WYREI7ihdrVILMFAxUqOpBIg71kTz5q0hDTwEY4H bTBjjy2FuxpdCrPi3cwHdXcBYK/OyezldGQhuhvsihh3U+6ycQIE/h+9U QtTu8UPrI782f6JkCcwUPKc4EsiYBjuKINt0zahj751kLrN15DhO+qAsT WYhIF5Jnpy26F35nX/Y8aCzoAuFf7VWb+uRAVO+vTXzQ62pRf1GGvZOje ldz7clgv8FhgnUu+GjFxnmxLn8XOgQWqQ24XNyqUEj9GmwD4ilxMpnPcX 7xbPME7vAqXu+J7WrWJ5ayfHbEZRx8BEvfwDjrA34aPqWzLqiNsJNdFha Q==; X-CSE-ConnectionGUID: UM5GzL3RR46PtSEPx8k2xA== X-CSE-MsgGUID: n8RFBWfzS4yeXOC6OpnTOw== X-IronPort-AV: E=Sophos;i="6.04,256,1695657600"; d="scan'208";a="4272789" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Dec 2023 17:03:46 +0800 IronPort-SDR: x/WQ/Z5QAAJWWiPN9pyLMrDOAU5v/3kUBjED1hIazNJG07Z1eHU3WZE8Dc833Y2EVl81+aHJdX F7zK0Yej0SNw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 00:14:46 -0800 IronPort-SDR: GQ+iCWRBRI0pf4peOqKGnAg2ysUNbQxMlsVQNVcWd40LiUE4gE+kMCTSHsh+xHnyWvY7LGyXa6 N3iHg94f2rcA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 07 Dec 2023 01:03:45 -0800 From: Johannes Thumshirn Date: Thu, 07 Dec 2023 01:03:36 -0800 Subject: [PATCH v5 9/9] btrfs: add fstest for overwriting a file partially with RST Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231207-btrfs-raid-v5-9-44aa1affe856@wdc.com> References: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> In-Reply-To: <20231207-btrfs-raid-v5-0-44aa1affe856@wdc.com> To: Anand Jain , Zorro Lang Cc: Filipe Manana , fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701939810; l=6825; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=XB+uBvH02Qk5vOSklnybT2yfKhnChBAe5ceI2GSy2co=; b=ZPcNRaT0mnvVXJ6rXXkdwDWIp0kFFjgvFs5XDCNFU6lZgjjiCprSB1As7Q2yhMfCi05wEmSwO MUOF0D7PDBfC5IoR3NtPfCg0lvaHotv8gggdJquEb5YmHuYvfOPGOvd X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Add a test writing 128k to an empty file with one stripe already pre-filled on-disk. Then overwrite a portion of the file in the middle. Signed-off-by: Johannes Thumshirn --- tests/btrfs/308 | 60 +++++++++++++++++++++++++++++ tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) diff --git a/tests/btrfs/308 b/tests/btrfs/308 new file mode 100755 index 000000000000..eb63acf6a9f2 --- /dev/null +++ b/tests/btrfs/308 @@ -0,0 +1,60 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Western Digital Cooperation. All Rights Reserved. +# +# FS QA Test 308 +# +# Test on-disk layout of RAID Stripe Tree Metadata by writing 128k to an empty +# file on a filesystem that has one stripe already pre-filled. Afterwards +# overwrite a portion of the file. +# +. ./common/preamble +_begin_fstest auto quick raid remount volume raid-stripe-tree + +. ./common/filter +. ./common/filter.btrfs + +_supported_fs btrfs +_require_btrfs_command inspect-internal dump-tree +_require_btrfs_mkfs_feature "raid-stripe-tree" +_require_scratch_dev_pool 4 +_require_btrfs_fs_feature "raid_stripe_tree" +_require_btrfs_fs_feature "free_space_tree" +_require_btrfs_free_space_tree +_require_btrfs_no_compress +_require_btrfs_no_nodatacow + +test_128k_write_overwrite() +{ + local profile=$1 + local ndevs=$2 + + _scratch_dev_pool_get $ndevs + + echo "==== Testing $profile ====" + _scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree + _scratch_mount + + $XFS_IO_PROG -fc "pwrite -W 0 32k" "$SCRATCH_MNT/bar" | _filter_xfs_io + $XFS_IO_PROG -fc "pwrite -W 0 128k" "$SCRATCH_MNT/foo" | _filter_xfs_io + $XFS_IO_PROG -fc "pwrite -W 64k 8k" "$SCRATCH_MNT/foo" | _filter_xfs_io + + _scratch_cycle_mount + md5sum "$SCRATCH_MNT/foo" | _filter_scratch + + _scratch_unmount + + $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\ + _filter_btrfs_version | _filter_stripe_tree + + _scratch_dev_pool_put +} + +echo "= Test 128k write to empty file with 1st stripe partially prefilled then overwrite =" +test_128k_write_overwrite raid0 2 +test_128k_write_overwrite raid1 2 +test_128k_write_overwrite raid10 4 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/308.out b/tests/btrfs/308.out new file mode 100644 index 000000000000..c93a3a43b248 --- /dev/null +++ b/tests/btrfs/308.out @@ -0,0 +1,106 @@ +QA output created by 308 += Test 128k write to empty file with 1st stripe partially prefilled then overwrite = +==== Testing raid0 ==== +wrote 32768/32768 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 2 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 2 physical XXXXXXXXX + item 3 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX + item 4 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 24 + encoding: RAID0 + stripe 0 devid 1 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid1 ==== +wrote 32768/32768 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 131072) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 2 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 40 + encoding: RAID1 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid +==== Testing raid10 ==== +wrote 32768/32768 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 8192/8192 bytes at offset 65536 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +d48858312a922db7eb86377f638dbc9f SCRATCH_MNT/foo + +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1 +checksum stored +checksum calced +fs uuid +chunk uuid + item 0 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 1 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 2 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 3 physical XXXXXXXXX + stripe 1 devid 4 physical XXXXXXXXX + item 3 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX + item 4 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 40 + encoding: RAID10 + stripe 0 devid 1 physical XXXXXXXXX + stripe 1 devid 2 physical XXXXXXXXX +total bytes XXXXXXXX +bytes used XXXXXX +uuid