]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_copy: format v5 sb logs correctly
authorBrian Foster <bfoster@redhat.com>
Tue, 13 Oct 2015 23:59:23 +0000 (10:59 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 13 Oct 2015 23:59:23 +0000 (10:59 +1100)
commitb4d947db398c0ed81808d7eeffe2ad162bd07524
tree3a1d537cf5decf1d1f65df1ae1d9c95e3e880e62
parent54b0c4dc3db498b3f174923ad4623d2ff461729d
xfs_copy: format v5 sb logs correctly

xfs_copy formats the target filesystem log in non-duplicate copy mode to
stamp the new fs UUID into the log. The current format mechanism resets
the current LSN of the target filesystem to cycle 1, which is invalid
for v5 superblocks. The current LSN of v5 superblocks must always move
forward and remain ahead of metadata LSNs stored in filesystem metadata.

Update the log format helper to detect and use an alternate format
mechanism for v5 superblock logs. Allocate an independent log format
buffer based on the size of the log and format the buffer with an
incremented cycle count using the libxfs log format mechanism.

Note that the new libxfs log format mechanism could be used for both v5
and older superblock formats. The new mechanism requires a new, full log
sized buffer allocation as well as doing I/O to the entire log whereas
the pre-v5 sb mechanism only writes to the log head and tail. This is
due to how xfs_copy uses its own internal buffer data structure rather
than libxfs buftarg structures. As such, keep the original mechanism
around to avoid potential disruption for non-v5 users. The old mechanism
can be removed at some point in the future when the new mechanism is
shaken out and v5 filesystems tend to outnumber v4.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
copy/xfs_copy.c