diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-02-17 14:43:56 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-03-01 17:35:50 -0500 |
commit | 60ec678371183f6e0d487e55fe8adbb33816518e (patch) | |
tree | 9959de5ad0fd47a8ef363c93e3046023ba81c67a | |
parent | d7658d487f4c62983015ba6c99f02dedb3ea97c7 (diff) |
xfs: cleanup xfs_iunpin_wait/xfs_iunpin_nowait
Remove the inode item pointer and ili_last_lsn checks in
__xfs_iunpin_wait as any pinned inode is guaranteed to have them
valid. After this the xfs_iunpin_nowait case is nothing more than a
xfs_log_force_lsn, as we know that the caller has already checked
the pincount.
Make xfs_iunpin_nowait the new low-level routine just doing the log
force and rewrite xfs_iunpin_wait around it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
-rw-r--r-- | fs/xfs/xfs_inode.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index fa31360046d4..16c3968c1bbe 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2467,47 +2467,31 @@ xfs_iunpin( | |||
2467 | } | 2467 | } |
2468 | 2468 | ||
2469 | /* | 2469 | /* |
2470 | * This is called to unpin an inode. It can be directed to wait or to return | 2470 | * This is called to unpin an inode. The caller must have the inode locked |
2471 | * immediately without waiting for the inode to be unpinned. The caller must | 2471 | * in at least shared mode so that the buffer cannot be subsequently pinned |
2472 | * have the inode locked in at least shared mode so that the buffer cannot be | 2472 | * once someone is waiting for it to be unpinned. |
2473 | * subsequently pinned once someone is waiting for it to be unpinned. | ||
2474 | */ | 2473 | */ |
2475 | STATIC void | 2474 | static void |
2476 | __xfs_iunpin_wait( | 2475 | xfs_iunpin_nowait( |
2477 | xfs_inode_t *ip, | 2476 | struct xfs_inode *ip) |
2478 | int wait) | ||
2479 | { | 2477 | { |
2480 | xfs_inode_log_item_t *iip = ip->i_itemp; | ||
2481 | |||
2482 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2478 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
2483 | if (atomic_read(&ip->i_pincount) == 0) | ||
2484 | return; | ||
2485 | 2479 | ||
2486 | /* Give the log a push to start the unpinning I/O */ | 2480 | /* Give the log a push to start the unpinning I/O */ |
2487 | if (iip && iip->ili_last_lsn) | 2481 | xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0); |
2488 | xfs_log_force_lsn(ip->i_mount, iip->ili_last_lsn, 0); | ||
2489 | else | ||
2490 | xfs_log_force(ip->i_mount, 0); | ||
2491 | 2482 | ||
2492 | if (wait) | ||
2493 | wait_event(ip->i_ipin_wait, (atomic_read(&ip->i_pincount) == 0)); | ||
2494 | } | 2483 | } |
2495 | 2484 | ||
2496 | void | 2485 | void |
2497 | xfs_iunpin_wait( | 2486 | xfs_iunpin_wait( |
2498 | xfs_inode_t *ip) | 2487 | struct xfs_inode *ip) |
2499 | { | 2488 | { |
2500 | __xfs_iunpin_wait(ip, 1); | 2489 | if (xfs_ipincount(ip)) { |
2501 | } | 2490 | xfs_iunpin_nowait(ip); |
2502 | 2491 | wait_event(ip->i_ipin_wait, (xfs_ipincount(ip) == 0)); | |
2503 | static inline void | 2492 | } |
2504 | xfs_iunpin_nowait( | ||
2505 | xfs_inode_t *ip) | ||
2506 | { | ||
2507 | __xfs_iunpin_wait(ip, 0); | ||
2508 | } | 2493 | } |
2509 | 2494 | ||
2510 | |||
2511 | /* | 2495 | /* |
2512 | * xfs_iextents_copy() | 2496 | * xfs_iextents_copy() |
2513 | * | 2497 | * |