Skip to contentSkip to conversation

xfs/020: use -f option for xfs_repair a fs image

PATCH Superseded Zorro Lang 3 participants 5 messages Aug 12, 2015 – Aug 14, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 xfs/020: use -f option for xfs_repair a fs image

This case creates a 60t image file on TEST_DIR. Generally this's no problem. But if the image sector size is smaller than the TEST_DEV sector size, for example we create the image on hard 4k TEST_DEV, the test will fail.

So use -f for xfs_repair will helpful.

---
 tests/xfs/020 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/020 +1 -1
index dc305c1..120492d 100755
@@ -55,7 +55,7 @@ fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
-$XFS_REPAIR_PROG -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
+$XFS_REPAIR_PROG -f -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
 
 status=$?
 exit
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Zorro Lang

This case creates a 60t image file on TEST_DIR. Generally this's no problem. But if the image sector size is smaller than the TEST_DEV sector size, for example we create the image on hard 4k TEST_DEV, the test will fail.

So use -f for xfs_repair will helpful.

---
 tests/xfs/020 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/020 +0 -0
index dc305c1..120492d 100755

tests/xfs/020 fsfile=$TEST_DIR/fsfile.$seq · line 58

Quoted 5 lines
tests/xfs/020 +1 -1
@@ -55,7 +55,7 @@ fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
-$XFS_REPAIR_PROG -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
+$XFS_REPAIR_PROG -f -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1

Agreed, but we should audit all tests for this problem, I think.

FWIW, the latest upstream will do this automatically...

So for this change, it's fine:

but will you see if other tests should be fixed as well?

-Eric

#2 lore raw

----- 原始邮件 -----

Quoted 32 lines

发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected] 抄送: [email protected]
发送时间: 星期四, 2015年 8 月 13日 上午 1:37:48
主题: Re: [PATCH] xfs/020: use -f option for xfs_repair a fs image

Quoted 17 lines · Zorro Lang

This case creates a 60t image file on TEST_DIR. Generally this's no problem. But if the image sector size is smaller than the TEST_DEV sector size, for example we create the image on hard 4k TEST_DEV, the test will fail.

So use -f for xfs_repair will helpful.

---
 tests/xfs/020 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/020 +0 -0
index dc305c1..120492d 100755

tests/xfs/020 fsfile=$TEST_DIR/fsfile.$seq · line 58

Quoted 5 lines
tests/xfs/020 +1 -1
@@ -55,7 +55,7 @@ fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
-$XFS_REPAIR_PROG -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
+$XFS_REPAIR_PROG -f -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1

Agreed, but we should audit all tests for this problem, I think.

Quoted 5 lines

FWIW, the latest upstream will do this automatically...

So for this change, it's fine:

Thanks for review.

Quoted 2 lines

but will you see if other tests should be fixed as well?

I saw you fixed one in commit ddd55d5.

Sure, I will help to find all cases should be fixed.

Maybe add -f automatically for xfs_repair will be better, if it try to repair an image file?

Or maybe add a function likes mkfs_image_file(), try to find the sector size of the device contain the image file at first?

Thanks,
Zorro

Quoted 4 lines

-Eric

#3 lore raw
In reply to Eric Sandeen

----- 原始邮件 -----

Quoted 32 lines

发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected] 抄送: [email protected]
发送时间: 星期四, 2015年 8 月 13日 上午 1:37:48
主题: Re: [PATCH] xfs/020: use -f option for xfs_repair a fs image

Quoted 17 lines · Zorro Lang

This case creates a 60t image file on TEST_DIR. Generally this's no problem. But if the image sector size is smaller than the TEST_DEV sector size, for example we create the image on hard 4k TEST_DEV, the test will fail.

So use -f for xfs_repair will helpful.

---
 tests/xfs/020 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/020 +0 -0
index dc305c1..120492d 100755

tests/xfs/020 fsfile=$TEST_DIR/fsfile.$seq · line 58

Quoted 5 lines
tests/xfs/020 +1 -1
@@ -55,7 +55,7 @@ fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
-$XFS_REPAIR_PROG -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
+$XFS_REPAIR_PROG -f -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1

Agreed, but we should audit all tests for this problem, I think.

Quoted 7 lines

FWIW, the latest upstream will do this automatically...

So for this change, it's fine:

but will you see if other tests should be fixed as well?

Hi Eric,

I have checked all xfstests cases about xfs_repair, only xfs/020 and xfs/032 try to repair a file image.

This patch is about xfs/020.

But for xfs/032, I think there is no big problem in it. Because always copy device to a file, if the device's sector size is 4k, the file image will follow it. Except the TEST_DEV sector size not equal to SCRATCH_DEV sector size. But yes, add -f will be safe.

Do you need I re-send a patch to add -f in xfs/020 and xfs/032 both?

Or you have another idea to fix this problem, likes add a new function?

Thanks,
Zorro Lang

Quoted 4 lines

-Eric

#4 lore raw
Quoted 48 lines · Zirong Lang

----- 原始邮件 -----

Quoted 32 lines

发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected] 抄送: [email protected]
发送时间: 星期四, 2015年 8 月 13日 上午 1:37:48
主题: Re: [PATCH] xfs/020: use -f option for xfs_repair a fs image

Quoted 17 lines · Zorro Lang

This case creates a 60t image file on TEST_DIR. Generally this's no problem. But if the image sector size is smaller than the TEST_DEV sector size, for example we create the image on hard 4k TEST_DEV, the test will fail.

So use -f for xfs_repair will helpful.

---
 tests/xfs/020 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/020 +0 -0
index dc305c1..120492d 100755

tests/xfs/020 fsfile=$TEST_DIR/fsfile.$seq · line 58

Quoted 5 lines
tests/xfs/020 +1 -1
@@ -55,7 +55,7 @@ fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
-$XFS_REPAIR_PROG -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1
+$XFS_REPAIR_PROG -f -o ag_stride=32 -t 1 $fsfile >/dev/null 2>&1

Agreed, but we should audit all tests for this problem, I think.

Quoted 7 lines

FWIW, the latest upstream will do this automatically...

So for this change, it's fine:

but will you see if other tests should be fixed as well?

Hi Eric,

I have checked all xfstests cases about xfs_repair, only xfs/020 and xfs/032 try to repair a file image.

Quoted 8 lines

This patch is about xfs/020.

But for xfs/032, I think there is no big problem in it. Because always copy device to a file, if the device's sector size is 4k, the file image will follow it. Except the TEST_DEV sector size not equal to SCRATCH_DEV sector size. But yes, add -f will be safe.

Do you need I re-send a patch to add -f in xfs/020 and xfs/032 both?

I think the current version of this patch is OK, as xfs/020 is the only affected case.

Thanks,
Eryu