From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH v2 2/8] xfs: refactor log record unpack and data processing
Date: Thu, 12 Nov 2015 10:37:22 -0500 [thread overview]
Message-ID: <1447342648-40012-3-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1447342648-40012-1-git-send-email-bfoster@redhat.com>
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>
---
fs/xfs/xfs_log_recover.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4f880d6..236ebaf 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -4190,6 +4190,26 @@ xlog_unpack_data(
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
xlog_valid_rec_header(
struct xlog *log,
@@ -4432,12 +4452,8 @@ xlog_do_recovery_pass(
goto bread_err2;
}
- error = xlog_unpack_data(rhead, offset, log);
- if (error)
- goto bread_err2;
-
- error = xlog_recover_process_data(log, rhash,
- rhead, offset, pass);
+ error = xlog_recover_process(log, rhash, rhead, offset,
+ pass);
if (error)
goto bread_err2;
blk_no += bblks;
@@ -4465,12 +4481,7 @@ xlog_do_recovery_pass(
if (error)
goto bread_err2;
- error = xlog_unpack_data(rhead, offset, log);
- if (error)
- goto bread_err2;
-
- error = xlog_recover_process_data(log, rhash,
- rhead, offset, pass);
+ error = xlog_recover_process(log, rhash, rhead, offset, pass);
if (error)
goto bread_err2;
blk_no += bblks + hblks;
--
2.1.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-11-12 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 15:37 [PATCH v2 0/8] xfs: log recovery torn write detection Brian Foster
2015-11-12 15:37 ` [PATCH v2 1/8] xfs: detect and handle invalid iclog size set by mkfs Brian Foster
2015-11-12 15:37 ` Brian Foster [this message]
2015-11-12 15:37 ` [PATCH v2 3/8] xfs: refactor and open code log record crc check Brian Foster
2015-11-12 15:37 ` [PATCH v2 4/8] xfs: return start block of first bad log record during recovery Brian Foster
2015-11-12 15:37 ` [PATCH v2 5/8] xfs: support a crc verification only log record pass Brian Foster
2015-11-12 15:37 ` [PATCH v2 6/8] xfs: refactor log record start detection into a new helper Brian Foster
2015-11-12 15:37 ` [PATCH v2 7/8] xfs: detect and trim torn writes during log recovery Brian Foster
2015-11-12 15:37 ` [PATCH v2 8/8] xfs: debug mode log record crc error injection Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447342648-40012-3-git-send-email-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox