diff options
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 052a2c0ec5fb..a199dbcee7d8 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -147,7 +147,7 @@ xlog_align( | |||
147 | xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); | 147 | xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); |
148 | 148 | ||
149 | ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp)); | 149 | ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp)); |
150 | return XFS_BUF_PTR(bp) + BBTOB(offset); | 150 | return bp->b_addr + BBTOB(offset); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
@@ -178,9 +178,7 @@ xlog_bread_noalign( | |||
178 | 178 | ||
179 | XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); | 179 | XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); |
180 | XFS_BUF_READ(bp); | 180 | XFS_BUF_READ(bp); |
181 | XFS_BUF_BUSY(bp); | ||
182 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); | 181 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); |
183 | XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); | ||
184 | 182 | ||
185 | xfsbdstrat(log->l_mp, bp); | 183 | xfsbdstrat(log->l_mp, bp); |
186 | error = xfs_buf_iowait(bp); | 184 | error = xfs_buf_iowait(bp); |
@@ -220,18 +218,18 @@ xlog_bread_offset( | |||
220 | xfs_buf_t *bp, | 218 | xfs_buf_t *bp, |
221 | xfs_caddr_t offset) | 219 | xfs_caddr_t offset) |
222 | { | 220 | { |
223 | xfs_caddr_t orig_offset = XFS_BUF_PTR(bp); | 221 | xfs_caddr_t orig_offset = bp->b_addr; |
224 | int orig_len = bp->b_buffer_length; | 222 | int orig_len = bp->b_buffer_length; |
225 | int error, error2; | 223 | int error, error2; |
226 | 224 | ||
227 | error = XFS_BUF_SET_PTR(bp, offset, BBTOB(nbblks)); | 225 | error = xfs_buf_associate_memory(bp, offset, BBTOB(nbblks)); |
228 | if (error) | 226 | if (error) |
229 | return error; | 227 | return error; |
230 | 228 | ||
231 | error = xlog_bread_noalign(log, blk_no, nbblks, bp); | 229 | error = xlog_bread_noalign(log, blk_no, nbblks, bp); |
232 | 230 | ||
233 | /* must reset buffer pointer even on error */ | 231 | /* must reset buffer pointer even on error */ |
234 | error2 = XFS_BUF_SET_PTR(bp, orig_offset, orig_len); | 232 | error2 = xfs_buf_associate_memory(bp, orig_offset, orig_len); |
235 | if (error) | 233 | if (error) |
236 | return error; | 234 | return error; |
237 | return error2; | 235 | return error2; |
@@ -266,11 +264,9 @@ xlog_bwrite( | |||
266 | 264 | ||
267 | XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); | 265 | XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); |
268 | XFS_BUF_ZEROFLAGS(bp); | 266 | XFS_BUF_ZEROFLAGS(bp); |
269 | XFS_BUF_BUSY(bp); | 267 | xfs_buf_hold(bp); |
270 | XFS_BUF_HOLD(bp); | ||
271 | xfs_buf_lock(bp); | 268 | xfs_buf_lock(bp); |
272 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); | 269 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); |
273 | XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); | ||
274 | 270 | ||
275 | if ((error = xfs_bwrite(log->l_mp, bp))) | 271 | if ((error = xfs_bwrite(log->l_mp, bp))) |
276 | xfs_ioerror_alert("xlog_bwrite", log->l_mp, | 272 | xfs_ioerror_alert("xlog_bwrite", log->l_mp, |
@@ -360,7 +356,7 @@ STATIC void | |||
360 | xlog_recover_iodone( | 356 | xlog_recover_iodone( |
361 | struct xfs_buf *bp) | 357 | struct xfs_buf *bp) |
362 | { | 358 | { |
363 | if (XFS_BUF_GETERROR(bp)) { | 359 | if (bp->b_error) { |
364 | /* | 360 | /* |
365 | * We're not going to bother about retrying | 361 | * We're not going to bother about retrying |
366 | * this during recovery. One strike! | 362 | * this during recovery. One strike! |
@@ -1262,7 +1258,7 @@ xlog_write_log_records( | |||
1262 | */ | 1258 | */ |
1263 | ealign = round_down(end_block, sectbb); | 1259 | ealign = round_down(end_block, sectbb); |
1264 | if (j == 0 && (start_block + endcount > ealign)) { | 1260 | if (j == 0 && (start_block + endcount > ealign)) { |
1265 | offset = XFS_BUF_PTR(bp) + BBTOB(ealign - start_block); | 1261 | offset = bp->b_addr + BBTOB(ealign - start_block); |
1266 | error = xlog_bread_offset(log, ealign, sectbb, | 1262 | error = xlog_bread_offset(log, ealign, sectbb, |
1267 | bp, offset); | 1263 | bp, offset); |
1268 | if (error) | 1264 | if (error) |
@@ -2135,15 +2131,16 @@ xlog_recover_buffer_pass2( | |||
2135 | 2131 | ||
2136 | bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, | 2132 | bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, |
2137 | buf_flags); | 2133 | buf_flags); |
2138 | if (XFS_BUF_ISERROR(bp)) { | 2134 | if (!bp) |
2135 | return XFS_ERROR(ENOMEM); | ||
2136 | error = bp->b_error; | ||
2137 | if (error) { | ||
2139 | xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, | 2138 | xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, |
2140 | bp, buf_f->blf_blkno); | 2139 | bp, buf_f->blf_blkno); |
2141 | error = XFS_BUF_GETERROR(bp); | ||
2142 | xfs_buf_relse(bp); | 2140 | xfs_buf_relse(bp); |
2143 | return error; | 2141 | return error; |
2144 | } | 2142 | } |
2145 | 2143 | ||
2146 | error = 0; | ||
2147 | if (buf_f->blf_flags & XFS_BLF_INODE_BUF) { | 2144 | if (buf_f->blf_flags & XFS_BLF_INODE_BUF) { |
2148 | error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); | 2145 | error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); |
2149 | } else if (buf_f->blf_flags & | 2146 | } else if (buf_f->blf_flags & |
@@ -2227,14 +2224,17 @@ xlog_recover_inode_pass2( | |||
2227 | 2224 | ||
2228 | bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, | 2225 | bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, |
2229 | XBF_LOCK); | 2226 | XBF_LOCK); |
2230 | if (XFS_BUF_ISERROR(bp)) { | 2227 | if (!bp) { |
2228 | error = ENOMEM; | ||
2229 | goto error; | ||
2230 | } | ||
2231 | error = bp->b_error; | ||
2232 | if (error) { | ||
2231 | xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, | 2233 | xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, |
2232 | bp, in_f->ilf_blkno); | 2234 | bp, in_f->ilf_blkno); |
2233 | error = XFS_BUF_GETERROR(bp); | ||
2234 | xfs_buf_relse(bp); | 2235 | xfs_buf_relse(bp); |
2235 | goto error; | 2236 | goto error; |
2236 | } | 2237 | } |
2237 | error = 0; | ||
2238 | ASSERT(in_f->ilf_fields & XFS_ILOG_CORE); | 2238 | ASSERT(in_f->ilf_fields & XFS_ILOG_CORE); |
2239 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset); | 2239 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset); |
2240 | 2240 | ||
@@ -3437,7 +3437,7 @@ xlog_do_recovery_pass( | |||
3437 | /* | 3437 | /* |
3438 | * Check for header wrapping around physical end-of-log | 3438 | * Check for header wrapping around physical end-of-log |
3439 | */ | 3439 | */ |
3440 | offset = XFS_BUF_PTR(hbp); | 3440 | offset = hbp->b_addr; |
3441 | split_hblks = 0; | 3441 | split_hblks = 0; |
3442 | wrapped_hblks = 0; | 3442 | wrapped_hblks = 0; |
3443 | if (blk_no + hblks <= log->l_logBBsize) { | 3443 | if (blk_no + hblks <= log->l_logBBsize) { |
@@ -3497,7 +3497,7 @@ xlog_do_recovery_pass( | |||
3497 | } else { | 3497 | } else { |
3498 | /* This log record is split across the | 3498 | /* This log record is split across the |
3499 | * physical end of log */ | 3499 | * physical end of log */ |
3500 | offset = XFS_BUF_PTR(dbp); | 3500 | offset = dbp->b_addr; |
3501 | split_bblks = 0; | 3501 | split_bblks = 0; |
3502 | if (blk_no != log->l_logBBsize) { | 3502 | if (blk_no != log->l_logBBsize) { |
3503 | /* some data is before the physical | 3503 | /* some data is before the physical |