Skip to contentSkip to conversation

xfs_copy: fix copy of hard 4k devices

PATCH In review Eric Sandeen 3 participants 3 messages Jun 17, 2015 – Jun 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

copy/xfs_copy.c +3 -2
index 279527c..b39c84d 100644
@@ -654,8 +654,9 @@ main(int argc, char **argv)
 
 	memset(&mbuf, 0, sizeof(xfs_mount_t));
 	libxfs_buftarg_init(&mbuf, xargs.ddev, xargs.logdev, xargs.rtdev);
-	sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR, 1, 0,
-							&xfs_sb_buf_ops);
+	sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR,
+			     1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT),
+			     0, &xfs_sb_buf_ops);
 	sb = &mbuf.m_sb;
 	libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Eric Sandeen

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.

---

Quoted 18 lines
copy/xfs_copy.c +3 -2
index 279527c..b39c84d 100644
@@ -654,8 +654,9 @@ main(int argc, char **argv)
 
 	memset(&mbuf, 0, sizeof(xfs_mount_t));
 	libxfs_buftarg_init(&mbuf, xargs.ddev, xargs.logdev, xargs.rtdev);
-	sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR, 1, 0,
-							&xfs_sb_buf_ops);
+	sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR,
+			     1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT),
+			     0, &xfs_sb_buf_ops);
 	sb = &mbuf.m_sb;
 	libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
 
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs