diff options
author | Dave Chinner <david@fromorbit.com> | 2014-05-14 19:37:44 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-05-14 19:37:44 -0400 |
commit | b76769294ba400415fc44038c21cc2df86f9a28b (patch) | |
tree | a1ca6152391c86ae024e09d69e7b0ad75a5c61d5 /fs/xfs/xfs_inode.c | |
parent | 232c2f5c65dd80055e7163a5c82e3816119330e6 (diff) | |
parent | 53801fd97ae000793f51187b122b9475102199a8 (diff) |
Merge branch 'xfs-free-inode-btree' into for-next
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6bbfcf0b3bb2..6d6b44a508f9 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1811,9 +1811,33 @@ xfs_inactive_ifree( | |||
1811 | int error; | 1811 | int error; |
1812 | 1812 | ||
1813 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 1813 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
1814 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, 0, 0); | 1814 | |
1815 | /* | ||
1816 | * The ifree transaction might need to allocate blocks for record | ||
1817 | * insertion to the finobt. We don't want to fail here at ENOSPC, so | ||
1818 | * allow ifree to dip into the reserved block pool if necessary. | ||
1819 | * | ||
1820 | * Freeing large sets of inodes generally means freeing inode chunks, | ||
1821 | * directory and file data blocks, so this should be relatively safe. | ||
1822 | * Only under severe circumstances should it be possible to free enough | ||
1823 | * inodes to exhaust the reserve block pool via finobt expansion while | ||
1824 | * at the same time not creating free space in the filesystem. | ||
1825 | * | ||
1826 | * Send a warning if the reservation does happen to fail, as the inode | ||
1827 | * now remains allocated and sits on the unlinked list until the fs is | ||
1828 | * repaired. | ||
1829 | */ | ||
1830 | tp->t_flags |= XFS_TRANS_RESERVE; | ||
1831 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, | ||
1832 | XFS_IFREE_SPACE_RES(mp), 0); | ||
1815 | if (error) { | 1833 | if (error) { |
1816 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 1834 | if (error == ENOSPC) { |
1835 | xfs_warn_ratelimited(mp, | ||
1836 | "Failed to remove inode(s) from unlinked list. " | ||
1837 | "Please free space, unmount and run xfs_repair."); | ||
1838 | } else { | ||
1839 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | ||
1840 | } | ||
1817 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES); | 1841 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES); |
1818 | return error; | 1842 | return error; |
1819 | } | 1843 | } |