forked from Minki/linux
xfs: refactor log record unpack and data processing
xlog_do_recovery_pass() duplicates a couple function calls related to processing log records because the function must handle wrapping around the end of the log if the head is behind the tail. This is implemented as separate loops. CRC verification pass support will modify how records are processed in both of these loops. Rather than continue to duplicate code, factor the calls that process a log record into a new helper and call that helper from both loops. This patch contains no functional changes. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
a70f9fe52d
commit
9d94901f6e
@ -4190,6 +4190,26 @@ xlog_unpack_data(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unpack and process a log record.
|
||||||
|
*/
|
||||||
|
STATIC int
|
||||||
|
xlog_recover_process(
|
||||||
|
struct xlog *log,
|
||||||
|
struct hlist_head rhash[],
|
||||||
|
struct xlog_rec_header *rhead,
|
||||||
|
char *dp,
|
||||||
|
int pass)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
error = xlog_unpack_data(rhead, dp, log);
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
return xlog_recover_process_data(log, rhash, rhead, dp, pass);
|
||||||
|
}
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
xlog_valid_rec_header(
|
xlog_valid_rec_header(
|
||||||
struct xlog *log,
|
struct xlog *log,
|
||||||
@ -4432,12 +4452,8 @@ xlog_do_recovery_pass(
|
|||||||
goto bread_err2;
|
goto bread_err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = xlog_unpack_data(rhead, offset, log);
|
error = xlog_recover_process(log, rhash, rhead, offset,
|
||||||
if (error)
|
pass);
|
||||||
goto bread_err2;
|
|
||||||
|
|
||||||
error = xlog_recover_process_data(log, rhash,
|
|
||||||
rhead, offset, pass);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto bread_err2;
|
goto bread_err2;
|
||||||
blk_no += bblks;
|
blk_no += bblks;
|
||||||
@ -4465,12 +4481,7 @@ xlog_do_recovery_pass(
|
|||||||
if (error)
|
if (error)
|
||||||
goto bread_err2;
|
goto bread_err2;
|
||||||
|
|
||||||
error = xlog_unpack_data(rhead, offset, log);
|
error = xlog_recover_process(log, rhash, rhead, offset, pass);
|
||||||
if (error)
|
|
||||||
goto bread_err2;
|
|
||||||
|
|
||||||
error = xlog_recover_process_data(log, rhash,
|
|
||||||
rhead, offset, pass);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto bread_err2;
|
goto bread_err2;
|
||||||
blk_no += bblks + hblks;
|
blk_no += bblks + hblks;
|
||||||
|
Loading…
Reference in New Issue
Block a user