aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c507
1 files changed, 108 insertions, 399 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 5874098ca9cf..98251cdc52aa 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -54,6 +54,7 @@
54#include "xfs_buf_item.h" 54#include "xfs_buf_item.h"
55#include "xfs_filestream.h" 55#include "xfs_filestream.h"
56#include "xfs_vnodeops.h" 56#include "xfs_vnodeops.h"
57#include "xfs_trace.h"
57 58
58 59
59#ifdef DEBUG 60#ifdef DEBUG
@@ -272,71 +273,6 @@ xfs_bmap_isaeof(
272 int whichfork, /* data or attribute fork */ 273 int whichfork, /* data or attribute fork */
273 char *aeof); /* return value */ 274 char *aeof); /* return value */
274 275
275#ifdef XFS_BMAP_TRACE
276/*
277 * Add bmap trace entry prior to a call to xfs_iext_remove.
278 */
279STATIC void
280xfs_bmap_trace_delete(
281 const char *fname, /* function name */
282 char *desc, /* operation description */
283 xfs_inode_t *ip, /* incore inode pointer */
284 xfs_extnum_t idx, /* index of entry(entries) deleted */
285 xfs_extnum_t cnt, /* count of entries deleted, 1 or 2 */
286 int whichfork); /* data or attr fork */
287
288/*
289 * Add bmap trace entry prior to a call to xfs_iext_insert, or
290 * reading in the extents list from the disk (in the btree).
291 */
292STATIC void
293xfs_bmap_trace_insert(
294 const char *fname, /* function name */
295 char *desc, /* operation description */
296 xfs_inode_t *ip, /* incore inode pointer */
297 xfs_extnum_t idx, /* index of entry(entries) inserted */
298 xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */
299 xfs_bmbt_irec_t *r1, /* inserted record 1 */
300 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
301 int whichfork); /* data or attr fork */
302
303/*
304 * Add bmap trace entry after updating an extent record in place.
305 */
306STATIC void
307xfs_bmap_trace_post_update(
308 const char *fname, /* function name */
309 char *desc, /* operation description */
310 xfs_inode_t *ip, /* incore inode pointer */
311 xfs_extnum_t idx, /* index of entry updated */
312 int whichfork); /* data or attr fork */
313
314/*
315 * Add bmap trace entry prior to updating an extent record in place.
316 */
317STATIC void
318xfs_bmap_trace_pre_update(
319 const char *fname, /* function name */
320 char *desc, /* operation description */
321 xfs_inode_t *ip, /* incore inode pointer */
322 xfs_extnum_t idx, /* index of entry to be updated */
323 int whichfork); /* data or attr fork */
324
325#define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w) \
326 xfs_bmap_trace_delete(__func__,d,ip,i,c,w)
327#define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w) \
328 xfs_bmap_trace_insert(__func__,d,ip,i,c,r1,r2,w)
329#define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w) \
330 xfs_bmap_trace_post_update(__func__,d,ip,i,w)
331#define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w) \
332 xfs_bmap_trace_pre_update(__func__,d,ip,i,w)
333#else
334#define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w)
335#define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w)
336#define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w)
337#define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w)
338#endif /* XFS_BMAP_TRACE */
339
340/* 276/*
341 * Compute the worst-case number of indirect blocks that will be used 277 * Compute the worst-case number of indirect blocks that will be used
342 * for ip's delayed extent of length "len". 278 * for ip's delayed extent of length "len".
@@ -363,18 +299,6 @@ xfs_bmap_validate_ret(
363#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) 299#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
364#endif /* DEBUG */ 300#endif /* DEBUG */
365 301
366#if defined(XFS_RW_TRACE)
367STATIC void
368xfs_bunmap_trace(
369 xfs_inode_t *ip,
370 xfs_fileoff_t bno,
371 xfs_filblks_t len,
372 int flags,
373 inst_t *ra);
374#else
375#define xfs_bunmap_trace(ip, bno, len, flags, ra)
376#endif /* XFS_RW_TRACE */
377
378STATIC int 302STATIC int
379xfs_bmap_count_tree( 303xfs_bmap_count_tree(
380 xfs_mount_t *mp, 304 xfs_mount_t *mp,
@@ -590,8 +514,6 @@ xfs_bmap_add_extent(
590 * already extents in the list. 514 * already extents in the list.
591 */ 515 */
592 if (nextents == 0) { 516 if (nextents == 0) {
593 XFS_BMAP_TRACE_INSERT("insert empty", ip, 0, 1, new, NULL,
594 whichfork);
595 xfs_iext_insert(ip, 0, 1, new, 517 xfs_iext_insert(ip, 0, 1, new,
596 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0); 518 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
597 519
@@ -843,14 +765,12 @@ xfs_bmap_add_extent_delay_real(
843 * Filling in all of a previously delayed allocation extent. 765 * Filling in all of a previously delayed allocation extent.
844 * The left and right neighbors are both contiguous with new. 766 * The left and right neighbors are both contiguous with new.
845 */ 767 */
846 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC|RC", ip, idx - 1, 768 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
847 XFS_DATA_FORK);
848 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 769 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
849 LEFT.br_blockcount + PREV.br_blockcount + 770 LEFT.br_blockcount + PREV.br_blockcount +
850 RIGHT.br_blockcount); 771 RIGHT.br_blockcount);
851 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, 772 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
852 XFS_DATA_FORK); 773
853 XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK);
854 xfs_iext_remove(ip, idx, 2, state); 774 xfs_iext_remove(ip, idx, 2, state);
855 ip->i_df.if_lastex = idx - 1; 775 ip->i_df.if_lastex = idx - 1;
856 ip->i_d.di_nextents--; 776 ip->i_d.di_nextents--;
@@ -889,14 +809,12 @@ xfs_bmap_add_extent_delay_real(
889 * Filling in all of a previously delayed allocation extent. 809 * Filling in all of a previously delayed allocation extent.
890 * The left neighbor is contiguous, the right is not. 810 * The left neighbor is contiguous, the right is not.
891 */ 811 */
892 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC", ip, idx - 1, 812 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
893 XFS_DATA_FORK);
894 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 813 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
895 LEFT.br_blockcount + PREV.br_blockcount); 814 LEFT.br_blockcount + PREV.br_blockcount);
896 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC", ip, idx - 1, 815 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
897 XFS_DATA_FORK); 816
898 ip->i_df.if_lastex = idx - 1; 817 ip->i_df.if_lastex = idx - 1;
899 XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK);
900 xfs_iext_remove(ip, idx, 1, state); 818 xfs_iext_remove(ip, idx, 1, state);
901 if (cur == NULL) 819 if (cur == NULL)
902 rval = XFS_ILOG_DEXT; 820 rval = XFS_ILOG_DEXT;
@@ -925,13 +843,13 @@ xfs_bmap_add_extent_delay_real(
925 * Filling in all of a previously delayed allocation extent. 843 * Filling in all of a previously delayed allocation extent.
926 * The right neighbor is contiguous, the left is not. 844 * The right neighbor is contiguous, the left is not.
927 */ 845 */
928 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); 846 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
929 xfs_bmbt_set_startblock(ep, new->br_startblock); 847 xfs_bmbt_set_startblock(ep, new->br_startblock);
930 xfs_bmbt_set_blockcount(ep, 848 xfs_bmbt_set_blockcount(ep,
931 PREV.br_blockcount + RIGHT.br_blockcount); 849 PREV.br_blockcount + RIGHT.br_blockcount);
932 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); 850 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
851
933 ip->i_df.if_lastex = idx; 852 ip->i_df.if_lastex = idx;
934 XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK);
935 xfs_iext_remove(ip, idx + 1, 1, state); 853 xfs_iext_remove(ip, idx + 1, 1, state);
936 if (cur == NULL) 854 if (cur == NULL)
937 rval = XFS_ILOG_DEXT; 855 rval = XFS_ILOG_DEXT;
@@ -961,9 +879,10 @@ xfs_bmap_add_extent_delay_real(
961 * Neither the left nor right neighbors are contiguous with 879 * Neither the left nor right neighbors are contiguous with
962 * the new one. 880 * the new one.
963 */ 881 */
964 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF", ip, idx, XFS_DATA_FORK); 882 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
965 xfs_bmbt_set_startblock(ep, new->br_startblock); 883 xfs_bmbt_set_startblock(ep, new->br_startblock);
966 XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx, XFS_DATA_FORK); 884 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
885
967 ip->i_df.if_lastex = idx; 886 ip->i_df.if_lastex = idx;
968 ip->i_d.di_nextents++; 887 ip->i_d.di_nextents++;
969 if (cur == NULL) 888 if (cur == NULL)
@@ -991,14 +910,15 @@ xfs_bmap_add_extent_delay_real(
991 * Filling in the first part of a previous delayed allocation. 910 * Filling in the first part of a previous delayed allocation.
992 * The left neighbor is contiguous. 911 * The left neighbor is contiguous.
993 */ 912 */
994 XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx - 1, XFS_DATA_FORK); 913 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
995 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 914 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
996 LEFT.br_blockcount + new->br_blockcount); 915 LEFT.br_blockcount + new->br_blockcount);
997 xfs_bmbt_set_startoff(ep, 916 xfs_bmbt_set_startoff(ep,
998 PREV.br_startoff + new->br_blockcount); 917 PREV.br_startoff + new->br_blockcount);
999 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx - 1, XFS_DATA_FORK); 918 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
919
1000 temp = PREV.br_blockcount - new->br_blockcount; 920 temp = PREV.br_blockcount - new->br_blockcount;
1001 XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK); 921 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1002 xfs_bmbt_set_blockcount(ep, temp); 922 xfs_bmbt_set_blockcount(ep, temp);
1003 ip->i_df.if_lastex = idx - 1; 923 ip->i_df.if_lastex = idx - 1;
1004 if (cur == NULL) 924 if (cur == NULL)
@@ -1020,7 +940,7 @@ xfs_bmap_add_extent_delay_real(
1020 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 940 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1021 startblockval(PREV.br_startblock)); 941 startblockval(PREV.br_startblock));
1022 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 942 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1023 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK); 943 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1024 *dnew = temp; 944 *dnew = temp;
1025 /* DELTA: The boundary between two in-core extents moved. */ 945 /* DELTA: The boundary between two in-core extents moved. */
1026 temp = LEFT.br_startoff; 946 temp = LEFT.br_startoff;
@@ -1033,12 +953,10 @@ xfs_bmap_add_extent_delay_real(
1033 * Filling in the first part of a previous delayed allocation. 953 * Filling in the first part of a previous delayed allocation.
1034 * The left neighbor is not contiguous. 954 * The left neighbor is not contiguous.
1035 */ 955 */
1036 XFS_BMAP_TRACE_PRE_UPDATE("LF", ip, idx, XFS_DATA_FORK); 956 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1037 xfs_bmbt_set_startoff(ep, new_endoff); 957 xfs_bmbt_set_startoff(ep, new_endoff);
1038 temp = PREV.br_blockcount - new->br_blockcount; 958 temp = PREV.br_blockcount - new->br_blockcount;
1039 xfs_bmbt_set_blockcount(ep, temp); 959 xfs_bmbt_set_blockcount(ep, temp);
1040 XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL,
1041 XFS_DATA_FORK);
1042 xfs_iext_insert(ip, idx, 1, new, state); 960 xfs_iext_insert(ip, idx, 1, new, state);
1043 ip->i_df.if_lastex = idx; 961 ip->i_df.if_lastex = idx;
1044 ip->i_d.di_nextents++; 962 ip->i_d.di_nextents++;
@@ -1070,7 +988,7 @@ xfs_bmap_add_extent_delay_real(
1070 (cur ? cur->bc_private.b.allocated : 0)); 988 (cur ? cur->bc_private.b.allocated : 0));
1071 ep = xfs_iext_get_ext(ifp, idx + 1); 989 ep = xfs_iext_get_ext(ifp, idx + 1);
1072 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 990 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1073 XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx + 1, XFS_DATA_FORK); 991 trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
1074 *dnew = temp; 992 *dnew = temp;
1075 /* DELTA: One in-core extent is split in two. */ 993 /* DELTA: One in-core extent is split in two. */
1076 temp = PREV.br_startoff; 994 temp = PREV.br_startoff;
@@ -1083,14 +1001,14 @@ xfs_bmap_add_extent_delay_real(
1083 * The right neighbor is contiguous with the new allocation. 1001 * The right neighbor is contiguous with the new allocation.
1084 */ 1002 */
1085 temp = PREV.br_blockcount - new->br_blockcount; 1003 temp = PREV.br_blockcount - new->br_blockcount;
1086 XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK); 1004 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1087 XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1, XFS_DATA_FORK); 1005 trace_xfs_bmap_pre_update(ip, idx + 1, state, _THIS_IP_);
1088 xfs_bmbt_set_blockcount(ep, temp); 1006 xfs_bmbt_set_blockcount(ep, temp);
1089 xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), 1007 xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1),
1090 new->br_startoff, new->br_startblock, 1008 new->br_startoff, new->br_startblock,
1091 new->br_blockcount + RIGHT.br_blockcount, 1009 new->br_blockcount + RIGHT.br_blockcount,
1092 RIGHT.br_state); 1010 RIGHT.br_state);
1093 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx + 1, XFS_DATA_FORK); 1011 trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
1094 ip->i_df.if_lastex = idx + 1; 1012 ip->i_df.if_lastex = idx + 1;
1095 if (cur == NULL) 1013 if (cur == NULL)
1096 rval = XFS_ILOG_DEXT; 1014 rval = XFS_ILOG_DEXT;
@@ -1111,7 +1029,7 @@ xfs_bmap_add_extent_delay_real(
1111 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 1029 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1112 startblockval(PREV.br_startblock)); 1030 startblockval(PREV.br_startblock));
1113 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 1031 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1114 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK); 1032 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1115 *dnew = temp; 1033 *dnew = temp;
1116 /* DELTA: The boundary between two in-core extents moved. */ 1034 /* DELTA: The boundary between two in-core extents moved. */
1117 temp = PREV.br_startoff; 1035 temp = PREV.br_startoff;
@@ -1125,10 +1043,8 @@ xfs_bmap_add_extent_delay_real(
1125 * The right neighbor is not contiguous. 1043 * The right neighbor is not contiguous.
1126 */ 1044 */
1127 temp = PREV.br_blockcount - new->br_blockcount; 1045 temp = PREV.br_blockcount - new->br_blockcount;
1128 XFS_BMAP_TRACE_PRE_UPDATE("RF", ip, idx, XFS_DATA_FORK); 1046 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1129 xfs_bmbt_set_blockcount(ep, temp); 1047 xfs_bmbt_set_blockcount(ep, temp);
1130 XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL,
1131 XFS_DATA_FORK);
1132 xfs_iext_insert(ip, idx + 1, 1, new, state); 1048 xfs_iext_insert(ip, idx + 1, 1, new, state);
1133 ip->i_df.if_lastex = idx + 1; 1049 ip->i_df.if_lastex = idx + 1;
1134 ip->i_d.di_nextents++; 1050 ip->i_d.di_nextents++;
@@ -1160,7 +1076,7 @@ xfs_bmap_add_extent_delay_real(
1160 (cur ? cur->bc_private.b.allocated : 0)); 1076 (cur ? cur->bc_private.b.allocated : 0));
1161 ep = xfs_iext_get_ext(ifp, idx); 1077 ep = xfs_iext_get_ext(ifp, idx);
1162 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 1078 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1163 XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); 1079 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1164 *dnew = temp; 1080 *dnew = temp;
1165 /* DELTA: One in-core extent is split in two. */ 1081 /* DELTA: One in-core extent is split in two. */
1166 temp = PREV.br_startoff; 1082 temp = PREV.br_startoff;
@@ -1174,7 +1090,7 @@ xfs_bmap_add_extent_delay_real(
1174 * This case is avoided almost all the time. 1090 * This case is avoided almost all the time.
1175 */ 1091 */
1176 temp = new->br_startoff - PREV.br_startoff; 1092 temp = new->br_startoff - PREV.br_startoff;
1177 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, XFS_DATA_FORK); 1093 trace_xfs_bmap_pre_update(ip, idx, 0, _THIS_IP_);
1178 xfs_bmbt_set_blockcount(ep, temp); 1094 xfs_bmbt_set_blockcount(ep, temp);
1179 r[0] = *new; 1095 r[0] = *new;
1180 r[1].br_state = PREV.br_state; 1096 r[1].br_state = PREV.br_state;
@@ -1182,8 +1098,6 @@ xfs_bmap_add_extent_delay_real(
1182 r[1].br_startoff = new_endoff; 1098 r[1].br_startoff = new_endoff;
1183 temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; 1099 temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff;
1184 r[1].br_blockcount = temp2; 1100 r[1].br_blockcount = temp2;
1185 XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1],
1186 XFS_DATA_FORK);
1187 xfs_iext_insert(ip, idx + 1, 2, &r[0], state); 1101 xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
1188 ip->i_df.if_lastex = idx + 1; 1102 ip->i_df.if_lastex = idx + 1;
1189 ip->i_d.di_nextents++; 1103 ip->i_d.di_nextents++;
@@ -1241,11 +1155,11 @@ xfs_bmap_add_extent_delay_real(
1241 } 1155 }
1242 ep = xfs_iext_get_ext(ifp, idx); 1156 ep = xfs_iext_get_ext(ifp, idx);
1243 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 1157 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1244 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK); 1158 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1245 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); 1159 trace_xfs_bmap_pre_update(ip, idx + 2, state, _THIS_IP_);
1246 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2), 1160 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2),
1247 nullstartblock((int)temp2)); 1161 nullstartblock((int)temp2));
1248 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); 1162 trace_xfs_bmap_post_update(ip, idx + 2, state, _THIS_IP_);
1249 *dnew = temp + temp2; 1163 *dnew = temp + temp2;
1250 /* DELTA: One in-core extent is split in three. */ 1164 /* DELTA: One in-core extent is split in three. */
1251 temp = PREV.br_startoff; 1165 temp = PREV.br_startoff;
@@ -1391,14 +1305,12 @@ xfs_bmap_add_extent_unwritten_real(
1391 * Setting all of a previous oldext extent to newext. 1305 * Setting all of a previous oldext extent to newext.
1392 * The left and right neighbors are both contiguous with new. 1306 * The left and right neighbors are both contiguous with new.
1393 */ 1307 */
1394 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC|RC", ip, idx - 1, 1308 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
1395 XFS_DATA_FORK);
1396 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 1309 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
1397 LEFT.br_blockcount + PREV.br_blockcount + 1310 LEFT.br_blockcount + PREV.br_blockcount +
1398 RIGHT.br_blockcount); 1311 RIGHT.br_blockcount);
1399 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, 1312 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
1400 XFS_DATA_FORK); 1313
1401 XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK);
1402 xfs_iext_remove(ip, idx, 2, state); 1314 xfs_iext_remove(ip, idx, 2, state);
1403 ip->i_df.if_lastex = idx - 1; 1315 ip->i_df.if_lastex = idx - 1;
1404 ip->i_d.di_nextents -= 2; 1316 ip->i_d.di_nextents -= 2;
@@ -1441,14 +1353,12 @@ xfs_bmap_add_extent_unwritten_real(
1441 * Setting all of a previous oldext extent to newext. 1353 * Setting all of a previous oldext extent to newext.
1442 * The left neighbor is contiguous, the right is not. 1354 * The left neighbor is contiguous, the right is not.
1443 */ 1355 */
1444 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC", ip, idx - 1, 1356 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
1445 XFS_DATA_FORK);
1446 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 1357 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
1447 LEFT.br_blockcount + PREV.br_blockcount); 1358 LEFT.br_blockcount + PREV.br_blockcount);
1448 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC", ip, idx - 1, 1359 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
1449 XFS_DATA_FORK); 1360
1450 ip->i_df.if_lastex = idx - 1; 1361 ip->i_df.if_lastex = idx - 1;
1451 XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK);
1452 xfs_iext_remove(ip, idx, 1, state); 1362 xfs_iext_remove(ip, idx, 1, state);
1453 ip->i_d.di_nextents--; 1363 ip->i_d.di_nextents--;
1454 if (cur == NULL) 1364 if (cur == NULL)
@@ -1483,15 +1393,12 @@ xfs_bmap_add_extent_unwritten_real(
1483 * Setting all of a previous oldext extent to newext. 1393 * Setting all of a previous oldext extent to newext.
1484 * The right neighbor is contiguous, the left is not. 1394 * The right neighbor is contiguous, the left is not.
1485 */ 1395 */
1486 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|RC", ip, idx, 1396 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1487 XFS_DATA_FORK);
1488 xfs_bmbt_set_blockcount(ep, 1397 xfs_bmbt_set_blockcount(ep,
1489 PREV.br_blockcount + RIGHT.br_blockcount); 1398 PREV.br_blockcount + RIGHT.br_blockcount);
1490 xfs_bmbt_set_state(ep, newext); 1399 xfs_bmbt_set_state(ep, newext);
1491 XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, 1400 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1492 XFS_DATA_FORK);
1493 ip->i_df.if_lastex = idx; 1401 ip->i_df.if_lastex = idx;
1494 XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK);
1495 xfs_iext_remove(ip, idx + 1, 1, state); 1402 xfs_iext_remove(ip, idx + 1, 1, state);
1496 ip->i_d.di_nextents--; 1403 ip->i_d.di_nextents--;
1497 if (cur == NULL) 1404 if (cur == NULL)
@@ -1527,11 +1434,10 @@ xfs_bmap_add_extent_unwritten_real(
1527 * Neither the left nor right neighbors are contiguous with 1434 * Neither the left nor right neighbors are contiguous with
1528 * the new one. 1435 * the new one.
1529 */ 1436 */
1530 XFS_BMAP_TRACE_PRE_UPDATE("LF|RF", ip, idx, 1437 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1531 XFS_DATA_FORK);
1532 xfs_bmbt_set_state(ep, newext); 1438 xfs_bmbt_set_state(ep, newext);
1533 XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx, 1439 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1534 XFS_DATA_FORK); 1440
1535 ip->i_df.if_lastex = idx; 1441 ip->i_df.if_lastex = idx;
1536 if (cur == NULL) 1442 if (cur == NULL)
1537 rval = XFS_ILOG_DEXT; 1443 rval = XFS_ILOG_DEXT;
@@ -1557,22 +1463,20 @@ xfs_bmap_add_extent_unwritten_real(
1557 * Setting the first part of a previous oldext extent to newext. 1463 * Setting the first part of a previous oldext extent to newext.
1558 * The left neighbor is contiguous. 1464 * The left neighbor is contiguous.
1559 */ 1465 */
1560 XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx - 1, 1466 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
1561 XFS_DATA_FORK);
1562 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 1467 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
1563 LEFT.br_blockcount + new->br_blockcount); 1468 LEFT.br_blockcount + new->br_blockcount);
1564 xfs_bmbt_set_startoff(ep, 1469 xfs_bmbt_set_startoff(ep,
1565 PREV.br_startoff + new->br_blockcount); 1470 PREV.br_startoff + new->br_blockcount);
1566 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx - 1, 1471 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
1567 XFS_DATA_FORK); 1472
1568 XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx, 1473 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1569 XFS_DATA_FORK);
1570 xfs_bmbt_set_startblock(ep, 1474 xfs_bmbt_set_startblock(ep,
1571 new->br_startblock + new->br_blockcount); 1475 new->br_startblock + new->br_blockcount);
1572 xfs_bmbt_set_blockcount(ep, 1476 xfs_bmbt_set_blockcount(ep,
1573 PREV.br_blockcount - new->br_blockcount); 1477 PREV.br_blockcount - new->br_blockcount);
1574 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, 1478 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1575 XFS_DATA_FORK); 1479
1576 ip->i_df.if_lastex = idx - 1; 1480 ip->i_df.if_lastex = idx - 1;
1577 if (cur == NULL) 1481 if (cur == NULL)
1578 rval = XFS_ILOG_DEXT; 1482 rval = XFS_ILOG_DEXT;
@@ -1608,16 +1512,15 @@ xfs_bmap_add_extent_unwritten_real(
1608 * Setting the first part of a previous oldext extent to newext. 1512 * Setting the first part of a previous oldext extent to newext.
1609 * The left neighbor is not contiguous. 1513 * The left neighbor is not contiguous.
1610 */ 1514 */
1611 XFS_BMAP_TRACE_PRE_UPDATE("LF", ip, idx, XFS_DATA_FORK); 1515 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1612 ASSERT(ep && xfs_bmbt_get_state(ep) == oldext); 1516 ASSERT(ep && xfs_bmbt_get_state(ep) == oldext);
1613 xfs_bmbt_set_startoff(ep, new_endoff); 1517 xfs_bmbt_set_startoff(ep, new_endoff);
1614 xfs_bmbt_set_blockcount(ep, 1518 xfs_bmbt_set_blockcount(ep,
1615 PREV.br_blockcount - new->br_blockcount); 1519 PREV.br_blockcount - new->br_blockcount);
1616 xfs_bmbt_set_startblock(ep, 1520 xfs_bmbt_set_startblock(ep,
1617 new->br_startblock + new->br_blockcount); 1521 new->br_startblock + new->br_blockcount);
1618 XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx, XFS_DATA_FORK); 1522 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1619 XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, 1523
1620 XFS_DATA_FORK);
1621 xfs_iext_insert(ip, idx, 1, new, state); 1524 xfs_iext_insert(ip, idx, 1, new, state);
1622 ip->i_df.if_lastex = idx; 1525 ip->i_df.if_lastex = idx;
1623 ip->i_d.di_nextents++; 1526 ip->i_d.di_nextents++;
@@ -1651,19 +1554,16 @@ xfs_bmap_add_extent_unwritten_real(
1651 * Setting the last part of a previous oldext extent to newext. 1554 * Setting the last part of a previous oldext extent to newext.
1652 * The right neighbor is contiguous with the new allocation. 1555 * The right neighbor is contiguous with the new allocation.
1653 */ 1556 */
1654 XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx, 1557 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1655 XFS_DATA_FORK); 1558 trace_xfs_bmap_pre_update(ip, idx + 1, state, _THIS_IP_);
1656 XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1,
1657 XFS_DATA_FORK);
1658 xfs_bmbt_set_blockcount(ep, 1559 xfs_bmbt_set_blockcount(ep,
1659 PREV.br_blockcount - new->br_blockcount); 1560 PREV.br_blockcount - new->br_blockcount);
1660 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, 1561 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1661 XFS_DATA_FORK);
1662 xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), 1562 xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1),
1663 new->br_startoff, new->br_startblock, 1563 new->br_startoff, new->br_startblock,
1664 new->br_blockcount + RIGHT.br_blockcount, newext); 1564 new->br_blockcount + RIGHT.br_blockcount, newext);
1665 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx + 1, 1565 trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
1666 XFS_DATA_FORK); 1566
1667 ip->i_df.if_lastex = idx + 1; 1567 ip->i_df.if_lastex = idx + 1;
1668 if (cur == NULL) 1568 if (cur == NULL)
1669 rval = XFS_ILOG_DEXT; 1569 rval = XFS_ILOG_DEXT;
@@ -1698,12 +1598,11 @@ xfs_bmap_add_extent_unwritten_real(
1698 * Setting the last part of a previous oldext extent to newext. 1598 * Setting the last part of a previous oldext extent to newext.
1699 * The right neighbor is not contiguous. 1599 * The right neighbor is not contiguous.
1700 */ 1600 */
1701 XFS_BMAP_TRACE_PRE_UPDATE("RF", ip, idx, XFS_DATA_FORK); 1601 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1702 xfs_bmbt_set_blockcount(ep, 1602 xfs_bmbt_set_blockcount(ep,
1703 PREV.br_blockcount - new->br_blockcount); 1603 PREV.br_blockcount - new->br_blockcount);
1704 XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); 1604 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1705 XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, 1605
1706 XFS_DATA_FORK);
1707 xfs_iext_insert(ip, idx + 1, 1, new, state); 1606 xfs_iext_insert(ip, idx + 1, 1, new, state);
1708 ip->i_df.if_lastex = idx + 1; 1607 ip->i_df.if_lastex = idx + 1;
1709 ip->i_d.di_nextents++; 1608 ip->i_d.di_nextents++;
@@ -1742,18 +1641,17 @@ xfs_bmap_add_extent_unwritten_real(
1742 * newext. Contiguity is impossible here. 1641 * newext. Contiguity is impossible here.
1743 * One extent becomes three extents. 1642 * One extent becomes three extents.
1744 */ 1643 */
1745 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, XFS_DATA_FORK); 1644 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1746 xfs_bmbt_set_blockcount(ep, 1645 xfs_bmbt_set_blockcount(ep,
1747 new->br_startoff - PREV.br_startoff); 1646 new->br_startoff - PREV.br_startoff);
1748 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK); 1647 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1648
1749 r[0] = *new; 1649 r[0] = *new;
1750 r[1].br_startoff = new_endoff; 1650 r[1].br_startoff = new_endoff;
1751 r[1].br_blockcount = 1651 r[1].br_blockcount =
1752 PREV.br_startoff + PREV.br_blockcount - new_endoff; 1652 PREV.br_startoff + PREV.br_blockcount - new_endoff;
1753 r[1].br_startblock = new->br_startblock + new->br_blockcount; 1653 r[1].br_startblock = new->br_startblock + new->br_blockcount;
1754 r[1].br_state = oldext; 1654 r[1].br_state = oldext;
1755 XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1],
1756 XFS_DATA_FORK);
1757 xfs_iext_insert(ip, idx + 1, 2, &r[0], state); 1655 xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
1758 ip->i_df.if_lastex = idx + 1; 1656 ip->i_df.if_lastex = idx + 1;
1759 ip->i_d.di_nextents += 2; 1657 ip->i_d.di_nextents += 2;
@@ -1908,8 +1806,8 @@ xfs_bmap_add_extent_hole_delay(
1908 */ 1806 */
1909 temp = left.br_blockcount + new->br_blockcount + 1807 temp = left.br_blockcount + new->br_blockcount +
1910 right.br_blockcount; 1808 right.br_blockcount;
1911 XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1, 1809
1912 XFS_DATA_FORK); 1810 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
1913 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); 1811 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp);
1914 oldlen = startblockval(left.br_startblock) + 1812 oldlen = startblockval(left.br_startblock) +
1915 startblockval(new->br_startblock) + 1813 startblockval(new->br_startblock) +
@@ -1917,9 +1815,8 @@ xfs_bmap_add_extent_hole_delay(
1917 newlen = xfs_bmap_worst_indlen(ip, temp); 1815 newlen = xfs_bmap_worst_indlen(ip, temp);
1918 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), 1816 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1),
1919 nullstartblock((int)newlen)); 1817 nullstartblock((int)newlen));
1920 XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, 1818 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
1921 XFS_DATA_FORK); 1819
1922 XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK);
1923 xfs_iext_remove(ip, idx, 1, state); 1820 xfs_iext_remove(ip, idx, 1, state);
1924 ip->i_df.if_lastex = idx - 1; 1821 ip->i_df.if_lastex = idx - 1;
1925 /* DELTA: Two in-core extents were replaced by one. */ 1822 /* DELTA: Two in-core extents were replaced by one. */
@@ -1934,16 +1831,15 @@ xfs_bmap_add_extent_hole_delay(
1934 * Merge the new allocation with the left neighbor. 1831 * Merge the new allocation with the left neighbor.
1935 */ 1832 */
1936 temp = left.br_blockcount + new->br_blockcount; 1833 temp = left.br_blockcount + new->br_blockcount;
1937 XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1, 1834 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
1938 XFS_DATA_FORK);
1939 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); 1835 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp);
1940 oldlen = startblockval(left.br_startblock) + 1836 oldlen = startblockval(left.br_startblock) +
1941 startblockval(new->br_startblock); 1837 startblockval(new->br_startblock);
1942 newlen = xfs_bmap_worst_indlen(ip, temp); 1838 newlen = xfs_bmap_worst_indlen(ip, temp);
1943 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), 1839 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1),
1944 nullstartblock((int)newlen)); 1840 nullstartblock((int)newlen));
1945 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, 1841 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
1946 XFS_DATA_FORK); 1842
1947 ip->i_df.if_lastex = idx - 1; 1843 ip->i_df.if_lastex = idx - 1;
1948 /* DELTA: One in-core extent grew into a hole. */ 1844 /* DELTA: One in-core extent grew into a hole. */
1949 temp2 = temp; 1845 temp2 = temp;
@@ -1956,14 +1852,15 @@ xfs_bmap_add_extent_hole_delay(
1956 * on the right. 1852 * on the right.
1957 * Merge the new allocation with the right neighbor. 1853 * Merge the new allocation with the right neighbor.
1958 */ 1854 */
1959 XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, XFS_DATA_FORK); 1855 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
1960 temp = new->br_blockcount + right.br_blockcount; 1856 temp = new->br_blockcount + right.br_blockcount;
1961 oldlen = startblockval(new->br_startblock) + 1857 oldlen = startblockval(new->br_startblock) +
1962 startblockval(right.br_startblock); 1858 startblockval(right.br_startblock);
1963 newlen = xfs_bmap_worst_indlen(ip, temp); 1859 newlen = xfs_bmap_worst_indlen(ip, temp);
1964 xfs_bmbt_set_allf(ep, new->br_startoff, 1860 xfs_bmbt_set_allf(ep, new->br_startoff,
1965 nullstartblock((int)newlen), temp, right.br_state); 1861 nullstartblock((int)newlen), temp, right.br_state);
1966 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, XFS_DATA_FORK); 1862 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
1863
1967 ip->i_df.if_lastex = idx; 1864 ip->i_df.if_lastex = idx;
1968 /* DELTA: One in-core extent grew into a hole. */ 1865 /* DELTA: One in-core extent grew into a hole. */
1969 temp2 = temp; 1866 temp2 = temp;
@@ -1977,8 +1874,6 @@ xfs_bmap_add_extent_hole_delay(
1977 * Insert a new entry. 1874 * Insert a new entry.
1978 */ 1875 */
1979 oldlen = newlen = 0; 1876 oldlen = newlen = 0;
1980 XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL,
1981 XFS_DATA_FORK);
1982 xfs_iext_insert(ip, idx, 1, new, state); 1877 xfs_iext_insert(ip, idx, 1, new, state);
1983 ip->i_df.if_lastex = idx; 1878 ip->i_df.if_lastex = idx;
1984 /* DELTA: A new in-core extent was added in a hole. */ 1879 /* DELTA: A new in-core extent was added in a hole. */
@@ -2091,14 +1986,12 @@ xfs_bmap_add_extent_hole_real(
2091 * left and on the right. 1986 * left and on the right.
2092 * Merge all three into a single extent record. 1987 * Merge all three into a single extent record.
2093 */ 1988 */
2094 XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1, 1989 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
2095 whichfork);
2096 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 1990 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
2097 left.br_blockcount + new->br_blockcount + 1991 left.br_blockcount + new->br_blockcount +
2098 right.br_blockcount); 1992 right.br_blockcount);
2099 XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, 1993 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
2100 whichfork); 1994
2101 XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, whichfork);
2102 xfs_iext_remove(ip, idx, 1, state); 1995 xfs_iext_remove(ip, idx, 1, state);
2103 ifp->if_lastex = idx - 1; 1996 ifp->if_lastex = idx - 1;
2104 XFS_IFORK_NEXT_SET(ip, whichfork, 1997 XFS_IFORK_NEXT_SET(ip, whichfork,
@@ -2140,10 +2033,11 @@ xfs_bmap_add_extent_hole_real(
2140 * on the left. 2033 * on the left.
2141 * Merge the new allocation with the left neighbor. 2034 * Merge the new allocation with the left neighbor.
2142 */ 2035 */
2143 XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1, whichfork); 2036 trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
2144 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), 2037 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1),
2145 left.br_blockcount + new->br_blockcount); 2038 left.br_blockcount + new->br_blockcount);
2146 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, whichfork); 2039 trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
2040
2147 ifp->if_lastex = idx - 1; 2041 ifp->if_lastex = idx - 1;
2148 if (cur == NULL) { 2042 if (cur == NULL) {
2149 rval = xfs_ilog_fext(whichfork); 2043 rval = xfs_ilog_fext(whichfork);
@@ -2174,11 +2068,12 @@ xfs_bmap_add_extent_hole_real(
2174 * on the right. 2068 * on the right.
2175 * Merge the new allocation with the right neighbor. 2069 * Merge the new allocation with the right neighbor.
2176 */ 2070 */
2177 XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, whichfork); 2071 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
2178 xfs_bmbt_set_allf(ep, new->br_startoff, new->br_startblock, 2072 xfs_bmbt_set_allf(ep, new->br_startoff, new->br_startblock,
2179 new->br_blockcount + right.br_blockcount, 2073 new->br_blockcount + right.br_blockcount,
2180 right.br_state); 2074 right.br_state);
2181 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, whichfork); 2075 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
2076
2182 ifp->if_lastex = idx; 2077 ifp->if_lastex = idx;
2183 if (cur == NULL) { 2078 if (cur == NULL) {
2184 rval = xfs_ilog_fext(whichfork); 2079 rval = xfs_ilog_fext(whichfork);
@@ -2209,7 +2104,6 @@ xfs_bmap_add_extent_hole_real(
2209 * real allocation. 2104 * real allocation.
2210 * Insert a new entry. 2105 * Insert a new entry.
2211 */ 2106 */
2212 XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, whichfork);
2213 xfs_iext_insert(ip, idx, 1, new, state); 2107 xfs_iext_insert(ip, idx, 1, new, state);
2214 ifp->if_lastex = idx; 2108 ifp->if_lastex = idx;
2215 XFS_IFORK_NEXT_SET(ip, whichfork, 2109 XFS_IFORK_NEXT_SET(ip, whichfork,
@@ -3070,8 +2964,13 @@ xfs_bmap_del_extent(
3070 uint qfield; /* quota field to update */ 2964 uint qfield; /* quota field to update */
3071 xfs_filblks_t temp; /* for indirect length calculations */ 2965 xfs_filblks_t temp; /* for indirect length calculations */
3072 xfs_filblks_t temp2; /* for indirect length calculations */ 2966 xfs_filblks_t temp2; /* for indirect length calculations */
2967 int state = 0;
3073 2968
3074 XFS_STATS_INC(xs_del_exlist); 2969 XFS_STATS_INC(xs_del_exlist);
2970
2971 if (whichfork == XFS_ATTR_FORK)
2972 state |= BMAP_ATTRFORK;
2973
3075 mp = ip->i_mount; 2974 mp = ip->i_mount;
3076 ifp = XFS_IFORK_PTR(ip, whichfork); 2975 ifp = XFS_IFORK_PTR(ip, whichfork);
3077 ASSERT((idx >= 0) && (idx < ifp->if_bytes / 2976 ASSERT((idx >= 0) && (idx < ifp->if_bytes /
@@ -3151,7 +3050,6 @@ xfs_bmap_del_extent(
3151 /* 3050 /*
3152 * Matches the whole extent. Delete the entry. 3051 * Matches the whole extent. Delete the entry.
3153 */ 3052 */
3154 XFS_BMAP_TRACE_DELETE("3", ip, idx, 1, whichfork);
3155 xfs_iext_remove(ip, idx, 1, 3053 xfs_iext_remove(ip, idx, 1,
3156 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0); 3054 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
3157 ifp->if_lastex = idx; 3055 ifp->if_lastex = idx;
@@ -3173,7 +3071,7 @@ xfs_bmap_del_extent(
3173 /* 3071 /*
3174 * Deleting the first part of the extent. 3072 * Deleting the first part of the extent.
3175 */ 3073 */
3176 XFS_BMAP_TRACE_PRE_UPDATE("2", ip, idx, whichfork); 3074 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
3177 xfs_bmbt_set_startoff(ep, del_endoff); 3075 xfs_bmbt_set_startoff(ep, del_endoff);
3178 temp = got.br_blockcount - del->br_blockcount; 3076 temp = got.br_blockcount - del->br_blockcount;
3179 xfs_bmbt_set_blockcount(ep, temp); 3077 xfs_bmbt_set_blockcount(ep, temp);
@@ -3182,13 +3080,12 @@ xfs_bmap_del_extent(
3182 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 3080 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
3183 da_old); 3081 da_old);
3184 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 3082 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
3185 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, 3083 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
3186 whichfork);
3187 da_new = temp; 3084 da_new = temp;
3188 break; 3085 break;
3189 } 3086 }
3190 xfs_bmbt_set_startblock(ep, del_endblock); 3087 xfs_bmbt_set_startblock(ep, del_endblock);
3191 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, whichfork); 3088 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
3192 if (!cur) { 3089 if (!cur) {
3193 flags |= xfs_ilog_fext(whichfork); 3090 flags |= xfs_ilog_fext(whichfork);
3194 break; 3091 break;
@@ -3204,19 +3101,18 @@ xfs_bmap_del_extent(
3204 * Deleting the last part of the extent. 3101 * Deleting the last part of the extent.
3205 */ 3102 */
3206 temp = got.br_blockcount - del->br_blockcount; 3103 temp = got.br_blockcount - del->br_blockcount;
3207 XFS_BMAP_TRACE_PRE_UPDATE("1", ip, idx, whichfork); 3104 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
3208 xfs_bmbt_set_blockcount(ep, temp); 3105 xfs_bmbt_set_blockcount(ep, temp);
3209 ifp->if_lastex = idx; 3106 ifp->if_lastex = idx;
3210 if (delay) { 3107 if (delay) {
3211 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 3108 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
3212 da_old); 3109 da_old);
3213 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp)); 3110 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
3214 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, 3111 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
3215 whichfork);
3216 da_new = temp; 3112 da_new = temp;
3217 break; 3113 break;
3218 } 3114 }
3219 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, whichfork); 3115 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
3220 if (!cur) { 3116 if (!cur) {
3221 flags |= xfs_ilog_fext(whichfork); 3117 flags |= xfs_ilog_fext(whichfork);
3222 break; 3118 break;
@@ -3233,7 +3129,7 @@ xfs_bmap_del_extent(
3233 * Deleting the middle of the extent. 3129 * Deleting the middle of the extent.
3234 */ 3130 */
3235 temp = del->br_startoff - got.br_startoff; 3131 temp = del->br_startoff - got.br_startoff;
3236 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, whichfork); 3132 trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
3237 xfs_bmbt_set_blockcount(ep, temp); 3133 xfs_bmbt_set_blockcount(ep, temp);
3238 new.br_startoff = del_endoff; 3134 new.br_startoff = del_endoff;
3239 temp2 = got_endoff - del_endoff; 3135 temp2 = got_endoff - del_endoff;
@@ -3320,11 +3216,8 @@ xfs_bmap_del_extent(
3320 } 3216 }
3321 } 3217 }
3322 } 3218 }
3323 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, whichfork); 3219 trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
3324 XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 1, &new, NULL, 3220 xfs_iext_insert(ip, idx + 1, 1, &new, state);
3325 whichfork);
3326 xfs_iext_insert(ip, idx + 1, 1, &new,
3327 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
3328 ifp->if_lastex = idx + 1; 3221 ifp->if_lastex = idx + 1;
3329 break; 3222 break;
3330 } 3223 }
@@ -3644,7 +3537,9 @@ xfs_bmap_local_to_extents(
3644 xfs_iext_add(ifp, 0, 1); 3537 xfs_iext_add(ifp, 0, 1);
3645 ep = xfs_iext_get_ext(ifp, 0); 3538 ep = xfs_iext_get_ext(ifp, 0);
3646 xfs_bmbt_set_allf(ep, 0, args.fsbno, 1, XFS_EXT_NORM); 3539 xfs_bmbt_set_allf(ep, 0, args.fsbno, 1, XFS_EXT_NORM);
3647 XFS_BMAP_TRACE_POST_UPDATE("new", ip, 0, whichfork); 3540 trace_xfs_bmap_post_update(ip, 0,
3541 whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0,
3542 _THIS_IP_);
3648 XFS_IFORK_NEXT_SET(ip, whichfork, 1); 3543 XFS_IFORK_NEXT_SET(ip, whichfork, 1);
3649 ip->i_d.di_nblocks = 1; 3544 ip->i_d.di_nblocks = 1;
3650 xfs_trans_mod_dquot_byino(tp, ip, 3545 xfs_trans_mod_dquot_byino(tp, ip,
@@ -3757,158 +3652,6 @@ xfs_bmap_search_extents(
3757 return ep; 3652 return ep;
3758} 3653}
3759 3654
3760
3761#ifdef XFS_BMAP_TRACE
3762ktrace_t *xfs_bmap_trace_buf;
3763
3764/*
3765 * Add a bmap trace buffer entry. Base routine for the others.
3766 */
3767STATIC void
3768xfs_bmap_trace_addentry(
3769 int opcode, /* operation */
3770 const char *fname, /* function name */
3771 char *desc, /* operation description */
3772 xfs_inode_t *ip, /* incore inode pointer */
3773 xfs_extnum_t idx, /* index of entry(ies) */
3774 xfs_extnum_t cnt, /* count of entries, 1 or 2 */
3775 xfs_bmbt_rec_host_t *r1, /* first record */
3776 xfs_bmbt_rec_host_t *r2, /* second record or null */
3777 int whichfork) /* data or attr fork */
3778{
3779 xfs_bmbt_rec_host_t tr2;
3780
3781 ASSERT(cnt == 1 || cnt == 2);
3782 ASSERT(r1 != NULL);
3783 if (cnt == 1) {
3784 ASSERT(r2 == NULL);
3785 r2 = &tr2;
3786 memset(&tr2, 0, sizeof(tr2));
3787 } else
3788 ASSERT(r2 != NULL);
3789 ktrace_enter(xfs_bmap_trace_buf,
3790 (void *)(__psint_t)(opcode | (whichfork << 16)),
3791 (void *)fname, (void *)desc, (void *)ip,
3792 (void *)(__psint_t)idx,
3793 (void *)(__psint_t)cnt,
3794 (void *)(__psunsigned_t)(ip->i_ino >> 32),
3795 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
3796 (void *)(__psunsigned_t)(r1->l0 >> 32),
3797 (void *)(__psunsigned_t)(unsigned)(r1->l0),
3798 (void *)(__psunsigned_t)(r1->l1 >> 32),
3799 (void *)(__psunsigned_t)(unsigned)(r1->l1),
3800 (void *)(__psunsigned_t)(r2->l0 >> 32),
3801 (void *)(__psunsigned_t)(unsigned)(r2->l0),
3802 (void *)(__psunsigned_t)(r2->l1 >> 32),
3803 (void *)(__psunsigned_t)(unsigned)(r2->l1)
3804 );
3805 ASSERT(ip->i_xtrace);
3806 ktrace_enter(ip->i_xtrace,
3807 (void *)(__psint_t)(opcode | (whichfork << 16)),
3808 (void *)fname, (void *)desc, (void *)ip,
3809 (void *)(__psint_t)idx,
3810 (void *)(__psint_t)cnt,
3811 (void *)(__psunsigned_t)(ip->i_ino >> 32),
3812 (void *)(__psunsigned_t)(unsigned)ip->i_ino,
3813 (void *)(__psunsigned_t)(r1->l0 >> 32),
3814 (void *)(__psunsigned_t)(unsigned)(r1->l0),
3815 (void *)(__psunsigned_t)(r1->l1 >> 32),
3816 (void *)(__psunsigned_t)(unsigned)(r1->l1),
3817 (void *)(__psunsigned_t)(r2->l0 >> 32),
3818 (void *)(__psunsigned_t)(unsigned)(r2->l0),
3819 (void *)(__psunsigned_t)(r2->l1 >> 32),
3820 (void *)(__psunsigned_t)(unsigned)(r2->l1)
3821 );
3822}
3823
3824/*
3825 * Add bmap trace entry prior to a call to xfs_iext_remove.
3826 */
3827STATIC void
3828xfs_bmap_trace_delete(
3829 const char *fname, /* function name */
3830 char *desc, /* operation description */
3831 xfs_inode_t *ip, /* incore inode pointer */
3832 xfs_extnum_t idx, /* index of entry(entries) deleted */
3833 xfs_extnum_t cnt, /* count of entries deleted, 1 or 2 */
3834 int whichfork) /* data or attr fork */
3835{
3836 xfs_ifork_t *ifp; /* inode fork pointer */
3837
3838 ifp = XFS_IFORK_PTR(ip, whichfork);
3839 xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_DELETE, fname, desc, ip, idx,
3840 cnt, xfs_iext_get_ext(ifp, idx),
3841 cnt == 2 ? xfs_iext_get_ext(ifp, idx + 1) : NULL,
3842 whichfork);
3843}
3844
3845/*
3846 * Add bmap trace entry prior to a call to xfs_iext_insert, or
3847 * reading in the extents list from the disk (in the btree).
3848 */
3849STATIC void
3850xfs_bmap_trace_insert(
3851 const char *fname, /* function name */
3852 char *desc, /* operation description */
3853 xfs_inode_t *ip, /* incore inode pointer */
3854 xfs_extnum_t idx, /* index of entry(entries) inserted */
3855 xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */
3856 xfs_bmbt_irec_t *r1, /* inserted record 1 */
3857 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
3858 int whichfork) /* data or attr fork */
3859{
3860 xfs_bmbt_rec_host_t tr1; /* compressed record 1 */
3861 xfs_bmbt_rec_host_t tr2; /* compressed record 2 if needed */
3862
3863 xfs_bmbt_set_all(&tr1, r1);
3864 if (cnt == 2) {
3865 ASSERT(r2 != NULL);
3866 xfs_bmbt_set_all(&tr2, r2);
3867 } else {
3868 ASSERT(cnt == 1);
3869 ASSERT(r2 == NULL);
3870 }
3871 xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_INSERT, fname, desc, ip, idx,
3872 cnt, &tr1, cnt == 2 ? &tr2 : NULL, whichfork);
3873}
3874
3875/*
3876 * Add bmap trace entry after updating an extent record in place.
3877 */
3878STATIC void
3879xfs_bmap_trace_post_update(
3880 const char *fname, /* function name */
3881 char *desc, /* operation description */
3882 xfs_inode_t *ip, /* incore inode pointer */
3883 xfs_extnum_t idx, /* index of entry updated */
3884 int whichfork) /* data or attr fork */
3885{
3886 xfs_ifork_t *ifp; /* inode fork pointer */
3887
3888 ifp = XFS_IFORK_PTR(ip, whichfork);
3889 xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_POST_UP, fname, desc, ip, idx,
3890 1, xfs_iext_get_ext(ifp, idx), NULL, whichfork);
3891}
3892
3893/*
3894 * Add bmap trace entry prior to updating an extent record in place.
3895 */
3896STATIC void
3897xfs_bmap_trace_pre_update(
3898 const char *fname, /* function name */
3899 char *desc, /* operation description */
3900 xfs_inode_t *ip, /* incore inode pointer */
3901 xfs_extnum_t idx, /* index of entry to be updated */
3902 int whichfork) /* data or attr fork */
3903{
3904 xfs_ifork_t *ifp; /* inode fork pointer */
3905
3906 ifp = XFS_IFORK_PTR(ip, whichfork);
3907 xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_PRE_UP, fname, desc, ip, idx, 1,
3908 xfs_iext_get_ext(ifp, idx), NULL, whichfork);
3909}
3910#endif /* XFS_BMAP_TRACE */
3911
3912/* 3655/*
3913 * Compute the worst-case number of indirect blocks that will be used 3656 * Compute the worst-case number of indirect blocks that will be used
3914 * for ip's delayed extent of length "len". 3657 * for ip's delayed extent of length "len".
@@ -3940,37 +3683,6 @@ xfs_bmap_worst_indlen(
3940 return rval; 3683 return rval;
3941} 3684}
3942 3685
3943#if defined(XFS_RW_TRACE)
3944STATIC void
3945xfs_bunmap_trace(
3946 xfs_inode_t *ip,
3947 xfs_fileoff_t bno,
3948 xfs_filblks_t len,
3949 int flags,
3950 inst_t *ra)
3951{
3952 if (ip->i_rwtrace == NULL)
3953 return;
3954 ktrace_enter(ip->i_rwtrace,
3955 (void *)(__psint_t)XFS_BUNMAP,
3956 (void *)ip,
3957 (void *)(__psint_t)((ip->i_d.di_size >> 32) & 0xffffffff),
3958 (void *)(__psint_t)(ip->i_d.di_size & 0xffffffff),
3959 (void *)(__psint_t)(((xfs_dfiloff_t)bno >> 32) & 0xffffffff),
3960 (void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff),
3961 (void *)(__psint_t)len,
3962 (void *)(__psint_t)flags,
3963 (void *)(unsigned long)current_cpu(),
3964 (void *)ra,
3965 (void *)0,
3966 (void *)0,
3967 (void *)0,
3968 (void *)0,
3969 (void *)0,
3970 (void *)0);
3971}
3972#endif
3973
3974/* 3686/*
3975 * Convert inode from non-attributed to attributed. 3687 * Convert inode from non-attributed to attributed.
3976 * Must not be in a transaction, ip must not be locked. 3688 * Must not be in a transaction, ip must not be locked.
@@ -4659,34 +4371,30 @@ error0:
4659 return XFS_ERROR(EFSCORRUPTED); 4371 return XFS_ERROR(EFSCORRUPTED);
4660} 4372}
4661 4373
4662#ifdef XFS_BMAP_TRACE 4374#ifdef DEBUG
4663/* 4375/*
4664 * Add bmap trace insert entries for all the contents of the extent records. 4376 * Add bmap trace insert entries for all the contents of the extent records.
4665 */ 4377 */
4666void 4378void
4667xfs_bmap_trace_exlist( 4379xfs_bmap_trace_exlist(
4668 const char *fname, /* function name */
4669 xfs_inode_t *ip, /* incore inode pointer */ 4380 xfs_inode_t *ip, /* incore inode pointer */
4670 xfs_extnum_t cnt, /* count of entries in the list */ 4381 xfs_extnum_t cnt, /* count of entries in the list */
4671 int whichfork) /* data or attr fork */ 4382 int whichfork, /* data or attr fork */
4383 unsigned long caller_ip)
4672{ 4384{
4673 xfs_bmbt_rec_host_t *ep; /* current extent record */
4674 xfs_extnum_t idx; /* extent record index */ 4385 xfs_extnum_t idx; /* extent record index */
4675 xfs_ifork_t *ifp; /* inode fork pointer */ 4386 xfs_ifork_t *ifp; /* inode fork pointer */
4676 xfs_bmbt_irec_t s; /* file extent record */ 4387 int state = 0;
4388
4389 if (whichfork == XFS_ATTR_FORK)
4390 state |= BMAP_ATTRFORK;
4677 4391
4678 ifp = XFS_IFORK_PTR(ip, whichfork); 4392 ifp = XFS_IFORK_PTR(ip, whichfork);
4679 ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))); 4393 ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
4680 for (idx = 0; idx < cnt; idx++) { 4394 for (idx = 0; idx < cnt; idx++)
4681 ep = xfs_iext_get_ext(ifp, idx); 4395 trace_xfs_extlist(ip, idx, whichfork, caller_ip);
4682 xfs_bmbt_get_all(ep, &s);
4683 XFS_BMAP_TRACE_INSERT("exlist", ip, idx, 1, &s, NULL,
4684 whichfork);
4685 }
4686} 4396}
4687#endif
4688 4397
4689#ifdef DEBUG
4690/* 4398/*
4691 * Validate that the bmbt_irecs being returned from bmapi are valid 4399 * Validate that the bmbt_irecs being returned from bmapi are valid
4692 * given the callers original parameters. Specifically check the 4400 * given the callers original parameters. Specifically check the
@@ -5435,7 +5143,8 @@ xfs_bunmapi(
5435 int rsvd; /* OK to allocate reserved blocks */ 5143 int rsvd; /* OK to allocate reserved blocks */
5436 xfs_fsblock_t sum; 5144 xfs_fsblock_t sum;
5437 5145
5438 xfs_bunmap_trace(ip, bno, len, flags, (inst_t *)__return_address); 5146 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_);
5147
5439 whichfork = (flags & XFS_BMAPI_ATTRFORK) ? 5148 whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
5440 XFS_ATTR_FORK : XFS_DATA_FORK; 5149 XFS_ATTR_FORK : XFS_DATA_FORK;
5441 ifp = XFS_IFORK_PTR(ip, whichfork); 5150 ifp = XFS_IFORK_PTR(ip, whichfork);