|
|
| version 1.371, 2007/07/09 06:12:03 | version 1.372, 2007/07/09 15:43:09 |
|---|---|
| Line 278 xfs_bmap_isaeof( | Line 278 xfs_bmap_isaeof( |
| STATIC void | STATIC void |
| xfs_bmap_trace_addentry( | xfs_bmap_trace_addentry( |
| int opcode, /* operation */ | int opcode, /* operation */ |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(ies) */ | xfs_extnum_t idx, /* index of entry(ies) */ |
| Line 292 xfs_bmap_trace_addentry( | Line 292 xfs_bmap_trace_addentry( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_delete( | xfs_bmap_trace_delete( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(entries) deleted */ | xfs_extnum_t idx, /* index of entry(entries) deleted */ |
| Line 305 xfs_bmap_trace_delete( | Line 305 xfs_bmap_trace_delete( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_insert( | xfs_bmap_trace_insert( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(entries) inserted */ | xfs_extnum_t idx, /* index of entry(entries) inserted */ |
| Line 319 xfs_bmap_trace_insert( | Line 319 xfs_bmap_trace_insert( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_post_update( | xfs_bmap_trace_post_update( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry updated */ | xfs_extnum_t idx, /* index of entry updated */ |
| Line 330 xfs_bmap_trace_post_update( | Line 330 xfs_bmap_trace_post_update( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_pre_update( | xfs_bmap_trace_pre_update( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry to be updated */ | xfs_extnum_t idx, /* index of entry to be updated */ |
| int whichfork); /* data or attr fork */ | int whichfork); /* data or attr fork */ |
| #define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w) \ | |
| xfs_bmap_trace_delete(__FUNCTION__,d,ip,i,c,w) | |
| #define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w) \ | |
| xfs_bmap_trace_insert(__FUNCTION__,d,ip,i,c,r1,r2,w) | |
| #define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w) \ | |
| xfs_bmap_trace_post_update(__FUNCTION__,d,ip,i,w) | |
| #define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w) \ | |
| xfs_bmap_trace_pre_update(__FUNCTION__,d,ip,i,w) | |
| #else | #else |
| #define xfs_bmap_trace_delete(f,d,ip,i,c,w) | #define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w) |
| #define xfs_bmap_trace_insert(f,d,ip,i,c,r1,r2,w) | #define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w) |
| #define xfs_bmap_trace_post_update(f,d,ip,i,w) | #define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w) |
| #define xfs_bmap_trace_pre_update(f,d,ip,i,w) | #define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w) |
| #endif /* XFS_BMAP_TRACE */ | #endif /* XFS_BMAP_TRACE */ |
| /* | /* |
| Line 532 xfs_bmap_add_extent( | Line 540 xfs_bmap_add_extent( |
| xfs_filblks_t da_new; /* new count del alloc blocks used */ | xfs_filblks_t da_new; /* new count del alloc blocks used */ |
| xfs_filblks_t da_old; /* old count del alloc blocks used */ | xfs_filblks_t da_old; /* old count del alloc blocks used */ |
| int error; /* error return value */ | int error; /* error return value */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_add_extent"; | |
| #endif | |
| xfs_ifork_t *ifp; /* inode fork ptr */ | xfs_ifork_t *ifp; /* inode fork ptr */ |
| int logflags; /* returned value */ | int logflags; /* returned value */ |
| xfs_extnum_t nextents; /* number of extents in file now */ | xfs_extnum_t nextents; /* number of extents in file now */ |
| Line 552 xfs_bmap_add_extent( | Line 557 xfs_bmap_add_extent( |
| * already extents in the list. | * already extents in the list. |
| */ | */ |
| if (nextents == 0) { | if (nextents == 0) { |
| xfs_bmap_trace_insert(fname, "insert empty", ip, 0, 1, new, | XFS_BMAP_TRACE_INSERT("insert empty", ip, 0, 1, new, NULL, |
| NULL, whichfork); | whichfork); |
| xfs_iext_insert(ifp, 0, 1, new); | xfs_iext_insert(ifp, 0, 1, new); |
| ASSERT(cur == NULL); | ASSERT(cur == NULL); |
| ifp->if_lastex = 0; | ifp->if_lastex = 0; |
| Line 711 xfs_bmap_add_extent_delay_real( | Line 716 xfs_bmap_add_extent_delay_real( |
| int diff; /* temp value */ | int diff; /* temp value */ |
| xfs_bmbt_rec_t *ep; /* extent entry for idx */ | xfs_bmbt_rec_t *ep; /* extent entry for idx */ |
| int error; /* error return value */ | int error; /* error return value */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_add_extent_delay_real"; | |
| #endif | |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_fileoff_t new_endoff; /* end offset of new entry */ | xfs_fileoff_t new_endoff; /* end offset of new entry */ |
| Line 809 xfs_bmap_add_extent_delay_real( | Line 811 xfs_bmap_add_extent_delay_real( |
| * Filling in all of a previously delayed allocation extent. | * Filling in all of a previously delayed allocation extent. |
| * The left and right neighbors are both contiguous with new. | * The left and right neighbors are both contiguous with new. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + PREV.br_blockcount + | LEFT.br_blockcount + PREV.br_blockcount + |
| RIGHT.br_blockcount); | RIGHT.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|RF|LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | |
| xfs_bmap_trace_delete(fname, "LF|RF|LC|RC", ip, idx, 2, | |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx, 2); | xfs_iext_remove(ifp, idx, 2); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| ip->i_d.di_nextents--; | ip->i_d.di_nextents--; |
| Line 856 xfs_bmap_add_extent_delay_real( | Line 857 xfs_bmap_add_extent_delay_real( |
| * Filling in all of a previously delayed allocation extent. | * Filling in all of a previously delayed allocation extent. |
| * The left neighbor is contiguous, the right is not. | * The left neighbor is contiguous, the right is not. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|LC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + PREV.br_blockcount); | LEFT.br_blockcount + PREV.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|RF|LC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| xfs_bmap_trace_delete(fname, "LF|RF|LC", ip, idx, 1, | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx, 1); | xfs_iext_remove(ifp, idx, 1); |
| if (cur == NULL) | if (cur == NULL) |
| rval = XFS_ILOG_DEXT; | rval = XFS_ILOG_DEXT; |
| Line 893 xfs_bmap_add_extent_delay_real( | Line 893 xfs_bmap_add_extent_delay_real( |
| * Filling in all of a previously delayed allocation extent. | * Filling in all of a previously delayed allocation extent. |
| * The right neighbor is contiguous, the left is not. | * The right neighbor is contiguous, the left is not. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|RC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_startblock(ep, new->br_startblock); | xfs_bmbt_set_startblock(ep, new->br_startblock); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount + RIGHT.br_blockcount); | PREV.br_blockcount + RIGHT.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|RF|RC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| xfs_bmap_trace_delete(fname, "LF|RF|RC", ip, idx + 1, 1, | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx + 1, 1); | xfs_iext_remove(ifp, idx + 1, 1); |
| if (cur == NULL) | if (cur == NULL) |
| rval = XFS_ILOG_DEXT; | rval = XFS_ILOG_DEXT; |
| Line 932 xfs_bmap_add_extent_delay_real( | Line 929 xfs_bmap_add_extent_delay_real( |
| * Neither the left nor right neighbors are contiguous with | * Neither the left nor right neighbors are contiguous with |
| * the new one. | * the new one. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_startblock(ep, new->br_startblock); | xfs_bmbt_set_startblock(ep, new->br_startblock); |
| xfs_bmap_trace_post_update(fname, "LF|RF", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| ip->i_d.di_nextents++; | ip->i_d.di_nextents++; |
| if (cur == NULL) | if (cur == NULL) |
| Line 964 xfs_bmap_add_extent_delay_real( | Line 959 xfs_bmap_add_extent_delay_real( |
| * Filling in the first part of a previous delayed allocation. | * Filling in the first part of a previous delayed allocation. |
| * The left neighbor is contiguous. | * The left neighbor is contiguous. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|LC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx - 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + new->br_blockcount); | LEFT.br_blockcount + new->br_blockcount); |
| xfs_bmbt_set_startoff(ep, | xfs_bmbt_set_startoff(ep, |
| PREV.br_startoff + new->br_blockcount); | PREV.br_startoff + new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|LC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx - 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| temp = PREV.br_blockcount - new->br_blockcount; | temp = PREV.br_blockcount - new->br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "LF|LC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| if (cur == NULL) | if (cur == NULL) |
| Line 996 xfs_bmap_add_extent_delay_real( | Line 988 xfs_bmap_add_extent_delay_real( |
| temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), | temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), |
| STARTBLOCKVAL(PREV.br_startblock)); | STARTBLOCKVAL(PREV.br_startblock)); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "LF|LC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| *dnew = temp; | *dnew = temp; |
| /* DELTA: The boundary between two in-core extents moved. */ | /* DELTA: The boundary between two in-core extents moved. */ |
| temp = LEFT.br_startoff; | temp = LEFT.br_startoff; |
| Line 1010 xfs_bmap_add_extent_delay_real( | Line 1001 xfs_bmap_add_extent_delay_real( |
| * Filling in the first part of a previous delayed allocation. | * Filling in the first part of a previous delayed allocation. |
| * The left neighbor is not contiguous. | * The left neighbor is not contiguous. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("LF", ip, idx, XFS_DATA_FORK); |
| xfs_bmbt_set_startoff(ep, new_endoff); | xfs_bmbt_set_startoff(ep, new_endoff); |
| temp = PREV.br_blockcount - new->br_blockcount; | temp = PREV.br_blockcount - new->br_blockcount; |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| xfs_bmap_trace_insert(fname, "LF", ip, idx, 1, new, NULL, | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx, 1, new); | xfs_iext_insert(ifp, idx, 1, new); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| Line 1047 xfs_bmap_add_extent_delay_real( | Line 1038 xfs_bmap_add_extent_delay_real( |
| (cur ? cur->bc_private.b.allocated : 0)); | (cur ? cur->bc_private.b.allocated : 0)); |
| ep = xfs_iext_get_ext(ifp, idx + 1); | ep = xfs_iext_get_ext(ifp, idx + 1); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "LF", ip, idx + 1, | XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx + 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| *dnew = temp; | *dnew = temp; |
| /* DELTA: One in-core extent is split in two. */ | /* DELTA: One in-core extent is split in two. */ |
| temp = PREV.br_startoff; | temp = PREV.br_startoff; |
| Line 1061 xfs_bmap_add_extent_delay_real( | Line 1051 xfs_bmap_add_extent_delay_real( |
| * The right neighbor is contiguous with the new allocation. | * The right neighbor is contiguous with the new allocation. |
| */ | */ |
| temp = PREV.br_blockcount - new->br_blockcount; | temp = PREV.br_blockcount - new->br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "RF|RC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1, XFS_DATA_FORK); |
| xfs_bmap_trace_pre_update(fname, "RF|RC", ip, idx + 1, | |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), | xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), |
| new->br_startoff, new->br_startblock, | new->br_startoff, new->br_startblock, |
| new->br_blockcount + RIGHT.br_blockcount, | new->br_blockcount + RIGHT.br_blockcount, |
| RIGHT.br_state); | RIGHT.br_state); |
| xfs_bmap_trace_post_update(fname, "RF|RC", ip, idx + 1, | XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx + 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| if (cur == NULL) | if (cur == NULL) |
| rval = XFS_ILOG_DEXT; | rval = XFS_ILOG_DEXT; |
| Line 1092 xfs_bmap_add_extent_delay_real( | Line 1079 xfs_bmap_add_extent_delay_real( |
| temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), | temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), |
| STARTBLOCKVAL(PREV.br_startblock)); | STARTBLOCKVAL(PREV.br_startblock)); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "RF|RC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| *dnew = temp; | *dnew = temp; |
| /* DELTA: The boundary between two in-core extents moved. */ | /* DELTA: The boundary between two in-core extents moved. */ |
| temp = PREV.br_startoff; | temp = PREV.br_startoff; |
| Line 1107 xfs_bmap_add_extent_delay_real( | Line 1093 xfs_bmap_add_extent_delay_real( |
| * The right neighbor is not contiguous. | * The right neighbor is not contiguous. |
| */ | */ |
| temp = PREV.br_blockcount - new->br_blockcount; | temp = PREV.br_blockcount - new->br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "RF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("RF", ip, idx, XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| xfs_bmap_trace_insert(fname, "RF", ip, idx + 1, 1, | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, |
| new, NULL, XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx + 1, 1, new); | xfs_iext_insert(ifp, idx + 1, 1, new); |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| ip->i_d.di_nextents++; | ip->i_d.di_nextents++; |
| Line 1142 xfs_bmap_add_extent_delay_real( | Line 1128 xfs_bmap_add_extent_delay_real( |
| (cur ? cur->bc_private.b.allocated : 0)); | (cur ? cur->bc_private.b.allocated : 0)); |
| ep = xfs_iext_get_ext(ifp, idx); | ep = xfs_iext_get_ext(ifp, idx); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "RF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); |
| *dnew = temp; | *dnew = temp; |
| /* DELTA: One in-core extent is split in two. */ | /* DELTA: One in-core extent is split in two. */ |
| temp = PREV.br_startoff; | temp = PREV.br_startoff; |
| Line 1156 xfs_bmap_add_extent_delay_real( | Line 1142 xfs_bmap_add_extent_delay_real( |
| * This case is avoided almost all the time. | * This case is avoided almost all the time. |
| */ | */ |
| temp = new->br_startoff - PREV.br_startoff; | temp = new->br_startoff - PREV.br_startoff; |
| xfs_bmap_trace_pre_update(fname, "0", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| r[0] = *new; | r[0] = *new; |
| r[1].br_state = PREV.br_state; | r[1].br_state = PREV.br_state; |
| Line 1164 xfs_bmap_add_extent_delay_real( | Line 1150 xfs_bmap_add_extent_delay_real( |
| r[1].br_startoff = new_endoff; | r[1].br_startoff = new_endoff; |
| temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; | temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; |
| r[1].br_blockcount = temp2; | r[1].br_blockcount = temp2; |
| xfs_bmap_trace_insert(fname, "0", ip, idx + 1, 2, &r[0], &r[1], | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx + 1, 2, &r[0]); | xfs_iext_insert(ifp, idx + 1, 2, &r[0]); |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| Line 1223 xfs_bmap_add_extent_delay_real( | Line 1209 xfs_bmap_add_extent_delay_real( |
| } | } |
| ep = xfs_iext_get_ext(ifp, idx); | ep = xfs_iext_get_ext(ifp, idx); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "0", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK); |
| xfs_bmap_trace_pre_update(fname, "0", ip, idx + 2, | XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2), | xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2), |
| NULLSTARTBLOCK((int)temp2)); | NULLSTARTBLOCK((int)temp2)); |
| xfs_bmap_trace_post_update(fname, "0", ip, idx + 2, | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| *dnew = temp + temp2; | *dnew = temp + temp2; |
| /* DELTA: One in-core extent is split in three. */ | /* DELTA: One in-core extent is split in three. */ |
| temp = PREV.br_startoff; | temp = PREV.br_startoff; |
| Line 1288 xfs_bmap_add_extent_unwritten_real( | Line 1272 xfs_bmap_add_extent_unwritten_real( |
| xfs_btree_cur_t *cur; /* btree cursor */ | xfs_btree_cur_t *cur; /* btree cursor */ |
| xfs_bmbt_rec_t *ep; /* extent entry for idx */ | xfs_bmbt_rec_t *ep; /* extent entry for idx */ |
| int error; /* error return value */ | int error; /* error return value */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_add_extent_unwritten_real"; | |
| #endif | |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_fileoff_t new_endoff; /* end offset of new entry */ | xfs_fileoff_t new_endoff; /* end offset of new entry */ |
| Line 1391 xfs_bmap_add_extent_unwritten_real( | Line 1372 xfs_bmap_add_extent_unwritten_real( |
| * Setting all of a previous oldext extent to newext. | * Setting all of a previous oldext extent to newext. |
| * The left and right neighbors are both contiguous with new. | * The left and right neighbors are both contiguous with new. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + PREV.br_blockcount + | LEFT.br_blockcount + PREV.br_blockcount + |
| RIGHT.br_blockcount); | RIGHT.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|RF|LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | |
| xfs_bmap_trace_delete(fname, "LF|RF|LC|RC", ip, idx, 2, | |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx, 2); | xfs_iext_remove(ifp, idx, 2); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| ip->i_d.di_nextents -= 2; | ip->i_d.di_nextents -= 2; |
| Line 1442 xfs_bmap_add_extent_unwritten_real( | Line 1422 xfs_bmap_add_extent_unwritten_real( |
| * Setting all of a previous oldext extent to newext. | * Setting all of a previous oldext extent to newext. |
| * The left neighbor is contiguous, the right is not. | * The left neighbor is contiguous, the right is not. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|LC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + PREV.br_blockcount); | LEFT.br_blockcount + PREV.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|RF|LC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| xfs_bmap_trace_delete(fname, "LF|RF|LC", ip, idx, 1, | XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx, 1); | xfs_iext_remove(ifp, idx, 1); |
| ip->i_d.di_nextents--; | ip->i_d.di_nextents--; |
| if (cur == NULL) | if (cur == NULL) |
| Line 1485 xfs_bmap_add_extent_unwritten_real( | Line 1464 xfs_bmap_add_extent_unwritten_real( |
| * Setting all of a previous oldext extent to newext. | * Setting all of a previous oldext extent to newext. |
| * The right neighbor is contiguous, the left is not. | * The right neighbor is contiguous, the left is not. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF|RC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF|RC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount + RIGHT.br_blockcount); | PREV.br_blockcount + RIGHT.br_blockcount); |
| xfs_bmbt_set_state(ep, newext); | xfs_bmbt_set_state(ep, newext); |
| xfs_bmap_trace_post_update(fname, "LF|RF|RC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF|RC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| xfs_bmap_trace_delete(fname, "LF|RF|RC", ip, idx + 1, 1, | XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK); |
| XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx + 1, 1); | xfs_iext_remove(ifp, idx + 1, 1); |
| ip->i_d.di_nextents--; | ip->i_d.di_nextents--; |
| if (cur == NULL) | if (cur == NULL) |
| Line 1530 xfs_bmap_add_extent_unwritten_real( | Line 1508 xfs_bmap_add_extent_unwritten_real( |
| * Neither the left nor right neighbors are contiguous with | * Neither the left nor right neighbors are contiguous with |
| * the new one. | * the new one. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|RF", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|RF", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_state(ep, newext); | xfs_bmbt_set_state(ep, newext); |
| xfs_bmap_trace_post_update(fname, "LF|RF", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| if (cur == NULL) | if (cur == NULL) |
| Line 1560 xfs_bmap_add_extent_unwritten_real( | Line 1538 xfs_bmap_add_extent_unwritten_real( |
| * Setting the first part of a previous oldext extent to newext. | * Setting the first part of a previous oldext extent to newext. |
| * The left neighbor is contiguous. | * The left neighbor is contiguous. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF|LC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| LEFT.br_blockcount + new->br_blockcount); | LEFT.br_blockcount + new->br_blockcount); |
| xfs_bmbt_set_startoff(ep, | xfs_bmbt_set_startoff(ep, |
| PREV.br_startoff + new->br_blockcount); | PREV.br_startoff + new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|LC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmap_trace_pre_update(fname, "LF|LC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_startblock(ep, | xfs_bmbt_set_startblock(ep, |
| new->br_startblock + new->br_blockcount); | new->br_startblock + new->br_blockcount); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount - new->br_blockcount); | PREV.br_blockcount - new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF|LC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| if (cur == NULL) | if (cur == NULL) |
| Line 1611 xfs_bmap_add_extent_unwritten_real( | Line 1589 xfs_bmap_add_extent_unwritten_real( |
| * Setting the first part of a previous oldext extent to newext. | * Setting the first part of a previous oldext extent to newext. |
| * The left neighbor is not contiguous. | * The left neighbor is not contiguous. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("LF", ip, idx, XFS_DATA_FORK); |
| ASSERT(ep && xfs_bmbt_get_state(ep) == oldext); | ASSERT(ep && xfs_bmbt_get_state(ep) == oldext); |
| xfs_bmbt_set_startoff(ep, new_endoff); | xfs_bmbt_set_startoff(ep, new_endoff); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount - new->br_blockcount); | PREV.br_blockcount - new->br_blockcount); |
| xfs_bmbt_set_startblock(ep, | xfs_bmbt_set_startblock(ep, |
| new->br_startblock + new->br_blockcount); | new->br_startblock + new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx, XFS_DATA_FORK); |
| xfs_bmap_trace_insert(fname, "LF", ip, idx, 1, new, NULL, | XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx, 1, new); | xfs_iext_insert(ifp, idx, 1, new); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| Line 1654 xfs_bmap_add_extent_unwritten_real( | Line 1632 xfs_bmap_add_extent_unwritten_real( |
| * Setting the last part of a previous oldext extent to newext. | * Setting the last part of a previous oldext extent to newext. |
| * The right neighbor is contiguous with the new allocation. | * The right neighbor is contiguous with the new allocation. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "RF|RC", ip, idx, | XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmap_trace_pre_update(fname, "RF|RC", ip, idx + 1, | XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount - new->br_blockcount); | PREV.br_blockcount - new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "RF|RC", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), | xfs_bmbt_set_allf(xfs_iext_get_ext(ifp, idx + 1), |
| new->br_startoff, new->br_startblock, | new->br_startoff, new->br_startblock, |
| new->br_blockcount + RIGHT.br_blockcount, newext); | new->br_blockcount + RIGHT.br_blockcount, newext); |
| xfs_bmap_trace_post_update(fname, "RF|RC", ip, idx + 1, | XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx + 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| if (cur == NULL) | if (cur == NULL) |
| Line 1701 xfs_bmap_add_extent_unwritten_real( | Line 1679 xfs_bmap_add_extent_unwritten_real( |
| * Setting the last part of a previous oldext extent to newext. | * Setting the last part of a previous oldext extent to newext. |
| * The right neighbor is not contiguous. | * The right neighbor is not contiguous. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "RF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("RF", ip, idx, XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| PREV.br_blockcount - new->br_blockcount); | PREV.br_blockcount - new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "RF", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); |
| xfs_bmap_trace_insert(fname, "RF", ip, idx + 1, 1, | XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL, |
| new, NULL, XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx + 1, 1, new); | xfs_iext_insert(ifp, idx + 1, 1, new); |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| ip->i_d.di_nextents++; | ip->i_d.di_nextents++; |
| Line 1745 xfs_bmap_add_extent_unwritten_real( | Line 1723 xfs_bmap_add_extent_unwritten_real( |
| * newext. Contiguity is impossible here. | * newext. Contiguity is impossible here. |
| * One extent becomes three extents. | * One extent becomes three extents. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "0", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(ep, | xfs_bmbt_set_blockcount(ep, |
| new->br_startoff - PREV.br_startoff); | new->br_startoff - PREV.br_startoff); |
| xfs_bmap_trace_post_update(fname, "0", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK); |
| r[0] = *new; | r[0] = *new; |
| r[1].br_startoff = new_endoff; | r[1].br_startoff = new_endoff; |
| r[1].br_blockcount = | r[1].br_blockcount = |
| PREV.br_startoff + PREV.br_blockcount - new_endoff; | PREV.br_startoff + PREV.br_blockcount - new_endoff; |
| r[1].br_startblock = new->br_startblock + new->br_blockcount; | r[1].br_startblock = new->br_startblock + new->br_blockcount; |
| r[1].br_state = oldext; | r[1].br_state = oldext; |
| xfs_bmap_trace_insert(fname, "0", ip, idx + 1, 2, &r[0], &r[1], | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 2, &r[0], &r[1], |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx + 1, 2, &r[0]); | xfs_iext_insert(ifp, idx + 1, 2, &r[0]); |
| ip->i_df.if_lastex = idx + 1; | ip->i_df.if_lastex = idx + 1; |
| Line 1846 xfs_bmap_add_extent_hole_delay( | Line 1824 xfs_bmap_add_extent_hole_delay( |
| int rsvd) /* OK to allocate reserved blocks */ | int rsvd) /* OK to allocate reserved blocks */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* extent record for idx */ | xfs_bmbt_rec_t *ep; /* extent record for idx */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_add_extent_hole_delay"; | |
| #endif | |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_irec_t left; /* left neighbor extent entry */ | xfs_bmbt_irec_t left; /* left neighbor extent entry */ |
| xfs_filblks_t newlen=0; /* new indirect size */ | xfs_filblks_t newlen=0; /* new indirect size */ |
| Line 1920 xfs_bmap_add_extent_hole_delay( | Line 1895 xfs_bmap_add_extent_hole_delay( |
| */ | */ |
| temp = left.br_blockcount + new->br_blockcount + | temp = left.br_blockcount + new->br_blockcount + |
| right.br_blockcount; | right.br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); |
| oldlen = STARTBLOCKVAL(left.br_startblock) + | oldlen = STARTBLOCKVAL(left.br_startblock) + |
| Line 1929 xfs_bmap_add_extent_hole_delay( | Line 1904 xfs_bmap_add_extent_hole_delay( |
| newlen = xfs_bmap_worst_indlen(ip, temp); | newlen = xfs_bmap_worst_indlen(ip, temp); |
| xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), |
| NULLSTARTBLOCK((int)newlen)); | NULLSTARTBLOCK((int)newlen)); |
| xfs_bmap_trace_post_update(fname, "LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, |
| XFS_DATA_FORK); | |
| xfs_bmap_trace_delete(fname, "LC|RC", ip, idx, 1, | |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK); | |
| xfs_iext_remove(ifp, idx, 1); | xfs_iext_remove(ifp, idx, 1); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| /* DELTA: Two in-core extents were replaced by one. */ | /* DELTA: Two in-core extents were replaced by one. */ |
| Line 1947 xfs_bmap_add_extent_hole_delay( | Line 1921 xfs_bmap_add_extent_hole_delay( |
| * Merge the new allocation with the left neighbor. | * Merge the new allocation with the left neighbor. |
| */ | */ |
| temp = left.br_blockcount + new->br_blockcount; | temp = left.br_blockcount + new->br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "LC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); |
| oldlen = STARTBLOCKVAL(left.br_startblock) + | oldlen = STARTBLOCKVAL(left.br_startblock) + |
| Line 1955 xfs_bmap_add_extent_hole_delay( | Line 1929 xfs_bmap_add_extent_hole_delay( |
| newlen = xfs_bmap_worst_indlen(ip, temp); | newlen = xfs_bmap_worst_indlen(ip, temp); |
| xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), |
| NULLSTARTBLOCK((int)newlen)); | NULLSTARTBLOCK((int)newlen)); |
| xfs_bmap_trace_post_update(fname, "LC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx - 1; | ip->i_df.if_lastex = idx - 1; |
| /* DELTA: One in-core extent grew into a hole. */ | /* DELTA: One in-core extent grew into a hole. */ |
| Line 1969 xfs_bmap_add_extent_hole_delay( | Line 1943 xfs_bmap_add_extent_hole_delay( |
| * on the right. | * on the right. |
| * Merge the new allocation with the right neighbor. | * Merge the new allocation with the right neighbor. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "RC", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, XFS_DATA_FORK); |
| temp = new->br_blockcount + right.br_blockcount; | temp = new->br_blockcount + right.br_blockcount; |
| oldlen = STARTBLOCKVAL(new->br_startblock) + | oldlen = STARTBLOCKVAL(new->br_startblock) + |
| STARTBLOCKVAL(right.br_startblock); | STARTBLOCKVAL(right.br_startblock); |
| newlen = xfs_bmap_worst_indlen(ip, temp); | newlen = xfs_bmap_worst_indlen(ip, temp); |
| xfs_bmbt_set_allf(ep, new->br_startoff, | xfs_bmbt_set_allf(ep, new->br_startoff, |
| NULLSTARTBLOCK((int)newlen), temp, right.br_state); | NULLSTARTBLOCK((int)newlen), temp, right.br_state); |
| xfs_bmap_trace_post_update(fname, "RC", ip, idx, XFS_DATA_FORK); | XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, XFS_DATA_FORK); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| /* DELTA: One in-core extent grew into a hole. */ | /* DELTA: One in-core extent grew into a hole. */ |
| temp2 = temp; | temp2 = temp; |
| Line 1990 xfs_bmap_add_extent_hole_delay( | Line 1964 xfs_bmap_add_extent_hole_delay( |
| * Insert a new entry. | * Insert a new entry. |
| */ | */ |
| oldlen = newlen = 0; | oldlen = newlen = 0; |
| xfs_bmap_trace_insert(fname, "0", ip, idx, 1, new, NULL, | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, |
| XFS_DATA_FORK); | XFS_DATA_FORK); |
| xfs_iext_insert(ifp, idx, 1, new); | xfs_iext_insert(ifp, idx, 1, new); |
| ip->i_df.if_lastex = idx; | ip->i_df.if_lastex = idx; |
| Line 2040 xfs_bmap_add_extent_hole_real( | Line 2014 xfs_bmap_add_extent_hole_real( |
| { | { |
| xfs_bmbt_rec_t *ep; /* pointer to extent entry ins. point */ | xfs_bmbt_rec_t *ep; /* pointer to extent entry ins. point */ |
| int error; /* error return value */ | int error; /* error return value */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_add_extent_hole_real"; | |
| #endif | |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_irec_t left; /* left neighbor extent entry */ | xfs_bmbt_irec_t left; /* left neighbor extent entry */ |
| Line 2119 xfs_bmap_add_extent_hole_real( | Line 2090 xfs_bmap_add_extent_hole_real( |
| * left and on the right. | * left and on the right. |
| * Merge all three into a single extent record. | * Merge all three into a single extent record. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1, |
| whichfork); | whichfork); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| left.br_blockcount + new->br_blockcount + | left.br_blockcount + new->br_blockcount + |
| right.br_blockcount); | right.br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LC|RC", ip, idx - 1, | XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, |
| whichfork); | whichfork); |
| xfs_bmap_trace_delete(fname, "LC|RC", ip, | XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, whichfork); |
| idx, 1, whichfork); | |
| xfs_iext_remove(ifp, idx, 1); | xfs_iext_remove(ifp, idx, 1); |
| ifp->if_lastex = idx - 1; | ifp->if_lastex = idx - 1; |
| XFS_IFORK_NEXT_SET(ip, whichfork, | XFS_IFORK_NEXT_SET(ip, whichfork, |
| Line 2169 xfs_bmap_add_extent_hole_real( | Line 2139 xfs_bmap_add_extent_hole_real( |
| * on the left. | * on the left. |
| * Merge the new allocation with the left neighbor. | * Merge the new allocation with the left neighbor. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "LC", ip, idx - 1, whichfork); | XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1, whichfork); |
| xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), | xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), |
| left.br_blockcount + new->br_blockcount); | left.br_blockcount + new->br_blockcount); |
| xfs_bmap_trace_post_update(fname, "LC", ip, idx - 1, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, whichfork); |
| ifp->if_lastex = idx - 1; | ifp->if_lastex = idx - 1; |
| if (cur == NULL) { | if (cur == NULL) { |
| rval = XFS_ILOG_FEXT(whichfork); | rval = XFS_ILOG_FEXT(whichfork); |
| Line 2203 xfs_bmap_add_extent_hole_real( | Line 2173 xfs_bmap_add_extent_hole_real( |
| * on the right. | * on the right. |
| * Merge the new allocation with the right neighbor. | * Merge the new allocation with the right neighbor. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "RC", ip, idx, whichfork); | XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, whichfork); |
| xfs_bmbt_set_allf(ep, new->br_startoff, new->br_startblock, | xfs_bmbt_set_allf(ep, new->br_startoff, new->br_startblock, |
| new->br_blockcount + right.br_blockcount, | new->br_blockcount + right.br_blockcount, |
| right.br_state); | right.br_state); |
| xfs_bmap_trace_post_update(fname, "RC", ip, idx, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, whichfork); |
| ifp->if_lastex = idx; | ifp->if_lastex = idx; |
| if (cur == NULL) { | if (cur == NULL) { |
| rval = XFS_ILOG_FEXT(whichfork); | rval = XFS_ILOG_FEXT(whichfork); |
| Line 2238 xfs_bmap_add_extent_hole_real( | Line 2208 xfs_bmap_add_extent_hole_real( |
| * real allocation. | * real allocation. |
| * Insert a new entry. | * Insert a new entry. |
| */ | */ |
| xfs_bmap_trace_insert(fname, "0", ip, idx, 1, new, NULL, | XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, whichfork); |
| whichfork); | |
| xfs_iext_insert(ifp, idx, 1, new); | xfs_iext_insert(ifp, idx, 1, new); |
| ifp->if_lastex = idx; | ifp->if_lastex = idx; |
| XFS_IFORK_NEXT_SET(ip, whichfork, | XFS_IFORK_NEXT_SET(ip, whichfork, |
| Line 3104 xfs_bmap_del_extent( | Line 3073 xfs_bmap_del_extent( |
| xfs_bmbt_rec_t *ep; /* current extent entry pointer */ | xfs_bmbt_rec_t *ep; /* current extent entry pointer */ |
| int error; /* error return value */ | int error; /* error return value */ |
| int flags; /* inode logging flags */ | int flags; /* inode logging flags */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_del_extent"; | |
| #endif | |
| xfs_bmbt_irec_t got; /* current extent entry */ | xfs_bmbt_irec_t got; /* current extent entry */ |
| xfs_fileoff_t got_endoff; /* first offset past got */ | xfs_fileoff_t got_endoff; /* first offset past got */ |
| int i; /* temp state */ | int i; /* temp state */ |
| Line 3200 xfs_bmap_del_extent( | Line 3166 xfs_bmap_del_extent( |
| /* | /* |
| * Matches the whole extent. Delete the entry. | * Matches the whole extent. Delete the entry. |
| */ | */ |
| xfs_bmap_trace_delete(fname, "3", ip, idx, 1, whichfork); | XFS_BMAP_TRACE_DELETE("3", ip, idx, 1, whichfork); |
| xfs_iext_remove(ifp, idx, 1); | xfs_iext_remove(ifp, idx, 1); |
| ifp->if_lastex = idx; | ifp->if_lastex = idx; |
| if (delay) | if (delay) |
| Line 3221 xfs_bmap_del_extent( | Line 3187 xfs_bmap_del_extent( |
| /* | /* |
| * Deleting the first part of the extent. | * Deleting the first part of the extent. |
| */ | */ |
| xfs_bmap_trace_pre_update(fname, "2", ip, idx, whichfork); | XFS_BMAP_TRACE_PRE_UPDATE("2", ip, idx, whichfork); |
| xfs_bmbt_set_startoff(ep, del_endoff); | xfs_bmbt_set_startoff(ep, del_endoff); |
| temp = got.br_blockcount - del->br_blockcount; | temp = got.br_blockcount - del->br_blockcount; |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| Line 3230 xfs_bmap_del_extent( | Line 3196 xfs_bmap_del_extent( |
| temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), | temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), |
| da_old); | da_old); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "2", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, |
| whichfork); | whichfork); |
| da_new = temp; | da_new = temp; |
| break; | break; |
| } | } |
| xfs_bmbt_set_startblock(ep, del_endblock); | xfs_bmbt_set_startblock(ep, del_endblock); |
| xfs_bmap_trace_post_update(fname, "2", ip, idx, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, whichfork); |
| if (!cur) { | if (!cur) { |
| flags |= XFS_ILOG_FEXT(whichfork); | flags |= XFS_ILOG_FEXT(whichfork); |
| break; | break; |
| Line 3252 xfs_bmap_del_extent( | Line 3218 xfs_bmap_del_extent( |
| * Deleting the last part of the extent. | * Deleting the last part of the extent. |
| */ | */ |
| temp = got.br_blockcount - del->br_blockcount; | temp = got.br_blockcount - del->br_blockcount; |
| xfs_bmap_trace_pre_update(fname, "1", ip, idx, whichfork); | XFS_BMAP_TRACE_PRE_UPDATE("1", ip, idx, whichfork); |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| ifp->if_lastex = idx; | ifp->if_lastex = idx; |
| if (delay) { | if (delay) { |
| temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), | temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), |
| da_old); | da_old); |
| xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); | xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); |
| xfs_bmap_trace_post_update(fname, "1", ip, idx, | XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, |
| whichfork); | whichfork); |
| da_new = temp; | da_new = temp; |
| break; | break; |
| } | } |
| xfs_bmap_trace_post_update(fname, "1", ip, idx, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, whichfork); |
| if (!cur) { | if (!cur) { |
| flags |= XFS_ILOG_FEXT(whichfork); | flags |= XFS_ILOG_FEXT(whichfork); |
| break; | break; |
| Line 3281 xfs_bmap_del_extent( | Line 3247 xfs_bmap_del_extent( |
| * Deleting the middle of the extent. | * Deleting the middle of the extent. |
| */ | */ |
| temp = del->br_startoff - got.br_startoff; | temp = del->br_startoff - got.br_startoff; |
| xfs_bmap_trace_pre_update(fname, "0", ip, idx, whichfork); | XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx, whichfork); |
| xfs_bmbt_set_blockcount(ep, temp); | xfs_bmbt_set_blockcount(ep, temp); |
| new.br_startoff = del_endoff; | new.br_startoff = del_endoff; |
| temp2 = got_endoff - del_endoff; | temp2 = got_endoff - del_endoff; |
| Line 3368 xfs_bmap_del_extent( | Line 3334 xfs_bmap_del_extent( |
| } | } |
| } | } |
| } | } |
| xfs_bmap_trace_post_update(fname, "0", ip, idx, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, whichfork); |
| xfs_bmap_trace_insert(fname, "0", ip, idx + 1, 1, &new, NULL, | XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 1, &new, NULL, |
| whichfork); | whichfork); |
| xfs_iext_insert(ifp, idx + 1, 1, &new); | xfs_iext_insert(ifp, idx + 1, 1, &new); |
| ifp->if_lastex = idx + 1; | ifp->if_lastex = idx + 1; |
| Line 3609 xfs_bmap_local_to_extents( | Line 3575 xfs_bmap_local_to_extents( |
| { | { |
| int error; /* error return value */ | int error; /* error return value */ |
| int flags; /* logging flags returned */ | int flags; /* logging flags returned */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_local_to_extents"; | |
| #endif | |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| /* | /* |
| Line 3666 xfs_bmap_local_to_extents( | Line 3629 xfs_bmap_local_to_extents( |
| xfs_iext_add(ifp, 0, 1); | xfs_iext_add(ifp, 0, 1); |
| ep = xfs_iext_get_ext(ifp, 0); | ep = xfs_iext_get_ext(ifp, 0); |
| xfs_bmbt_set_allf(ep, 0, args.fsbno, 1, XFS_EXT_NORM); | xfs_bmbt_set_allf(ep, 0, args.fsbno, 1, XFS_EXT_NORM); |
| xfs_bmap_trace_post_update(fname, "new", ip, 0, whichfork); | XFS_BMAP_TRACE_POST_UPDATE("new", ip, 0, whichfork); |
| XFS_IFORK_NEXT_SET(ip, whichfork, 1); | XFS_IFORK_NEXT_SET(ip, whichfork, 1); |
| ip->i_d.di_nblocks = 1; | ip->i_d.di_nblocks = 1; |
| XFS_TRANS_MOD_DQUOT_BYINO(args.mp, tp, ip, | XFS_TRANS_MOD_DQUOT_BYINO(args.mp, tp, ip, |
| Line 3789 ktrace_t *xfs_bmap_trace_buf; | Line 3752 ktrace_t *xfs_bmap_trace_buf; |
| STATIC void | STATIC void |
| xfs_bmap_trace_addentry( | xfs_bmap_trace_addentry( |
| int opcode, /* operation */ | int opcode, /* operation */ |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(ies) */ | xfs_extnum_t idx, /* index of entry(ies) */ |
| Line 3848 xfs_bmap_trace_addentry( | Line 3811 xfs_bmap_trace_addentry( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_delete( | xfs_bmap_trace_delete( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(entries) deleted */ | xfs_extnum_t idx, /* index of entry(entries) deleted */ |
| Line 3870 xfs_bmap_trace_delete( | Line 3833 xfs_bmap_trace_delete( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_insert( | xfs_bmap_trace_insert( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(entries) inserted */ | xfs_extnum_t idx, /* index of entry(entries) inserted */ |
| Line 3899 xfs_bmap_trace_insert( | Line 3862 xfs_bmap_trace_insert( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_post_update( | xfs_bmap_trace_post_update( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry updated */ | xfs_extnum_t idx, /* index of entry updated */ |
| Line 3917 xfs_bmap_trace_post_update( | Line 3880 xfs_bmap_trace_post_update( |
| */ | */ |
| STATIC void | STATIC void |
| xfs_bmap_trace_pre_update( | xfs_bmap_trace_pre_update( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| char *desc, /* operation description */ | char *desc, /* operation description */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry to be updated */ | xfs_extnum_t idx, /* index of entry to be updated */ |
| Line 4534 xfs_bmap_read_extents( | Line 4497 xfs_bmap_read_extents( |
| xfs_buf_t *bp; /* buffer for "block" */ | xfs_buf_t *bp; /* buffer for "block" */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_exntfmt_t exntf; /* XFS_EXTFMT_NOSTATE, if checking */ | xfs_exntfmt_t exntf; /* XFS_EXTFMT_NOSTATE, if checking */ |
| #ifdef XFS_BMAP_TRACE | |
| static char fname[] = "xfs_bmap_read_extents"; | |
| #endif | |
| xfs_extnum_t i, j; /* index into the extents list */ | xfs_extnum_t i, j; /* index into the extents list */ |
| xfs_ifork_t *ifp; /* fork structure */ | xfs_ifork_t *ifp; /* fork structure */ |
| int level; /* btree level, for checking */ | int level; /* btree level, for checking */ |
| Line 4653 xfs_bmap_read_extents( | Line 4613 xfs_bmap_read_extents( |
| } | } |
| ASSERT(i == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))); | ASSERT(i == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))); |
| ASSERT(i == XFS_IFORK_NEXTENTS(ip, whichfork)); | ASSERT(i == XFS_IFORK_NEXTENTS(ip, whichfork)); |
| xfs_bmap_trace_exlist(fname, ip, i, whichfork); | XFS_BMAP_TRACE_EXLIST(ip, i, whichfork); |
| return 0; | return 0; |
| error0: | error0: |
| xfs_trans_brelse(tp, bp); | xfs_trans_brelse(tp, bp); |
| Line 4666 error0: | Line 4626 error0: |
| */ | */ |
| void | void |
| xfs_bmap_trace_exlist( | xfs_bmap_trace_exlist( |
| char *fname, /* function name */ | const char *fname, /* function name */ |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t cnt, /* count of entries in the list */ | xfs_extnum_t cnt, /* count of entries in the list */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| Line 4681 xfs_bmap_trace_exlist( | Line 4641 xfs_bmap_trace_exlist( |
| for (idx = 0; idx < cnt; idx++) { | for (idx = 0; idx < cnt; idx++) { |
| ep = xfs_iext_get_ext(ifp, idx); | ep = xfs_iext_get_ext(ifp, idx); |
| xfs_bmbt_get_all(ep, &s); | xfs_bmbt_get_all(ep, &s); |
| xfs_bmap_trace_insert(fname, "exlist", ip, idx, 1, &s, NULL, | XFS_BMAP_TRACE_INSERT("exlist", ip, idx, 1, &s, NULL, |
| whichfork); | whichfork); |
| } | } |
| } | } |