public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC] xfs_copy: don't use DIRECT IO to copy 4k sector device
@ 2015-08-13 15:07 Zorro Lang
  2015-08-13 16:23 ` Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2015-08-13 15:07 UTC (permalink / raw)
  To: xfs; +Cc: 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/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.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---

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(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index e13f468..1cd6253 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -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);
-- 
1.9.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-13 23:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-13 15:07 [PATCH][RFC] xfs_copy: don't use DIRECT IO to copy 4k sector device Zorro Lang
2015-08-13 16:23 ` Eric Sandeen
2015-08-13 16:40   ` Zirong Lang
2015-08-13 16:54     ` Eric Sandeen
2015-08-13 23:51       ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox