diff options
author | Christoph Hellwig <hch@lst.de> | 2010-02-18 07:43:22 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-03-01 17:35:56 -0500 |
commit | a14a5ab58f9d783ec3a2a287320fab22e1764813 (patch) | |
tree | 52d0a4cbaa9aa4fe2e711cf5a68ba9fe6c2e677c /fs | |
parent | 60ec678371183f6e0d487e55fe8adbb33816518e (diff) |
xfs: remove xfs_ipin/xfs_iunpin
Inodes are only pinned/unpinned via the inode item methods, and lots of
code relies on that fact. So remove the separate xfs_ipin/xfs_iunpin
helpers and merge them into their only callers. This also fixes up
various duplicate and/or incorrect comments.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_inode.c | 28 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 18 |
3 files changed, 11 insertions, 37 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 16c3968c1bbe..0ffd56447045 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2439,34 +2439,6 @@ xfs_idestroy_fork( | |||
2439 | } | 2439 | } |
2440 | 2440 | ||
2441 | /* | 2441 | /* |
2442 | * Increment the pin count of the given buffer. | ||
2443 | * This value is protected by ipinlock spinlock in the mount structure. | ||
2444 | */ | ||
2445 | void | ||
2446 | xfs_ipin( | ||
2447 | xfs_inode_t *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. The caller must have the inode locked | 2442 | * This is called to unpin an inode. The caller must have the inode locked |
2471 | * in at least shared mode so that the buffer cannot be subsequently pinned | 2443 | * in at least shared mode so that the buffer cannot be subsequently pinned |
2472 | * once someone is waiting for it to be unpinned. | 2444 | * once someone is waiting for it to be unpinned. |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 41e8a4e2e3be..9965e40a4615 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -471,8 +471,6 @@ int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, | |||
471 | int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); | 471 | int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); |
472 | 472 | ||
473 | void xfs_iext_realloc(xfs_inode_t *, int, int); | 473 | void xfs_iext_realloc(xfs_inode_t *, int, int); |
474 | void xfs_ipin(xfs_inode_t *); | ||
475 | void xfs_iunpin(xfs_inode_t *); | ||
476 | void xfs_iunpin_wait(xfs_inode_t *); | 474 | void xfs_iunpin_wait(xfs_inode_t *); |
477 | int xfs_iflush(xfs_inode_t *, uint); | 475 | int xfs_iflush(xfs_inode_t *, uint); |
478 | void xfs_ichgtime(xfs_inode_t *, int); | 476 | void xfs_ichgtime(xfs_inode_t *, int); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index d4dc063111f8..7bfea8540159 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -535,23 +535,23 @@ xfs_inode_item_format( | |||
535 | 535 | ||
536 | /* | 536 | /* |
537 | * This is called to pin the inode associated with the inode log | 537 | * This is called to pin the inode associated with the inode log |
538 | * item in memory so it cannot be written out. Do this by calling | 538 | * item in memory so it cannot be written out. |
539 | * xfs_ipin() to bump the pin count in the inode while holding the | ||
540 | * inode pin lock. | ||
541 | */ | 539 | */ |
542 | STATIC void | 540 | STATIC void |
543 | xfs_inode_item_pin( | 541 | xfs_inode_item_pin( |
544 | xfs_inode_log_item_t *iip) | 542 | xfs_inode_log_item_t *iip) |
545 | { | 543 | { |
546 | ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); | 544 | ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); |
547 | xfs_ipin(iip->ili_inode); | 545 | |
546 | atomic_inc(&iip->ili_inode->i_pincount); | ||
548 | } | 547 | } |
549 | 548 | ||
550 | 549 | ||
551 | /* | 550 | /* |
552 | * This is called to unpin the inode associated with the inode log | 551 | * This is called to unpin the inode associated with the inode log |
553 | * item which was previously pinned with a call to xfs_inode_item_pin(). | 552 | * item which was previously pinned with a call to xfs_inode_item_pin(). |
554 | * Just call xfs_iunpin() on the inode to do this. | 553 | * |
554 | * Also wake up anyone in xfs_iunpin_wait() if the count goes to 0. | ||
555 | */ | 555 | */ |
556 | /* ARGSUSED */ | 556 | /* ARGSUSED */ |
557 | STATIC void | 557 | STATIC void |
@@ -559,7 +559,11 @@ xfs_inode_item_unpin( | |||
559 | xfs_inode_log_item_t *iip, | 559 | xfs_inode_log_item_t *iip, |
560 | int stale) | 560 | int stale) |
561 | { | 561 | { |
562 | xfs_iunpin(iip->ili_inode); | 562 | struct xfs_inode *ip = iip->ili_inode; |
563 | |||
564 | ASSERT(atomic_read(&ip->i_pincount) > 0); | ||
565 | if (atomic_dec_and_test(&ip->i_pincount)) | ||
566 | wake_up(&ip->i_ipin_wait); | ||
563 | } | 567 | } |
564 | 568 | ||
565 | /* ARGSUSED */ | 569 | /* ARGSUSED */ |
@@ -568,7 +572,7 @@ xfs_inode_item_unpin_remove( | |||
568 | xfs_inode_log_item_t *iip, | 572 | xfs_inode_log_item_t *iip, |
569 | xfs_trans_t *tp) | 573 | xfs_trans_t *tp) |
570 | { | 574 | { |
571 | xfs_iunpin(iip->ili_inode); | 575 | xfs_inode_item_unpin(iip, 0); |
572 | } | 576 | } |
573 | 577 | ||
574 | /* | 578 | /* |