Commit eb35746ca5e2211569b91ebb44d55b88ec91f3b0

Authored by Mark Fasheh
1 parent f12033d206

ocfs2: Remove overzealous BUG_ON()

The truncate code was never supposed to BUG() on an allocator it doesn't
know about, but rather to ignore it. Right now, this does nothing, but when
we change our allocation paths to use all suballocator files, this will
allow current versions of the fs module to work fine.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

Showing 1 changed file with 20 additions and 8 deletions Side-by-side Diff

... ... @@ -1717,17 +1717,29 @@
1717 1717  
1718 1718 ocfs2_remove_from_cache(inode, eb_bh);
1719 1719  
1720   - BUG_ON(eb->h_suballoc_slot);
1721 1720 BUG_ON(el->l_recs[0].e_clusters);
1722 1721 BUG_ON(el->l_recs[0].e_cpos);
1723 1722 BUG_ON(el->l_recs[0].e_blkno);
1724   - status = ocfs2_free_extent_block(handle,
1725   - tc->tc_ext_alloc_inode,
1726   - tc->tc_ext_alloc_bh,
1727   - eb);
1728   - if (status < 0) {
1729   - mlog_errno(status);
1730   - goto bail;
  1723 + if (eb->h_suballoc_slot == 0) {
  1724 + /*
  1725 + * This code only understands how to
  1726 + * lock the suballocator in slot 0,
  1727 + * which is fine because allocation is
  1728 + * only ever done out of that
  1729 + * suballocator too. A future version
  1730 + * might change that however, so avoid
  1731 + * a free if we don't know how to
  1732 + * handle it. This way an fs incompat
  1733 + * bit will not be necessary.
  1734 + */
  1735 + status = ocfs2_free_extent_block(handle,
  1736 + tc->tc_ext_alloc_inode,
  1737 + tc->tc_ext_alloc_bh,
  1738 + eb);
  1739 + if (status < 0) {
  1740 + mlog_errno(status);
  1741 + goto bail;
  1742 + }
1731 1743 }
1732 1744 }
1733 1745 brelse(eb_bh);