diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 67 |
1 files changed, 9 insertions, 58 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 614acd508b35..ce278b3ae7fc 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -47,10 +47,10 @@ | |||
47 | #include "xfs_rw.h" | 47 | #include "xfs_rw.h" |
48 | #include "xfs_error.h" | 48 | #include "xfs_error.h" |
49 | #include "xfs_utils.h" | 49 | #include "xfs_utils.h" |
50 | #include "xfs_dir2_trace.h" | ||
51 | #include "xfs_quota.h" | 50 | #include "xfs_quota.h" |
52 | #include "xfs_filestream.h" | 51 | #include "xfs_filestream.h" |
53 | #include "xfs_vnodeops.h" | 52 | #include "xfs_vnodeops.h" |
53 | #include "xfs_trace.h" | ||
54 | 54 | ||
55 | kmem_zone_t *xfs_ifork_zone; | 55 | kmem_zone_t *xfs_ifork_zone; |
56 | kmem_zone_t *xfs_inode_zone; | 56 | kmem_zone_t *xfs_inode_zone; |
@@ -1291,42 +1291,6 @@ xfs_file_last_byte( | |||
1291 | return last_byte; | 1291 | return last_byte; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | #if defined(XFS_RW_TRACE) | ||
1295 | STATIC void | ||
1296 | xfs_itrunc_trace( | ||
1297 | int tag, | ||
1298 | xfs_inode_t *ip, | ||
1299 | int flag, | ||
1300 | xfs_fsize_t new_size, | ||
1301 | xfs_off_t toss_start, | ||
1302 | xfs_off_t toss_finish) | ||
1303 | { | ||
1304 | if (ip->i_rwtrace == NULL) { | ||
1305 | return; | ||
1306 | } | ||
1307 | |||
1308 | ktrace_enter(ip->i_rwtrace, | ||
1309 | (void*)((long)tag), | ||
1310 | (void*)ip, | ||
1311 | (void*)(unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff), | ||
1312 | (void*)(unsigned long)(ip->i_d.di_size & 0xffffffff), | ||
1313 | (void*)((long)flag), | ||
1314 | (void*)(unsigned long)((new_size >> 32) & 0xffffffff), | ||
1315 | (void*)(unsigned long)(new_size & 0xffffffff), | ||
1316 | (void*)(unsigned long)((toss_start >> 32) & 0xffffffff), | ||
1317 | (void*)(unsigned long)(toss_start & 0xffffffff), | ||
1318 | (void*)(unsigned long)((toss_finish >> 32) & 0xffffffff), | ||
1319 | (void*)(unsigned long)(toss_finish & 0xffffffff), | ||
1320 | (void*)(unsigned long)current_cpu(), | ||
1321 | (void*)(unsigned long)current_pid(), | ||
1322 | (void*)NULL, | ||
1323 | (void*)NULL, | ||
1324 | (void*)NULL); | ||
1325 | } | ||
1326 | #else | ||
1327 | #define xfs_itrunc_trace(tag, ip, flag, new_size, toss_start, toss_finish) | ||
1328 | #endif | ||
1329 | |||
1330 | /* | 1294 | /* |
1331 | * Start the truncation of the file to new_size. The new size | 1295 | * Start the truncation of the file to new_size. The new size |
1332 | * must be smaller than the current size. This routine will | 1296 | * must be smaller than the current size. This routine will |
@@ -1409,8 +1373,7 @@ xfs_itruncate_start( | |||
1409 | return 0; | 1373 | return 0; |
1410 | } | 1374 | } |
1411 | last_byte = xfs_file_last_byte(ip); | 1375 | last_byte = xfs_file_last_byte(ip); |
1412 | xfs_itrunc_trace(XFS_ITRUNC_START, ip, flags, new_size, toss_start, | 1376 | trace_xfs_itruncate_start(ip, flags, new_size, toss_start, last_byte); |
1413 | last_byte); | ||
1414 | if (last_byte > toss_start) { | 1377 | if (last_byte > toss_start) { |
1415 | if (flags & XFS_ITRUNC_DEFINITE) { | 1378 | if (flags & XFS_ITRUNC_DEFINITE) { |
1416 | xfs_tosspages(ip, toss_start, | 1379 | xfs_tosspages(ip, toss_start, |
@@ -1514,7 +1477,8 @@ xfs_itruncate_finish( | |||
1514 | new_size = 0LL; | 1477 | new_size = 0LL; |
1515 | } | 1478 | } |
1516 | first_unmap_block = XFS_B_TO_FSB(mp, (xfs_ufsize_t)new_size); | 1479 | first_unmap_block = XFS_B_TO_FSB(mp, (xfs_ufsize_t)new_size); |
1517 | xfs_itrunc_trace(XFS_ITRUNC_FINISH1, ip, 0, new_size, 0, 0); | 1480 | trace_xfs_itruncate_finish_start(ip, new_size); |
1481 | |||
1518 | /* | 1482 | /* |
1519 | * The first thing we do is set the size to new_size permanently | 1483 | * The first thing we do is set the size to new_size permanently |
1520 | * on disk. This way we don't have to worry about anyone ever | 1484 | * on disk. This way we don't have to worry about anyone ever |
@@ -1731,7 +1695,7 @@ xfs_itruncate_finish( | |||
1731 | ASSERT((new_size != 0) || | 1695 | ASSERT((new_size != 0) || |
1732 | (fork == XFS_ATTR_FORK) || | 1696 | (fork == XFS_ATTR_FORK) || |
1733 | (ip->i_d.di_nextents == 0)); | 1697 | (ip->i_d.di_nextents == 0)); |
1734 | xfs_itrunc_trace(XFS_ITRUNC_FINISH2, ip, 0, new_size, 0, 0); | 1698 | trace_xfs_itruncate_finish_end(ip, new_size); |
1735 | return 0; | 1699 | return 0; |
1736 | } | 1700 | } |
1737 | 1701 | ||
@@ -3252,23 +3216,6 @@ corrupt_out: | |||
3252 | return XFS_ERROR(EFSCORRUPTED); | 3216 | return XFS_ERROR(EFSCORRUPTED); |
3253 | } | 3217 | } |
3254 | 3218 | ||
3255 | |||
3256 | |||
3257 | #ifdef XFS_ILOCK_TRACE | ||
3258 | void | ||
3259 | xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra) | ||
3260 | { | ||
3261 | ktrace_enter(ip->i_lock_trace, | ||
3262 | (void *)ip, | ||
3263 | (void *)(unsigned long)lock, /* 1 = LOCK, 3=UNLOCK, etc */ | ||
3264 | (void *)(unsigned long)lockflags, /* XFS_ILOCK_EXCL etc */ | ||
3265 | (void *)ra, /* caller of ilock */ | ||
3266 | (void *)(unsigned long)current_cpu(), | ||
3267 | (void *)(unsigned long)current_pid(), | ||
3268 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); | ||
3269 | } | ||
3270 | #endif | ||
3271 | |||
3272 | /* | 3219 | /* |
3273 | * Return a pointer to the extent record at file index idx. | 3220 | * Return a pointer to the extent record at file index idx. |
3274 | */ | 3221 | */ |
@@ -3309,6 +3256,8 @@ xfs_iext_insert( | |||
3309 | xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; | 3256 | xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; |
3310 | xfs_extnum_t i; /* extent record index */ | 3257 | xfs_extnum_t i; /* extent record index */ |
3311 | 3258 | ||
3259 | trace_xfs_iext_insert(ip, idx, new, state, _RET_IP_); | ||
3260 | |||
3312 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); | 3261 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); |
3313 | xfs_iext_add(ifp, idx, count); | 3262 | xfs_iext_add(ifp, idx, count); |
3314 | for (i = idx; i < idx + count; i++, new++) | 3263 | for (i = idx; i < idx + count; i++, new++) |
@@ -3560,6 +3509,8 @@ xfs_iext_remove( | |||
3560 | xfs_extnum_t nextents; /* number of extents in file */ | 3509 | xfs_extnum_t nextents; /* number of extents in file */ |
3561 | int new_size; /* size of extents after removal */ | 3510 | int new_size; /* size of extents after removal */ |
3562 | 3511 | ||
3512 | trace_xfs_iext_remove(ip, idx, state, _RET_IP_); | ||
3513 | |||
3563 | ASSERT(ext_diff > 0); | 3514 | ASSERT(ext_diff > 0); |
3564 | nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); | 3515 | nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); |
3565 | new_size = (nextents - ext_diff) * sizeof(xfs_bmbt_rec_t); | 3516 | new_size = (nextents - ext_diff) * sizeof(xfs_bmbt_rec_t); |