xfs_copy: don't use DIRECT IO to copy 4k sector device
RFC PATCH 1/1 xfs_copy: don't use DIRECT IO to copy 4k sector device
When I run xfstests xfs/032 in ppc64le, I hit a failure:
xfs_copy: read failed: Invalid argument
xfs_copy: size check failed
xfs_copy: /dev/sda5 filesystem failed to initialize
xfs_copy: Aborting.
Copy failed for Sector size 4096 Block size 4096
I try to use gdb trace xfs_copy. I find it try to open the source device with DIRECT flag, then read the device with ((1<<BBSHIFT))=512 bytes length. If the source device is 4k sector, directly read 512 bytes will be failed.
xfs_copy '-b' option only work for target file/device, to sure it will open the target without DIRECT flag. But useless for source device open.
So I make DIRECT flag only be enabled when source device sector size equal BBSIZE.
---
Hi,
I'm not so familiar for xfsprogs, so I'm not sure this's the best idea to fix this problem. Please help to check, and maybe give me better suggestions.
Thanks very much,
Zorro Lang
copy/xfs_copy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
copy/xfs_copy.c +2 -1
@@ -666,7 +666,6 @@ main(int argc, char **argv)/* prepare the libxfs_init structure */ memset (&xargs,0 ,sizeof (xargs)); - xargs.isdirect =LIBXFS_DIRECT ; xargs.isreadonly =LIBXFS_ISREADONLY ;if (source_is_file) {
@@ -689,6 +688,8 @@ main(int argc, char **argv) 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); sb = &mbuf.m_sb;libxfs_sb_from_disk (sb,XFS_BUF_TO_SBP (sbp)); +if (sb->sb_sectsize ==BBSIZE ) + xargs.isdirect =LIBXFS_DIRECT ;/* Do it again, now with proper length and verifier */ libxfs_putbuf (sbp);
Signature · 6 lines
1.9.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 13 lines · Zorro Lang
When I run xfstests xfs/032 in ppc64le, I hit a failure:
xfs_copy: read failed: Invalid argument
xfs_copy: size check failed
xfs_copy:/dev/sda5filesystem failed to initialize
xfs_copy: Aborting.
Copy failed for Sector size 4096 Block size 4096I try to use gdb trace
xfs_copy. I find it try to open the source device with DIRECT flag, then read the device with ((1<<BBSHIFT))=512 bytes length. If the source device is 4k sector, directly read 512 bytes will be failed.
Quoted 6 lines
xfs_copy'-b' option only work for target file/device, to sure it will open the target without DIRECT flag. But useless for source device open.So I make DIRECT flag only be enabled when source device sector size equal BBSIZE.
Which version of xfsprogs did you test? This is recently upstream:
commit c63ce10a9450020382bbbe2c48788961b19830f4
Author: Eric Sandeen <[email protected]> Date: Fri Jul 31 09:03:11 2015 +1000
xfs_copy: fix copy of hard 4k devices
If we have a pure 4k device with no 512 emulation, xfs_copy fails straightaway because it tries to do a 512-byte direct IO read of the superblock.
Do like we do in xfs_db, and read in the max possible sector size, because we don't yet know what the filesystem's sector size is.
This fixes a failure in xfs/032 on a hard 4k device.
-Eric
Quoted 29 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
I'm not so familiar for xfsprogs, so I'm not sure this's the best idea to fix this problem. Please help to check, and maybe give me better suggestions.
Thanks very much,
Zorro Langcopy/xfs_copy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)copy/xfs_copy.c +0
-1@@ -666,7 +666,6 @@ main(int argc, char **argv)/* prepare the libxfs_init structure */ memset (&xargs,0 ,sizeof (xargs)); - xargs.isdirect =LIBXFS_DIRECT ; xargs.isreadonly =LIBXFS_ISREADONLY ;if (source_is_file) {
copy/xfs_copy.c main(int argc, char **argv) · line 695
Quoted 8 lines
copy/xfs_copy.c +2
-0@@ -689,6 +688,8 @@ main(int argc, char **argv) 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); sb = &mbuf.m_sb;libxfs_sb_from_disk (sb,XFS_BUF_TO_SBP (sbp)); +if (sb->sb_sectsize ==BBSIZE ) + xargs.isdirect =LIBXFS_DIRECT ;/* Do it again, now with proper length and verifier */ libxfs_putbuf (sbp);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
----- 原始邮件 -----
Quoted 19 lines
发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected]
发送时间: 星期五, 2015年 8 月 14日 上午 12:23:22
主题: Re: [PATCH][RFC]xfs_copy: don't use DIRECT IO to copy 4k sector deviceQuoted 13 lines · Zorro Lang
When I run xfstests xfs/032 in ppc64le, I hit a failure:
xfs_copy: read failed: Invalid argument
xfs_copy: size check failed
xfs_copy:/dev/sda5filesystem failed to initialize
xfs_copy: Aborting.
Copy failed for Sector size 4096 Block size 4096I try to use gdb trace
xfs_copy. I find it try to open the source device with DIRECT flag, then read the device with ((1<<BBSHIFT))=512 bytes length. If the source device is 4k sector, directly read 512 bytes will be failed.
Quoted 8 lines
Quoted 6 lines
xfs_copy'-b' option only work for target file/device, to sure it will open the target without DIRECT flag. But useless for source device open.So I make DIRECT flag only be enabled when source device sector size equal BBSIZE.
Which version of xfsprogs did you test? This is recently upstream:
Sorry I didn't notice that you have fix this problem. I test on the newest version from git://oss.sgi.com/xfs/cmds/xfsprogs, it haven't fix this problem. I test this patch on it at first. Then I find there is another version in git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git
I don't know they are too different, so I didn't check if this xfsprogs-dev has
fixed it, and just did this patch on it and send out.
Sorry for this mistake, and your patch is really better:)
Thanks,
Zorro Lang
Quoted 52 lines
commit
c63ce10a9450020382bbbe2c48788961b19830f4Author: Eric Sandeen <[email protected]> Date: Fri Jul 31 09:03:11 2015 +1000
xfs_copy: fix copy of hard 4k devicesIf we have a pure 4k device with no 512 emulation,
xfs_copyfails straightaway because it tries to do a 512-byte direct IO read of the superblock.Do like we do in
xfs_db, and read in the max possible sector size, because we don't yet know what the filesystem's sector size is.This fixes a failure in xfs/032 on a hard 4k device.
-Eric
Quoted 34 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
I'm not so familiar for xfsprogs, so I'm not sure this's the best idea to fix this problem. Please help to check, and maybe give me better suggestions.
Thanks very much,
Zorro Langcopy/xfs_copy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)copy/xfs_copy.c +2
-1@@ -666,7 +666,6 @@ main(int argc, char **argv)/* prepare the libxfs_init structure */ memset (&xargs,0 ,sizeof (xargs)); - xargs.isdirect =LIBXFS_DIRECT ; xargs.isreadonly =LIBXFS_ISREADONLY ;if (source_is_file) {@@ -689,6 +688,8 @@ main(int argc, char **argv) 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); sb = &mbuf.m_sb;libxfs_sb_from_disk (sb,XFS_BUF_TO_SBP (sbp)); +if (sb->sb_sectsize ==BBSIZE ) + xargs.isdirect =LIBXFS_DIRECT ;
Quoted 5 lines
copy/xfs_copy.c main(int argc, char **argv) · line 695
Quoted 3 lines
copy/xfs_copy.c +0
-0/* Do it again, now with proper length and verifier */ libxfs_putbuf (sbp);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 36 lines · Zirong Lang
----- 原始邮件 -----
Quoted 19 lines
发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected]
发送时间: 星期五, 2015年 8 月 14日 上午 12:23:22
主题: Re: [PATCH][RFC]xfs_copy: don't use DIRECT IO to copy 4k sector deviceQuoted 13 lines · Zorro Lang
When I run xfstests xfs/032 in ppc64le, I hit a failure:
xfs_copy: read failed: Invalid argument
xfs_copy: size check failed
xfs_copy:/dev/sda5filesystem failed to initialize
xfs_copy: Aborting.
Copy failed for Sector size 4096 Block size 4096I try to use gdb trace
xfs_copy. I find it try to open the source device with DIRECT flag, then read the device with ((1<<BBSHIFT))=512 bytes length. If the source device is 4k sector, directly read 512 bytes will be failed.Quoted 8 lines
Quoted 6 lines
xfs_copy'-b' option only work for target file/device, to sure it will open the target without DIRECT flag. But useless for source device open.So I make DIRECT flag only be enabled when source device sector size equal BBSIZE.
Which version of xfsprogs did you test? This is recently upstream:
Sorry I didn't notice that you have fix this problem. I test on the newest version from
git://oss.sgi.com/xfs/cmds/xfsprogs, it haven't fix this problem. I test this patch on it at first. Then I find there is another version ingit://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git
Quoted 4 lines
I don't know they are too different, so I didn't check if this xfsprogs-dev has
fixed it, and just did this patch on it and send out.Sorry for this mistake, and your patch is really better:)
No problem, thanks for looking into it! I'm not sure why the sgi git tree is a bit behind right now.
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 37 lines · Eric Sandeen
Quoted 36 lines · Zirong Lang
----- 原始邮件 -----
Quoted 19 lines
发件人: "Eric Sandeen" <[email protected]>
收件人: "Zorro Lang" <[email protected]>, [email protected]
发送时间: 星期五, 2015年 8 月 14日 上午 12:23:22
主题: Re: [PATCH][RFC]xfs_copy: don't use DIRECT IO to copy 4k sector deviceQuoted 13 lines · Zorro Lang
When I run xfstests xfs/032 in ppc64le, I hit a failure:
xfs_copy: read failed: Invalid argument
xfs_copy: size check failed
xfs_copy:/dev/sda5filesystem failed to initialize
xfs_copy: Aborting.
Copy failed for Sector size 4096 Block size 4096I try to use gdb trace
xfs_copy. I find it try to open the source device with DIRECT flag, then read the device with ((1<<BBSHIFT))=512 bytes length. If the source device is 4k sector, directly read 512 bytes will be failed.Quoted 8 lines
Quoted 6 lines
xfs_copy'-b' option only work for target file/device, to sure it will open the target without DIRECT flag. But useless for source device open.So I make DIRECT flag only be enabled when source device sector size equal BBSIZE.
Which version of xfsprogs did you test? This is recently upstream:
Sorry I didn't notice that you have fix this problem. I test on the newest version from
git://oss.sgi.com/xfs/cmds/xfsprogs, it haven't fix this problem. I test this patch on it at first. Then I find there is another version ingit://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git
Quoted 7 lines
Quoted 4 lines
I don't know they are too different, so I didn't check if this xfsprogs-dev has
fixed it, and just did this patch on it and send out.Sorry for this mistake, and your patch is really better:)
No problem, thanks for looking into it! I'm not sure why the sgi git tree is a bit behind right now.
I didn't push 4.2.0-rc1 in case anyone objected to the change of version numbering I was proposing. Nobody has commented, so when I push 4.2.0-rc2 out, I'll also update the oss.sgi.com repo.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs