diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 72 |
1 files changed, 32 insertions, 40 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 5e7a38fa6ee6..6d6b44a508f9 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -655,7 +655,6 @@ xfs_ialloc( | |||
655 | uint flags; | 655 | uint flags; |
656 | int error; | 656 | int error; |
657 | timespec_t tv; | 657 | timespec_t tv; |
658 | int filestreams = 0; | ||
659 | 658 | ||
660 | /* | 659 | /* |
661 | * Call the space management code to pick | 660 | * Call the space management code to pick |
@@ -772,13 +771,6 @@ xfs_ialloc( | |||
772 | flags |= XFS_ILOG_DEV; | 771 | flags |= XFS_ILOG_DEV; |
773 | break; | 772 | break; |
774 | case S_IFREG: | 773 | case S_IFREG: |
775 | /* | ||
776 | * we can't set up filestreams until after the VFS inode | ||
777 | * is set up properly. | ||
778 | */ | ||
779 | if (pip && xfs_inode_is_filestream(pip)) | ||
780 | filestreams = 1; | ||
781 | /* fall through */ | ||
782 | case S_IFDIR: | 774 | case S_IFDIR: |
783 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { | 775 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { |
784 | uint di_flags = 0; | 776 | uint di_flags = 0; |
@@ -844,15 +836,6 @@ xfs_ialloc( | |||
844 | /* now that we have an i_mode we can setup inode ops and unlock */ | 836 | /* now that we have an i_mode we can setup inode ops and unlock */ |
845 | xfs_setup_inode(ip); | 837 | xfs_setup_inode(ip); |
846 | 838 | ||
847 | /* now we have set up the vfs inode we can associate the filestream */ | ||
848 | if (filestreams) { | ||
849 | error = xfs_filestream_associate(pip, ip); | ||
850 | if (error < 0) | ||
851 | return -error; | ||
852 | if (!error) | ||
853 | xfs_iflags_set(ip, XFS_IFILESTREAM); | ||
854 | } | ||
855 | |||
856 | *ipp = ip; | 839 | *ipp = ip; |
857 | return 0; | 840 | return 0; |
858 | } | 841 | } |
@@ -1334,7 +1317,8 @@ int | |||
1334 | xfs_create_tmpfile( | 1317 | xfs_create_tmpfile( |
1335 | struct xfs_inode *dp, | 1318 | struct xfs_inode *dp, |
1336 | struct dentry *dentry, | 1319 | struct dentry *dentry, |
1337 | umode_t mode) | 1320 | umode_t mode, |
1321 | struct xfs_inode **ipp) | ||
1338 | { | 1322 | { |
1339 | struct xfs_mount *mp = dp->i_mount; | 1323 | struct xfs_mount *mp = dp->i_mount; |
1340 | struct xfs_inode *ip = NULL; | 1324 | struct xfs_inode *ip = NULL; |
@@ -1402,7 +1386,6 @@ xfs_create_tmpfile( | |||
1402 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); | 1386 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); |
1403 | 1387 | ||
1404 | ip->i_d.di_nlink--; | 1388 | ip->i_d.di_nlink--; |
1405 | d_tmpfile(dentry, VFS_I(ip)); | ||
1406 | error = xfs_iunlink(tp, ip); | 1389 | error = xfs_iunlink(tp, ip); |
1407 | if (error) | 1390 | if (error) |
1408 | goto out_trans_abort; | 1391 | goto out_trans_abort; |
@@ -1415,6 +1398,7 @@ xfs_create_tmpfile( | |||
1415 | xfs_qm_dqrele(gdqp); | 1398 | xfs_qm_dqrele(gdqp); |
1416 | xfs_qm_dqrele(pdqp); | 1399 | xfs_qm_dqrele(pdqp); |
1417 | 1400 | ||
1401 | *ipp = ip; | ||
1418 | return 0; | 1402 | return 0; |
1419 | 1403 | ||
1420 | out_trans_abort: | 1404 | out_trans_abort: |
@@ -1698,16 +1682,6 @@ xfs_release( | |||
1698 | int truncated; | 1682 | int truncated; |
1699 | 1683 | ||
1700 | /* | 1684 | /* |
1701 | * If we are using filestreams, and we have an unlinked | ||
1702 | * file that we are processing the last close on, then nothing | ||
1703 | * will be able to reopen and write to this file. Purge this | ||
1704 | * inode from the filestreams cache so that it doesn't delay | ||
1705 | * teardown of the inode. | ||
1706 | */ | ||
1707 | if ((ip->i_d.di_nlink == 0) && xfs_inode_is_filestream(ip)) | ||
1708 | xfs_filestream_deassociate(ip); | ||
1709 | |||
1710 | /* | ||
1711 | * If we previously truncated this file and removed old data | 1685 | * If we previously truncated this file and removed old data |
1712 | * in the process, we want to initiate "early" writeout on | 1686 | * in the process, we want to initiate "early" writeout on |
1713 | * the last close. This is an attempt to combat the notorious | 1687 | * the last close. This is an attempt to combat the notorious |
@@ -1837,9 +1811,33 @@ xfs_inactive_ifree( | |||
1837 | int error; | 1811 | int error; |
1838 | 1812 | ||
1839 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 1813 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
1840 | 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); | ||
1841 | if (error) { | 1833 | if (error) { |
1842 | 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 | } | ||
1843 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES); | 1841 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES); |
1844 | return error; | 1842 | return error; |
1845 | } | 1843 | } |
@@ -2663,13 +2661,7 @@ xfs_remove( | |||
2663 | if (error) | 2661 | if (error) |
2664 | goto std_return; | 2662 | goto std_return; |
2665 | 2663 | ||
2666 | /* | 2664 | if (is_dir && xfs_inode_is_filestream(ip)) |
2667 | * If we are using filestreams, kill the stream association. | ||
2668 | * If the file is still open it may get a new one but that | ||
2669 | * will get killed on last close in xfs_close() so we don't | ||
2670 | * have to worry about that. | ||
2671 | */ | ||
2672 | if (!is_dir && link_zero && xfs_inode_is_filestream(ip)) | ||
2673 | xfs_filestream_deassociate(ip); | 2665 | xfs_filestream_deassociate(ip); |
2674 | 2666 | ||
2675 | return 0; | 2667 | return 0; |
@@ -3371,9 +3363,9 @@ xfs_iflush_int( | |||
3371 | } | 3363 | } |
3372 | } | 3364 | } |
3373 | 3365 | ||
3374 | xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK, bp); | 3366 | xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); |
3375 | if (XFS_IFORK_Q(ip)) | 3367 | if (XFS_IFORK_Q(ip)) |
3376 | xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK, bp); | 3368 | xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); |
3377 | xfs_inobp_check(mp, bp); | 3369 | xfs_inobp_check(mp, bp); |
3378 | 3370 | ||
3379 | /* | 3371 | /* |