diff options
| -rw-r--r-- | fs/ocfs2/alloc.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index edaab05a93e0..f43bc5f18a35 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
| @@ -1717,17 +1717,29 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, | |||
| 1717 | 1717 | ||
| 1718 | ocfs2_remove_from_cache(inode, eb_bh); | 1718 | ocfs2_remove_from_cache(inode, eb_bh); |
| 1719 | 1719 | ||
| 1720 | BUG_ON(eb->h_suballoc_slot); | ||
| 1721 | BUG_ON(el->l_recs[0].e_clusters); | 1720 | BUG_ON(el->l_recs[0].e_clusters); |
| 1722 | BUG_ON(el->l_recs[0].e_cpos); | 1721 | BUG_ON(el->l_recs[0].e_cpos); |
| 1723 | BUG_ON(el->l_recs[0].e_blkno); | 1722 | BUG_ON(el->l_recs[0].e_blkno); |
| 1724 | status = ocfs2_free_extent_block(handle, | 1723 | if (eb->h_suballoc_slot == 0) { |
| 1725 | tc->tc_ext_alloc_inode, | 1724 | /* |
| 1726 | tc->tc_ext_alloc_bh, | 1725 | * This code only understands how to |
| 1727 | eb); | 1726 | * lock the suballocator in slot 0, |
| 1728 | if (status < 0) { | 1727 | * which is fine because allocation is |
| 1729 | mlog_errno(status); | 1728 | * only ever done out of that |
| 1730 | goto bail; | 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 | brelse(eb_bh); | 1745 | brelse(eb_bh); |
