diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:32:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:32:21 -0500 |
commit | 66ce3cf84deba6cc71dcf43c9d56a4278e5f712d (patch) | |
tree | 7580bcc42fc7c52620b98d78ebdc654bd7ed83ea /fs/xfs/xfs_inode.c | |
parent | 05c5cb31ec47cacf38db56d9efaa37ca9d473132 (diff) | |
parent | 9b1f56d60acfd634728f91f34922066c6f80ede6 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs: (21 commits)
xfs: return inode fork offset in bulkstat for fsr
xfs: Increase the default size of the reserved blocks pool
xfs: truncate delalloc extents when IO fails in writeback
xfs: check for more work before sleeping in xfssyncd
xfs: Fix a build warning in xfs_aops.c
xfs: fix locking for inode cache radix tree tag updates
xfs: remove xfs_ipin/xfs_iunpin
xfs: cleanup xfs_iunpin_wait/xfs_iunpin_nowait
xfs: kill xfs_lrw.h
xfs: factor common xfs_trans_bjoin code
xfs: stop passing opaque handles to xfs_log.c routines
xfs: split xfs_bmap_btalloc
xfs: fix xfs_fsblock_t tracing
xfs: fix inode pincount check in fsync
xfs: Non-blocking inode locking in IO completion
xfs: implement optimized fdatasync
xfs: remove wrapper for the fsync file operation
xfs: remove wrappers for read/write file operations
xfs: merge xfs_lrw.c into xfs_file.c
xfs: fix dquota trace format
...
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 68 |
1 files changed, 12 insertions, 56 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index fa31360046d4..0ffd56447045 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2439,75 +2439,31 @@ xfs_idestroy_fork( | |||
2439 | } | 2439 | } |
2440 | 2440 | ||
2441 | /* | 2441 | /* |
2442 | * Increment the pin count of the given buffer. | 2442 | * This is called to unpin an inode. The caller must have the inode locked |
2443 | * This value is protected by ipinlock spinlock in the mount structure. | 2443 | * in at least shared mode so that the buffer cannot be subsequently pinned |
2444 | * once someone is waiting for it to be unpinned. | ||
2444 | */ | 2445 | */ |
2445 | void | 2446 | static void |
2446 | xfs_ipin( | 2447 | xfs_iunpin_nowait( |
2447 | xfs_inode_t *ip) | 2448 | struct xfs_inode *ip) |
2448 | { | ||
2449 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | ||
2450 | |||
2451 | atomic_inc(&ip->i_pincount); | ||
2452 | } | ||
2453 | |||
2454 | /* | ||
2455 | * Decrement the pin count of the given inode, and wake up | ||
2456 | * anyone in xfs_iwait_unpin() if the count goes to 0. The | ||
2457 | * inode must have been previously pinned with a call to xfs_ipin(). | ||
2458 | */ | ||
2459 | void | ||
2460 | xfs_iunpin( | ||
2461 | xfs_inode_t *ip) | ||
2462 | { | ||
2463 | ASSERT(atomic_read(&ip->i_pincount) > 0); | ||
2464 | |||
2465 | if (atomic_dec_and_test(&ip->i_pincount)) | ||
2466 | wake_up(&ip->i_ipin_wait); | ||
2467 | } | ||
2468 | |||
2469 | /* | ||
2470 | * This is called to unpin an inode. It can be directed to wait or to return | ||
2471 | * immediately without waiting for the inode to be unpinned. The caller must | ||
2472 | * have the inode locked in at least shared mode so that the buffer cannot be | ||
2473 | * subsequently pinned once someone is waiting for it to be unpinned. | ||
2474 | */ | ||
2475 | STATIC void | ||
2476 | __xfs_iunpin_wait( | ||
2477 | xfs_inode_t *ip, | ||
2478 | int wait) | ||
2479 | { | 2449 | { |
2480 | xfs_inode_log_item_t *iip = ip->i_itemp; | ||
2481 | |||
2482 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2450 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
2483 | if (atomic_read(&ip->i_pincount) == 0) | ||
2484 | return; | ||
2485 | 2451 | ||
2486 | /* Give the log a push to start the unpinning I/O */ | 2452 | /* Give the log a push to start the unpinning I/O */ |
2487 | if (iip && iip->ili_last_lsn) | 2453 | 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 | 2454 | ||
2492 | if (wait) | ||
2493 | wait_event(ip->i_ipin_wait, (atomic_read(&ip->i_pincount) == 0)); | ||
2494 | } | 2455 | } |
2495 | 2456 | ||
2496 | void | 2457 | void |
2497 | xfs_iunpin_wait( | 2458 | xfs_iunpin_wait( |
2498 | xfs_inode_t *ip) | 2459 | struct xfs_inode *ip) |
2499 | { | 2460 | { |
2500 | __xfs_iunpin_wait(ip, 1); | 2461 | if (xfs_ipincount(ip)) { |
2501 | } | 2462 | xfs_iunpin_nowait(ip); |
2502 | 2463 | wait_event(ip->i_ipin_wait, (xfs_ipincount(ip) == 0)); | |
2503 | static inline void | 2464 | } |
2504 | xfs_iunpin_nowait( | ||
2505 | xfs_inode_t *ip) | ||
2506 | { | ||
2507 | __xfs_iunpin_wait(ip, 0); | ||
2508 | } | 2465 | } |
2509 | 2466 | ||
2510 | |||
2511 | /* | 2467 | /* |
2512 | * xfs_iextents_copy() | 2468 | * xfs_iextents_copy() |
2513 | * | 2469 | * |