diff options
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 6154ca030724..5874098ca9cf 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -592,7 +592,9 @@ xfs_bmap_add_extent( | |||
592 | if (nextents == 0) { | 592 | if (nextents == 0) { |
593 | XFS_BMAP_TRACE_INSERT("insert empty", ip, 0, 1, new, NULL, | 593 | XFS_BMAP_TRACE_INSERT("insert empty", ip, 0, 1, new, NULL, |
594 | whichfork); | 594 | whichfork); |
595 | xfs_iext_insert(ifp, 0, 1, new); | 595 | xfs_iext_insert(ip, 0, 1, new, |
596 | whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0); | ||
597 | |||
596 | ASSERT(cur == NULL); | 598 | ASSERT(cur == NULL); |
597 | ifp->if_lastex = 0; | 599 | ifp->if_lastex = 0; |
598 | if (!isnullstartblock(new->br_startblock)) { | 600 | if (!isnullstartblock(new->br_startblock)) { |
@@ -849,7 +851,7 @@ xfs_bmap_add_extent_delay_real( | |||
849 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, | 851 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
850 | XFS_DATA_FORK); | 852 | XFS_DATA_FORK); |
851 | XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); | 853 | XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); |
852 | xfs_iext_remove(ifp, idx, 2); | 854 | xfs_iext_remove(ip, idx, 2, state); |
853 | ip->i_df.if_lastex = idx - 1; | 855 | ip->i_df.if_lastex = idx - 1; |
854 | ip->i_d.di_nextents--; | 856 | ip->i_d.di_nextents--; |
855 | if (cur == NULL) | 857 | if (cur == NULL) |
@@ -895,7 +897,7 @@ xfs_bmap_add_extent_delay_real( | |||
895 | XFS_DATA_FORK); | 897 | XFS_DATA_FORK); |
896 | ip->i_df.if_lastex = idx - 1; | 898 | ip->i_df.if_lastex = idx - 1; |
897 | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); | 899 | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); |
898 | xfs_iext_remove(ifp, idx, 1); | 900 | xfs_iext_remove(ip, idx, 1, state); |
899 | if (cur == NULL) | 901 | if (cur == NULL) |
900 | rval = XFS_ILOG_DEXT; | 902 | rval = XFS_ILOG_DEXT; |
901 | else { | 903 | else { |
@@ -930,7 +932,7 @@ xfs_bmap_add_extent_delay_real( | |||
930 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); | 932 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); |
931 | ip->i_df.if_lastex = idx; | 933 | ip->i_df.if_lastex = idx; |
932 | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); | 934 | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); |
933 | xfs_iext_remove(ifp, idx + 1, 1); | 935 | xfs_iext_remove(ip, idx + 1, 1, state); |
934 | if (cur == NULL) | 936 | if (cur == NULL) |
935 | rval = XFS_ILOG_DEXT; | 937 | rval = XFS_ILOG_DEXT; |
936 | else { | 938 | else { |
@@ -1037,7 +1039,7 @@ xfs_bmap_add_extent_delay_real( | |||
1037 | xfs_bmbt_set_blockcount(ep, temp); | 1039 | xfs_bmbt_set_blockcount(ep, temp); |
1038 | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, | 1040 | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, |
1039 | XFS_DATA_FORK); | 1041 | XFS_DATA_FORK); |
1040 | xfs_iext_insert(ifp, idx, 1, new); | 1042 | xfs_iext_insert(ip, idx, 1, new, state); |
1041 | ip->i_df.if_lastex = idx; | 1043 | ip->i_df.if_lastex = idx; |
1042 | ip->i_d.di_nextents++; | 1044 | ip->i_d.di_nextents++; |
1043 | if (cur == NULL) | 1045 | if (cur == NULL) |
@@ -1127,7 +1129,7 @@ xfs_bmap_add_extent_delay_real( | |||
1127 | xfs_bmbt_set_blockcount(ep, temp); | 1129 | xfs_bmbt_set_blockcount(ep, temp); |
1128 | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, | 1130 | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, |
1129 | XFS_DATA_FORK); | 1131 | XFS_DATA_FORK); |
1130 | xfs_iext_insert(ifp, idx + 1, 1, new); | 1132 | xfs_iext_insert(ip, idx + 1, 1, new, state); |
1131 | ip->i_df.if_lastex = idx + 1; | 1133 | ip->i_df.if_lastex = idx + 1; |
1132 | ip->i_d.di_nextents++; | 1134 | ip->i_d.di_nextents++; |
1133 | if (cur == NULL) | 1135 | if (cur == NULL) |
@@ -1182,7 +1184,7 @@ xfs_bmap_add_extent_delay_real( | |||
1182 | r[1].br_blockcount = temp2; | 1184 | r[1].br_blockcount = temp2; |
1183 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], | 1185 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], |
1184 | XFS_DATA_FORK); | 1186 | XFS_DATA_FORK); |
1185 | xfs_iext_insert(ifp, idx + 1, 2, &r[0]); | 1187 | xfs_iext_insert(ip, idx + 1, 2, &r[0], state); |
1186 | ip->i_df.if_lastex = idx + 1; | 1188 | ip->i_df.if_lastex = idx + 1; |
1187 | ip->i_d.di_nextents++; | 1189 | ip->i_d.di_nextents++; |
1188 | if (cur == NULL) | 1190 | if (cur == NULL) |
@@ -1397,7 +1399,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1397 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, | 1399 | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
1398 | XFS_DATA_FORK); | 1400 | XFS_DATA_FORK); |
1399 | XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); | 1401 | XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); |
1400 | xfs_iext_remove(ifp, idx, 2); | 1402 | xfs_iext_remove(ip, idx, 2, state); |
1401 | ip->i_df.if_lastex = idx - 1; | 1403 | ip->i_df.if_lastex = idx - 1; |
1402 | ip->i_d.di_nextents -= 2; | 1404 | ip->i_d.di_nextents -= 2; |
1403 | if (cur == NULL) | 1405 | if (cur == NULL) |
@@ -1447,7 +1449,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1447 | XFS_DATA_FORK); | 1449 | XFS_DATA_FORK); |
1448 | ip->i_df.if_lastex = idx - 1; | 1450 | ip->i_df.if_lastex = idx - 1; |
1449 | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); | 1451 | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); |
1450 | xfs_iext_remove(ifp, idx, 1); | 1452 | xfs_iext_remove(ip, idx, 1, state); |
1451 | ip->i_d.di_nextents--; | 1453 | ip->i_d.di_nextents--; |
1452 | if (cur == NULL) | 1454 | if (cur == NULL) |
1453 | rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; | 1455 | rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; |
@@ -1490,7 +1492,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1490 | XFS_DATA_FORK); | 1492 | XFS_DATA_FORK); |
1491 | ip->i_df.if_lastex = idx; | 1493 | ip->i_df.if_lastex = idx; |
1492 | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); | 1494 | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); |
1493 | xfs_iext_remove(ifp, idx + 1, 1); | 1495 | xfs_iext_remove(ip, idx + 1, 1, state); |
1494 | ip->i_d.di_nextents--; | 1496 | ip->i_d.di_nextents--; |
1495 | if (cur == NULL) | 1497 | if (cur == NULL) |
1496 | rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; | 1498 | rval = XFS_ILOG_CORE | XFS_ILOG_DEXT; |
@@ -1616,7 +1618,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1616 | XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx, XFS_DATA_FORK); | 1618 | XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx, XFS_DATA_FORK); |
1617 | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, | 1619 | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, |
1618 | XFS_DATA_FORK); | 1620 | XFS_DATA_FORK); |
1619 | xfs_iext_insert(ifp, idx, 1, new); | 1621 | xfs_iext_insert(ip, idx, 1, new, state); |
1620 | ip->i_df.if_lastex = idx; | 1622 | ip->i_df.if_lastex = idx; |
1621 | ip->i_d.di_nextents++; | 1623 | ip->i_d.di_nextents++; |
1622 | if (cur == NULL) | 1624 | if (cur == NULL) |
@@ -1702,7 +1704,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1702 | XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); | 1704 | XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); |
1703 | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, | 1705 | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, |
1704 | XFS_DATA_FORK); | 1706 | XFS_DATA_FORK); |
1705 | xfs_iext_insert(ifp, idx + 1, 1, new); | 1707 | xfs_iext_insert(ip, idx + 1, 1, new, state); |
1706 | ip->i_df.if_lastex = idx + 1; | 1708 | ip->i_df.if_lastex = idx + 1; |
1707 | ip->i_d.di_nextents++; | 1709 | ip->i_d.di_nextents++; |
1708 | if (cur == NULL) | 1710 | if (cur == NULL) |
@@ -1752,7 +1754,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1752 | r[1].br_state = oldext; | 1754 | r[1].br_state = oldext; |
1753 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], | 1755 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], |
1754 | XFS_DATA_FORK); | 1756 | XFS_DATA_FORK); |
1755 | xfs_iext_insert(ifp, idx + 1, 2, &r[0]); | 1757 | xfs_iext_insert(ip, idx + 1, 2, &r[0], state); |
1756 | ip->i_df.if_lastex = idx + 1; | 1758 | ip->i_df.if_lastex = idx + 1; |
1757 | ip->i_d.di_nextents += 2; | 1759 | ip->i_d.di_nextents += 2; |
1758 | if (cur == NULL) | 1760 | if (cur == NULL) |
@@ -1918,7 +1920,7 @@ xfs_bmap_add_extent_hole_delay( | |||
1918 | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, | 1920 | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, |
1919 | XFS_DATA_FORK); | 1921 | XFS_DATA_FORK); |
1920 | XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK); | 1922 | XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK); |
1921 | xfs_iext_remove(ifp, idx, 1); | 1923 | xfs_iext_remove(ip, idx, 1, state); |
1922 | ip->i_df.if_lastex = idx - 1; | 1924 | ip->i_df.if_lastex = idx - 1; |
1923 | /* DELTA: Two in-core extents were replaced by one. */ | 1925 | /* DELTA: Two in-core extents were replaced by one. */ |
1924 | temp2 = temp; | 1926 | temp2 = temp; |
@@ -1977,7 +1979,7 @@ xfs_bmap_add_extent_hole_delay( | |||
1977 | oldlen = newlen = 0; | 1979 | oldlen = newlen = 0; |
1978 | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, | 1980 | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, |
1979 | XFS_DATA_FORK); | 1981 | XFS_DATA_FORK); |
1980 | xfs_iext_insert(ifp, idx, 1, new); | 1982 | xfs_iext_insert(ip, idx, 1, new, state); |
1981 | ip->i_df.if_lastex = idx; | 1983 | ip->i_df.if_lastex = idx; |
1982 | /* DELTA: A new in-core extent was added in a hole. */ | 1984 | /* DELTA: A new in-core extent was added in a hole. */ |
1983 | temp2 = new->br_blockcount; | 1985 | temp2 = new->br_blockcount; |
@@ -2033,6 +2035,9 @@ xfs_bmap_add_extent_hole_real( | |||
2033 | ep = xfs_iext_get_ext(ifp, idx); | 2035 | ep = xfs_iext_get_ext(ifp, idx); |
2034 | state = 0; | 2036 | state = 0; |
2035 | 2037 | ||
2038 | if (whichfork == XFS_ATTR_FORK) | ||
2039 | state |= BMAP_ATTRFORK; | ||
2040 | |||
2036 | /* | 2041 | /* |
2037 | * Check and set flags if this segment has a left neighbor. | 2042 | * Check and set flags if this segment has a left neighbor. |
2038 | */ | 2043 | */ |
@@ -2094,7 +2099,7 @@ xfs_bmap_add_extent_hole_real( | |||
2094 | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, | 2099 | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, |
2095 | whichfork); | 2100 | whichfork); |
2096 | XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, whichfork); | 2101 | XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, whichfork); |
2097 | xfs_iext_remove(ifp, idx, 1); | 2102 | xfs_iext_remove(ip, idx, 1, state); |
2098 | ifp->if_lastex = idx - 1; | 2103 | ifp->if_lastex = idx - 1; |
2099 | XFS_IFORK_NEXT_SET(ip, whichfork, | 2104 | XFS_IFORK_NEXT_SET(ip, whichfork, |
2100 | XFS_IFORK_NEXTENTS(ip, whichfork) - 1); | 2105 | XFS_IFORK_NEXTENTS(ip, whichfork) - 1); |
@@ -2205,7 +2210,7 @@ xfs_bmap_add_extent_hole_real( | |||
2205 | * Insert a new entry. | 2210 | * Insert a new entry. |
2206 | */ | 2211 | */ |
2207 | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, whichfork); | 2212 | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, whichfork); |
2208 | xfs_iext_insert(ifp, idx, 1, new); | 2213 | xfs_iext_insert(ip, idx, 1, new, state); |
2209 | ifp->if_lastex = idx; | 2214 | ifp->if_lastex = idx; |
2210 | XFS_IFORK_NEXT_SET(ip, whichfork, | 2215 | XFS_IFORK_NEXT_SET(ip, whichfork, |
2211 | XFS_IFORK_NEXTENTS(ip, whichfork) + 1); | 2216 | XFS_IFORK_NEXTENTS(ip, whichfork) + 1); |
@@ -3147,7 +3152,8 @@ xfs_bmap_del_extent( | |||
3147 | * Matches the whole extent. Delete the entry. | 3152 | * Matches the whole extent. Delete the entry. |
3148 | */ | 3153 | */ |
3149 | XFS_BMAP_TRACE_DELETE("3", ip, idx, 1, whichfork); | 3154 | XFS_BMAP_TRACE_DELETE("3", ip, idx, 1, whichfork); |
3150 | xfs_iext_remove(ifp, idx, 1); | 3155 | xfs_iext_remove(ip, idx, 1, |
3156 | whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0); | ||
3151 | ifp->if_lastex = idx; | 3157 | ifp->if_lastex = idx; |
3152 | if (delay) | 3158 | if (delay) |
3153 | break; | 3159 | break; |
@@ -3317,7 +3323,8 @@ xfs_bmap_del_extent( | |||
3317 | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, whichfork); | 3323 | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, whichfork); |
3318 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 1, &new, NULL, | 3324 | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 1, &new, NULL, |
3319 | whichfork); | 3325 | whichfork); |
3320 | xfs_iext_insert(ifp, idx + 1, 1, &new); | 3326 | xfs_iext_insert(ip, idx + 1, 1, &new, |
3327 | whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0); | ||
3321 | ifp->if_lastex = idx + 1; | 3328 | ifp->if_lastex = idx + 1; |
3322 | break; | 3329 | break; |
3323 | } | 3330 | } |