aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorAlex Elder <aelder@sgi.com>2010-04-15 14:17:34 -0400
committerAlex Elder <aelder@sgi.com>2010-05-19 10:58:14 -0400
commit3f943d853d6ce6d808e7362e4444c7ed5f692357 (patch)
tree78ade96089353117fbcacd2a2e7297af9e652115 /fs/xfs
parente3bb2e30d532b00a9bdda997e174a9f9916cb1c0 (diff)
xfs: minor odds and ends in xfs_log_recover.c
Odds and ends in "xfs_log_recover.c". This patch just contains some minor things that didn't seem to warrant their own individual patches: - In xlog_bread_noalign(), drop an assertion that a pointer is non-null (the crash will tell us it was a bad pointer). - Add a more descriptive header comment for xlog_find_verify_cycle(). - Make a few additions to the comments in xlog_find_head(). Also rearrange some expressions in a few spots to produce the same result, but in a way that seems more clear what's being computed. (Updated in response to Dave's review comments. Note I did not split this patch like I said I would.) Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_log_recover.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 7b3375db6728..3bfff4220a74 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -167,7 +167,6 @@ xlog_bread_noalign(
167 167
168 ASSERT(nbblks > 0); 168 ASSERT(nbblks > 0);
169 ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp)); 169 ASSERT(BBTOB(nbblks) <= XFS_BUF_SIZE(bp));
170 ASSERT(bp);
171 170
172 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 171 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
173 XFS_BUF_READ(bp); 172 XFS_BUF_READ(bp);
@@ -380,14 +379,12 @@ xlog_find_cycle_start(
380} 379}
381 380
382/* 381/*
383 * Check that the range of blocks does not contain the cycle number 382 * Check that a range of blocks does not contain stop_on_cycle_no.
384 * given. The scan needs to occur from front to back and the ptr into the 383 * Fill in *new_blk with the block offset where such a block is
385 * region must be updated since a later routine will need to perform another 384 * found, or with -1 (an invalid block number) if there is no such
386 * test. If the region is completely good, we end up returning the same 385 * block in the range. The scan needs to occur from front to back
387 * last block number. 386 * and the pointer into the region must be updated since a later
388 * 387 * routine will need to perform another test.
389 * Set blkno to -1 if we encounter no errors. This is an invalid block number
390 * since we don't ever expect logs to get this large.
391 */ 388 */
392STATIC int 389STATIC int
393xlog_find_verify_cycle( 390xlog_find_verify_cycle(
@@ -661,7 +658,7 @@ xlog_find_head(
661 * In this case we want to find the first block with cycle 658 * In this case we want to find the first block with cycle
662 * number matching last_half_cycle. We expect the log to be 659 * number matching last_half_cycle. We expect the log to be
663 * some variation on 660 * some variation on
664 * x + 1 ... | x ... 661 * x + 1 ... | x ... | x
665 * The first block with cycle number x (last_half_cycle) will 662 * The first block with cycle number x (last_half_cycle) will
666 * be where the new head belongs. First we do a binary search 663 * be where the new head belongs. First we do a binary search
667 * for the first occurrence of last_half_cycle. The binary 664 * for the first occurrence of last_half_cycle. The binary
@@ -671,11 +668,13 @@ xlog_find_head(
671 * the log, then we look for occurrences of last_half_cycle - 1 668 * the log, then we look for occurrences of last_half_cycle - 1
672 * at the end of the log. The cases we're looking for look 669 * at the end of the log. The cases we're looking for look
673 * like 670 * like
674 * x + 1 ... | x | x + 1 | x ... 671 * v binary search stopped here
675 * ^ binary search stopped here 672 * x + 1 ... | x | x + 1 | x ... | x
673 * ^ but we want to locate this spot
676 * or 674 * or
677 * x + 1 ... | x ... | x - 1 | x
678 * <---------> less than scan distance 675 * <---------> less than scan distance
676 * x + 1 ... | x ... | x - 1 | x
677 * ^ we want to locate this spot
679 */ 678 */
680 stop_on_cycle = last_half_cycle; 679 stop_on_cycle = last_half_cycle;
681 if ((error = xlog_find_cycle_start(log, bp, first_blk, 680 if ((error = xlog_find_cycle_start(log, bp, first_blk,
@@ -731,9 +730,9 @@ xlog_find_head(
731 * certainly not the head of the log. By searching for 730 * certainly not the head of the log. By searching for
732 * last_half_cycle-1 we accomplish that. 731 * last_half_cycle-1 we accomplish that.
733 */ 732 */
734 start_blk = log_bbnum - num_scan_bblks + head_blk;
735 ASSERT(head_blk <= INT_MAX && 733 ASSERT(head_blk <= INT_MAX &&
736 (xfs_daddr_t) num_scan_bblks - head_blk >= 0); 734 (xfs_daddr_t) num_scan_bblks >= head_blk);
735 start_blk = log_bbnum - (num_scan_bblks - head_blk);
737 if ((error = xlog_find_verify_cycle(log, start_blk, 736 if ((error = xlog_find_verify_cycle(log, start_blk,
738 num_scan_bblks - (int)head_blk, 737 num_scan_bblks - (int)head_blk,
739 (stop_on_cycle - 1), &new_blk))) 738 (stop_on_cycle - 1), &new_blk)))
@@ -780,7 +779,7 @@ validate_head:
780 if ((error = xlog_find_verify_log_record(log, start_blk, 779 if ((error = xlog_find_verify_log_record(log, start_blk,
781 &head_blk, 0)) == -1) { 780 &head_blk, 0)) == -1) {
782 /* We hit the beginning of the log during our search */ 781 /* We hit the beginning of the log during our search */
783 start_blk = log_bbnum - num_scan_bblks + head_blk; 782 start_blk = log_bbnum - (num_scan_bblks - head_blk);
784 new_blk = log_bbnum; 783 new_blk = log_bbnum;
785 ASSERT(start_blk <= INT_MAX && 784 ASSERT(start_blk <= INT_MAX &&
786 (xfs_daddr_t) log_bbnum-start_blk >= 0); 785 (xfs_daddr_t) log_bbnum-start_blk >= 0);