diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-04-22 03:34:37 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-29 01:57:11 -0400 |
commit | d4d90b577ee5af5c1b29bd693aca026a77a1a2f1 (patch) | |
tree | 24f050ac11d3bad60f7910c63138c37c3214ca1f /fs/xfs/xfs_mount.c | |
parent | e8b0ebaa115ac46b21622b103c29927f5805aeaa (diff) |
[XFS] Add xfs_icsb_sync_counters_locked for when m_sb_lock already held
Add a new xfs_icsb_sync_counters_locked for the case where m_sb_lock
is already taken and add a flags argument to xfs_icsb_sync_counters so
that xfs_icsb_sync_counters_flags is not needed.
SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30917a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 2fec452afbcc..a2fad07fd844 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -55,7 +55,6 @@ STATIC void xfs_unmountfs_wait(xfs_mount_t *); | |||
55 | STATIC void xfs_icsb_destroy_counters(xfs_mount_t *); | 55 | STATIC void xfs_icsb_destroy_counters(xfs_mount_t *); |
56 | STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t, | 56 | STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t, |
57 | int, int); | 57 | int, int); |
58 | STATIC void xfs_icsb_sync_counters(xfs_mount_t *); | ||
59 | STATIC int xfs_icsb_modify_counters(xfs_mount_t *, xfs_sb_field_t, | 58 | STATIC int xfs_icsb_modify_counters(xfs_mount_t *, xfs_sb_field_t, |
60 | int64_t, int); | 59 | int64_t, int); |
61 | STATIC void xfs_icsb_disable_counter(xfs_mount_t *, xfs_sb_field_t); | 60 | STATIC void xfs_icsb_disable_counter(xfs_mount_t *, xfs_sb_field_t); |
@@ -64,7 +63,6 @@ STATIC void xfs_icsb_disable_counter(xfs_mount_t *, xfs_sb_field_t); | |||
64 | 63 | ||
65 | #define xfs_icsb_destroy_counters(mp) do { } while (0) | 64 | #define xfs_icsb_destroy_counters(mp) do { } while (0) |
66 | #define xfs_icsb_balance_counter(mp, a, b, c) do { } while (0) | 65 | #define xfs_icsb_balance_counter(mp, a, b, c) do { } while (0) |
67 | #define xfs_icsb_sync_counters(mp) do { } while (0) | ||
68 | #define xfs_icsb_modify_counters(mp, a, b, c) do { } while (0) | 66 | #define xfs_icsb_modify_counters(mp, a, b, c) do { } while (0) |
69 | 67 | ||
70 | #endif | 68 | #endif |
@@ -1400,7 +1398,7 @@ xfs_log_sbcount( | |||
1400 | if (!xfs_fs_writable(mp)) | 1398 | if (!xfs_fs_writable(mp)) |
1401 | return 0; | 1399 | return 0; |
1402 | 1400 | ||
1403 | xfs_icsb_sync_counters(mp); | 1401 | xfs_icsb_sync_counters(mp, 0); |
1404 | 1402 | ||
1405 | /* | 1403 | /* |
1406 | * we don't need to do this if we are updating the superblock | 1404 | * we don't need to do this if we are updating the superblock |
@@ -2278,38 +2276,33 @@ xfs_icsb_enable_counter( | |||
2278 | } | 2276 | } |
2279 | 2277 | ||
2280 | void | 2278 | void |
2281 | xfs_icsb_sync_counters_flags( | 2279 | xfs_icsb_sync_counters_locked( |
2282 | xfs_mount_t *mp, | 2280 | xfs_mount_t *mp, |
2283 | int flags) | 2281 | int flags) |
2284 | { | 2282 | { |
2285 | xfs_icsb_cnts_t cnt; | 2283 | xfs_icsb_cnts_t cnt; |
2286 | 2284 | ||
2287 | /* Pass 1: lock all counters */ | ||
2288 | if ((flags & XFS_ICSB_SB_LOCKED) == 0) | ||
2289 | spin_lock(&mp->m_sb_lock); | ||
2290 | |||
2291 | xfs_icsb_count(mp, &cnt, flags); | 2285 | xfs_icsb_count(mp, &cnt, flags); |
2292 | 2286 | ||
2293 | /* Step 3: update mp->m_sb fields */ | ||
2294 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_ICOUNT)) | 2287 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_ICOUNT)) |
2295 | mp->m_sb.sb_icount = cnt.icsb_icount; | 2288 | mp->m_sb.sb_icount = cnt.icsb_icount; |
2296 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_IFREE)) | 2289 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_IFREE)) |
2297 | mp->m_sb.sb_ifree = cnt.icsb_ifree; | 2290 | mp->m_sb.sb_ifree = cnt.icsb_ifree; |
2298 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_FDBLOCKS)) | 2291 | if (!xfs_icsb_counter_disabled(mp, XFS_SBS_FDBLOCKS)) |
2299 | mp->m_sb.sb_fdblocks = cnt.icsb_fdblocks; | 2292 | mp->m_sb.sb_fdblocks = cnt.icsb_fdblocks; |
2300 | |||
2301 | if ((flags & XFS_ICSB_SB_LOCKED) == 0) | ||
2302 | spin_unlock(&mp->m_sb_lock); | ||
2303 | } | 2293 | } |
2304 | 2294 | ||
2305 | /* | 2295 | /* |
2306 | * Accurate update of per-cpu counters to incore superblock | 2296 | * Accurate update of per-cpu counters to incore superblock |
2307 | */ | 2297 | */ |
2308 | STATIC void | 2298 | void |
2309 | xfs_icsb_sync_counters( | 2299 | xfs_icsb_sync_counters( |
2310 | xfs_mount_t *mp) | 2300 | xfs_mount_t *mp, |
2301 | int flags) | ||
2311 | { | 2302 | { |
2312 | xfs_icsb_sync_counters_flags(mp, 0); | 2303 | spin_lock(&mp->m_sb_lock); |
2304 | xfs_icsb_sync_counters_locked(mp, flags); | ||
2305 | spin_unlock(&mp->m_sb_lock); | ||
2313 | } | 2306 | } |
2314 | 2307 | ||
2315 | /* | 2308 | /* |