aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-02-18 07:43:22 -0500
committerAlex Elder <aelder@sgi.com>2010-03-01 17:35:56 -0500
commita14a5ab58f9d783ec3a2a287320fab22e1764813 (patch)
tree52d0a4cbaa9aa4fe2e711cf5a68ba9fe6c2e677c /fs
parent60ec678371183f6e0d487e55fe8adbb33816518e (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.c28
-rw-r--r--fs/xfs/xfs_inode.h2
-rw-r--r--fs/xfs/xfs_inode_item.c18
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 */
2445void
2446xfs_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 */
2459void
2460xfs_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 *,
471int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); 471int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
472 472
473void xfs_iext_realloc(xfs_inode_t *, int, int); 473void xfs_iext_realloc(xfs_inode_t *, int, int);
474void xfs_ipin(xfs_inode_t *);
475void xfs_iunpin(xfs_inode_t *);
476void xfs_iunpin_wait(xfs_inode_t *); 474void xfs_iunpin_wait(xfs_inode_t *);
477int xfs_iflush(xfs_inode_t *, uint); 475int xfs_iflush(xfs_inode_t *, uint);
478void xfs_ichgtime(xfs_inode_t *, int); 476void 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 */
542STATIC void 540STATIC void
543xfs_inode_item_pin( 541xfs_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 */
557STATIC void 557STATIC 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/*