diff options
author | Christoph Hellwig <hch@lst.de> | 2008-12-03 06:20:25 -0500 |
---|---|---|
committer | Niv Sardi <xaiki@sgi.com> | 2008-12-03 23:39:20 -0500 |
commit | 5cafdeb2891a415a5dbf0ad80f0afedf8369e6bb (patch) | |
tree | f1d6653c4dee098e46f4bdc4ddda60cf4a6d35fd /fs/xfs/xfs_inode.c | |
parent | ccd0be6cfc6943c4e0b3e3cdb598e0b7354a2d78 (diff) |
cleanup the inode reclaim path
Merge xfs_iextract and xfs_idestroy into xfs_ireclaim as they are never
called individually. Also rewrite most comments in this area as they
were severly out of date.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 872191b46784..4e664f57860b 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2450,78 +2450,6 @@ xfs_idestroy_fork( | |||
2450 | } | 2450 | } |
2451 | 2451 | ||
2452 | /* | 2452 | /* |
2453 | * This is called free all the memory associated with an inode. | ||
2454 | * It must free the inode itself and any buffers allocated for | ||
2455 | * if_extents/if_data and if_broot. It must also free the lock | ||
2456 | * associated with the inode. | ||
2457 | * | ||
2458 | * Note: because we don't initialise everything on reallocation out | ||
2459 | * of the zone, we must ensure we nullify everything correctly before | ||
2460 | * freeing the structure. | ||
2461 | */ | ||
2462 | void | ||
2463 | xfs_idestroy( | ||
2464 | xfs_inode_t *ip) | ||
2465 | { | ||
2466 | switch (ip->i_d.di_mode & S_IFMT) { | ||
2467 | case S_IFREG: | ||
2468 | case S_IFDIR: | ||
2469 | case S_IFLNK: | ||
2470 | xfs_idestroy_fork(ip, XFS_DATA_FORK); | ||
2471 | break; | ||
2472 | } | ||
2473 | if (ip->i_afp) | ||
2474 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); | ||
2475 | |||
2476 | #ifdef XFS_INODE_TRACE | ||
2477 | ktrace_free(ip->i_trace); | ||
2478 | #endif | ||
2479 | #ifdef XFS_BMAP_TRACE | ||
2480 | ktrace_free(ip->i_xtrace); | ||
2481 | #endif | ||
2482 | #ifdef XFS_BTREE_TRACE | ||
2483 | ktrace_free(ip->i_btrace); | ||
2484 | #endif | ||
2485 | #ifdef XFS_RW_TRACE | ||
2486 | ktrace_free(ip->i_rwtrace); | ||
2487 | #endif | ||
2488 | #ifdef XFS_ILOCK_TRACE | ||
2489 | ktrace_free(ip->i_lock_trace); | ||
2490 | #endif | ||
2491 | #ifdef XFS_DIR2_TRACE | ||
2492 | ktrace_free(ip->i_dir_trace); | ||
2493 | #endif | ||
2494 | if (ip->i_itemp) { | ||
2495 | /* | ||
2496 | * Only if we are shutting down the fs will we see an | ||
2497 | * inode still in the AIL. If it is there, we should remove | ||
2498 | * it to prevent a use-after-free from occurring. | ||
2499 | */ | ||
2500 | xfs_log_item_t *lip = &ip->i_itemp->ili_item; | ||
2501 | struct xfs_ail *ailp = lip->li_ailp; | ||
2502 | |||
2503 | ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) || | ||
2504 | XFS_FORCED_SHUTDOWN(ip->i_mount)); | ||
2505 | if (lip->li_flags & XFS_LI_IN_AIL) { | ||
2506 | spin_lock(&ailp->xa_lock); | ||
2507 | if (lip->li_flags & XFS_LI_IN_AIL) | ||
2508 | xfs_trans_ail_delete(ailp, lip); | ||
2509 | else | ||
2510 | spin_unlock(&ailp->xa_lock); | ||
2511 | } | ||
2512 | xfs_inode_item_destroy(ip); | ||
2513 | ip->i_itemp = NULL; | ||
2514 | } | ||
2515 | /* asserts to verify all state is correct here */ | ||
2516 | ASSERT(atomic_read(&ip->i_iocount) == 0); | ||
2517 | ASSERT(atomic_read(&ip->i_pincount) == 0); | ||
2518 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); | ||
2519 | ASSERT(completion_done(&ip->i_flush)); | ||
2520 | kmem_zone_free(xfs_inode_zone, ip); | ||
2521 | } | ||
2522 | |||
2523 | |||
2524 | /* | ||
2525 | * Increment the pin count of the given buffer. | 2453 | * Increment the pin count of the given buffer. |
2526 | * This value is protected by ipinlock spinlock in the mount structure. | 2454 | * This value is protected by ipinlock spinlock in the mount structure. |
2527 | */ | 2455 | */ |