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 tag 'for-linus-v3.8-rc4' of git://oss.sgi.com/xfs/xfs

Pull xfs bugfixes from Ben Myers:

- fix(es) for compound buffers

- fix for dquot soft timer asserts due to overflow of d_blk_softlimit

- fix for regression in dir v2 code introduced in commit 20f7e9f3726a
("xfs: factor dir2 block read operations")

* tag 'for-linus-v3.8-rc4' of git://oss.sgi.com/xfs/xfs:
xfs: recalculate leaf entry pointer after compacting a dir2 block
xfs: remove int casts from debug dquot soft limit timer asserts
xfs: fix the multi-segment log buffer format
xfs: fix segment in xfs_buf_item_format_segment
xfs: rename bli_format to avoid confusion with bli_formats
xfs: use b_maps[] for discontiguous buffers

+64 -42
+6 -6
fs/xfs/xfs_buf.c
··· 175 175 bp->b_map_count = map_count; 176 176 177 177 if (map_count == 1) { 178 - bp->b_maps = &bp->b_map; 178 + bp->b_maps = &bp->__b_map; 179 179 return 0; 180 180 } 181 181 ··· 193 193 xfs_buf_free_maps( 194 194 struct xfs_buf *bp) 195 195 { 196 - if (bp->b_maps != &bp->b_map) { 196 + if (bp->b_maps != &bp->__b_map) { 197 197 kmem_free(bp->b_maps); 198 198 bp->b_maps = NULL; 199 199 } ··· 377 377 } 378 378 379 379 use_alloc_page: 380 - start = BBTOB(bp->b_map.bm_bn) >> PAGE_SHIFT; 381 - end = (BBTOB(bp->b_map.bm_bn + bp->b_length) + PAGE_SIZE - 1) 380 + start = BBTOB(bp->b_maps[0].bm_bn) >> PAGE_SHIFT; 381 + end = (BBTOB(bp->b_maps[0].bm_bn + bp->b_length) + PAGE_SIZE - 1) 382 382 >> PAGE_SHIFT; 383 383 page_count = end - start; 384 384 error = _xfs_buf_get_pages(bp, page_count, flags); ··· 640 640 xfs_buf_flags_t flags) 641 641 { 642 642 ASSERT(!(flags & XBF_WRITE)); 643 - ASSERT(bp->b_map.bm_bn != XFS_BUF_DADDR_NULL); 643 + ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL); 644 644 645 645 bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD); 646 646 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); ··· 1709 1709 struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); 1710 1710 xfs_daddr_t diff; 1711 1711 1712 - diff = ap->b_map.bm_bn - bp->b_map.bm_bn; 1712 + diff = ap->b_maps[0].bm_bn - bp->b_maps[0].bm_bn; 1713 1713 if (diff < 0) 1714 1714 return -1; 1715 1715 if (diff > 0)
+3 -3
fs/xfs/xfs_buf.h
··· 151 151 struct page **b_pages; /* array of page pointers */ 152 152 struct page *b_page_array[XB_PAGES]; /* inline pages */ 153 153 struct xfs_buf_map *b_maps; /* compound buffer map */ 154 - struct xfs_buf_map b_map; /* inline compound buffer map */ 154 + struct xfs_buf_map __b_map; /* inline compound buffer map */ 155 155 int b_map_count; 156 156 int b_io_length; /* IO size in BBs */ 157 157 atomic_t b_pin_count; /* pin count */ ··· 330 330 * In future, uncached buffers will pass the block number directly to the io 331 331 * request function and hence these macros will go away at that point. 332 332 */ 333 - #define XFS_BUF_ADDR(bp) ((bp)->b_map.bm_bn) 334 - #define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno)) 333 + #define XFS_BUF_ADDR(bp) ((bp)->b_maps[0].bm_bn) 334 + #define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_maps[0].bm_bn = (xfs_daddr_t)(bno)) 335 335 336 336 static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) 337 337 {
+33 -16
fs/xfs/xfs_buf_item.c
··· 71 71 chunk_num = byte >> XFS_BLF_SHIFT; 72 72 word_num = chunk_num >> BIT_TO_WORD_SHIFT; 73 73 bit_num = chunk_num & (NBWORD - 1); 74 - wordp = &(bip->bli_format.blf_data_map[word_num]); 74 + wordp = &(bip->__bli_format.blf_data_map[word_num]); 75 75 bit_set = *wordp & (1 << bit_num); 76 76 ASSERT(bit_set); 77 77 byte++; ··· 237 237 * cancel flag in it. 238 238 */ 239 239 trace_xfs_buf_item_size_stale(bip); 240 - ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 240 + ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 241 241 return bip->bli_format_count; 242 242 } 243 243 ··· 278 278 uint buffer_offset; 279 279 280 280 /* copy the flags across from the base format item */ 281 - blfp->blf_flags = bip->bli_format.blf_flags; 281 + blfp->blf_flags = bip->__bli_format.blf_flags; 282 282 283 283 /* 284 284 * Base size is the actual size of the ondisk structure - it reflects ··· 287 287 */ 288 288 base_size = offsetof(struct xfs_buf_log_format, blf_data_map) + 289 289 (blfp->blf_map_size * sizeof(blfp->blf_data_map[0])); 290 + 291 + nvecs = 0; 292 + first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0); 293 + if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) { 294 + /* 295 + * If the map is not be dirty in the transaction, mark 296 + * the size as zero and do not advance the vector pointer. 297 + */ 298 + goto out; 299 + } 300 + 290 301 vecp->i_addr = blfp; 291 302 vecp->i_len = base_size; 292 303 vecp->i_type = XLOG_REG_TYPE_BFORMAT; ··· 312 301 */ 313 302 trace_xfs_buf_item_format_stale(bip); 314 303 ASSERT(blfp->blf_flags & XFS_BLF_CANCEL); 315 - blfp->blf_size = nvecs; 316 - return vecp; 304 + goto out; 317 305 } 318 306 319 307 /* 320 308 * Fill in an iovec for each set of contiguous chunks. 321 309 */ 322 - first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0); 323 - ASSERT(first_bit != -1); 310 + 324 311 last_bit = first_bit; 325 312 nbits = 1; 326 313 for (;;) { ··· 380 371 nbits++; 381 372 } 382 373 } 383 - bip->bli_format.blf_size = nvecs; 374 + out: 375 + blfp->blf_size = nvecs; 384 376 return vecp; 385 377 } 386 378 ··· 415 405 if (bip->bli_flags & XFS_BLI_INODE_BUF) { 416 406 if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && 417 407 xfs_log_item_in_current_chkpt(lip))) 418 - bip->bli_format.blf_flags |= XFS_BLF_INODE_BUF; 408 + bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF; 419 409 bip->bli_flags &= ~XFS_BLI_INODE_BUF; 420 410 } 421 411 ··· 495 485 ASSERT(bip->bli_flags & XFS_BLI_STALE); 496 486 ASSERT(xfs_buf_islocked(bp)); 497 487 ASSERT(XFS_BUF_ISSTALE(bp)); 498 - ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 488 + ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 499 489 500 490 trace_xfs_buf_item_unpin_stale(bip); 501 491 ··· 611 601 { 612 602 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 613 603 struct xfs_buf *bp = bip->bli_buf; 614 - int aborted; 604 + int aborted, clean, i; 615 605 uint hold; 616 606 617 607 /* Clear the buffer's association with this transaction. */ ··· 641 631 */ 642 632 if (bip->bli_flags & XFS_BLI_STALE) { 643 633 trace_xfs_buf_item_unlock_stale(bip); 644 - ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 634 + ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 645 635 if (!aborted) { 646 636 atomic_dec(&bip->bli_refcount); 647 637 return; ··· 654 644 * If the buf item isn't tracking any data, free it, otherwise drop the 655 645 * reference we hold to it. 656 646 */ 657 - if (xfs_bitmap_empty(bip->bli_format.blf_data_map, 658 - bip->bli_format.blf_map_size)) 647 + clean = 1; 648 + for (i = 0; i < bip->bli_format_count; i++) { 649 + if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map, 650 + bip->bli_formats[i].blf_map_size)) { 651 + clean = 0; 652 + break; 653 + } 654 + } 655 + if (clean) 659 656 xfs_buf_item_relse(bp); 660 657 else 661 658 atomic_dec(&bip->bli_refcount); ··· 733 716 bip->bli_format_count = count; 734 717 735 718 if (count == 1) { 736 - bip->bli_formats = &bip->bli_format; 719 + bip->bli_formats = &bip->__bli_format; 737 720 return 0; 738 721 } 739 722 ··· 748 731 xfs_buf_item_free_format( 749 732 struct xfs_buf_log_item *bip) 750 733 { 751 - if (bip->bli_formats != &bip->bli_format) { 734 + if (bip->bli_formats != &bip->__bli_format) { 752 735 kmem_free(bip->bli_formats); 753 736 bip->bli_formats = NULL; 754 737 }
+1 -1
fs/xfs/xfs_buf_item.h
··· 104 104 #endif 105 105 int bli_format_count; /* count of headers */ 106 106 struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ 107 - struct xfs_buf_log_format bli_format; /* embedded in-log header */ 107 + struct xfs_buf_log_format __bli_format; /* embedded in-log header */ 108 108 } xfs_buf_log_item_t; 109 109 110 110 void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
+4 -2
fs/xfs/xfs_dir2_block.c
··· 355 355 /* 356 356 * If need to compact the leaf entries, do it now. 357 357 */ 358 - if (compact) 358 + if (compact) { 359 359 xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog, 360 360 &lfloghigh, &lfloglow); 361 - else if (btp->stale) { 361 + /* recalculate blp post-compaction */ 362 + blp = xfs_dir2_block_leaf_p(btp); 363 + } else if (btp->stale) { 362 364 /* 363 365 * Set leaf logging boundaries to impossible state. 364 366 * For the no-stale case they're set explicitly.
+2 -2
fs/xfs/xfs_qm_syscalls.c
··· 784 784 (XFS_IS_OQUOTA_ENFORCED(mp) && 785 785 (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && 786 786 dst->d_id != 0) { 787 - if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) && 787 + if ((dst->d_bcount > dst->d_blk_softlimit) && 788 788 (dst->d_blk_softlimit > 0)) { 789 789 ASSERT(dst->d_btimer != 0); 790 790 } 791 - if (((int) dst->d_icount > (int) dst->d_ino_softlimit) && 791 + if ((dst->d_icount > dst->d_ino_softlimit) && 792 792 (dst->d_ino_softlimit > 0)) { 793 793 ASSERT(dst->d_itimer != 0); 794 794 }
+15 -12
fs/xfs/xfs_trans_buf.c
··· 93 93 xfs_buf_item_init(bp, tp->t_mountp); 94 94 bip = bp->b_fspriv; 95 95 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 96 - ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 96 + ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 97 97 ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED)); 98 98 if (reset_recur) 99 99 bip->bli_recur = 0; ··· 432 432 bip = bp->b_fspriv; 433 433 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); 434 434 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 435 - ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 435 + ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 436 436 ASSERT(atomic_read(&bip->bli_refcount) > 0); 437 437 438 438 trace_xfs_trans_brelse(bip); ··· 519 519 ASSERT(bp->b_transp == tp); 520 520 ASSERT(bip != NULL); 521 521 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 522 - ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 522 + ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 523 523 ASSERT(atomic_read(&bip->bli_refcount) > 0); 524 524 525 525 bip->bli_flags |= XFS_BLI_HOLD; ··· 539 539 ASSERT(bp->b_transp == tp); 540 540 ASSERT(bip != NULL); 541 541 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 542 - ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 542 + ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 543 543 ASSERT(atomic_read(&bip->bli_refcount) > 0); 544 544 ASSERT(bip->bli_flags & XFS_BLI_HOLD); 545 545 ··· 598 598 bip->bli_flags &= ~XFS_BLI_STALE; 599 599 ASSERT(XFS_BUF_ISSTALE(bp)); 600 600 XFS_BUF_UNSTALE(bp); 601 - bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL; 601 + bip->__bli_format.blf_flags &= ~XFS_BLF_CANCEL; 602 602 } 603 603 604 604 tp->t_flags |= XFS_TRANS_DIRTY; ··· 643 643 xfs_buf_t *bp) 644 644 { 645 645 xfs_buf_log_item_t *bip = bp->b_fspriv; 646 + int i; 646 647 647 648 ASSERT(bp->b_transp == tp); 648 649 ASSERT(bip != NULL); ··· 658 657 */ 659 658 ASSERT(XFS_BUF_ISSTALE(bp)); 660 659 ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY))); 661 - ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF)); 662 - ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 660 + ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_INODE_BUF)); 661 + ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 663 662 ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY); 664 663 ASSERT(tp->t_flags & XFS_TRANS_DIRTY); 665 664 return; ··· 669 668 670 669 bip->bli_flags |= XFS_BLI_STALE; 671 670 bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY); 672 - bip->bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; 673 - bip->bli_format.blf_flags |= XFS_BLF_CANCEL; 674 - memset((char *)(bip->bli_format.blf_data_map), 0, 675 - (bip->bli_format.blf_map_size * sizeof(uint))); 671 + bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; 672 + bip->__bli_format.blf_flags |= XFS_BLF_CANCEL; 673 + for (i = 0; i < bip->bli_format_count; i++) { 674 + memset(bip->bli_formats[i].blf_data_map, 0, 675 + (bip->bli_formats[i].blf_map_size * sizeof(uint))); 676 + } 676 677 bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; 677 678 tp->t_flags |= XFS_TRANS_DIRTY; 678 679 } ··· 778 775 type == XFS_BLF_GDQUOT_BUF); 779 776 ASSERT(atomic_read(&bip->bli_refcount) > 0); 780 777 781 - bip->bli_format.blf_flags |= type; 778 + bip->__bli_format.blf_flags |= type; 782 779 }