diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 89 |
1 files changed, 34 insertions, 55 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 160bcdc34a6e..1e5d97f86ea8 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -319,7 +319,7 @@ xfs_attr_set_int( | |||
319 | return (error); | 319 | return (error); |
320 | } | 320 | } |
321 | 321 | ||
322 | xfs_trans_ijoin(args.trans, dp); | 322 | xfs_trans_ijoin(args.trans, dp, 0); |
323 | 323 | ||
324 | /* | 324 | /* |
325 | * If the attribute list is non-existent or a shortform list, | 325 | * If the attribute list is non-existent or a shortform list, |
@@ -389,7 +389,7 @@ xfs_attr_set_int( | |||
389 | * a new one. We need the inode to be in all transactions. | 389 | * a new one. We need the inode to be in all transactions. |
390 | */ | 390 | */ |
391 | if (committed) | 391 | if (committed) |
392 | xfs_trans_ijoin(args.trans, dp); | 392 | xfs_trans_ijoin(args.trans, dp, 0); |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * Commit the leaf transformation. We'll need another (linked) | 395 | * Commit the leaf transformation. We'll need another (linked) |
@@ -537,7 +537,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags) | |||
537 | * No need to make quota reservations here. We expect to release some | 537 | * No need to make quota reservations here. We expect to release some |
538 | * blocks not allocate in the common case. | 538 | * blocks not allocate in the common case. |
539 | */ | 539 | */ |
540 | xfs_trans_ijoin(args.trans, dp); | 540 | xfs_trans_ijoin(args.trans, dp, 0); |
541 | 541 | ||
542 | /* | 542 | /* |
543 | * Decide on what work routines to call based on the inode size. | 543 | * Decide on what work routines to call based on the inode size. |
@@ -809,7 +809,7 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
809 | * No need to make quota reservations here. We expect to release some | 809 | * No need to make quota reservations here. We expect to release some |
810 | * blocks, not allocate, in the common case. | 810 | * blocks, not allocate, in the common case. |
811 | */ | 811 | */ |
812 | xfs_trans_ijoin(trans, dp); | 812 | xfs_trans_ijoin(trans, dp, 0); |
813 | 813 | ||
814 | /* | 814 | /* |
815 | * Decide on what work routines to call based on the inode size. | 815 | * Decide on what work routines to call based on the inode size. |
@@ -823,18 +823,6 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
823 | if (error) | 823 | if (error) |
824 | goto out; | 824 | goto out; |
825 | 825 | ||
826 | /* | ||
827 | * Signal synchronous inactive transactions unless this is a | ||
828 | * synchronous mount filesystem in which case we know that we're here | ||
829 | * because we've been called out of xfs_inactive which means that the | ||
830 | * last reference is gone and the unlink transaction has already hit | ||
831 | * the disk so async inactive transactions are safe. | ||
832 | */ | ||
833 | if (!(mp->m_flags & XFS_MOUNT_WSYNC)) { | ||
834 | if (dp->i_d.di_anextents > 0) | ||
835 | xfs_trans_set_sync(trans); | ||
836 | } | ||
837 | |||
838 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); | 826 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); |
839 | if (error) | 827 | if (error) |
840 | goto out; | 828 | goto out; |
@@ -973,7 +961,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
973 | * a new one. We need the inode to be in all transactions. | 961 | * a new one. We need the inode to be in all transactions. |
974 | */ | 962 | */ |
975 | if (committed) | 963 | if (committed) |
976 | xfs_trans_ijoin(args->trans, dp); | 964 | xfs_trans_ijoin(args->trans, dp, 0); |
977 | 965 | ||
978 | /* | 966 | /* |
979 | * Commit the current trans (including the inode) and start | 967 | * Commit the current trans (including the inode) and start |
@@ -1075,7 +1063,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
1075 | * in all transactions. | 1063 | * in all transactions. |
1076 | */ | 1064 | */ |
1077 | if (committed) | 1065 | if (committed) |
1078 | xfs_trans_ijoin(args->trans, dp); | 1066 | xfs_trans_ijoin(args->trans, dp, 0); |
1079 | } else | 1067 | } else |
1080 | xfs_da_buf_done(bp); | 1068 | xfs_da_buf_done(bp); |
1081 | 1069 | ||
@@ -1149,7 +1137,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) | |||
1149 | * a new one. We need the inode to be in all transactions. | 1137 | * a new one. We need the inode to be in all transactions. |
1150 | */ | 1138 | */ |
1151 | if (committed) | 1139 | if (committed) |
1152 | xfs_trans_ijoin(args->trans, dp); | 1140 | xfs_trans_ijoin(args->trans, dp, 0); |
1153 | } else | 1141 | } else |
1154 | xfs_da_buf_done(bp); | 1142 | xfs_da_buf_done(bp); |
1155 | return(0); | 1143 | return(0); |
@@ -1303,7 +1291,7 @@ restart: | |||
1303 | * in all transactions. | 1291 | * in all transactions. |
1304 | */ | 1292 | */ |
1305 | if (committed) | 1293 | if (committed) |
1306 | xfs_trans_ijoin(args->trans, dp); | 1294 | xfs_trans_ijoin(args->trans, dp, 0); |
1307 | 1295 | ||
1308 | /* | 1296 | /* |
1309 | * Commit the node conversion and start the next | 1297 | * Commit the node conversion and start the next |
@@ -1340,7 +1328,7 @@ restart: | |||
1340 | * a new one. We need the inode to be in all transactions. | 1328 | * a new one. We need the inode to be in all transactions. |
1341 | */ | 1329 | */ |
1342 | if (committed) | 1330 | if (committed) |
1343 | xfs_trans_ijoin(args->trans, dp); | 1331 | xfs_trans_ijoin(args->trans, dp, 0); |
1344 | } else { | 1332 | } else { |
1345 | /* | 1333 | /* |
1346 | * Addition succeeded, update Btree hashvals. | 1334 | * Addition succeeded, update Btree hashvals. |
@@ -1452,7 +1440,7 @@ restart: | |||
1452 | * in all transactions. | 1440 | * in all transactions. |
1453 | */ | 1441 | */ |
1454 | if (committed) | 1442 | if (committed) |
1455 | xfs_trans_ijoin(args->trans, dp); | 1443 | xfs_trans_ijoin(args->trans, dp, 0); |
1456 | } | 1444 | } |
1457 | 1445 | ||
1458 | /* | 1446 | /* |
@@ -1584,7 +1572,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1584 | * a new one. We need the inode to be in all transactions. | 1572 | * a new one. We need the inode to be in all transactions. |
1585 | */ | 1573 | */ |
1586 | if (committed) | 1574 | if (committed) |
1587 | xfs_trans_ijoin(args->trans, dp); | 1575 | xfs_trans_ijoin(args->trans, dp, 0); |
1588 | 1576 | ||
1589 | /* | 1577 | /* |
1590 | * Commit the Btree join operation and start a new trans. | 1578 | * Commit the Btree join operation and start a new trans. |
@@ -1635,7 +1623,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1635 | * in all transactions. | 1623 | * in all transactions. |
1636 | */ | 1624 | */ |
1637 | if (committed) | 1625 | if (committed) |
1638 | xfs_trans_ijoin(args->trans, dp); | 1626 | xfs_trans_ijoin(args->trans, dp, 0); |
1639 | } else | 1627 | } else |
1640 | xfs_da_brelse(args->trans, bp); | 1628 | xfs_da_brelse(args->trans, bp); |
1641 | } | 1629 | } |
@@ -1975,10 +1963,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
1975 | lblkno = args->rmtblkno; | 1963 | lblkno = args->rmtblkno; |
1976 | while (valuelen > 0) { | 1964 | while (valuelen > 0) { |
1977 | nmap = ATTR_RMTVALUE_MAPSIZE; | 1965 | nmap = ATTR_RMTVALUE_MAPSIZE; |
1978 | error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, | 1966 | error = xfs_bmapi_read(args->dp, (xfs_fileoff_t)lblkno, |
1979 | args->rmtblkcnt, | 1967 | args->rmtblkcnt, map, &nmap, |
1980 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 1968 | XFS_BMAPI_ATTRFORK); |
1981 | NULL, 0, map, &nmap, NULL); | ||
1982 | if (error) | 1969 | if (error) |
1983 | return(error); | 1970 | return(error); |
1984 | ASSERT(nmap >= 1); | 1971 | ASSERT(nmap >= 1); |
@@ -2052,10 +2039,9 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2052 | */ | 2039 | */ |
2053 | xfs_bmap_init(args->flist, args->firstblock); | 2040 | xfs_bmap_init(args->flist, args->firstblock); |
2054 | nmap = 1; | 2041 | nmap = 1; |
2055 | error = xfs_bmapi(args->trans, dp, (xfs_fileoff_t)lblkno, | 2042 | error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, |
2056 | blkcnt, | 2043 | blkcnt, |
2057 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | | 2044 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2058 | XFS_BMAPI_WRITE, | ||
2059 | args->firstblock, args->total, &map, &nmap, | 2045 | args->firstblock, args->total, &map, &nmap, |
2060 | args->flist); | 2046 | args->flist); |
2061 | if (!error) { | 2047 | if (!error) { |
@@ -2074,7 +2060,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2074 | * a new one. We need the inode to be in all transactions. | 2060 | * a new one. We need the inode to be in all transactions. |
2075 | */ | 2061 | */ |
2076 | if (committed) | 2062 | if (committed) |
2077 | xfs_trans_ijoin(args->trans, dp); | 2063 | xfs_trans_ijoin(args->trans, dp, 0); |
2078 | 2064 | ||
2079 | ASSERT(nmap == 1); | 2065 | ASSERT(nmap == 1); |
2080 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && | 2066 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && |
@@ -2104,14 +2090,11 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2104 | */ | 2090 | */ |
2105 | xfs_bmap_init(args->flist, args->firstblock); | 2091 | xfs_bmap_init(args->flist, args->firstblock); |
2106 | nmap = 1; | 2092 | nmap = 1; |
2107 | error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, | 2093 | error = xfs_bmapi_read(dp, (xfs_fileoff_t)lblkno, |
2108 | args->rmtblkcnt, | 2094 | args->rmtblkcnt, &map, &nmap, |
2109 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2095 | XFS_BMAPI_ATTRFORK); |
2110 | args->firstblock, 0, &map, &nmap, | 2096 | if (error) |
2111 | NULL); | ||
2112 | if (error) { | ||
2113 | return(error); | 2097 | return(error); |
2114 | } | ||
2115 | ASSERT(nmap == 1); | 2098 | ASSERT(nmap == 1); |
2116 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && | 2099 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && |
2117 | (map.br_startblock != HOLESTARTBLOCK)); | 2100 | (map.br_startblock != HOLESTARTBLOCK)); |
@@ -2121,16 +2104,17 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2121 | 2104 | ||
2122 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, | 2105 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, |
2123 | XBF_LOCK | XBF_DONT_BLOCK); | 2106 | XBF_LOCK | XBF_DONT_BLOCK); |
2124 | ASSERT(!xfs_buf_geterror(bp)); | 2107 | if (!bp) |
2125 | 2108 | return ENOMEM; | |
2126 | tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : | 2109 | tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : |
2127 | XFS_BUF_SIZE(bp); | 2110 | XFS_BUF_SIZE(bp); |
2128 | xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); | 2111 | xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); |
2129 | if (tmp < XFS_BUF_SIZE(bp)) | 2112 | if (tmp < XFS_BUF_SIZE(bp)) |
2130 | xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp); | 2113 | xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp); |
2131 | if ((error = xfs_bwrite(mp, bp))) {/* GROT: NOTE: synchronous write */ | 2114 | error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */ |
2132 | return (error); | 2115 | xfs_buf_relse(bp); |
2133 | } | 2116 | if (error) |
2117 | return error; | ||
2134 | src += tmp; | 2118 | src += tmp; |
2135 | valuelen -= tmp; | 2119 | valuelen -= tmp; |
2136 | 2120 | ||
@@ -2166,16 +2150,12 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2166 | /* | 2150 | /* |
2167 | * Try to remember where we decided to put the value. | 2151 | * Try to remember where we decided to put the value. |
2168 | */ | 2152 | */ |
2169 | xfs_bmap_init(args->flist, args->firstblock); | ||
2170 | nmap = 1; | 2153 | nmap = 1; |
2171 | error = xfs_bmapi(NULL, args->dp, (xfs_fileoff_t)lblkno, | 2154 | error = xfs_bmapi_read(args->dp, (xfs_fileoff_t)lblkno, |
2172 | args->rmtblkcnt, | 2155 | args->rmtblkcnt, &map, &nmap, |
2173 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2156 | XFS_BMAPI_ATTRFORK); |
2174 | args->firstblock, 0, &map, &nmap, | 2157 | if (error) |
2175 | args->flist); | ||
2176 | if (error) { | ||
2177 | return(error); | 2158 | return(error); |
2178 | } | ||
2179 | ASSERT(nmap == 1); | 2159 | ASSERT(nmap == 1); |
2180 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && | 2160 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && |
2181 | (map.br_startblock != HOLESTARTBLOCK)); | 2161 | (map.br_startblock != HOLESTARTBLOCK)); |
@@ -2188,8 +2168,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2188 | */ | 2168 | */ |
2189 | bp = xfs_incore(mp->m_ddev_targp, dblkno, blkcnt, XBF_TRYLOCK); | 2169 | bp = xfs_incore(mp->m_ddev_targp, dblkno, blkcnt, XBF_TRYLOCK); |
2190 | if (bp) { | 2170 | if (bp) { |
2191 | XFS_BUF_STALE(bp); | 2171 | xfs_buf_stale(bp); |
2192 | XFS_BUF_UNDELAYWRITE(bp); | ||
2193 | xfs_buf_relse(bp); | 2172 | xfs_buf_relse(bp); |
2194 | bp = NULL; | 2173 | bp = NULL; |
2195 | } | 2174 | } |
@@ -2227,7 +2206,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2227 | * a new one. We need the inode to be in all transactions. | 2206 | * a new one. We need the inode to be in all transactions. |
2228 | */ | 2207 | */ |
2229 | if (committed) | 2208 | if (committed) |
2230 | xfs_trans_ijoin(args->trans, args->dp); | 2209 | xfs_trans_ijoin(args->trans, args->dp, 0); |
2231 | 2210 | ||
2232 | /* | 2211 | /* |
2233 | * Close out trans and start the next one in the chain. | 2212 | * Close out trans and start the next one in the chain. |