diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 12:12:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 12:12:43 -0500 |
commit | d180ec5d348e3a51836d723c182374483012c981 (patch) | |
tree | 252bcf36f7f6e329d94092a3238a79d7f2e1e2e2 /fs/xfs/xfs_inode.c | |
parent | 53365383c4667aba55385cd1858582c19a7a8a36 (diff) | |
parent | 0b1b213fcf3a8486ada99a2bab84ab8c6f51b264 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: event tracing support
xfs: change the xfs_iext_insert / xfs_iext_remove
xfs: cleanup bmap extent state macros
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 79 |
1 files changed, 17 insertions, 62 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index b92a4fa2a0a1..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 | */ |
@@ -3300,13 +3247,17 @@ xfs_iext_get_ext( | |||
3300 | */ | 3247 | */ |
3301 | void | 3248 | void |
3302 | xfs_iext_insert( | 3249 | xfs_iext_insert( |
3303 | xfs_ifork_t *ifp, /* inode fork pointer */ | 3250 | xfs_inode_t *ip, /* incore inode pointer */ |
3304 | xfs_extnum_t idx, /* starting index of new items */ | 3251 | xfs_extnum_t idx, /* starting index of new items */ |
3305 | xfs_extnum_t count, /* number of inserted items */ | 3252 | xfs_extnum_t count, /* number of inserted items */ |
3306 | xfs_bmbt_irec_t *new) /* items to insert */ | 3253 | xfs_bmbt_irec_t *new, /* items to insert */ |
3254 | int state) /* type of extent conversion */ | ||
3307 | { | 3255 | { |
3256 | xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; | ||
3308 | xfs_extnum_t i; /* extent record index */ | 3257 | xfs_extnum_t i; /* extent record index */ |
3309 | 3258 | ||
3259 | trace_xfs_iext_insert(ip, idx, new, state, _RET_IP_); | ||
3260 | |||
3310 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); | 3261 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); |
3311 | xfs_iext_add(ifp, idx, count); | 3262 | xfs_iext_add(ifp, idx, count); |
3312 | for (i = idx; i < idx + count; i++, new++) | 3263 | for (i = idx; i < idx + count; i++, new++) |
@@ -3549,13 +3500,17 @@ xfs_iext_add_indirect_multi( | |||
3549 | */ | 3500 | */ |
3550 | void | 3501 | void |
3551 | xfs_iext_remove( | 3502 | xfs_iext_remove( |
3552 | xfs_ifork_t *ifp, /* inode fork pointer */ | 3503 | xfs_inode_t *ip, /* incore inode pointer */ |
3553 | xfs_extnum_t idx, /* index to begin removing exts */ | 3504 | xfs_extnum_t idx, /* index to begin removing exts */ |
3554 | int ext_diff) /* number of extents to remove */ | 3505 | int ext_diff, /* number of extents to remove */ |
3506 | int state) /* type of extent conversion */ | ||
3555 | { | 3507 | { |
3508 | xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; | ||
3556 | xfs_extnum_t nextents; /* number of extents in file */ | 3509 | xfs_extnum_t nextents; /* number of extents in file */ |
3557 | int new_size; /* size of extents after removal */ | 3510 | int new_size; /* size of extents after removal */ |
3558 | 3511 | ||
3512 | trace_xfs_iext_remove(ip, idx, state, _RET_IP_); | ||
3513 | |||
3559 | ASSERT(ext_diff > 0); | 3514 | ASSERT(ext_diff > 0); |
3560 | nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); | 3515 | nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); |
3561 | new_size = (nextents - ext_diff) * sizeof(xfs_bmbt_rec_t); | 3516 | new_size = (nextents - ext_diff) * sizeof(xfs_bmbt_rec_t); |