tree: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git xfs-4.14-merge head: 538547735d0ded2e0320a7485ec2242fcab12653 commit: a097077ef708e6822399c34be58452a406b0138d [18/35] xfs: remove unnecessary dirty bli format check for ordered bufs config: x86_64-randconfig-b0-08311231 (attached as .config) compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce: git checkout a097077ef708e6822399c34be58452a406b0138d # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): fs//xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock': >> fs//xfs/xfs_buf_item.c:581: warning: unused variable 'ordered' vim +/ordered +581 fs//xfs/xfs_buf_item.c 552 553 /* 554 * Release the buffer associated with the buf log item. If there is no dirty 555 * logged data associated with the buffer recorded in the buf log item, then 556 * free the buf log item and remove the reference to it in the buffer. 557 * 558 * This call ignores the recursion count. It is only called when the buffer 559 * should REALLY be unlocked, regardless of the recursion count. 560 * 561 * We unconditionally drop the transaction's reference to the log item. If the 562 * item was logged, then another reference was taken when it was pinned, so we 563 * can safely drop the transaction reference now. This also allows us to avoid 564 * potential races with the unpin code freeing the bli by not referencing the 565 * bli after we've dropped the reference count. 566 * 567 * If the XFS_BLI_HOLD flag is set in the buf log item, then free the log item 568 * if necessary but do not unlock the buffer. This is for support of 569 * xfs_trans_bhold(). Make sure the XFS_BLI_HOLD field is cleared if we don't 570 * free the item. 571 */ 572 STATIC void 573 xfs_buf_item_unlock( 574 struct xfs_log_item *lip) 575 { 576 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 577 struct xfs_buf *bp = bip->bli_buf; 578 bool aborted = !!(lip->li_flags & XFS_LI_ABORTED); 579 bool hold = !!(bip->bli_flags & XFS_BLI_HOLD); 580 bool dirty = !!(bip->bli_flags & XFS_BLI_DIRTY); > 581 bool ordered = !!(bip->bli_flags & XFS_BLI_ORDERED); 582 583 /* Clear the buffer's association with this transaction. */ 584 bp->b_transp = NULL; 585 586 /* 587 * The per-transaction state has been copied above so clear it from the 588 * bli. 589 */ 590 bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED); 591 592 /* 593 * If the buf item is marked stale, then don't do anything. We'll 594 * unlock the buffer and free the buf item when the buffer is unpinned 595 * for the last time. 596 */ 597 if (bip->bli_flags & XFS_BLI_STALE) { 598 trace_xfs_buf_item_unlock_stale(bip); 599 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 600 if (!aborted) { 601 atomic_dec(&bip->bli_refcount); 602 return; 603 } 604 } 605 606 trace_xfs_buf_item_unlock(bip); 607 608 /* 609 * If the buf item isn't tracking any data, free it, otherwise drop the 610 * reference we hold to it. If we are aborting the transaction, this may 611 * be the only reference to the buf item, so we free it anyway 612 * regardless of whether it is dirty or not. A dirty abort implies a 613 * shutdown, anyway. 614 * 615 * The bli dirty state should match whether the blf has logged segments 616 * except for ordered buffers, where only the bli should be dirty. 617 */ 618 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) || 619 (ordered && dirty && !xfs_buf_item_dirty_format(bip))); 620 621 /* 622 * Clean buffers, by definition, cannot be in the AIL. However, aborted 623 * buffers may be in the AIL regardless of dirty state. An aborted 624 * transaction that invalidates a buffer already in the AIL may have 625 * marked it stale and cleared the dirty state, for example. 626 * 627 * Therefore if we are aborting a buffer and we've just taken the last 628 * reference away, we have to check if it is in the AIL before freeing 629 * it. We need to free it in this case, because an aborted transaction 630 * has already shut the filesystem down and this is the last chance we 631 * will have to do so. 632 */ 633 if (atomic_dec_and_test(&bip->bli_refcount)) { 634 if (aborted) { 635 ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp)); 636 xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR); 637 xfs_buf_item_relse(bp); 638 } else if (!dirty) 639 xfs_buf_item_relse(bp); 640 } 641 642 if (!hold) 643 xfs_buf_relse(bp); 644 } 645 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip