From patchwork Wed Dec 13 11:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490758 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="ZTqs4Qyf" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4A71710; Wed, 13 Dec 2023 03:35:26 -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=1702467326; x=1734003326; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=dTwUgOv/JrakUFKeSHVnjuhZOXq56pcOwJzXwvjhAwM=; b=ZTqs4QyfrmU+1amQLri7qLXG4PvAFJCbhKCdZej2pRHtqWiEkgha04zR ki+gp9m50ToNlmc7N0ALCDy02pCJ3XcwyePEdNwcB3Tu8tKANsHOeN7L9 /nFtPTL/BzBM8OrNeIWdUEiMPFO9PLFMwKJGin1l64pDfz2Lg4FW6D0s8 Kw3lAzwNNZPTuWlxJLTU8Nlr5+FawbxaV6h3FYyJX8IvcBbhyAx8egB0T vM7LTblTUrPCZUYFo5Wp41iNjOjOrnJ05TrP8Ao76JrHmNKS0m7WdBtnG Mm45b+sc5f/4Fa2XnTYDTkFGr0+7R5CUdG37OmUAaR65Hjc5P+cwdUrs5 w==; X-CSE-ConnectionGUID: FKr90zZvQsiAaLtKdzCrPA== X-CSE-MsgGUID: ElOa5TTvRO2w0jg6GF3Kgg== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718828" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:25 +0800 IronPort-SDR: +bLEK0OlSJwr4bfvb5kRjVM0rokMVguEpRhIggt6hp8aBh1ugk/hXKfOlUHdTM6PrFkr3tV84z uU219zdEulKw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:37 -0800 IronPort-SDR: DH8lDxRUOhIusB3JYbYaBNgQL/Mi91yxPspjFi+O5hyYTtuCio8a0XSeLDyLmI1ydY0AjvEf5E YPQTYVZpjXlA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:26 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:22 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-1-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=753; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=dTwUgOv/JrakUFKeSHVnjuhZOXq56pcOwJzXwvjhAwM=; b=kKqSKZzrrJt1QRcxEku85ge+qTprewomoo2Jrc+GvllS01PDjxD+1zOgm8s9a6ab0gCl4dSMp g4euPeOfbuRCYzhqTxl8xgFMcPnh7B6bnLVzGLAalWDVHXgBRV8KNC2 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. Reviewed-by: Filipe Manana 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 fec6bf71abcb..2ac95ac83a79 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 Wed Dec 13 11:35:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490759 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NvB+VEaq" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766401715; Wed, 13 Dec 2023 03:35:27 -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=1702467327; x=1734003327; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=5iZA9SkIO5wyZ+2Fn6Ju/riFtUFCqKW90ZWUZWCI4E0=; b=NvB+VEaq25R2AKxAW8gItp8zgmPbBLH53ITEOuLVqJoMKkALObMCqGKC G4mweHczsuvvHo06zjk3IAQpAlEskTIY5sTJVjHcBMK2+FrpT95Yi/aFC PpDqr3ZJGm3tmGBWdlAeTIgSzyWB5IaVZBaO9u/0ECDDmTgDkJm+leefo Wz2GvXeCoDP3nsY14fPMtwIsLQE7FFvfyAVd/1YHUXnTAaS6O1t168Ecg Wzopgj3CUJJ/j1qwJqirgfO5LEfk5ry0PR8IxwY4IvklPBRHTYDk+1Pd1 XWv57z7Ss/twbQzMVn355mgYbWMOfGbbQyzifRG3KYgpELjwNz8Fc74k2 g==; X-CSE-ConnectionGUID: JMPt+RazR5iSJv6TZiT95A== X-CSE-MsgGUID: RnhMLba/REuIjmfGpTx7vQ== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718830" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:26 +0800 IronPort-SDR: ylthAfIruGxnKzuEhSijATll9urUif876uX/IIcipGvyk65OJkeOQIhimD7hdv9qTAB4ywwckt SqtWIzR+nWfg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:38 -0800 IronPort-SDR: wsrp3X1qO4iiKJH4UP7TS6N6Fc8YVsGXEf9iW2Fmp8dNnM0xeOWturM5UBqyMRCSFrFQDgxpgm CZkAoWRpivFQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:27 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:23 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-2-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=1539; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=5iZA9SkIO5wyZ+2Fn6Ju/riFtUFCqKW90ZWUZWCI4E0=; b=kPERd2MkTh471A0ti/duDAVL98vy1Bpteo9ATJlw3qYeR4/MMs+ycW0MdM+af3mOSabDQDwRj KRq8v3AyqsqDAG/HiymnZOmv3U/5wQZzK99lLAhkyQtQFAsyFuxkW6o X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Reviewed-by: Filipe Manana 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 Wed Dec 13 11:35:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490760 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="YEB0Muz0" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E548310F; Wed, 13 Dec 2023 03:35: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=1702467340; x=1734003340; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=v5k4+1h53SpXphnL69HSsqydNWptq57JFBS9641GEd4=; b=YEB0Muz0tLa5aoZoDalqouFRBdxeSi2kIKmDmqEi++aNumc9FgXxVArS HBGNROKOCHJ7f5xlw0R7Mx2HAlVcSldYUlFmvE0KvTLMUBlMwbCooF1T0 IOQScbGikbJic42g5xi4gv/j8PId4XMKLizscK4Y/5p+OfDxgGU300mQ/ oRz82wVAI3aRCOo8H6HVWAfQTED08cRgvBn2ugr++uOMrAdlC4YuNSAFE u2fYlQAx5/smKsyJcYlTlrKi45dhklOTAxUw1Zo0gUiizzmO71MBKy4Kk /lkC8gCFs0IBltwcDazjhHRa9JJ9VHLeFCbMrkEus5Mi6n1pow5dCGjWU Q==; X-CSE-ConnectionGUID: 6dVjPDyJTx+TTvZ2hVxHdg== X-CSE-MsgGUID: 8kPpatZoSUK6Cpo0PMcuUw== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718831" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:27 +0800 IronPort-SDR: AfpuSi8y1ZfuHilru19ltnfB9AZaCb/d3Rt0PmscTHGK/BXHRXkfy9t3s7UdywNFrukCo6DVLe 5XyaAv6nV4Vw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:39 -0800 IronPort-SDR: 48ecPNzRiLoC6w/KrwvcY+KJsxN8y7SB+pRlZOYugheS04SMuynd1I3zWmhH6I63s+sdHLheYg aKFMhE02XJUA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:28 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:24 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-3-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=638; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=v5k4+1h53SpXphnL69HSsqydNWptq57JFBS9641GEd4=; b=EZYgI+sfJbYgxvuPmcX/VRcR+CrDDeJfhnoFKNNHUqnnrXQVSFwihtQUTK9khyAsGx/Sp1s9s 0N7T3B+wInSAELZk0NYq6mLoV9UgwPIL+q4uOeeVL+AbZtQdwLYeF6e X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- common/btrfs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/btrfs b/common/btrfs index 36f9b94b02c5..a80ff0264c6a 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 Wed Dec 13 11:35:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490761 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="c7LM+L93" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D80F114; Wed, 13 Dec 2023 03:35: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=1702467341; x=1734003341; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=SrNCAwEsJo1UM4mmIzdwJpUzppVy34ero4srnNdxS5Y=; b=c7LM+L93qjgEITJCEZ+rox/U6RV7vi9uiyjTC1drMnwvsFhJ+zXL4mtg U8aSuLWXv6E7ZvUCatFsOcc/N29PeTgHIPVjcTwqGp1SbGJBajDzGF7SJ bPOYrG/g+CLUuHEktgiTzdI+kC0pTlRSimEHk1cBFNHFjyUroatp3lZIO 6KVsOc6jGNWFlgatzAiX1hOeXjBJnAk9Kx/dWNOL/OAo3Tys+s+z4ElVs kfB8xb9zFA6GLW4B0G145PwJdANFnhFyW+8MJLga672nwBXUrob5KjSm1 teCo4W4lOUJvYQ6c/bykoYBRv3hBWVci0vaoiPD+3FIz4w1+hPt4H6xUm g==; X-CSE-ConnectionGUID: 0NceXpY0QNG12BhRQLjWXg== X-CSE-MsgGUID: YkBldq6SRP2NAAQurMrqhg== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718834" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:29 +0800 IronPort-SDR: RJZX/PoYAupVXjD0T0d1hRS9DrYLmLHg+9aaf5dA47GisEvh4q/i2QF4W3pVPZHJe8ZeL8FdH4 k1teywbwM+NQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:41 -0800 IronPort-SDR: kP4NVaZD0wLmYvQzXk2K8vPjWbgsuTbqe74xbTGRRdGxvY1bXyNt5EkfD0foRkbwjKFk+pcm/A G2rhIyUtkHQw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:29 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:25 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-4-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=685; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=SrNCAwEsJo1UM4mmIzdwJpUzppVy34ero4srnNdxS5Y=; b=4HwvpPGd5PwdoHVOLG+h5eoD4fagSJLhSwcLNyQIib16BPrhJ6prslV7UId30KqG9OSwGEoed tfyKk9rIJwxDKocc9WHrLVQDNMy/QYENrwgnIyiTmaPoRH9vkplcnV2 X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- common/btrfs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/btrfs b/common/btrfs index a80ff0264c6a..2196c3d58360 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 Wed Dec 13 11:35:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490762 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="gbFo6c57" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507E112F; Wed, 13 Dec 2023 03:35:42 -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=1702467342; x=1734003342; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=PVzeiQ/I5Y/CN+btHXiXPZLrxdaj722ZejTSdHska2M=; b=gbFo6c57q8UahAI8JGpDy6NgH8gFfAAberIUBvyX/HzsA8F+R/atxEPw qust6WmF/ZroW/HUcb4840bw9RFirjH2KbnAE0B5qKPPZTV3Shf6CFv++ v3VMPFRYEcC0dPVMGZ+un1I1b1M0fHa1dVa/F9r/i6AElXzN8ohaF9tFG Yt3w11KpLLZGGWDfSPBQdol4TpOmO2S/B9Sggu3g4ZtsI0cqNx6ZJll5F NbroFPFLr3gAoAybtf4JowB5ShayNn9gUTkQCi1/1gSXf1a63KTb2pl13 fAcIbFEGORh0vE+S6RVNHbmRs87N2HvOLrpcj7whADlgLDzmXbPN27YFS g==; X-CSE-ConnectionGUID: Cg/6MCBzQiaChl1QSjmU9w== X-CSE-MsgGUID: w8oOy3jfQqenbTEqKI57hg== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718835" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:30 +0800 IronPort-SDR: ZJKOTqXpOYst1HdcNqqUuFGjIHPc5k4raz0E4fyDw0oQx2BolzYFHar6gmh3gEDzvT2Qv9XwnT rWL+1IklcO2A== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:42 -0800 IronPort-SDR: ecB7GJubt6Hq4AEHiao7hbg1juAQ89hp6zD4J0Eh+BdP+Gy2qDjTwfNyVurxVNcr6GTKQDY1yv d3kMumHyq4kA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:30 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:26 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-5-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=4337; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=PVzeiQ/I5Y/CN+btHXiXPZLrxdaj722ZejTSdHska2M=; b=KMfEZ2aLb9C1SjJBVojgfvbe7Edi0Lutzw/kSQYZAjNP0gmahQJcAPD7bYjP4cAkY/dyOfryW NhY0DwhQDbvAiw0MZESZehxOonlpja0O+wM4m30hd4qrSYZkM3OFahX 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. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn Reviewed-by: Anand Jain --- tests/btrfs/304 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/304.out | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/tests/btrfs/304 b/tests/btrfs/304 new file mode 100755 index 000000000000..05a4ae32639d --- /dev/null +++ b/tests/btrfs/304 @@ -0,0 +1,58 @@ +#! /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 _get_page_size -eq 4096 || _notrun "this tests requires 4k pagesize" + +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 Wed Dec 13 11:35:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13490764 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="QCIFzHC0" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5363127; Wed, 13 Dec 2023 03:35: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=1702467344; x=1734003344; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=/y/Lnv/S84cGvjPrkd5EksLL3re+7yQ7JeTy3dK4doA=; b=QCIFzHC0f6NpyEnqfySxYXiFyPET3vl3LbDlH4nnUy/cfxllLF4oRwiQ D4Kwtx4Q0Ps5fDh8jkSEsRHgbwqCUOFW2ntRt5T7rhBW49FQ4D9CvNj/8 5ccN0wW+gGo1DdsIo8S01COzpDUOsX96qh+L21OJE1dvW8otftP0kW5YT aJt9yjEj39005xtIJ/TQ2vQEFYSlCy87WOMYG2Smx4vsXKC8jLqtr69sj 7skk3fg42xiCrNKRD+rHdEuHRTJlRE6fG/KXI12Nu+Bjeq84q7TxP42yu pO+sxqWvQ+c30hXsSSK2j1GTApVBa1i33Y/nvI1O4csRNJvMOXQMhrnvI w==; X-CSE-ConnectionGUID: TBNuhN52TSCMft1sOsDGkg== X-CSE-MsgGUID: v4XfzD7CRQ+SkZEEWlitBw== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718839" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:33 +0800 IronPort-SDR: LfWwlBgqiCVrNVNeicJOKh2a2vr1i21+uSHVCMXQiF/CWjeIZCc6b4akoEkT3ZLAUrx0SAwBOC odkkpLz935fA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:45 -0800 IronPort-SDR: eMtRVp3XhVBJKMuugkZ7m645I8Irgzq5cAcF5YKyawBktdyfSOKa6elZQcCPygquMX9ySujNmP 5ROrNIEtqHog== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:32 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:27 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-6-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=5838; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=/y/Lnv/S84cGvjPrkd5EksLL3re+7yQ7JeTy3dK4doA=; b=tfRbCSmdTeLa3zUSQUtzYSefrm03fsZAEgTC7xtEHTgamEIZRrjTgYibchAfYVnr3CCJZTDgd RBvZp3vzBaxA5fQBDPa00YSI8lin+1PF0AE+QfQw/GBBun33JrpmKu3 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. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- tests/btrfs/305 | 63 ++++++++++++++++++++++++++++++++++++++++ tests/btrfs/305.out | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) diff --git a/tests/btrfs/305 b/tests/btrfs/305 new file mode 100755 index 000000000000..b36cd5524374 --- /dev/null +++ b/tests/btrfs/305 @@ -0,0 +1,63 @@ +#! /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 _get_page_size -eq 4096 || _notrun "this tests requires 4k pagesize" + +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 Wed Dec 13 11:35: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: 13490763 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="DI/7im5h" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EC812B; Wed, 13 Dec 2023 03:35: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=1702467344; x=1734003344; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=v/ZFE5dui/VpK3mip31D422Shp0/m06qNUb94e9oJWI=; b=DI/7im5hEOLdOfyus9PJHPWGhc0qorzY2AvfRIpuA5bd5Awb0MD/eUCU sEkrWe8N2lclrZ6P5xcepat9mXoiPsQMnqWcJz4aWeDvpPExexxWSNyIW qQhR401aCF7gvGwDHzFrJvZ9yPL/rAi3bBLMM8czqeAQCU7gBPtHPl5o9 LLRSm9zdSLA2kmUy164odpmVQMw/3ciMMWXAsVsr5a1+v1siNyoJBAaUH 4V2mhsoJopxQe+dWl7Ivacw+XmbfZnGESxau8Ov6aXEs2r/zCEoh/gMZt RepQeYPBjoLNAYmUrDz8wG0x9P13ugDVAMoH2NpBfHROWDbzZYi7bbkXq Q==; X-CSE-ConnectionGUID: uTmsL0CZQ0qG+keRJHYk7g== X-CSE-MsgGUID: n9I6fufoS1yrrB72/SuIog== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718840" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:33 +0800 IronPort-SDR: +YtdtvjqHi1ghYTaWcxPSvcnsqBgthTzG2xkXvGgT8x0Q5DTqEDIxA0F6wJLZ+n2dgwzZu454V KKkOgg3RAvwA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:45 -0800 IronPort-SDR: h75W+29eekO1iF8YnG8D8H25sq1W/Q5CdU/QDKiGlrSrBd0llVf3m/bjlad0mAtMPCdE4puw44 3Hk3s/8dWUzw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:33 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:28 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-7-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=5441; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=v/ZFE5dui/VpK3mip31D422Shp0/m06qNUb94e9oJWI=; b=b2ncUv197SasLNuQfqj2P8RwJALsITdE6fnPxDYyTtSMz0MJlUvG5AVcvnOZhU60W5lOruttK 6MkISTHx0ppCwDo4DgoyuMKYUR8xGfQThHFO8zkWMjmDx1Ohv+756Pv 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. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- tests/btrfs/306 | 61 +++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/306.out | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/tests/btrfs/306 b/tests/btrfs/306 new file mode 100755 index 000000000000..2cadeac68268 --- /dev/null +++ b/tests/btrfs/306 @@ -0,0 +1,61 @@ +#! /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 _get_page_size -eq 4096 || _notrun "this tests requires 4k pagesize" + +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 Wed Dec 13 11:35: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: 13490765 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="BzQPjCqc" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A959B1AA; Wed, 13 Dec 2023 03:35: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=1702467345; x=1734003345; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=YEk1tznjwMidqmoAZvjahDS5fLgl+rGJ8y/1DVhkZXo=; b=BzQPjCqc6D/QwEXmXasHY+JJkgLlZYVLTZqjfwIR2EABuXtvDALA9fIE k0/0iCrx2afMDoYSnGAiQGxEnlNpRNbrwlYU+k7fj9IUMTPzSrNpi2BRR 1qpAxTCv7INFxPeYF8fVH1TT6LcgytKQg9DqMd4e8YdmEhSvpKT72bV54 y+jn3azmcFhMQ0DcKfkEyH7BnYu+7xDz0ngVQaiWYSR2s8Qn9b9O/8ENW m/90bS8Wkw+/ZX0ayC1lHvImYuy3ryJU18mqZ2nZvZJoZ5TKA3M2y38Gh xUWAC+r8FBRGFEsGVJ5YaIP5S0o5Qt6ZZj4AlRoQrNeg4q2618ll8QSyF w==; X-CSE-ConnectionGUID: jmEfLmCNTZ2UvUYkCLbp1Q== X-CSE-MsgGUID: IAA3bPMARnuAray3iPH44w== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718841" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:34 +0800 IronPort-SDR: lW7eSBHXBB0kE3pVCwZE7Pr2DPOQL4/yA3O5rzSVr3s0kJxxaMkJyLpVDS0WFGbz0gOVoBgUbs 7XCqz/ui0GdA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:46 -0800 IronPort-SDR: Htvt0tvB9Zhn1B+9eD0X2X8IUafsaBd/hUV+GGJl1btg2lq4RIwV4665PFJQlZbKJZZNTGRY20 UokdP91k0nfQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:34 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:29 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-8-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=4682; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=YEk1tznjwMidqmoAZvjahDS5fLgl+rGJ8y/1DVhkZXo=; b=v5rJCBJAPKtHfq63175R9fPclCN7bYWbbSoRndZIO8dejZaCyEh2dqKoboPAncjbHTC9JCssY eVKn+/yWYTODGdFhrjFo8ISmWGzPOWOcT/obG0kwEWpgoTuIXONezaj 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. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- tests/btrfs/307 | 58 +++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/307.out | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/tests/btrfs/307 b/tests/btrfs/307 new file mode 100755 index 000000000000..ff61ee1f79db --- /dev/null +++ b/tests/btrfs/307 @@ -0,0 +1,58 @@ +#! /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 _get_page_size -eq 4096 || _notrun "this tests requires 4k pagesize" + +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 Wed Dec 13 11:35: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: 13490766 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="fSnr4J4Q" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5041610F; Wed, 13 Dec 2023 03:35:46 -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=1702467346; x=1734003346; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=c7K6ye4ECrk/rqwJG0NQWH5K0hRc0hdL/n5pdDiHpm4=; b=fSnr4J4QP8x7vcEAc8EwmaiInKFALsKe6F2D9cFSb5RG54IASaIrsj1H /pOnB2hGE1tCqCqy91DT9EWlT5kH2pJBrMZUH6hwNgVd3I7f/SNO6/0a7 aCCAfWCLcYEp1npewDuHwBXZAXYj08LemzUennB32A4G1F7S5voozAG+2 xHwuCkitzJ1xPavvtIb3QhFgRdEkkUiF2n3gLniHZ4z5gEq37E7DPKJyN kuD38jWVscJ4RmoKIHkjIG7/COpFlkumIAUDNjlsciKJU92z8qWMsGnIx GeyCw5O2GBCDFSgu1Qdp7L1OttRGnf5W1lPG87GRKo0O6NVe8BR18fTaD Q==; X-CSE-ConnectionGUID: NP17EFZpTQiOn2O4+mlZkw== X-CSE-MsgGUID: 3oERq7KfRKemlpkhyZsZWQ== X-IronPort-AV: E=Sophos;i="6.04,272,1695657600"; d="scan'208";a="4718849" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Dec 2023 19:35:35 +0800 IronPort-SDR: b3KTwXrLmCMyb7qDUouoOxblHL/h5oyOUFhBxctN0ddANPrwP3pe4dLZFVkUxeU64wFAB492wu Bga8XH+T8+5A== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Dec 2023 02:40:47 -0800 IronPort-SDR: As73M59qLiEn53nmEZo9dSBU3AHWSwQSbne23nGJ/jyk0ZLvfp85QevgSi/4SDANM/3uZzlmen 1t8YRBSJHMrw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2023 03:35:36 -0800 From: Johannes Thumshirn Date: Wed, 13 Dec 2023 03:35:30 -0800 Subject: [PATCH v6 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: <20231213-btrfs-raid-v6-9-913738861069@wdc.com> References: <20231213-btrfs-raid-v6-0-913738861069@wdc.com> In-Reply-To: <20231213-btrfs-raid-v6-0-913738861069@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=1702467323; l=6953; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=c7K6ye4ECrk/rqwJG0NQWH5K0hRc0hdL/n5pdDiHpm4=; b=O3cFdJLqNsHKfVPoX5Bo6JH/xDstDFVDvBt5OuNvKGcS1fPLP9i1RBTcNwVVkg361sbWFzyTN +ikUVW4z+GQBUgdKjttQmHyjXYdOxBrH+bULwQ2pNbPc+dtBOzweyMy 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. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- tests/btrfs/308 | 62 ++++++++++++++++++++++++++++++ tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) diff --git a/tests/btrfs/308 b/tests/btrfs/308 new file mode 100755 index 000000000000..e5210fdfe2bd --- /dev/null +++ b/tests/btrfs/308 @@ -0,0 +1,62 @@ +#! /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 _get_page_size -eq 4096 || _notrun "this tests requires 4k pagesize" + +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