aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index a6cbc140c330..7b3375db6728 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -354,26 +354,27 @@ xlog_find_cycle_start(
354{ 354{
355 xfs_caddr_t offset; 355 xfs_caddr_t offset;
356 xfs_daddr_t mid_blk; 356 xfs_daddr_t mid_blk;
357 xfs_daddr_t end_blk;
357 uint mid_cycle; 358 uint mid_cycle;
358 int error; 359 int error;
359 360
360 mid_blk = BLK_AVG(first_blk, *last_blk); 361 end_blk = *last_blk;
361 while (mid_blk != first_blk && mid_blk != *last_blk) { 362 mid_blk = BLK_AVG(first_blk, end_blk);
363 while (mid_blk != first_blk && mid_blk != end_blk) {
362 error = xlog_bread(log, mid_blk, 1, bp, &offset); 364 error = xlog_bread(log, mid_blk, 1, bp, &offset);
363 if (error) 365 if (error)
364 return error; 366 return error;
365 mid_cycle = xlog_get_cycle(offset); 367 mid_cycle = xlog_get_cycle(offset);
366 if (mid_cycle == cycle) { 368 if (mid_cycle == cycle)
367 *last_blk = mid_blk; 369 end_blk = mid_blk; /* last_half_cycle == mid_cycle */
368 /* last_half_cycle == mid_cycle */ 370 else
369 } else { 371 first_blk = mid_blk; /* first_half_cycle == mid_cycle */
370 first_blk = mid_blk; 372 mid_blk = BLK_AVG(first_blk, end_blk);
371 /* first_half_cycle == mid_cycle */
372 }
373 mid_blk = BLK_AVG(first_blk, *last_blk);
374 } 373 }
375 ASSERT((mid_blk == first_blk && mid_blk+1 == *last_blk) || 374 ASSERT((mid_blk == first_blk && mid_blk+1 == end_blk) ||
376 (mid_blk == *last_blk && mid_blk-1 == first_blk)); 375 (mid_blk == end_blk && mid_blk-1 == first_blk));
376
377 *last_blk = end_blk;
377 378
378 return 0; 379 return 0;
379} 380}