diff options
-rw-r--r-- | fs/xfs/xfs_mount.c | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 21 |
2 files changed, 33 insertions, 11 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 37c612ce3d05..cbe729310eee 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -543,11 +543,11 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
543 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); | 543 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); |
544 | } | 544 | } |
545 | 545 | ||
546 | mutex_lock(&mp->m_icsb_mutex); | 546 | xfs_icsb_lock(mp); |
547 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); | 547 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); |
548 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); | 548 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); |
549 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); | 549 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); |
550 | mutex_unlock(&mp->m_icsb_mutex); | 550 | xfs_icsb_unlock(mp); |
551 | 551 | ||
552 | mp->m_sb_bp = bp; | 552 | mp->m_sb_bp = bp; |
553 | xfs_buf_relse(bp); | 553 | xfs_buf_relse(bp); |
@@ -1736,17 +1736,17 @@ xfs_icsb_cpu_notify( | |||
1736 | memset(cntp, 0, sizeof(xfs_icsb_cnts_t)); | 1736 | memset(cntp, 0, sizeof(xfs_icsb_cnts_t)); |
1737 | break; | 1737 | break; |
1738 | case CPU_ONLINE: | 1738 | case CPU_ONLINE: |
1739 | mutex_lock(&mp->m_icsb_mutex); | 1739 | xfs_icsb_lock(mp); |
1740 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); | 1740 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); |
1741 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); | 1741 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); |
1742 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); | 1742 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); |
1743 | mutex_unlock(&mp->m_icsb_mutex); | 1743 | xfs_icsb_unlock(mp); |
1744 | break; | 1744 | break; |
1745 | case CPU_DEAD: | 1745 | case CPU_DEAD: |
1746 | /* Disable all the counters, then fold the dead cpu's | 1746 | /* Disable all the counters, then fold the dead cpu's |
1747 | * count into the total on the global superblock and | 1747 | * count into the total on the global superblock and |
1748 | * re-enable the counters. */ | 1748 | * re-enable the counters. */ |
1749 | mutex_lock(&mp->m_icsb_mutex); | 1749 | xfs_icsb_lock(mp); |
1750 | s = XFS_SB_LOCK(mp); | 1750 | s = XFS_SB_LOCK(mp); |
1751 | xfs_icsb_disable_counter(mp, XFS_SBS_ICOUNT); | 1751 | xfs_icsb_disable_counter(mp, XFS_SBS_ICOUNT); |
1752 | xfs_icsb_disable_counter(mp, XFS_SBS_IFREE); | 1752 | xfs_icsb_disable_counter(mp, XFS_SBS_IFREE); |
@@ -1765,7 +1765,7 @@ xfs_icsb_cpu_notify( | |||
1765 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, | 1765 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, |
1766 | XFS_ICSB_SB_LOCKED, 0); | 1766 | XFS_ICSB_SB_LOCKED, 0); |
1767 | XFS_SB_UNLOCK(mp, s); | 1767 | XFS_SB_UNLOCK(mp, s); |
1768 | mutex_unlock(&mp->m_icsb_mutex); | 1768 | xfs_icsb_unlock(mp); |
1769 | break; | 1769 | break; |
1770 | } | 1770 | } |
1771 | 1771 | ||
@@ -1813,6 +1813,7 @@ xfs_icsb_destroy_counters( | |||
1813 | unregister_hotcpu_notifier(&mp->m_icsb_notifier); | 1813 | unregister_hotcpu_notifier(&mp->m_icsb_notifier); |
1814 | free_percpu(mp->m_sb_cnts); | 1814 | free_percpu(mp->m_sb_cnts); |
1815 | } | 1815 | } |
1816 | mutex_destroy(&mp->m_icsb_mutex); | ||
1816 | } | 1817 | } |
1817 | 1818 | ||
1818 | STATIC_INLINE void | 1819 | STATIC_INLINE void |
@@ -2156,7 +2157,7 @@ slow_path: | |||
2156 | * the superblock lock. We still need to hold the superblock | 2157 | * the superblock lock. We still need to hold the superblock |
2157 | * lock, however, when we modify the global structures. | 2158 | * lock, however, when we modify the global structures. |
2158 | */ | 2159 | */ |
2159 | mutex_lock(&mp->m_icsb_mutex); | 2160 | xfs_icsb_lock(mp); |
2160 | 2161 | ||
2161 | /* | 2162 | /* |
2162 | * Now running atomically. | 2163 | * Now running atomically. |
@@ -2165,7 +2166,7 @@ slow_path: | |||
2165 | * Drop the lock and try again in the fast path.... | 2166 | * Drop the lock and try again in the fast path.... |
2166 | */ | 2167 | */ |
2167 | if (!(xfs_icsb_counter_disabled(mp, field))) { | 2168 | if (!(xfs_icsb_counter_disabled(mp, field))) { |
2168 | mutex_unlock(&mp->m_icsb_mutex); | 2169 | xfs_icsb_unlock(mp); |
2169 | goto again; | 2170 | goto again; |
2170 | } | 2171 | } |
2171 | 2172 | ||
@@ -2192,7 +2193,7 @@ slow_path: | |||
2192 | */ | 2193 | */ |
2193 | if (ret != ENOSPC) | 2194 | if (ret != ENOSPC) |
2194 | xfs_icsb_balance_counter(mp, field, 0, 0); | 2195 | xfs_icsb_balance_counter(mp, field, 0, 0); |
2195 | mutex_unlock(&mp->m_icsb_mutex); | 2196 | xfs_icsb_unlock(mp); |
2196 | return ret; | 2197 | return ret; |
2197 | 2198 | ||
2198 | balance_counter: | 2199 | balance_counter: |
@@ -2205,7 +2206,7 @@ balance_counter: | |||
2205 | * do more balances than strictly necessary but it is not | 2206 | * do more balances than strictly necessary but it is not |
2206 | * the common slowpath case. | 2207 | * the common slowpath case. |
2207 | */ | 2208 | */ |
2208 | mutex_lock(&mp->m_icsb_mutex); | 2209 | xfs_icsb_lock(mp); |
2209 | 2210 | ||
2210 | /* | 2211 | /* |
2211 | * running atomically. | 2212 | * running atomically. |
@@ -2216,7 +2217,7 @@ balance_counter: | |||
2216 | * another balance operation being required. | 2217 | * another balance operation being required. |
2217 | */ | 2218 | */ |
2218 | xfs_icsb_balance_counter(mp, field, 0, delta); | 2219 | xfs_icsb_balance_counter(mp, field, 0, delta); |
2219 | mutex_unlock(&mp->m_icsb_mutex); | 2220 | xfs_icsb_unlock(mp); |
2220 | goto again; | 2221 | goto again; |
2221 | } | 2222 | } |
2222 | 2223 | ||
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index a2295df61d2e..416c89fbe8b5 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #ifndef __XFS_MOUNT_H__ | 18 | #ifndef __XFS_MOUNT_H__ |
19 | #define __XFS_MOUNT_H__ | 19 | #define __XFS_MOUNT_H__ |
20 | 20 | ||
21 | |||
21 | typedef struct xfs_trans_reservations { | 22 | typedef struct xfs_trans_reservations { |
22 | uint tr_write; /* extent alloc trans */ | 23 | uint tr_write; /* extent alloc trans */ |
23 | uint tr_itruncate; /* truncate trans */ | 24 | uint tr_itruncate; /* truncate trans */ |
@@ -564,6 +565,26 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) | |||
564 | } | 565 | } |
565 | 566 | ||
566 | /* | 567 | /* |
568 | * Per-cpu superblock locking functions | ||
569 | */ | ||
570 | #ifdef HAVE_PERCPU_SB | ||
571 | STATIC_INLINE void | ||
572 | xfs_icsb_lock(xfs_mount_t *mp) | ||
573 | { | ||
574 | mutex_lock(&mp->m_icsb_mutex); | ||
575 | } | ||
576 | |||
577 | STATIC_INLINE void | ||
578 | xfs_icsb_unlock(xfs_mount_t *mp) | ||
579 | { | ||
580 | mutex_unlock(&mp->m_icsb_mutex); | ||
581 | } | ||
582 | #else | ||
583 | #define xfs_icsb_lock(mp) | ||
584 | #define xfs_icsb_unlock(mp) | ||
585 | #endif | ||
586 | |||
587 | /* | ||
567 | * This structure is for use by the xfs_mod_incore_sb_batch() routine. | 588 | * This structure is for use by the xfs_mod_incore_sb_batch() routine. |
568 | */ | 589 | */ |
569 | typedef struct xfs_mod_sb { | 590 | typedef struct xfs_mod_sb { |