From d0cc40d23aa0b0ae2c12f87fbde45e7ce3c6b4e7 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Thu, 2 May 2024 18:37:55 +0930 Subject: [PATCH] btrfs-progs: tests: add test case for ram_bytes detection and repair The new test case would contain a file system image, with the following file: item 4 key (257 INODE_ITEM 0) itemoff 15883 itemsize 160 generation 7 transid 8 size 16384 nbytes 16384 block group 0 mode 100600 links 1 uid 0 gid 0 rdev 0 sequence 258 flags 0x0(none) atime 1714635006.328482575 (2024-05-02 17:00:06) ctime 1714635013.394980640 (2024-05-02 17:00:13) mtime 1714635013.394980640 (2024-05-02 17:00:13) otime 1714635006.328482575 (2024-05-02 17:00:06) item 5 key (257 INODE_REF 256) itemoff 15869 itemsize 14 index 2 namelen 4 name: file item 6 key (257 EXTENT_DATA 0) itemoff 15816 itemsize 53 generation 7 type 1 (regular) extent data disk byte 13631488 nr 1048576 extent data offset 0 nr 16384 ram 16384 extent compression 0 (none) Note the ram bytes, which should be 1048576. Furthermore, the inode size is truncated to 16K (originally 1M), so that offset + num_bytes would still be no larger than ram_bytes. So the only error is the mismatch between ram_bytes and disk_num_bytes for the non-compressed data extent. The image is hand crafted for now, as btrfs-corrupt-block doesn't not yet support corrupting the ram_bytes field. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- .../default.img.xz | Bin 0 -> 2076 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/fsck-tests/062-noncompressed-ram-bytes-mismatch/default.img.xz diff --git a/tests/fsck-tests/062-noncompressed-ram-bytes-mismatch/default.img.xz b/tests/fsck-tests/062-noncompressed-ram-bytes-mismatch/default.img.xz new file mode 100644 index 0000000000000000000000000000000000000000..94a587a83e64a9d1981d8b74e313b4ff7e497c68 GIT binary patch literal 2076 zcmV+%2;=wtH+ooF000E$*0e?hz}pXiARz%3000000001m;;ozD5B~?#T>wRyj;C3^ zv%$$4d1r37hBKh;&NC{9Vlybk2gs>;O=+*j*Fys=1WO!J9Q0^Gqiqs0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