From 63cccfa582eb9104fb880d7f01d652db93f7d172 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 1 Apr 2020 09:35:56 -0700 Subject: [PATCH] scoutfs-tests: check setattr_more offline extent We had a bug where we were creating extent lengths that were rounded up to the size of the packed extent items instead of being limited by i_size. As it happens the last setattr_more test would have found it if I'd actually done the math to check that the extent length was correct. We add an explicit offline blocks count test because that's what lead us to notice that the offline extent length was wrong. Signed-off-by: Zach Brown --- tests/golden/setattr_more | 4 +++- tests/tests/setattr_more.sh | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/golden/setattr_more b/tests/golden/setattr_more index 0f57a44b..dd80461f 100644 --- a/tests/golden/setattr_more +++ b/tests/golden/setattr_more @@ -25,5 +25,7 @@ scoutfs: setattr failed: Invalid argument (22) Filesystem type is: 554f4353 File size of /mnt/test/test/setattr_more/file is 40988672 (10007 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: - 0: 0.. 10239: 0.. 10239: 10240: unknown,eof + 0: 0.. 10006: 0.. 10006: 10007: unknown,eof /mnt/test/test/setattr_more/file: 1 extent found +== correct offline extent length +976563 diff --git a/tests/tests/setattr_more.sh b/tests/tests/setattr_more.sh index 94257663..0aecd9be 100644 --- a/tests/tests/setattr_more.sh +++ b/tests/tests/setattr_more.sh @@ -61,4 +61,11 @@ scoutfs setattr -d 1 -o -s $((10007 * 4096)) -f "$FILE" 2>&1 | t_filter_fs filefrag -v -b4096 "$FILE" 2>&1 | t_filter_fs rm "$FILE" +# had a bug where we were creating extents that were too long +echo "== correct offline extent length" +touch "$FILE" +scoutfs setattr -d 1 -o -s 4000000000 -f "$FILE" 2>&1 | t_filter_fs +scoutfs stat -s offline_blocks "$FILE" +rm "$FILE" + t_pass