public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs: fix kbuild regression due to log recovery crc verification
Date: Mon,  4 Jan 2016 10:52:55 -0500	[thread overview]
Message-ID: <1451922775-15502-1-git-send-email-bfoster@redhat.com> (raw)

The auto kbuild infrastructure reports several failures on
non-standard arches (i386, sh, arm) due to a regression in the
recent log recovery crc verification (short write detection)
patches:

   fs/built-in.o: In function `xlog_find_tail':
>> xfs_log_recover.c:(.text+0x1c5db5): undefined reference to `__moddi3'
   xfs_log_recover.c:(.text+0x1c5e9d): undefined reference to `__moddi3'

This is due to the introduction of 64-bit modulus operations that
were 32-bit operations prior to the change. xlog_find_tail() used an
int to store the record header start block for the head of the log.
This was converted to an xfs_daddr_t as this is how the value is
represented in the callee functions that handle record
detection/verification, etc.

This was included as a minor cleanup as there wasn't an obvious
reason for using an int for this value in xlog_find_tail(). The
previously implicit cast was likely safe as this value represents a
log relative block number and the log can only be so big (2G). That
said, since all of the surrounding functionality uses xfs_daddr_t,
including the log buffer I/O helpers, update these calculations to
use do_mod() and handle the 64-bit modulus correctly regardless of
architecture.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---

Compile tested with ARCH=i386 and spot tested with xfstests on x86-64.

Brian

 fs/xfs/xfs_log_recover.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 5bf8076..26e67b4 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1330,12 +1330,13 @@ xlog_find_tail(
 	} else {
 		hblks = 1;
 	}
-	after_umount_blk = (rhead_blk + hblks + (int)
-		BTOBB(be32_to_cpu(rhead->h_len))) % log->l_logBBsize;
+	after_umount_blk = rhead_blk + hblks + BTOBB(be32_to_cpu(rhead->h_len));
+	after_umount_blk = do_mod(after_umount_blk, log->l_logBBsize);
 	tail_lsn = atomic64_read(&log->l_tail_lsn);
 	if (*head_blk == after_umount_blk &&
 	    be32_to_cpu(rhead->h_num_logops) == 1) {
-		umount_data_blk = (rhead_blk + hblks) % log->l_logBBsize;
+		umount_data_blk = rhead_blk + hblks;
+		umount_data_blk = do_mod(umount_data_blk, log->l_logBBsize);
 		error = xlog_bread(log, umount_data_blk, 1, bp, &offset);
 		if (error)
 			goto done;
-- 
2.4.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2016-01-04 15:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1451922775-15502-1-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