|
42 | 42 | #include "xfs_pnfs.h" |
43 | 43 | #include "xfs_parent.h" |
44 | 44 | #include "xfs_xattr.h" |
| 45 | +#include "xfs_sb.h" |
45 | 46 |
|
46 | 47 | struct kmem_cache *xfs_inode_cache; |
47 | 48 |
|
@@ -870,9 +871,16 @@ xfs_init_new_inode( |
870 | 871 | * this saves us from needing to run a separate transaction to set the |
871 | 872 | * fork offset in the immediate future. |
872 | 873 | */ |
873 | | - if (init_xattrs && xfs_has_attr(mp)) { |
| 874 | + if (init_xattrs) { |
874 | 875 | ip->i_forkoff = xfs_default_attroffset(ip) >> 3; |
875 | 876 | xfs_ifork_init_attr(ip, XFS_DINODE_FMT_EXTENTS, 0); |
| 877 | + |
| 878 | + if (!xfs_has_attr(mp)) { |
| 879 | + spin_lock(&mp->m_sb_lock); |
| 880 | + xfs_add_attr(mp); |
| 881 | + spin_unlock(&mp->m_sb_lock); |
| 882 | + xfs_log_sb(tp); |
| 883 | + } |
876 | 884 | } |
877 | 885 |
|
878 | 886 | /* |
@@ -1595,7 +1603,7 @@ xfs_release( |
1595 | 1603 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) |
1596 | 1604 | return 0; |
1597 | 1605 |
|
1598 | | - if (xfs_can_free_eofblocks(ip, false)) { |
| 1606 | + if (xfs_can_free_eofblocks(ip)) { |
1599 | 1607 | /* |
1600 | 1608 | * Check if the inode is being opened, written and closed |
1601 | 1609 | * frequently and we have delayed allocation blocks outstanding |
@@ -1856,15 +1864,13 @@ xfs_inode_needs_inactive( |
1856 | 1864 |
|
1857 | 1865 | /* |
1858 | 1866 | * This file isn't being freed, so check if there are post-eof blocks |
1859 | | - * to free. @force is true because we are evicting an inode from the |
1860 | | - * cache. Post-eof blocks must be freed, lest we end up with broken |
1861 | | - * free space accounting. |
| 1867 | + * to free. |
1862 | 1868 | * |
1863 | 1869 | * Note: don't bother with iolock here since lockdep complains about |
1864 | 1870 | * acquiring it in reclaim context. We have the only reference to the |
1865 | 1871 | * inode at this point anyways. |
1866 | 1872 | */ |
1867 | | - return xfs_can_free_eofblocks(ip, true); |
| 1873 | + return xfs_can_free_eofblocks(ip); |
1868 | 1874 | } |
1869 | 1875 |
|
1870 | 1876 | /* |
@@ -1947,15 +1953,11 @@ xfs_inactive( |
1947 | 1953 |
|
1948 | 1954 | if (VFS_I(ip)->i_nlink != 0) { |
1949 | 1955 | /* |
1950 | | - * force is true because we are evicting an inode from the |
1951 | | - * cache. Post-eof blocks must be freed, lest we end up with |
1952 | | - * broken free space accounting. |
1953 | | - * |
1954 | 1956 | * Note: don't bother with iolock here since lockdep complains |
1955 | 1957 | * about acquiring it in reclaim context. We have the only |
1956 | 1958 | * reference to the inode at this point anyways. |
1957 | 1959 | */ |
1958 | | - if (xfs_can_free_eofblocks(ip, true)) |
| 1960 | + if (xfs_can_free_eofblocks(ip)) |
1959 | 1961 | error = xfs_free_eofblocks(ip); |
1960 | 1962 |
|
1961 | 1963 | goto out; |
|
0 commit comments