aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2016-01-03 23:55:10 -0500
committerDave Chinner <david@fromorbit.com>2016-01-03 23:55:10 -0500
commit9d94901f6e17c4c75d9aeb9efd4213a736c2ef9c (patch)
treed632bd5ce37d512b5a627984820cbaf27dbd8d1b /fs/xfs
parenta70f9fe52daa839d3925ac7e2dbd0ca758434493 (diff)
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_log_recover.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4f880d6cfb93..236ebaf678f2 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -4190,6 +4190,26 @@ xlog_unpack_data(
4190 return 0; 4190 return 0;
4191} 4191}
4192 4192
4193/*
4194 * Unpack and process a log record.
4195 */
4196STATIC int
4197xlog_recover_process(
4198 struct xlog *log,
4199 struct hlist_head rhash[],
4200 struct xlog_rec_header *rhead,
4201 char *dp,
4202 int pass)
4203{
4204 int error;
4205
4206 error = xlog_unpack_data(rhead, dp, log);
4207 if (error)
4208 return error;
4209
4210 return xlog_recover_process_data(log, rhash, rhead, dp, pass);
4211}
4212
4193STATIC int 4213STATIC int
4194xlog_valid_rec_header( 4214xlog_valid_rec_header(
4195 struct xlog *log, 4215 struct xlog *log,
@@ -4432,12 +4452,8 @@ xlog_do_recovery_pass(
4432 goto bread_err2; 4452 goto bread_err2;
4433 } 4453 }
4434 4454
4435 error = xlog_unpack_data(rhead, offset, log); 4455 error = xlog_recover_process(log, rhash, rhead, offset,
4436 if (error) 4456 pass);
4437 goto bread_err2;
4438
4439 error = xlog_recover_process_data(log, rhash,
4440 rhead, offset, pass);
4441 if (error) 4457 if (error)
4442 goto bread_err2; 4458 goto bread_err2;
4443 blk_no += bblks; 4459 blk_no += bblks;
@@ -4465,12 +4481,7 @@ xlog_do_recovery_pass(
4465 if (error) 4481 if (error)
4466 goto bread_err2; 4482 goto bread_err2;
4467 4483
4468 error = xlog_unpack_data(rhead, offset, log); 4484 error = xlog_recover_process(log, rhash, rhead, offset, pass);
4469 if (error)
4470 goto bread_err2;
4471
4472 error = xlog_recover_process_data(log, rhash,
4473 rhead, offset, pass);
4474 if (error) 4485 if (error)
4475 goto bread_err2; 4486 goto bread_err2;
4476 blk_no += bblks + hblks; 4487 blk_no += bblks + hblks;