]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_mdrestore: fix restore of internal realtime device configs xfs-zoned-2024-12-09
authorChristoph Hellwig <hch@lst.de>
Sat, 7 Dec 2024 13:38:48 +0000 (22:38 +0900)
committerChristoph Hellwig <hch@lst.de>
Mon, 9 Dec 2024 14:24:33 +0000 (15:24 +0100)
We still need the calculation based on the internal rtdev size that got
dropped when moving to the fsblock-unit rtstart, and we now also need
it for the v1 format now that zoned file systems don't force the v2
format due to the lack of a rtsb.

Signed-off-by: Christoph Hellwig <hch@lst.de>
mdrestore/xfs_mdrestore.c

index adbda4151f9baab8891e54550e9ad82f06a24c08..170fc930570b2dae98523ff82b27cfe0cfc01eec 100644 (file)
@@ -169,6 +169,21 @@ verify_device_size(
        }
 }
 
+static void
+verify_main_device_size(
+       int             dev_fd,
+       bool            is_file,
+       struct xfs_sb   *sb)
+{
+       xfs_rfsblock_t  nr_blocks = sb->sb_dblocks;
+
+       /* internal RT device */
+       if (sb->sb_rtstart)
+               nr_blocks = sb->sb_rtstart + sb->sb_rblocks;
+
+       verify_device_size(dev_fd, is_file, nr_blocks, sb->sb_blocksize);
+}
+
 static void
 read_header_v1(
        union mdrestore_headers *h,
@@ -258,8 +273,7 @@ restore_v1(
 
        ((struct xfs_dsb*)block_buffer)->sb_inprogress = 1;
 
-       verify_device_size(ddev_fd, is_data_target_file, sb.sb_dblocks,
-                       sb.sb_blocksize);
+       verify_main_device_size(ddev_fd, is_data_target_file, &sb);
 
        bytes_read = 0;
 
@@ -425,8 +439,7 @@ restore_v2(
 
        ((struct xfs_dsb *)block_buffer)->sb_inprogress = 1;
 
-       verify_device_size(ddev_fd, is_data_target_file,
-                       sb.sb_rtstart + sb.sb_rblocks, sb.sb_blocksize);
+       verify_main_device_size(ddev_fd, is_data_target_file, &sb);
 
        if (sb.sb_logstart == 0) {
                ASSERT(mdrestore.external_log == true);