Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: replace xfs_buf_geterror() with bp->b_error
xfs: Check the return value of xfs_buf_read() for NULL
"xfs: fix error handling for synchronous writes" revisited
xfs: set cursor in xfs_ail_splice() even when AIL was empty
xfs: Remove the macro XFS_BUFTARG_NAME
xfs: Remove the macro XFS_BUF_TARGET
xfs: Remove the macro XFS_BUF_SET_TARGET
Replace the macro XFS_BUF_ISPINNED with helper xfs_buf_ispinned
xfs: Remove the macro XFS_BUF_SET_PTR
xfs: Remove the macro XFS_BUF_PTR
xfs: Remove macro XFS_BUF_SET_START
xfs: Remove macro XFS_BUF_HOLD
xfs: Remove macro XFS_BUF_BUSY and family
xfs: Remove the macro XFS_BUF_ERROR and family
xfs: Remove the macro XFS_BUF_BFLAGS

+155 -204
+7 -8
fs/xfs/linux-2.6/xfs_buf.c
··· 596 596 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); 597 597 598 598 status = xfs_buf_iorequest(bp); 599 - if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) 599 + if (status || bp->b_error || (flags & XBF_ASYNC)) 600 600 return status; 601 601 return xfs_buf_iowait(bp); 602 602 } ··· 679 679 /* set up the buffer for a read IO */ 680 680 XFS_BUF_SET_ADDR(bp, daddr); 681 681 XFS_BUF_READ(bp); 682 - XFS_BUF_BUSY(bp); 683 682 684 683 xfsbdstrat(mp, bp); 685 684 error = xfs_buf_iowait(bp); ··· 1068 1069 /* 1069 1070 * No need to wait until the buffer is unpinned, we aren't flushing it. 1070 1071 */ 1071 - XFS_BUF_ERROR(bp, EIO); 1072 + xfs_buf_ioerror(bp, EIO); 1072 1073 1073 1074 /* 1074 1075 * We're calling xfs_buf_ioend, so delete XBF_DONE flag. ··· 1093 1094 xfs_bioerror_relse( 1094 1095 struct xfs_buf *bp) 1095 1096 { 1096 - int64_t fl = XFS_BUF_BFLAGS(bp); 1097 + int64_t fl = bp->b_flags; 1097 1098 /* 1098 1099 * No need to wait until the buffer is unpinned. 1099 1100 * We aren't flushing it. ··· 1114 1115 * There's no reason to mark error for 1115 1116 * ASYNC buffers. 1116 1117 */ 1117 - XFS_BUF_ERROR(bp, EIO); 1118 + xfs_buf_ioerror(bp, EIO); 1118 1119 XFS_BUF_FINISH_IOWAIT(bp); 1119 1120 } else { 1120 1121 xfs_buf_relse(bp); ··· 1323 1324 struct page *page; 1324 1325 1325 1326 if (bp->b_flags & XBF_MAPPED) 1326 - return XFS_BUF_PTR(bp) + offset; 1327 + return bp->b_addr + offset; 1327 1328 1328 1329 offset += bp->b_offset; 1329 1330 page = bp->b_pages[offset >> PAGE_SHIFT]; ··· 1483 1484 if (set_blocksize(btp->bt_bdev, sectorsize)) { 1484 1485 xfs_warn(btp->bt_mount, 1485 1486 "Cannot set_blocksize to %u on device %s\n", 1486 - sectorsize, XFS_BUFTARG_NAME(btp)); 1487 + sectorsize, xfs_buf_target_name(btp)); 1487 1488 return EINVAL; 1488 1489 } 1489 1490 ··· 1680 1681 list_for_each_entry_safe(bp, n, dwq, b_list) { 1681 1682 ASSERT(bp->b_flags & XBF_DELWRI); 1682 1683 1683 - if (!XFS_BUF_ISPINNED(bp) && xfs_buf_trylock(bp)) { 1684 + if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) { 1684 1685 if (!force && 1685 1686 time_before(jiffies, bp->b_queuetime + age)) { 1686 1687 xfs_buf_unlock(bp);
+11 -21
fs/xfs/linux-2.6/xfs_buf.h
··· 228 228 extern int xfs_buf_init(void); 229 229 extern void xfs_buf_terminate(void); 230 230 231 - #define xfs_buf_target_name(target) \ 232 - ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; }) 231 + static inline const char * 232 + xfs_buf_target_name(struct xfs_buftarg *target) 233 + { 234 + static char __b[BDEVNAME_SIZE]; 235 + 236 + return bdevname(target->bt_bdev, __b); 237 + } 233 238 234 239 235 - #define XFS_BUF_BFLAGS(bp) ((bp)->b_flags) 236 240 #define XFS_BUF_ZEROFLAGS(bp) \ 237 241 ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \ 238 242 XBF_SYNCIO|XBF_FUA|XBF_FLUSH)) ··· 255 251 #define XFS_BUF_UNDELAYWRITE(bp) xfs_buf_delwri_dequeue(bp) 256 252 #define XFS_BUF_ISDELAYWRITE(bp) ((bp)->b_flags & XBF_DELWRI) 257 253 258 - #define XFS_BUF_ERROR(bp,no) xfs_buf_ioerror(bp,no) 259 - #define XFS_BUF_GETERROR(bp) xfs_buf_geterror(bp) 260 - #define XFS_BUF_ISERROR(bp) (xfs_buf_geterror(bp) ? 1 : 0) 261 - 262 254 #define XFS_BUF_DONE(bp) ((bp)->b_flags |= XBF_DONE) 263 255 #define XFS_BUF_UNDONE(bp) ((bp)->b_flags &= ~XBF_DONE) 264 256 #define XFS_BUF_ISDONE(bp) ((bp)->b_flags & XBF_DONE) 265 - 266 - #define XFS_BUF_BUSY(bp) do { } while (0) 267 - #define XFS_BUF_UNBUSY(bp) do { } while (0) 268 - #define XFS_BUF_ISBUSY(bp) (1) 269 257 270 258 #define XFS_BUF_ASYNC(bp) ((bp)->b_flags |= XBF_ASYNC) 271 259 #define XFS_BUF_UNASYNC(bp) ((bp)->b_flags &= ~XBF_ASYNC) 272 260 #define XFS_BUF_ISASYNC(bp) ((bp)->b_flags & XBF_ASYNC) 273 261 274 - #define XFS_BUF_HOLD(bp) xfs_buf_hold(bp) 275 262 #define XFS_BUF_READ(bp) ((bp)->b_flags |= XBF_READ) 276 263 #define XFS_BUF_UNREAD(bp) ((bp)->b_flags &= ~XBF_READ) 277 264 #define XFS_BUF_ISREAD(bp) ((bp)->b_flags & XBF_READ) ··· 271 276 #define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE) 272 277 #define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE) 273 278 274 - #define XFS_BUF_SET_START(bp) do { } while (0) 275 - 276 - #define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->b_addr) 277 - #define XFS_BUF_SET_PTR(bp, val, cnt) xfs_buf_associate_memory(bp, val, cnt) 278 279 #define XFS_BUF_ADDR(bp) ((bp)->b_bn) 279 280 #define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) 280 281 #define XFS_BUF_OFFSET(bp) ((bp)->b_file_offset) ··· 290 299 #define XFS_BUF_SET_VTYPE_REF(bp, type, ref) xfs_buf_set_ref(bp, ref) 291 300 #define XFS_BUF_SET_VTYPE(bp, type) do { } while (0) 292 301 293 - #define XFS_BUF_ISPINNED(bp) atomic_read(&((bp)->b_pin_count)) 302 + static inline int xfs_buf_ispinned(struct xfs_buf *bp) 303 + { 304 + return atomic_read(&bp->b_pin_count); 305 + } 294 306 295 307 #define XFS_BUF_FINISH_IOWAIT(bp) complete(&bp->b_iowait); 296 - 297 - #define XFS_BUF_SET_TARGET(bp, target) ((bp)->b_target = (target)) 298 - #define XFS_BUF_TARGET(bp) ((bp)->b_target) 299 - #define XFS_BUFTARG_NAME(target) xfs_buf_target_name(target) 300 308 301 309 static inline void xfs_buf_relse(xfs_buf_t *bp) 302 310 {
+1 -1
fs/xfs/linux-2.6/xfs_sync.c
··· 332 332 * between there and here. 333 333 */ 334 334 bp = xfs_getsb(mp, 0); 335 - if (XFS_BUF_ISPINNED(bp)) 335 + if (xfs_buf_ispinned(bp)) 336 336 xfs_log_force(mp, 0); 337 337 338 338 return xfs_bwrite(mp, bp);
+6 -10
fs/xfs/quota/xfs_dquot.c
··· 318 318 int curid, i; 319 319 320 320 ASSERT(tp); 321 - ASSERT(XFS_BUF_ISBUSY(bp)); 322 321 ASSERT(xfs_buf_islocked(bp)); 323 322 324 - d = (xfs_dqblk_t *)XFS_BUF_PTR(bp); 323 + d = bp->b_addr; 325 324 326 325 /* 327 326 * ID of the first dquot in the block - id's are zero based. ··· 402 403 dqp->q_blkno, 403 404 mp->m_quotainfo->qi_dqchunklen, 404 405 0); 405 - if (!bp || (error = XFS_BUF_GETERROR(bp))) 406 + if (!bp || (error = xfs_buf_geterror(bp))) 406 407 goto error1; 407 408 /* 408 409 * Make a chunk of dquots out of this buffer and log ··· 533 534 return XFS_ERROR(error); 534 535 } 535 536 536 - ASSERT(XFS_BUF_ISBUSY(bp)); 537 537 ASSERT(xfs_buf_islocked(bp)); 538 538 539 539 /* 540 540 * calculate the location of the dquot inside the buffer. 541 541 */ 542 - ddq = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); 542 + ddq = bp->b_addr + dqp->q_bufoffset; 543 543 544 544 /* 545 545 * A simple sanity check in case we got a corrupted dquot... ··· 551 553 xfs_trans_brelse(tp, bp); 552 554 return XFS_ERROR(EIO); 553 555 } 554 - XFS_BUF_BUSY(bp); /* We dirtied this */ 555 556 } 556 557 557 558 *O_bpp = bp; ··· 619 622 * this particular dquot was repaired. We still aren't afraid to 620 623 * brelse it because we have the changes incore. 621 624 */ 622 - ASSERT(XFS_BUF_ISBUSY(bp)); 623 625 ASSERT(xfs_buf_islocked(bp)); 624 626 xfs_trans_brelse(tp, bp); 625 627 ··· 1200 1204 /* 1201 1205 * Calculate the location of the dquot inside the buffer. 1202 1206 */ 1203 - ddqp = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); 1207 + ddqp = bp->b_addr + dqp->q_bufoffset; 1204 1208 1205 1209 /* 1206 1210 * A simple sanity check in case we got a corrupted dquot.. ··· 1236 1240 * If the buffer is pinned then push on the log so we won't 1237 1241 * get stuck waiting in the write for too long. 1238 1242 */ 1239 - if (XFS_BUF_ISPINNED(bp)) { 1243 + if (xfs_buf_ispinned(bp)) { 1240 1244 trace_xfs_dqflush_force(dqp); 1241 1245 xfs_log_force(mp, 0); 1242 1246 } ··· 1443 1447 goto out_lock; 1444 1448 1445 1449 if (XFS_BUF_ISDELAYWRITE(bp)) { 1446 - if (XFS_BUF_ISPINNED(bp)) 1450 + if (xfs_buf_ispinned(bp)) 1447 1451 xfs_log_force(mp, 0); 1448 1452 xfs_buf_delwri_promote(bp); 1449 1453 wake_up_process(bp->b_target->bt_task);
+1 -1
fs/xfs/quota/xfs_qm.c
··· 1240 1240 do_div(j, sizeof(xfs_dqblk_t)); 1241 1241 ASSERT(mp->m_quotainfo->qi_dqperchunk == j); 1242 1242 #endif 1243 - ddq = (xfs_disk_dquot_t *)XFS_BUF_PTR(bp); 1243 + ddq = bp->b_addr; 1244 1244 for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) { 1245 1245 /* 1246 1246 * Do a sanity check, and if needed, repair the dqblk. Don't
+3 -3
fs/xfs/xfs_ag.h
··· 103 103 /* disk block (xfs_daddr_t) in the AG */ 104 104 #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) 105 105 #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) 106 - #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) 106 + #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr)) 107 107 108 108 extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp, 109 109 xfs_agnumber_t agno, int flags, struct xfs_buf **bpp); ··· 156 156 /* disk block (xfs_daddr_t) in the AG */ 157 157 #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) 158 158 #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) 159 - #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) 159 + #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr)) 160 160 161 161 extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp, 162 162 xfs_agnumber_t agno, struct xfs_buf **bpp); ··· 168 168 #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) 169 169 #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)) 170 170 #define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t)) 171 - #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) 171 + #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr)) 172 172 173 173 typedef struct xfs_agfl { 174 174 __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */
+3 -4
fs/xfs/xfs_alloc.c
··· 451 451 XFS_FSS_TO_BB(mp, 1), 0, &bp); 452 452 if (error) 453 453 return error; 454 - ASSERT(bp); 455 - ASSERT(!XFS_BUF_GETERROR(bp)); 454 + ASSERT(!xfs_buf_geterror(bp)); 456 455 XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGFL, XFS_AGFL_REF); 457 456 *bpp = bp; 458 457 return 0; ··· 2115 2116 if (!*bpp) 2116 2117 return 0; 2117 2118 2118 - ASSERT(!XFS_BUF_GETERROR(*bpp)); 2119 + ASSERT(!(*bpp)->b_error); 2119 2120 agf = XFS_BUF_TO_AGF(*bpp); 2120 2121 2121 2122 /* ··· 2167 2168 return error; 2168 2169 if (!*bpp) 2169 2170 return 0; 2170 - ASSERT(!XFS_BUF_GETERROR(*bpp)); 2171 + ASSERT(!(*bpp)->b_error); 2171 2172 2172 2173 agf = XFS_BUF_TO_AGF(*bpp); 2173 2174 pag = xfs_perag_get(mp, agno);
+1 -2
fs/xfs/xfs_attr.c
··· 2121 2121 2122 2122 bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, 2123 2123 XBF_LOCK | XBF_DONT_BLOCK); 2124 - ASSERT(bp); 2125 - ASSERT(!XFS_BUF_GETERROR(bp)); 2124 + ASSERT(!xfs_buf_geterror(bp)); 2126 2125 2127 2126 tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : 2128 2127 XFS_BUF_SIZE(bp);
+1 -2
fs/xfs/xfs_bmap.c
··· 3383 3383 ASSERT(args.len == 1); 3384 3384 *firstblock = args.fsbno; 3385 3385 bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); 3386 - memcpy((char *)XFS_BUF_PTR(bp), ifp->if_u1.if_data, 3387 - ifp->if_bytes); 3386 + memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); 3388 3387 xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); 3389 3388 xfs_bmap_forkoff_reset(args.mp, ip, whichfork); 3390 3389 xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
+6 -11
fs/xfs/xfs_btree.c
··· 275 275 return error; 276 276 } 277 277 new->bc_bufs[i] = bp; 278 - ASSERT(bp); 279 - ASSERT(!XFS_BUF_GETERROR(bp)); 278 + ASSERT(!xfs_buf_geterror(bp)); 280 279 } else 281 280 new->bc_bufs[i] = NULL; 282 281 } ··· 466 467 ASSERT(fsbno != NULLFSBLOCK); 467 468 d = XFS_FSB_TO_DADDR(mp, fsbno); 468 469 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); 469 - ASSERT(bp); 470 - ASSERT(!XFS_BUF_GETERROR(bp)); 470 + ASSERT(!xfs_buf_geterror(bp)); 471 471 return bp; 472 472 } 473 473 ··· 489 491 ASSERT(agbno != NULLAGBLOCK); 490 492 d = XFS_AGB_TO_DADDR(mp, agno, agbno); 491 493 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); 492 - ASSERT(bp); 493 - ASSERT(!XFS_BUF_GETERROR(bp)); 494 + ASSERT(!xfs_buf_geterror(bp)); 494 495 return bp; 495 496 } 496 497 ··· 629 632 mp->m_bsize, lock, &bp))) { 630 633 return error; 631 634 } 632 - ASSERT(!bp || !XFS_BUF_GETERROR(bp)); 635 + ASSERT(!xfs_buf_geterror(bp)); 633 636 if (bp) 634 637 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval); 635 638 *bpp = bp; ··· 970 973 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d, 971 974 mp->m_bsize, flags); 972 975 973 - ASSERT(*bpp); 974 - ASSERT(!XFS_BUF_GETERROR(*bpp)); 976 + ASSERT(!xfs_buf_geterror(*bpp)); 975 977 976 978 *block = XFS_BUF_TO_BLOCK(*bpp); 977 979 return 0; ··· 1002 1006 if (error) 1003 1007 return error; 1004 1008 1005 - ASSERT(*bpp != NULL); 1006 - ASSERT(!XFS_BUF_GETERROR(*bpp)); 1009 + ASSERT(!xfs_buf_geterror(*bpp)); 1007 1010 1008 1011 xfs_btree_set_refs(cur, *bpp); 1009 1012 *block = XFS_BUF_TO_BLOCK(*bpp);
+1 -1
fs/xfs/xfs_btree.h
··· 262 262 /* 263 263 * Convert from buffer to btree block header. 264 264 */ 265 - #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)XFS_BUF_PTR(bp)) 265 + #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)((bp)->b_addr)) 266 266 267 267 268 268 /*
+10 -14
fs/xfs/xfs_buf_item.c
··· 124 124 125 125 bp = bip->bli_buf; 126 126 ASSERT(XFS_BUF_COUNT(bp) > 0); 127 - ASSERT(XFS_BUF_PTR(bp) != NULL); 127 + ASSERT(bp->b_addr != NULL); 128 128 orig = bip->bli_orig; 129 - buffer = XFS_BUF_PTR(bp); 129 + buffer = bp->b_addr; 130 130 for (x = 0; x < XFS_BUF_COUNT(bp); x++) { 131 131 if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) { 132 132 xfs_emerg(bp->b_mount, ··· 371 371 { 372 372 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 373 373 374 - ASSERT(XFS_BUF_ISBUSY(bip->bli_buf)); 375 374 ASSERT(atomic_read(&bip->bli_refcount) > 0); 376 375 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || 377 376 (bip->bli_flags & XFS_BLI_STALE)); ··· 478 479 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 479 480 struct xfs_buf *bp = bip->bli_buf; 480 481 481 - if (XFS_BUF_ISPINNED(bp)) 482 + if (xfs_buf_ispinned(bp)) 482 483 return XFS_ITEM_PINNED; 483 484 if (!xfs_buf_trylock(bp)) 484 485 return XFS_ITEM_LOCKED; 485 486 486 487 /* take a reference to the buffer. */ 487 - XFS_BUF_HOLD(bp); 488 + xfs_buf_hold(bp); 488 489 489 490 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 490 491 trace_xfs_buf_item_trylock(bip); ··· 725 726 * to have logged. 726 727 */ 727 728 bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP); 728 - memcpy(bip->bli_orig, XFS_BUF_PTR(bp), XFS_BUF_COUNT(bp)); 729 + memcpy(bip->bli_orig, bp->b_addr, XFS_BUF_COUNT(bp)); 729 730 bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP); 730 731 #endif 731 732 ··· 894 895 { 895 896 xfs_log_item_t *head_lip; 896 897 897 - ASSERT(XFS_BUF_ISBUSY(bp)); 898 898 ASSERT(xfs_buf_islocked(bp)); 899 899 900 900 lip->li_cb = cb; ··· 958 960 static ulong lasttime; 959 961 static xfs_buftarg_t *lasttarg; 960 962 961 - if (likely(!XFS_BUF_GETERROR(bp))) 963 + if (likely(!xfs_buf_geterror(bp))) 962 964 goto do_callbacks; 963 965 964 966 /* ··· 971 973 goto do_callbacks; 972 974 } 973 975 974 - if (XFS_BUF_TARGET(bp) != lasttarg || 976 + if (bp->b_target != lasttarg || 975 977 time_after(jiffies, (lasttime + 5*HZ))) { 976 978 lasttime = jiffies; 977 979 xfs_alert(mp, "Device %s: metadata write error block 0x%llx", 978 - XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), 980 + xfs_buf_target_name(bp->b_target), 979 981 (__uint64_t)XFS_BUF_ADDR(bp)); 980 982 } 981 - lasttarg = XFS_BUF_TARGET(bp); 983 + lasttarg = bp->b_target; 982 984 983 985 /* 984 986 * If the write was asynchronous then no one will be looking for the ··· 989 991 * around. 990 992 */ 991 993 if (XFS_BUF_ISASYNC(bp)) { 992 - XFS_BUF_ERROR(bp, 0); /* errno of 0 unsets the flag */ 994 + xfs_buf_ioerror(bp, 0); /* errno of 0 unsets the flag */ 993 995 994 996 if (!XFS_BUF_ISSTALE(bp)) { 995 997 XFS_BUF_DELAYWRITE(bp); 996 998 XFS_BUF_DONE(bp); 997 - XFS_BUF_SET_START(bp); 998 999 } 999 1000 ASSERT(bp->b_iodone != NULL); 1000 1001 trace_xfs_buf_item_iodone_async(bp, _RET_IP_); ··· 1010 1013 XFS_BUF_UNDELAYWRITE(bp); 1011 1014 1012 1015 trace_xfs_buf_error_relse(bp, _RET_IP_); 1013 - xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); 1014 1016 1015 1017 do_callbacks: 1016 1018 xfs_buf_do_callbacks(bp);
+6 -6
fs/xfs/xfs_da_btree.c
··· 2050 2050 case 0: 2051 2051 bp = xfs_trans_get_buf(trans, mp->m_ddev_targp, 2052 2052 mappedbno, nmapped, 0); 2053 - error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); 2053 + error = bp ? bp->b_error : XFS_ERROR(EIO); 2054 2054 break; 2055 2055 case 1: 2056 2056 case 2: ··· 2268 2268 dabuf->nbuf = 1; 2269 2269 bp = bps[0]; 2270 2270 dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp)); 2271 - dabuf->data = XFS_BUF_PTR(bp); 2271 + dabuf->data = bp->b_addr; 2272 2272 dabuf->bps[0] = bp; 2273 2273 } else { 2274 2274 dabuf->nbuf = nbuf; ··· 2279 2279 dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP); 2280 2280 for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) { 2281 2281 bp = bps[i]; 2282 - memcpy((char *)dabuf->data + off, XFS_BUF_PTR(bp), 2282 + memcpy((char *)dabuf->data + off, bp->b_addr, 2283 2283 XFS_BUF_COUNT(bp)); 2284 2284 } 2285 2285 } ··· 2302 2302 for (i = off = 0; i < dabuf->nbuf; 2303 2303 i++, off += XFS_BUF_COUNT(bp)) { 2304 2304 bp = dabuf->bps[i]; 2305 - memcpy(XFS_BUF_PTR(bp), (char *)dabuf->data + off, 2306 - XFS_BUF_COUNT(bp)); 2305 + memcpy(bp->b_addr, dabuf->data + off, 2306 + XFS_BUF_COUNT(bp)); 2307 2307 } 2308 2308 } 2309 2309 } ··· 2340 2340 2341 2341 ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]); 2342 2342 if (dabuf->nbuf == 1) { 2343 - ASSERT(dabuf->data == (void *)XFS_BUF_PTR(dabuf->bps[0])); 2343 + ASSERT(dabuf->data == dabuf->bps[0]->b_addr); 2344 2344 xfs_trans_log_buf(tp, dabuf->bps[0], first, last); 2345 2345 return; 2346 2346 }
+1 -1
fs/xfs/xfs_dinode.h
··· 148 148 be32_to_cpu((dip)->di_nextents) : \ 149 149 be16_to_cpu((dip)->di_anextents)) 150 150 151 - #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) 151 + #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr)) 152 152 153 153 /* 154 154 * For block and character special files the 32bit dev_t is stored at the
+2 -3
fs/xfs/xfs_ialloc.c
··· 202 202 fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 203 203 mp->m_bsize * blks_per_cluster, 204 204 XBF_LOCK); 205 - ASSERT(fbuf); 206 - ASSERT(!XFS_BUF_GETERROR(fbuf)); 205 + ASSERT(!xfs_buf_geterror(fbuf)); 207 206 208 207 /* 209 208 * Initialize all inodes in this buffer and then log them. ··· 1485 1486 if (error) 1486 1487 return error; 1487 1488 1488 - ASSERT(*bpp && !XFS_BUF_GETERROR(*bpp)); 1489 + ASSERT(!xfs_buf_geterror(*bpp)); 1489 1490 agi = XFS_BUF_TO_AGI(*bpp); 1490 1491 1491 1492 /*
+2 -2
fs/xfs/xfs_inode.c
··· 2473 2473 if (bp->b_iodone) { 2474 2474 XFS_BUF_UNDONE(bp); 2475 2475 XFS_BUF_STALE(bp); 2476 - XFS_BUF_ERROR(bp,EIO); 2476 + xfs_buf_ioerror(bp, EIO); 2477 2477 xfs_buf_ioend(bp, 0); 2478 2478 } else { 2479 2479 XFS_BUF_STALE(bp); ··· 2585 2585 * If the buffer is pinned then push on the log now so we won't 2586 2586 * get stuck waiting in the write for too long. 2587 2587 */ 2588 - if (XFS_BUF_ISPINNED(bp)) 2588 + if (xfs_buf_ispinned(bp)) 2589 2589 xfs_log_force(mp, 0); 2590 2590 2591 2591 /*
+5 -9
fs/xfs/xfs_log.c
··· 878 878 /* 879 879 * Race to shutdown the filesystem if we see an error. 880 880 */ 881 - if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, 881 + if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp, 882 882 XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) { 883 883 xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp)); 884 884 XFS_BUF_STALE(bp); ··· 1051 1051 if (!bp) 1052 1052 goto out_free_log; 1053 1053 bp->b_iodone = xlog_iodone; 1054 - ASSERT(XFS_BUF_ISBUSY(bp)); 1055 1054 ASSERT(xfs_buf_islocked(bp)); 1056 1055 log->l_xbuf = bp; 1057 1056 ··· 1107 1108 iclog->ic_callback_tail = &(iclog->ic_callback); 1108 1109 iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; 1109 1110 1110 - ASSERT(XFS_BUF_ISBUSY(iclog->ic_bp)); 1111 1111 ASSERT(xfs_buf_islocked(iclog->ic_bp)); 1112 1112 init_waitqueue_head(&iclog->ic_force_wait); 1113 1113 init_waitqueue_head(&iclog->ic_write_wait); ··· 1246 1248 struct xlog_in_core *iclog = bp->b_fspriv; 1247 1249 1248 1250 if (iclog->ic_state & XLOG_STATE_IOERROR) { 1249 - XFS_BUF_ERROR(bp, EIO); 1251 + xfs_buf_ioerror(bp, EIO); 1250 1252 XFS_BUF_STALE(bp); 1251 1253 xfs_buf_ioend(bp, 0); 1252 1254 /* ··· 1353 1355 XFS_BUF_SET_COUNT(bp, count); 1354 1356 bp->b_fspriv = iclog; 1355 1357 XFS_BUF_ZEROFLAGS(bp); 1356 - XFS_BUF_BUSY(bp); 1357 1358 XFS_BUF_ASYNC(bp); 1358 1359 bp->b_flags |= XBF_SYNCIO; 1359 1360 ··· 1395 1398 if (split) { 1396 1399 bp = iclog->ic_log->l_xbuf; 1397 1400 XFS_BUF_SET_ADDR(bp, 0); /* logical 0 */ 1398 - XFS_BUF_SET_PTR(bp, (xfs_caddr_t)((__psint_t)&(iclog->ic_header)+ 1399 - (__psint_t)count), split); 1401 + xfs_buf_associate_memory(bp, 1402 + (char *)&iclog->ic_header + count, split); 1400 1403 bp->b_fspriv = iclog; 1401 1404 XFS_BUF_ZEROFLAGS(bp); 1402 - XFS_BUF_BUSY(bp); 1403 1405 XFS_BUF_ASYNC(bp); 1404 1406 bp->b_flags |= XBF_SYNCIO; 1405 1407 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) 1406 1408 bp->b_flags |= XBF_FUA; 1407 - dptr = XFS_BUF_PTR(bp); 1409 + dptr = bp->b_addr; 1408 1410 /* 1409 1411 * Bump the cycle numbers at the start of each block 1410 1412 * since this part of the buffer is at the start of
+19 -19
fs/xfs/xfs_log_recover.c
··· 147 147 xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); 148 148 149 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 178 179 179 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 180 180 XFS_BUF_READ(bp); 181 - XFS_BUF_BUSY(bp); 182 181 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 183 - XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); 184 182 185 183 xfsbdstrat(log->l_mp, bp); 186 184 error = xfs_buf_iowait(bp); ··· 218 220 xfs_buf_t *bp, 219 221 xfs_caddr_t offset) 220 222 { 221 - xfs_caddr_t orig_offset = XFS_BUF_PTR(bp); 223 + xfs_caddr_t orig_offset = bp->b_addr; 222 224 int orig_len = bp->b_buffer_length; 223 225 int error, error2; 224 226 225 - error = XFS_BUF_SET_PTR(bp, offset, BBTOB(nbblks)); 227 + error = xfs_buf_associate_memory(bp, offset, BBTOB(nbblks)); 226 228 if (error) 227 229 return error; 228 230 229 231 error = xlog_bread_noalign(log, blk_no, nbblks, bp); 230 232 231 233 /* must reset buffer pointer even on error */ 232 - error2 = XFS_BUF_SET_PTR(bp, orig_offset, orig_len); 234 + error2 = xfs_buf_associate_memory(bp, orig_offset, orig_len); 233 235 if (error) 234 236 return error; 235 237 return error2; ··· 264 266 265 267 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 266 268 XFS_BUF_ZEROFLAGS(bp); 267 - XFS_BUF_BUSY(bp); 268 - XFS_BUF_HOLD(bp); 269 + xfs_buf_hold(bp); 269 270 xfs_buf_lock(bp); 270 271 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 271 - XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp); 272 272 273 273 if ((error = xfs_bwrite(log->l_mp, bp))) 274 274 xfs_ioerror_alert("xlog_bwrite", log->l_mp, ··· 356 360 xlog_recover_iodone( 357 361 struct xfs_buf *bp) 358 362 { 359 - if (XFS_BUF_GETERROR(bp)) { 363 + if (bp->b_error) { 360 364 /* 361 365 * We're not going to bother about retrying 362 366 * this during recovery. One strike! ··· 1258 1262 */ 1259 1263 ealign = round_down(end_block, sectbb); 1260 1264 if (j == 0 && (start_block + endcount > ealign)) { 1261 - offset = XFS_BUF_PTR(bp) + BBTOB(ealign - start_block); 1265 + offset = bp->b_addr + BBTOB(ealign - start_block); 1262 1266 error = xlog_bread_offset(log, ealign, sectbb, 1263 1267 bp, offset); 1264 1268 if (error) ··· 2131 2135 2132 2136 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, 2133 2137 buf_flags); 2134 - if (XFS_BUF_ISERROR(bp)) { 2138 + if (!bp) 2139 + return XFS_ERROR(ENOMEM); 2140 + error = bp->b_error; 2141 + if (error) { 2135 2142 xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, 2136 2143 bp, buf_f->blf_blkno); 2137 - error = XFS_BUF_GETERROR(bp); 2138 2144 xfs_buf_relse(bp); 2139 2145 return error; 2140 2146 } 2141 2147 2142 - error = 0; 2143 2148 if (buf_f->blf_flags & XFS_BLF_INODE_BUF) { 2144 2149 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); 2145 2150 } else if (buf_f->blf_flags & ··· 2224 2227 2225 2228 bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, 2226 2229 XBF_LOCK); 2227 - if (XFS_BUF_ISERROR(bp)) { 2230 + if (!bp) { 2231 + error = ENOMEM; 2232 + goto error; 2233 + } 2234 + error = bp->b_error; 2235 + if (error) { 2228 2236 xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, 2229 2237 bp, in_f->ilf_blkno); 2230 - error = XFS_BUF_GETERROR(bp); 2231 2238 xfs_buf_relse(bp); 2232 2239 goto error; 2233 2240 } 2234 - error = 0; 2235 2241 ASSERT(in_f->ilf_fields & XFS_ILOG_CORE); 2236 2242 dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset); 2237 2243 ··· 3437 3437 /* 3438 3438 * Check for header wrapping around physical end-of-log 3439 3439 */ 3440 - offset = XFS_BUF_PTR(hbp); 3440 + offset = hbp->b_addr; 3441 3441 split_hblks = 0; 3442 3442 wrapped_hblks = 0; 3443 3443 if (blk_no + hblks <= log->l_logBBsize) { ··· 3497 3497 } else { 3498 3498 /* This log record is split across the 3499 3499 * physical end of log */ 3500 - offset = XFS_BUF_PTR(dbp); 3500 + offset = dbp->b_addr; 3501 3501 split_bblks = 0; 3502 3502 if (blk_no != log->l_logBBsize) { 3503 3503 /* some data is before the physical
+2 -2
fs/xfs/xfs_mount.c
··· 1615 1615 XFS_BUF_UNDELAYWRITE(sbp); 1616 1616 XFS_BUF_WRITE(sbp); 1617 1617 XFS_BUF_UNASYNC(sbp); 1618 - ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); 1618 + ASSERT(sbp->b_target == mp->m_ddev_targp); 1619 1619 xfsbdstrat(mp, sbp); 1620 1620 error = xfs_buf_iowait(sbp); 1621 1621 if (error) ··· 1938 1938 xfs_buf_lock(bp); 1939 1939 } 1940 1940 1941 - XFS_BUF_HOLD(bp); 1941 + xfs_buf_hold(bp); 1942 1942 ASSERT(XFS_BUF_ISDONE(bp)); 1943 1943 return bp; 1944 1944 }
+16 -16
fs/xfs/xfs_rtalloc.c
··· 168 168 xfs_trans_cancel(tp, cancelflags); 169 169 goto error; 170 170 } 171 - memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize); 171 + memset(bp->b_addr, 0, mp->m_sb.sb_blocksize); 172 172 xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); 173 173 /* 174 174 * Commit the transaction. ··· 883 883 if (error) { 884 884 return error; 885 885 } 886 - ASSERT(bp && !XFS_BUF_GETERROR(bp)); 886 + ASSERT(!xfs_buf_geterror(bp)); 887 887 *bpp = bp; 888 888 return 0; 889 889 } ··· 943 943 if (error) { 944 944 return error; 945 945 } 946 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 946 + bufp = bp->b_addr; 947 947 /* 948 948 * Compute the starting word's address, and starting bit. 949 949 */ ··· 994 994 if (error) { 995 995 return error; 996 996 } 997 - b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 997 + b = bufp = bp->b_addr; 998 998 word = 0; 999 999 } else { 1000 1000 /* ··· 1040 1040 if (error) { 1041 1041 return error; 1042 1042 } 1043 - b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1043 + b = bufp = bp->b_addr; 1044 1044 word = 0; 1045 1045 } else { 1046 1046 /* ··· 1158 1158 if (error) { 1159 1159 return error; 1160 1160 } 1161 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1161 + bufp = bp->b_addr; 1162 1162 /* 1163 1163 * Get the first word's index & point to it. 1164 1164 */ ··· 1210 1210 if (error) { 1211 1211 return error; 1212 1212 } 1213 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1213 + bufp = bp->b_addr; 1214 1214 word = XFS_BLOCKWMASK(mp); 1215 1215 b = &bufp[word]; 1216 1216 } else { ··· 1256 1256 if (error) { 1257 1257 return error; 1258 1258 } 1259 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1259 + bufp = bp->b_addr; 1260 1260 word = XFS_BLOCKWMASK(mp); 1261 1261 b = &bufp[word]; 1262 1262 } else { ··· 1333 1333 if (error) { 1334 1334 return error; 1335 1335 } 1336 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1336 + bufp = bp->b_addr; 1337 1337 /* 1338 1338 * Get the first word's index & point to it. 1339 1339 */ ··· 1384 1384 if (error) { 1385 1385 return error; 1386 1386 } 1387 - b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1387 + b = bufp = bp->b_addr; 1388 1388 word = 0; 1389 1389 } else { 1390 1390 /* ··· 1429 1429 if (error) { 1430 1430 return error; 1431 1431 } 1432 - b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1432 + b = bufp = bp->b_addr; 1433 1433 word = 0; 1434 1434 } else { 1435 1435 /* ··· 1649 1649 if (error) { 1650 1650 return error; 1651 1651 } 1652 - bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1652 + bufp = bp->b_addr; 1653 1653 /* 1654 1654 * Compute the starting word's address, and starting bit. 1655 1655 */ ··· 1694 1694 if (error) { 1695 1695 return error; 1696 1696 } 1697 - first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1697 + first = b = bufp = bp->b_addr; 1698 1698 word = 0; 1699 1699 } else { 1700 1700 /* ··· 1734 1734 if (error) { 1735 1735 return error; 1736 1736 } 1737 - first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1737 + first = b = bufp = bp->b_addr; 1738 1738 word = 0; 1739 1739 } else { 1740 1740 /* ··· 1832 1832 */ 1833 1833 sp = XFS_SUMPTR(mp, bp, so); 1834 1834 *sp += delta; 1835 - xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)XFS_BUF_PTR(bp)), 1836 - (uint)((char *)sp - (char *)XFS_BUF_PTR(bp) + sizeof(*sp) - 1)); 1835 + xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)bp->b_addr), 1836 + (uint)((char *)sp - (char *)bp->b_addr + sizeof(*sp) - 1)); 1837 1837 return 0; 1838 1838 } 1839 1839
+1 -1
fs/xfs/xfs_rtalloc.h
··· 47 47 #define XFS_SUMOFFSTOBLOCK(mp,s) \ 48 48 (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) 49 49 #define XFS_SUMPTR(mp,bp,so) \ 50 - ((xfs_suminfo_t *)((char *)XFS_BUF_PTR(bp) + \ 50 + ((xfs_suminfo_t *)((bp)->b_addr + \ 51 51 (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) 52 52 53 53 #define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log)
+4 -4
fs/xfs/xfs_rw.c
··· 104 104 xfs_alert(mp, 105 105 "I/O error occurred: meta-data dev %s block 0x%llx" 106 106 " (\"%s\") error %d buf count %zd", 107 - XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), 107 + xfs_buf_target_name(bp->b_target), 108 108 (__uint64_t)blkno, func, 109 - XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp)); 109 + bp->b_error, XFS_BUF_COUNT(bp)); 110 110 } 111 111 112 112 /* ··· 137 137 bp = xfs_buf_read(target, blkno, len, flags); 138 138 if (!bp) 139 139 return XFS_ERROR(EIO); 140 - error = XFS_BUF_GETERROR(bp); 141 - if (bp && !error && !XFS_FORCED_SHUTDOWN(mp)) { 140 + error = bp->b_error; 141 + if (!error && !XFS_FORCED_SHUTDOWN(mp)) { 142 142 *bpp = bp; 143 143 } else { 144 144 *bpp = NULL;
+1 -1
fs/xfs/xfs_sb.h
··· 509 509 510 510 #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 511 511 #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 512 - #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp)) 512 + #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr)) 513 513 514 514 #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) 515 515 #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
+29 -38
fs/xfs/xfs_trans_ail.c
··· 299 299 * Splice the log item list into the AIL at the given LSN. We splice to the 300 300 * tail of the given LSN to maintain insert order for push traversals. The 301 301 * cursor is optional, allowing repeated updates to the same LSN to avoid 302 - * repeated traversals. 302 + * repeated traversals. This should not be called with an empty list. 303 303 */ 304 304 static void 305 305 xfs_ail_splice( ··· 308 308 struct list_head *list, 309 309 xfs_lsn_t lsn) 310 310 { 311 - struct xfs_log_item *lip = cur ? cur->item : NULL; 312 - struct xfs_log_item *next_lip; 311 + struct xfs_log_item *lip; 312 + 313 + ASSERT(!list_empty(list)); 313 314 314 315 /* 315 - * Get a new cursor if we don't have a placeholder or the existing one 316 - * has been invalidated. 316 + * Use the cursor to determine the insertion point if one is 317 + * provided. If not, or if the one we got is not valid, 318 + * find the place in the AIL where the items belong. 317 319 */ 318 - if (!lip || (__psint_t)lip & 1) { 320 + lip = cur ? cur->item : NULL; 321 + if (!lip || (__psint_t) lip & 1) 319 322 lip = __xfs_trans_ail_cursor_last(ailp, lsn); 320 323 321 - if (!lip) { 322 - /* The list is empty, so just splice and return. */ 323 - if (cur) 324 - cur->item = NULL; 325 - list_splice(list, &ailp->xa_ail); 326 - return; 327 - } 328 - } 324 + /* 325 + * If a cursor is provided, we know we're processing the AIL 326 + * in lsn order, and future items to be spliced in will 327 + * follow the last one being inserted now. Update the 328 + * cursor to point to that last item, now while we have a 329 + * reliable pointer to it. 330 + */ 331 + if (cur) 332 + cur->item = list_entry(list->prev, struct xfs_log_item, li_ail); 329 333 330 334 /* 331 - * Our cursor points to the item we want to insert _after_, so we have 332 - * to update the cursor to point to the end of the list we are splicing 333 - * in so that it points to the correct location for the next splice. 334 - * i.e. before the splice 335 - * 336 - * lsn -> lsn -> lsn + x -> lsn + x ... 337 - * ^ 338 - * | cursor points here 339 - * 340 - * After the splice we have: 341 - * 342 - * lsn -> lsn -> lsn -> lsn -> .... -> lsn -> lsn + x -> lsn + x ... 343 - * ^ ^ 344 - * | cursor points here | needs to move here 345 - * 346 - * So we set the cursor to the last item in the list to be spliced 347 - * before we execute the splice, resulting in the cursor pointing to 348 - * the correct item after the splice occurs. 335 + * Finally perform the splice. Unless the AIL was empty, 336 + * lip points to the item in the AIL _after_ which the new 337 + * items should go. If lip is null the AIL was empty, so 338 + * the new items go at the head of the AIL. 349 339 */ 350 - if (cur) { 351 - next_lip = list_entry(list->prev, struct xfs_log_item, li_ail); 352 - cur->item = next_lip; 353 - } 354 - list_splice(list, &lip->li_ail); 340 + if (lip) 341 + list_splice(list, &lip->li_ail); 342 + else 343 + list_splice(list, &ailp->xa_ail); 355 344 } 356 345 357 346 /* ··· 671 682 int i; 672 683 LIST_HEAD(tmp); 673 684 685 + ASSERT(nr_items > 0); /* Not required, but true. */ 674 686 mlip = xfs_ail_min(ailp); 675 687 676 688 for (i = 0; i < nr_items; i++) { ··· 691 701 list_add(&lip->li_ail, &tmp); 692 702 } 693 703 694 - xfs_ail_splice(ailp, cur, &tmp, lsn); 704 + if (!list_empty(&tmp)) 705 + xfs_ail_splice(ailp, cur, &tmp, lsn); 695 706 696 707 if (!mlip_changed) { 697 708 spin_unlock(&ailp->xa_lock);
+9 -19
fs/xfs/xfs_trans_buf.c
··· 54 54 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 55 55 blip = (struct xfs_buf_log_item *)lidp->lid_item; 56 56 if (blip->bli_item.li_type == XFS_LI_BUF && 57 - XFS_BUF_TARGET(blip->bli_buf) == target && 57 + blip->bli_buf->b_target == target && 58 58 XFS_BUF_ADDR(blip->bli_buf) == blkno && 59 59 XFS_BUF_COUNT(blip->bli_buf) == len) 60 60 return blip->bli_buf; ··· 80 80 { 81 81 struct xfs_buf_log_item *bip; 82 82 83 - ASSERT(XFS_BUF_ISBUSY(bp)); 84 83 ASSERT(bp->b_transp == NULL); 85 84 86 85 /* ··· 193 194 return NULL; 194 195 } 195 196 196 - ASSERT(!XFS_BUF_GETERROR(bp)); 197 + ASSERT(!bp->b_error); 197 198 198 199 _xfs_trans_bjoin(tp, bp, 1); 199 200 trace_xfs_trans_get_buf(bp->b_fspriv); ··· 292 293 return (flags & XBF_TRYLOCK) ? 293 294 EAGAIN : XFS_ERROR(ENOMEM); 294 295 295 - if (XFS_BUF_GETERROR(bp) != 0) { 296 + if (bp->b_error) { 297 + error = bp->b_error; 296 298 xfs_ioerror_alert("xfs_trans_read_buf", mp, 297 299 bp, blkno); 298 - error = XFS_BUF_GETERROR(bp); 299 300 xfs_buf_relse(bp); 300 301 return error; 301 302 } ··· 329 330 ASSERT(xfs_buf_islocked(bp)); 330 331 ASSERT(bp->b_transp == tp); 331 332 ASSERT(bp->b_fspriv != NULL); 332 - ASSERT((XFS_BUF_ISERROR(bp)) == 0); 333 + ASSERT(!bp->b_error); 333 334 if (!(XFS_BUF_ISDONE(bp))) { 334 335 trace_xfs_trans_read_buf_io(bp, _RET_IP_); 335 336 ASSERT(!XFS_BUF_ISASYNC(bp)); ··· 385 386 return (flags & XBF_TRYLOCK) ? 386 387 0 : XFS_ERROR(ENOMEM); 387 388 } 388 - if (XFS_BUF_GETERROR(bp) != 0) { 389 - XFS_BUF_SUPER_STALE(bp); 390 - error = XFS_BUF_GETERROR(bp); 391 - 389 + if (bp->b_error) { 390 + error = bp->b_error; 391 + XFS_BUF_SUPER_STALE(bp); 392 392 xfs_ioerror_alert("xfs_trans_read_buf", mp, 393 393 bp, blkno); 394 394 if (tp->t_flags & XFS_TRANS_DIRTY) ··· 428 430 if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp)) 429 431 xfs_notice(mp, "about to pop assert, bp == 0x%p", bp); 430 432 #endif 431 - ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) != 433 + ASSERT((bp->b_flags & (XBF_STALE|XBF_DELWRI)) != 432 434 (XBF_STALE|XBF_DELWRI)); 433 435 434 436 trace_xfs_trans_read_buf_shut(bp, _RET_IP_); ··· 579 581 { 580 582 xfs_buf_log_item_t *bip = bp->b_fspriv; 581 583 582 - ASSERT(XFS_BUF_ISBUSY(bp)); 583 584 ASSERT(bp->b_transp == tp); 584 585 ASSERT(bip != NULL); 585 586 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ··· 599 602 { 600 603 xfs_buf_log_item_t *bip = bp->b_fspriv; 601 604 602 - ASSERT(XFS_BUF_ISBUSY(bp)); 603 605 ASSERT(bp->b_transp == tp); 604 606 ASSERT(bip != NULL); 605 607 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ··· 627 631 { 628 632 xfs_buf_log_item_t *bip = bp->b_fspriv; 629 633 630 - ASSERT(XFS_BUF_ISBUSY(bp)); 631 634 ASSERT(bp->b_transp == tp); 632 635 ASSERT(bip != NULL); 633 636 ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp))); ··· 697 702 { 698 703 xfs_buf_log_item_t *bip = bp->b_fspriv; 699 704 700 - ASSERT(XFS_BUF_ISBUSY(bp)); 701 705 ASSERT(bp->b_transp == tp); 702 706 ASSERT(bip != NULL); 703 707 ASSERT(atomic_read(&bip->bli_refcount) > 0); ··· 768 774 { 769 775 xfs_buf_log_item_t *bip = bp->b_fspriv; 770 776 771 - ASSERT(XFS_BUF_ISBUSY(bp)); 772 777 ASSERT(bp->b_transp == tp); 773 778 ASSERT(bip != NULL); 774 779 ASSERT(atomic_read(&bip->bli_refcount) > 0); ··· 791 798 { 792 799 xfs_buf_log_item_t *bip = bp->b_fspriv; 793 800 794 - ASSERT(XFS_BUF_ISBUSY(bp)); 795 801 ASSERT(bp->b_transp == tp); 796 802 ASSERT(bip != NULL); 797 803 ASSERT(atomic_read(&bip->bli_refcount) > 0); ··· 815 823 { 816 824 xfs_buf_log_item_t *bip = bp->b_fspriv; 817 825 818 - ASSERT(XFS_BUF_ISBUSY(bp)); 819 826 ASSERT(bp->b_transp == tp); 820 827 ASSERT(bip != NULL); 821 828 ASSERT(atomic_read(&bip->bli_refcount) > 0); ··· 842 851 { 843 852 xfs_buf_log_item_t *bip = bp->b_fspriv; 844 853 845 - ASSERT(XFS_BUF_ISBUSY(bp)); 846 854 ASSERT(bp->b_transp == tp); 847 855 ASSERT(bip != NULL); 848 856 ASSERT(type == XFS_BLF_UDQUOT_BUF ||
+7 -5
fs/xfs/xfs_vnodeops.c
··· 83 83 84 84 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 85 85 XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK); 86 - error = XFS_BUF_GETERROR(bp); 86 + if (!bp) 87 + return XFS_ERROR(ENOMEM); 88 + error = bp->b_error; 87 89 if (error) { 88 90 xfs_ioerror_alert("xfs_readlink", 89 91 ip->i_mount, bp, XFS_BUF_ADDR(bp)); ··· 96 94 byte_cnt = pathlen; 97 95 pathlen -= byte_cnt; 98 96 99 - memcpy(link, XFS_BUF_PTR(bp), byte_cnt); 97 + memcpy(link, bp->b_addr, byte_cnt); 100 98 xfs_buf_relse(bp); 101 99 } 102 100 ··· 1650 1648 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); 1651 1649 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 1652 1650 BTOBB(byte_cnt), 0); 1653 - ASSERT(bp && !XFS_BUF_GETERROR(bp)); 1651 + ASSERT(!xfs_buf_geterror(bp)); 1654 1652 if (pathlen < byte_cnt) { 1655 1653 byte_cnt = pathlen; 1656 1654 } 1657 1655 pathlen -= byte_cnt; 1658 1656 1659 - memcpy(XFS_BUF_PTR(bp), cur_chunk, byte_cnt); 1657 + memcpy(bp->b_addr, cur_chunk, byte_cnt); 1660 1658 cur_chunk += byte_cnt; 1661 1659 1662 1660 xfs_trans_log_buf(tp, bp, 0, byte_cnt - 1); ··· 2001 1999 mp, bp, XFS_BUF_ADDR(bp)); 2002 2000 break; 2003 2001 } 2004 - memset(XFS_BUF_PTR(bp) + 2002 + memset(bp->b_addr + 2005 2003 (offset - XFS_FSB_TO_B(mp, imap.br_startoff)), 2006 2004 0, lastoffset - offset + 1); 2007 2005 XFS_BUF_UNDONE(bp);