|
@@ -54,6 +54,7 @@
|
|
#include "xfs_buf_item.h"
|
|
#include "xfs_buf_item.h"
|
|
#include "xfs_filestream.h"
|
|
#include "xfs_filestream.h"
|
|
#include "xfs_vnodeops.h"
|
|
#include "xfs_vnodeops.h"
|
|
|
|
+#include "xfs_trace.h"
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
#ifdef DEBUG
|
|
@@ -272,71 +273,6 @@ xfs_bmap_isaeof(
|
|
int whichfork, /* data or attribute fork */
|
|
int whichfork, /* data or attribute fork */
|
|
char *aeof); /* return value */
|
|
char *aeof); /* return value */
|
|
|
|
|
|
-#ifdef XFS_BMAP_TRACE
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to a call to xfs_iext_remove.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_delete(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry(entries) deleted */
|
|
|
|
- xfs_extnum_t cnt, /* count of entries deleted, 1 or 2 */
|
|
|
|
- int whichfork); /* data or attr fork */
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to a call to xfs_iext_insert, or
|
|
|
|
- * reading in the extents list from the disk (in the btree).
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_insert(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry(entries) inserted */
|
|
|
|
- xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */
|
|
|
|
- xfs_bmbt_irec_t *r1, /* inserted record 1 */
|
|
|
|
- xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
|
|
|
|
- int whichfork); /* data or attr fork */
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry after updating an extent record in place.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_post_update(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry updated */
|
|
|
|
- int whichfork); /* data or attr fork */
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to updating an extent record in place.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_pre_update(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry to be updated */
|
|
|
|
- int whichfork); /* data or attr fork */
|
|
|
|
-
|
|
|
|
-#define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w) \
|
|
|
|
- xfs_bmap_trace_delete(__func__,d,ip,i,c,w)
|
|
|
|
-#define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w) \
|
|
|
|
- xfs_bmap_trace_insert(__func__,d,ip,i,c,r1,r2,w)
|
|
|
|
-#define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w) \
|
|
|
|
- xfs_bmap_trace_post_update(__func__,d,ip,i,w)
|
|
|
|
-#define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w) \
|
|
|
|
- xfs_bmap_trace_pre_update(__func__,d,ip,i,w)
|
|
|
|
-#else
|
|
|
|
-#define XFS_BMAP_TRACE_DELETE(d,ip,i,c,w)
|
|
|
|
-#define XFS_BMAP_TRACE_INSERT(d,ip,i,c,r1,r2,w)
|
|
|
|
-#define XFS_BMAP_TRACE_POST_UPDATE(d,ip,i,w)
|
|
|
|
-#define XFS_BMAP_TRACE_PRE_UPDATE(d,ip,i,w)
|
|
|
|
-#endif /* XFS_BMAP_TRACE */
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Compute the worst-case number of indirect blocks that will be used
|
|
* Compute the worst-case number of indirect blocks that will be used
|
|
* for ip's delayed extent of length "len".
|
|
* for ip's delayed extent of length "len".
|
|
@@ -363,18 +299,6 @@ xfs_bmap_validate_ret(
|
|
#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
|
|
#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
|
|
#endif /* DEBUG */
|
|
#endif /* DEBUG */
|
|
|
|
|
|
-#if defined(XFS_RW_TRACE)
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bunmap_trace(
|
|
|
|
- xfs_inode_t *ip,
|
|
|
|
- xfs_fileoff_t bno,
|
|
|
|
- xfs_filblks_t len,
|
|
|
|
- int flags,
|
|
|
|
- inst_t *ra);
|
|
|
|
-#else
|
|
|
|
-#define xfs_bunmap_trace(ip, bno, len, flags, ra)
|
|
|
|
-#endif /* XFS_RW_TRACE */
|
|
|
|
-
|
|
|
|
STATIC int
|
|
STATIC int
|
|
xfs_bmap_count_tree(
|
|
xfs_bmap_count_tree(
|
|
xfs_mount_t *mp,
|
|
xfs_mount_t *mp,
|
|
@@ -590,8 +514,6 @@ xfs_bmap_add_extent(
|
|
* already extents in the list.
|
|
* already extents in the list.
|
|
*/
|
|
*/
|
|
if (nextents == 0) {
|
|
if (nextents == 0) {
|
|
- XFS_BMAP_TRACE_INSERT("insert empty", ip, 0, 1, new, NULL,
|
|
|
|
- whichfork);
|
|
|
|
xfs_iext_insert(ip, 0, 1, new,
|
|
xfs_iext_insert(ip, 0, 1, new,
|
|
whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
|
|
whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
|
|
|
|
|
|
@@ -843,14 +765,12 @@ 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("LF|RF|LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|RF|LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_remove(ip, idx, 2, state);
|
|
xfs_iext_remove(ip, idx, 2, state);
|
|
ip->i_df.if_lastex = idx - 1;
|
|
ip->i_df.if_lastex = idx - 1;
|
|
ip->i_d.di_nextents--;
|
|
ip->i_d.di_nextents--;
|
|
@@ -889,14 +809,12 @@ 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("LF|RF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|RF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
ip->i_df.if_lastex = idx - 1;
|
|
ip->i_df.if_lastex = idx - 1;
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK);
|
|
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
if (cur == NULL)
|
|
if (cur == NULL)
|
|
rval = XFS_ILOG_DEXT;
|
|
rval = XFS_ILOG_DEXT;
|
|
@@ -925,13 +843,13 @@ 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("LF|RF|RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("LF|RF|RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK);
|
|
|
|
xfs_iext_remove(ip, idx + 1, 1, state);
|
|
xfs_iext_remove(ip, idx + 1, 1, state);
|
|
if (cur == NULL)
|
|
if (cur == NULL)
|
|
rval = XFS_ILOG_DEXT;
|
|
rval = XFS_ILOG_DEXT;
|
|
@@ -961,9 +879,10 @@ 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("LF|RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
xfs_bmbt_set_startblock(ep, new->br_startblock);
|
|
xfs_bmbt_set_startblock(ep, new->br_startblock);
|
|
- XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
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)
|
|
@@ -991,14 +910,15 @@ 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("LF|LC", ip, idx - 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|LC", ip, idx - 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
temp = PREV.br_blockcount - new->br_blockcount;
|
|
temp = PREV.br_blockcount - new->br_blockcount;
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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)
|
|
@@ -1020,7 +940,7 @@ 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("LF|LC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
*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;
|
|
@@ -1033,12 +953,10 @@ 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("LF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("LF", ip, idx, 1, new, NULL,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_d.di_nextents++;
|
|
ip->i_d.di_nextents++;
|
|
@@ -1070,7 +988,7 @@ 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("LF", ip, idx + 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
|
|
*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;
|
|
@@ -1083,14 +1001,14 @@ 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("RF|RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx + 1, state, _THIS_IP_);
|
|
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("RF|RC", ip, idx + 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
|
|
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;
|
|
@@ -1111,7 +1029,7 @@ 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("RF|RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
*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;
|
|
@@ -1125,10 +1043,8 @@ 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("RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
xfs_bmbt_set_blockcount(ep, temp);
|
|
xfs_bmbt_set_blockcount(ep, temp);
|
|
- XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
xfs_iext_insert(ip, idx + 1, 1, new, state);
|
|
xfs_iext_insert(ip, idx + 1, 1, new, state);
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_d.di_nextents++;
|
|
ip->i_d.di_nextents++;
|
|
@@ -1160,7 +1076,7 @@ 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("RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
*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;
|
|
@@ -1174,7 +1090,7 @@ 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("0", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, 0, _THIS_IP_);
|
|
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;
|
|
@@ -1182,8 +1098,6 @@ 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("0", ip, idx + 1, 2, &r[0], &r[1],
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
|
|
xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_d.di_nextents++;
|
|
ip->i_d.di_nextents++;
|
|
@@ -1241,11 +1155,11 @@ 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("0", ip, idx, XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx + 2, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx + 2, state, _THIS_IP_);
|
|
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("0", ip, idx + 2, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx + 2, state, _THIS_IP_);
|
|
*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;
|
|
@@ -1391,14 +1305,12 @@ 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("LF|RF|LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|RF|LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|LC|RC", ip, idx, 2, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_remove(ip, idx, 2, state);
|
|
xfs_iext_remove(ip, idx, 2, state);
|
|
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;
|
|
@@ -1441,14 +1353,12 @@ 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("LF|RF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|RF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
ip->i_df.if_lastex = idx - 1;
|
|
ip->i_df.if_lastex = idx - 1;
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|LC", ip, idx, 1, XFS_DATA_FORK);
|
|
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
ip->i_d.di_nextents--;
|
|
ip->i_d.di_nextents--;
|
|
if (cur == NULL)
|
|
if (cur == NULL)
|
|
@@ -1483,15 +1393,12 @@ 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("LF|RF|RC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("LF|RF|RC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
- XFS_BMAP_TRACE_DELETE("LF|RF|RC", ip, idx + 1, 1, XFS_DATA_FORK);
|
|
|
|
xfs_iext_remove(ip, idx + 1, 1, state);
|
|
xfs_iext_remove(ip, idx + 1, 1, state);
|
|
ip->i_d.di_nextents--;
|
|
ip->i_d.di_nextents--;
|
|
if (cur == NULL)
|
|
if (cur == NULL)
|
|
@@ -1527,11 +1434,10 @@ 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("LF|RF", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
xfs_bmbt_set_state(ep, newext);
|
|
xfs_bmbt_set_state(ep, newext);
|
|
- XFS_BMAP_TRACE_POST_UPDATE("LF|RF", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
if (cur == NULL)
|
|
if (cur == NULL)
|
|
rval = XFS_ILOG_DEXT;
|
|
rval = XFS_ILOG_DEXT;
|
|
@@ -1557,22 +1463,20 @@ 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("LF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LF|LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("LF|LC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("LF|LC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
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;
|
|
@@ -1608,16 +1512,15 @@ 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("LF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("LF", ip, idx, XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_INSERT("LF", ip, idx, 1, new, NULL,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_d.di_nextents++;
|
|
ip->i_d.di_nextents++;
|
|
@@ -1651,19 +1554,16 @@ 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("RF|RC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("RF|RC", ip, idx + 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx + 1, state, _THIS_IP_);
|
|
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("RF|RC", ip, idx,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
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("RF|RC", ip, idx + 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
|
|
|
|
+
|
|
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;
|
|
@@ -1698,12 +1598,11 @@ 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("RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("RF", ip, idx, XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_INSERT("RF", ip, idx + 1, 1, new, NULL,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_insert(ip, idx + 1, 1, new, state);
|
|
xfs_iext_insert(ip, idx + 1, 1, new, state);
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_df.if_lastex = idx + 1;
|
|
ip->i_d.di_nextents++;
|
|
ip->i_d.di_nextents++;
|
|
@@ -1742,18 +1641,17 @@ 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("0", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("0", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
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("0", ip, idx + 1, 2, &r[0], &r[1],
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
|
|
xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
|
|
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;
|
|
@@ -1908,8 +1806,8 @@ 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("LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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) +
|
|
startblockval(new->br_startblock) +
|
|
startblockval(new->br_startblock) +
|
|
@@ -1917,9 +1815,8 @@ 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("LC|RC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
- XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
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. */
|
|
@@ -1934,16 +1831,15 @@ 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("LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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) +
|
|
startblockval(new->br_startblock);
|
|
startblockval(new->br_startblock);
|
|
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("LC", ip, idx - 1,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
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. */
|
|
temp2 = temp;
|
|
temp2 = temp;
|
|
@@ -1956,14 +1852,15 @@ 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("RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("RC", ip, idx, XFS_DATA_FORK);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
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;
|
|
@@ -1977,8 +1874,6 @@ xfs_bmap_add_extent_hole_delay(
|
|
* Insert a new entry.
|
|
* Insert a new entry.
|
|
*/
|
|
*/
|
|
oldlen = newlen = 0;
|
|
oldlen = newlen = 0;
|
|
- XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL,
|
|
|
|
- XFS_DATA_FORK);
|
|
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
ip->i_df.if_lastex = idx;
|
|
ip->i_df.if_lastex = idx;
|
|
/* DELTA: A new in-core extent was added in a hole. */
|
|
/* DELTA: A new in-core extent was added in a hole. */
|
|
@@ -2091,14 +1986,12 @@ 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("LC|RC", ip, idx - 1,
|
|
|
|
- whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LC|RC", ip, idx - 1,
|
|
|
|
- whichfork);
|
|
|
|
- XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
xfs_iext_remove(ip, idx, 1, state);
|
|
ifp->if_lastex = idx - 1;
|
|
ifp->if_lastex = idx - 1;
|
|
XFS_IFORK_NEXT_SET(ip, whichfork,
|
|
XFS_IFORK_NEXT_SET(ip, whichfork,
|
|
@@ -2140,10 +2033,11 @@ 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("LC", ip, idx - 1, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx - 1, state, _THIS_IP_);
|
|
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("LC", ip, idx - 1, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
|
|
|
|
+
|
|
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);
|
|
@@ -2174,11 +2068,12 @@ 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("RC", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("RC", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+
|
|
ifp->if_lastex = idx;
|
|
ifp->if_lastex = idx;
|
|
if (cur == NULL) {
|
|
if (cur == NULL) {
|
|
rval = xfs_ilog_fext(whichfork);
|
|
rval = xfs_ilog_fext(whichfork);
|
|
@@ -2209,7 +2104,6 @@ xfs_bmap_add_extent_hole_real(
|
|
* real allocation.
|
|
* real allocation.
|
|
* Insert a new entry.
|
|
* Insert a new entry.
|
|
*/
|
|
*/
|
|
- XFS_BMAP_TRACE_INSERT("0", ip, idx, 1, new, NULL, whichfork);
|
|
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
xfs_iext_insert(ip, idx, 1, new, state);
|
|
ifp->if_lastex = idx;
|
|
ifp->if_lastex = idx;
|
|
XFS_IFORK_NEXT_SET(ip, whichfork,
|
|
XFS_IFORK_NEXT_SET(ip, whichfork,
|
|
@@ -3070,8 +2964,13 @@ xfs_bmap_del_extent(
|
|
uint qfield; /* quota field to update */
|
|
uint qfield; /* quota field to update */
|
|
xfs_filblks_t temp; /* for indirect length calculations */
|
|
xfs_filblks_t temp; /* for indirect length calculations */
|
|
xfs_filblks_t temp2; /* for indirect length calculations */
|
|
xfs_filblks_t temp2; /* for indirect length calculations */
|
|
|
|
+ int state = 0;
|
|
|
|
|
|
XFS_STATS_INC(xs_del_exlist);
|
|
XFS_STATS_INC(xs_del_exlist);
|
|
|
|
+
|
|
|
|
+ if (whichfork == XFS_ATTR_FORK)
|
|
|
|
+ state |= BMAP_ATTRFORK;
|
|
|
|
+
|
|
mp = ip->i_mount;
|
|
mp = ip->i_mount;
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
ASSERT((idx >= 0) && (idx < ifp->if_bytes /
|
|
ASSERT((idx >= 0) && (idx < ifp->if_bytes /
|
|
@@ -3151,7 +3050,6 @@ xfs_bmap_del_extent(
|
|
/*
|
|
/*
|
|
* Matches the whole extent. Delete the entry.
|
|
* Matches the whole extent. Delete the entry.
|
|
*/
|
|
*/
|
|
- XFS_BMAP_TRACE_DELETE("3", ip, idx, 1, whichfork);
|
|
|
|
xfs_iext_remove(ip, idx, 1,
|
|
xfs_iext_remove(ip, idx, 1,
|
|
whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
|
|
whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
|
|
ifp->if_lastex = idx;
|
|
ifp->if_lastex = idx;
|
|
@@ -3173,7 +3071,7 @@ xfs_bmap_del_extent(
|
|
/*
|
|
/*
|
|
* Deleting the first part of the extent.
|
|
* Deleting the first part of the extent.
|
|
*/
|
|
*/
|
|
- XFS_BMAP_TRACE_PRE_UPDATE("2", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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);
|
|
@@ -3182,13 +3080,12 @@ 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("2", ip, idx,
|
|
|
|
- whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
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("2", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
if (!cur) {
|
|
if (!cur) {
|
|
flags |= xfs_ilog_fext(whichfork);
|
|
flags |= xfs_ilog_fext(whichfork);
|
|
break;
|
|
break;
|
|
@@ -3204,19 +3101,18 @@ 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("1", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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("1", ip, idx,
|
|
|
|
- whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
da_new = temp;
|
|
da_new = temp;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
if (!cur) {
|
|
if (!cur) {
|
|
flags |= xfs_ilog_fext(whichfork);
|
|
flags |= xfs_ilog_fext(whichfork);
|
|
break;
|
|
break;
|
|
@@ -3233,7 +3129,7 @@ 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("0", ip, idx, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_pre_update(ip, idx, state, _THIS_IP_);
|
|
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;
|
|
@@ -3320,11 +3216,8 @@ xfs_bmap_del_extent(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, whichfork);
|
|
|
|
- XFS_BMAP_TRACE_INSERT("0", ip, idx + 1, 1, &new, NULL,
|
|
|
|
- whichfork);
|
|
|
|
- xfs_iext_insert(ip, idx + 1, 1, &new,
|
|
|
|
- whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
|
|
|
|
+ xfs_iext_insert(ip, idx + 1, 1, &new, state);
|
|
ifp->if_lastex = idx + 1;
|
|
ifp->if_lastex = idx + 1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -3644,7 +3537,9 @@ 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("new", ip, 0, whichfork);
|
|
|
|
|
|
+ trace_xfs_bmap_post_update(ip, 0,
|
|
|
|
+ whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0,
|
|
|
|
+ _THIS_IP_);
|
|
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(tp, ip,
|
|
xfs_trans_mod_dquot_byino(tp, ip,
|
|
@@ -3757,158 +3652,6 @@ xfs_bmap_search_extents(
|
|
return ep;
|
|
return ep;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-#ifdef XFS_BMAP_TRACE
|
|
|
|
-ktrace_t *xfs_bmap_trace_buf;
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add a bmap trace buffer entry. Base routine for the others.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_addentry(
|
|
|
|
- int opcode, /* operation */
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry(ies) */
|
|
|
|
- xfs_extnum_t cnt, /* count of entries, 1 or 2 */
|
|
|
|
- xfs_bmbt_rec_host_t *r1, /* first record */
|
|
|
|
- xfs_bmbt_rec_host_t *r2, /* second record or null */
|
|
|
|
- int whichfork) /* data or attr fork */
|
|
|
|
-{
|
|
|
|
- xfs_bmbt_rec_host_t tr2;
|
|
|
|
-
|
|
|
|
- ASSERT(cnt == 1 || cnt == 2);
|
|
|
|
- ASSERT(r1 != NULL);
|
|
|
|
- if (cnt == 1) {
|
|
|
|
- ASSERT(r2 == NULL);
|
|
|
|
- r2 = &tr2;
|
|
|
|
- memset(&tr2, 0, sizeof(tr2));
|
|
|
|
- } else
|
|
|
|
- ASSERT(r2 != NULL);
|
|
|
|
- ktrace_enter(xfs_bmap_trace_buf,
|
|
|
|
- (void *)(__psint_t)(opcode | (whichfork << 16)),
|
|
|
|
- (void *)fname, (void *)desc, (void *)ip,
|
|
|
|
- (void *)(__psint_t)idx,
|
|
|
|
- (void *)(__psint_t)cnt,
|
|
|
|
- (void *)(__psunsigned_t)(ip->i_ino >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)ip->i_ino,
|
|
|
|
- (void *)(__psunsigned_t)(r1->l0 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r1->l0),
|
|
|
|
- (void *)(__psunsigned_t)(r1->l1 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r1->l1),
|
|
|
|
- (void *)(__psunsigned_t)(r2->l0 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r2->l0),
|
|
|
|
- (void *)(__psunsigned_t)(r2->l1 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r2->l1)
|
|
|
|
- );
|
|
|
|
- ASSERT(ip->i_xtrace);
|
|
|
|
- ktrace_enter(ip->i_xtrace,
|
|
|
|
- (void *)(__psint_t)(opcode | (whichfork << 16)),
|
|
|
|
- (void *)fname, (void *)desc, (void *)ip,
|
|
|
|
- (void *)(__psint_t)idx,
|
|
|
|
- (void *)(__psint_t)cnt,
|
|
|
|
- (void *)(__psunsigned_t)(ip->i_ino >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)ip->i_ino,
|
|
|
|
- (void *)(__psunsigned_t)(r1->l0 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r1->l0),
|
|
|
|
- (void *)(__psunsigned_t)(r1->l1 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r1->l1),
|
|
|
|
- (void *)(__psunsigned_t)(r2->l0 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r2->l0),
|
|
|
|
- (void *)(__psunsigned_t)(r2->l1 >> 32),
|
|
|
|
- (void *)(__psunsigned_t)(unsigned)(r2->l1)
|
|
|
|
- );
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to a call to xfs_iext_remove.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_delete(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry(entries) deleted */
|
|
|
|
- xfs_extnum_t cnt, /* count of entries deleted, 1 or 2 */
|
|
|
|
- int whichfork) /* data or attr fork */
|
|
|
|
-{
|
|
|
|
- xfs_ifork_t *ifp; /* inode fork pointer */
|
|
|
|
-
|
|
|
|
- ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
|
- xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_DELETE, fname, desc, ip, idx,
|
|
|
|
- cnt, xfs_iext_get_ext(ifp, idx),
|
|
|
|
- cnt == 2 ? xfs_iext_get_ext(ifp, idx + 1) : NULL,
|
|
|
|
- whichfork);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to a call to xfs_iext_insert, or
|
|
|
|
- * reading in the extents list from the disk (in the btree).
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_insert(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry(entries) inserted */
|
|
|
|
- xfs_extnum_t cnt, /* count of entries inserted, 1 or 2 */
|
|
|
|
- xfs_bmbt_irec_t *r1, /* inserted record 1 */
|
|
|
|
- xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
|
|
|
|
- int whichfork) /* data or attr fork */
|
|
|
|
-{
|
|
|
|
- xfs_bmbt_rec_host_t tr1; /* compressed record 1 */
|
|
|
|
- xfs_bmbt_rec_host_t tr2; /* compressed record 2 if needed */
|
|
|
|
-
|
|
|
|
- xfs_bmbt_set_all(&tr1, r1);
|
|
|
|
- if (cnt == 2) {
|
|
|
|
- ASSERT(r2 != NULL);
|
|
|
|
- xfs_bmbt_set_all(&tr2, r2);
|
|
|
|
- } else {
|
|
|
|
- ASSERT(cnt == 1);
|
|
|
|
- ASSERT(r2 == NULL);
|
|
|
|
- }
|
|
|
|
- xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_INSERT, fname, desc, ip, idx,
|
|
|
|
- cnt, &tr1, cnt == 2 ? &tr2 : NULL, whichfork);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry after updating an extent record in place.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_post_update(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry updated */
|
|
|
|
- int whichfork) /* data or attr fork */
|
|
|
|
-{
|
|
|
|
- xfs_ifork_t *ifp; /* inode fork pointer */
|
|
|
|
-
|
|
|
|
- ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
|
- xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_POST_UP, fname, desc, ip, idx,
|
|
|
|
- 1, xfs_iext_get_ext(ifp, idx), NULL, whichfork);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Add bmap trace entry prior to updating an extent record in place.
|
|
|
|
- */
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bmap_trace_pre_update(
|
|
|
|
- const char *fname, /* function name */
|
|
|
|
- char *desc, /* operation description */
|
|
|
|
- xfs_inode_t *ip, /* incore inode pointer */
|
|
|
|
- xfs_extnum_t idx, /* index of entry to be updated */
|
|
|
|
- int whichfork) /* data or attr fork */
|
|
|
|
-{
|
|
|
|
- xfs_ifork_t *ifp; /* inode fork pointer */
|
|
|
|
-
|
|
|
|
- ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
|
- xfs_bmap_trace_addentry(XFS_BMAP_KTRACE_PRE_UP, fname, desc, ip, idx, 1,
|
|
|
|
- xfs_iext_get_ext(ifp, idx), NULL, whichfork);
|
|
|
|
-}
|
|
|
|
-#endif /* XFS_BMAP_TRACE */
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Compute the worst-case number of indirect blocks that will be used
|
|
* Compute the worst-case number of indirect blocks that will be used
|
|
* for ip's delayed extent of length "len".
|
|
* for ip's delayed extent of length "len".
|
|
@@ -3940,37 +3683,6 @@ xfs_bmap_worst_indlen(
|
|
return rval;
|
|
return rval;
|
|
}
|
|
}
|
|
|
|
|
|
-#if defined(XFS_RW_TRACE)
|
|
|
|
-STATIC void
|
|
|
|
-xfs_bunmap_trace(
|
|
|
|
- xfs_inode_t *ip,
|
|
|
|
- xfs_fileoff_t bno,
|
|
|
|
- xfs_filblks_t len,
|
|
|
|
- int flags,
|
|
|
|
- inst_t *ra)
|
|
|
|
-{
|
|
|
|
- if (ip->i_rwtrace == NULL)
|
|
|
|
- return;
|
|
|
|
- ktrace_enter(ip->i_rwtrace,
|
|
|
|
- (void *)(__psint_t)XFS_BUNMAP,
|
|
|
|
- (void *)ip,
|
|
|
|
- (void *)(__psint_t)((ip->i_d.di_size >> 32) & 0xffffffff),
|
|
|
|
- (void *)(__psint_t)(ip->i_d.di_size & 0xffffffff),
|
|
|
|
- (void *)(__psint_t)(((xfs_dfiloff_t)bno >> 32) & 0xffffffff),
|
|
|
|
- (void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff),
|
|
|
|
- (void *)(__psint_t)len,
|
|
|
|
- (void *)(__psint_t)flags,
|
|
|
|
- (void *)(unsigned long)current_cpu(),
|
|
|
|
- (void *)ra,
|
|
|
|
- (void *)0,
|
|
|
|
- (void *)0,
|
|
|
|
- (void *)0,
|
|
|
|
- (void *)0,
|
|
|
|
- (void *)0,
|
|
|
|
- (void *)0);
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Convert inode from non-attributed to attributed.
|
|
* Convert inode from non-attributed to attributed.
|
|
* Must not be in a transaction, ip must not be locked.
|
|
* Must not be in a transaction, ip must not be locked.
|
|
@@ -4659,34 +4371,30 @@ error0:
|
|
return XFS_ERROR(EFSCORRUPTED);
|
|
return XFS_ERROR(EFSCORRUPTED);
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef XFS_BMAP_TRACE
|
|
|
|
|
|
+#ifdef DEBUG
|
|
/*
|
|
/*
|
|
* Add bmap trace insert entries for all the contents of the extent records.
|
|
* Add bmap trace insert entries for all the contents of the extent records.
|
|
*/
|
|
*/
|
|
void
|
|
void
|
|
xfs_bmap_trace_exlist(
|
|
xfs_bmap_trace_exlist(
|
|
- 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 */
|
|
|
|
+ unsigned long caller_ip)
|
|
{
|
|
{
|
|
- xfs_bmbt_rec_host_t *ep; /* current extent record */
|
|
|
|
xfs_extnum_t idx; /* extent record index */
|
|
xfs_extnum_t idx; /* extent record index */
|
|
xfs_ifork_t *ifp; /* inode fork pointer */
|
|
xfs_ifork_t *ifp; /* inode fork pointer */
|
|
- xfs_bmbt_irec_t s; /* file extent record */
|
|
|
|
|
|
+ int state = 0;
|
|
|
|
+
|
|
|
|
+ if (whichfork == XFS_ATTR_FORK)
|
|
|
|
+ state |= BMAP_ATTRFORK;
|
|
|
|
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
|
|
ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
|
|
- for (idx = 0; idx < cnt; idx++) {
|
|
|
|
- ep = xfs_iext_get_ext(ifp, idx);
|
|
|
|
- xfs_bmbt_get_all(ep, &s);
|
|
|
|
- XFS_BMAP_TRACE_INSERT("exlist", ip, idx, 1, &s, NULL,
|
|
|
|
- whichfork);
|
|
|
|
- }
|
|
|
|
|
|
+ for (idx = 0; idx < cnt; idx++)
|
|
|
|
+ trace_xfs_extlist(ip, idx, whichfork, caller_ip);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
|
|
-#ifdef DEBUG
|
|
|
|
/*
|
|
/*
|
|
* Validate that the bmbt_irecs being returned from bmapi are valid
|
|
* Validate that the bmbt_irecs being returned from bmapi are valid
|
|
* given the callers original parameters. Specifically check the
|
|
* given the callers original parameters. Specifically check the
|
|
@@ -5435,7 +5143,8 @@ xfs_bunmapi(
|
|
int rsvd; /* OK to allocate reserved blocks */
|
|
int rsvd; /* OK to allocate reserved blocks */
|
|
xfs_fsblock_t sum;
|
|
xfs_fsblock_t sum;
|
|
|
|
|
|
- xfs_bunmap_trace(ip, bno, len, flags, (inst_t *)__return_address);
|
|
|
|
|
|
+ trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_);
|
|
|
|
+
|
|
whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
|
|
whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
|
|
XFS_ATTR_FORK : XFS_DATA_FORK;
|
|
XFS_ATTR_FORK : XFS_DATA_FORK;
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|