From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH v2 06/12] libxlog: pull struct xlog out of xlog_is_dirty()
Date: Fri, 11 Sep 2015 14:55:36 -0400 [thread overview]
Message-ID: <1441997742-37160-7-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1441997742-37160-1-git-send-email-bfoster@redhat.com>
The xlog_is_dirty() helper is called in various places to acquire the
current log head, tail and to determine whether the log is dirty. Some
callers will require additional information to deal with formatting the
log, such as the current LSN. xlog_is_dirty() already acquires this
information through existing sub-helpers, but it is not available to
callers as the xlog structure is allocated on the local stack.
Update xlog_is_dirty() to receive the xlog structure as a parameter and
pass it along such that additional information about the log is
available to callers. Update the existing callers to allocate the xlog
structure on the stack.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
db/metadump.c | 5 +++--
db/sb.c | 3 ++-
include/libxlog.h | 3 ++-
libxlog/util.c | 37 +++++++++++++++++++------------------
4 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/db/metadump.c b/db/metadump.c
index af96e12..129670e 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -2512,7 +2512,8 @@ copy_sb_inodes(void)
static int
copy_log(void)
{
- int dirty;
+ struct xlog log;
+ int dirty;
if (show_progress)
print_progress("Copying log");
@@ -2530,7 +2531,7 @@ copy_log(void)
if (!obfuscate && !zero_stale_data)
goto done;
- dirty = xlog_is_dirty(mp, &x, 0);
+ dirty = xlog_is_dirty(mp, &log, &x, 0);
switch (dirty) {
case 0:
diff --git a/db/sb.c b/db/sb.c
index 560e653..9c585ca 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -229,6 +229,7 @@ int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *t, int p)
int
sb_logcheck(void)
{
+ struct xlog log;
int dirty;
if (mp->m_sb.sb_logstart) {
@@ -247,7 +248,7 @@ sb_logcheck(void)
libxfs_buftarg_init(mp, x.ddev, x.logdev, x.rtdev);
- dirty = xlog_is_dirty(mp, &x, 0);
+ dirty = xlog_is_dirty(mp, &log, &x, 0);
if (dirty == -1) {
dbprintf(_("ERROR: cannot find log head/tail, run xfs_repair\n"));
return 0;
diff --git a/include/libxlog.h b/include/libxlog.h
index 05b16e8..6c6e83a 100644
--- a/include/libxlog.h
+++ b/include/libxlog.h
@@ -84,7 +84,8 @@ extern int print_record_header;
extern libxfs_init_t x;
-extern int xlog_is_dirty(xfs_mount_t *mp, libxfs_init_t *x, int verbose);
+extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *,
+ int);
extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
extern void xlog_put_bp(struct xfs_buf *);
extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
diff --git a/libxlog/util.c b/libxlog/util.c
index c6b8f2a..72b8b18 100644
--- a/libxlog/util.c
+++ b/libxlog/util.c
@@ -29,15 +29,15 @@ libxfs_init_t x;
*/
int
xlog_is_dirty(
- xfs_mount_t *mp,
- libxfs_init_t *x,
- int verbose)
+ struct xfs_mount *mp,
+ struct xlog *log,
+ libxfs_init_t *x,
+ int verbose)
{
- int error;
- struct xlog log;
- xfs_daddr_t head_blk, tail_blk;
+ int error;
+ xfs_daddr_t head_blk, tail_blk;
- memset(&log, 0, sizeof(log));
+ memset(log, 0, sizeof(*log));
/* We (re-)init members of libxfs_init_t here? really? */
x->logBBsize = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
@@ -46,23 +46,24 @@ xlog_is_dirty(
if (xfs_sb_version_hassector(&mp->m_sb))
x->lbsize <<= (mp->m_sb.sb_logsectlog - BBSHIFT);
- log.l_dev = mp->m_logdev_targp;
- log.l_logBBsize = x->logBBsize;
- log.l_logBBstart = x->logBBstart;
- log.l_sectBBsize = BTOBB(x->lbsize);
- log.l_mp = mp;
+ log->l_dev = mp->m_logdev_targp;
+ log->l_logBBsize = x->logBBsize;
+ log->l_logBBstart = x->logBBstart;
+ log->l_sectBBsize = BTOBB(x->lbsize);
+ log->l_mp = mp;
if (xfs_sb_version_hassector(&mp->m_sb)) {
- log.l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
- ASSERT(log.l_sectbb_log <= mp->m_sectbb_log);
+ log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
+ ASSERT(log->l_sectbb_log <= mp->m_sectbb_log);
/* for larger sector sizes, must have v2 or external log */
- ASSERT(log.l_sectbb_log == 0 ||
- log.l_logBBstart == 0 ||
+ ASSERT(log->l_sectbb_log == 0 ||
+ log->l_logBBstart == 0 ||
xfs_sb_version_haslogv2(&mp->m_sb));
ASSERT(mp->m_sb.sb_logsectlog >= BBSHIFT);
}
- log.l_sectbb_mask = (1 << log.l_sectbb_log) - 1;
+ log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1;
- if ((error = xlog_find_tail(&log, &head_blk, &tail_blk))) {
+ error = xlog_find_tail(log, &head_blk, &tail_blk);
+ if (error) {
xlog_warn(_("%s: cannot find log head/tail "
"(xlog_find_tail=%d)\n"),
__func__, error);
--
2.1.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-09-11 18:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 18:55 [PATCH v2 00/12] xfsprogs: format the log correctly on v5 supers Brian Foster
2015-09-11 18:55 ` [PATCH v2 01/12] libxfs: validate metadata LSNs against log on v5 superblocks Brian Foster
2015-09-11 18:55 ` [PATCH v2 02/12] libxfs: track largest metadata LSN in use via verifiers Brian Foster
2015-09-23 3:44 ` Dave Chinner
2015-09-23 13:18 ` Brian Foster
2015-09-23 22:36 ` Dave Chinner
2015-10-01 20:38 ` Brian Foster
2015-10-02 2:16 ` Dave Chinner
2015-10-02 11:33 ` Brian Foster
2015-09-11 18:55 ` [PATCH v2 03/12] libxfs: don't hardcode cycle 1 into unmount op header Brian Foster
2015-09-23 3:48 ` Dave Chinner
2015-09-23 13:22 ` Brian Foster
2015-09-24 0:37 ` Dave Chinner
2015-09-24 13:00 ` Brian Foster
2015-09-11 18:55 ` [PATCH v2 04/12] libxfs: pass lsn param to log clear and record header logging helpers Brian Foster
2015-09-11 18:55 ` [PATCH v2 05/12] libxfs: add ability to clear log to arbitrary log cycle Brian Foster
2015-09-11 18:55 ` Brian Foster [this message]
2015-09-11 18:55 ` [PATCH v2 07/12] xfs_repair: track log state throughout all recovery phases Brian Foster
2015-09-11 18:55 ` [PATCH v2 08/12] xfs_repair: process the log in no_modify mode Brian Foster
2015-09-11 18:55 ` [PATCH v2 09/12] xfs_repair: format the log with forward cycle number on v5 supers Brian Foster
2015-09-11 18:55 ` [PATCH v2 10/12] xfs_repair: don't clear the log by default Brian Foster
2015-09-11 18:55 ` [PATCH v2 11/12] xfs_db: do not reset current lsn from uuid command on v5 supers Brian Foster
2015-09-11 18:55 ` [PATCH v2 12/12] db/metadump: bump lsn when log is cleared " 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=1441997742-37160-7-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