]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - libxfs/rdwr.c
libxfs: format the log with valid log record headers
authorBrian Foster <bfoster@redhat.com>
Fri, 18 Dec 2015 01:14:06 +0000 (12:14 +1100)
committerDave Chinner <david@fromorbit.com>
Fri, 18 Dec 2015 01:14:06 +0000 (12:14 +1100)
commit20fbd4593ff20fafb777aef61cca6ad13a2d1fd7
tree060af1165d8f42cce29e740781e284387fc98282
parent011207f63a7046d6db1463142ec8b46e096bd1db
libxfs: format the log with valid log record headers

xfsprogs supports the ability to clear or reformat the log to an
arbitrary cycle number. This functionality is invoked in mkfs,
xfs_repair, etc. The code currently fills the log with unmount records
sized based on the specified log stripe unit alignment. When the stripe
unit is sufficiently larger, however, the resulting log records are
technically invalid. For example, the log buffer size (h_size) field is
always hardcoded to 32k even when the particular record length is
larger.

This has not traditionally been a problem because the kernel does not
fully process the log record when the log is clean. Recent changes to
unconditionally CRC verify the head of the log changes this behavior,
however, which means the log should be valid. Technically, the records
written from userspace are not written with a CRC, but this also helps
support unit testing by writing a log that can be verified with
logprint.

Update libxfs_log_header() to write a valid log record based on the
specified log stripe unit. h_size is updated to the log buffer size
based on the stripe unit and the expected number of extended record
headers are written out based on the log buffer size.

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