aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-05-20 01:10:52 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:58:29 -0400
commitc962fb7902669a48a2c613649c1f03865c0ffd1e (patch)
tree370bdf7273c92a2bcb230680c6b0bfa4928b11e8 /fs/xfs/xfs_mount.c
parentbdd907bab78419f34113c51470192945741b839e (diff)
[XFS] kill xfs_mount_init
xfs_mount_init is inlined into xfs_fs_fill_super and allocation switched to kzalloc. Plug a leak of the mount structure for most early mount failures. Move xfs_icsb_init_counters to as late as possible in the mount path and make sure to undo it so that no stale hotplug cpu notifiers are left around on mount failures. SGI-PV: 981951 SGI-Modid: xfs-linux-melb:xfs-kern:31196a 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.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index c67f8a9ae418..1bfaa204f689 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -51,7 +51,6 @@ STATIC void xfs_unmountfs_wait(xfs_mount_t *);
51 51
52 52
53#ifdef HAVE_PERCPU_SB 53#ifdef HAVE_PERCPU_SB
54STATIC void xfs_icsb_destroy_counters(xfs_mount_t *);
55STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t, 54STATIC void xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t,
56 int); 55 int);
57STATIC void xfs_icsb_balance_counter_locked(xfs_mount_t *, xfs_sb_field_t, 56STATIC void xfs_icsb_balance_counter_locked(xfs_mount_t *, xfs_sb_field_t,
@@ -62,7 +61,6 @@ STATIC void xfs_icsb_disable_counter(xfs_mount_t *, xfs_sb_field_t);
62 61
63#else 62#else
64 63
65#define xfs_icsb_destroy_counters(mp) do { } while (0)
66#define xfs_icsb_balance_counter(mp, a, b) do { } while (0) 64#define xfs_icsb_balance_counter(mp, a, b) do { } while (0)
67#define xfs_icsb_balance_counter_locked(mp, a, b) do { } while (0) 65#define xfs_icsb_balance_counter_locked(mp, a, b) 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)
@@ -125,33 +123,11 @@ static const struct {
125}; 123};
126 124
127/* 125/*
128 * Return a pointer to an initialized xfs_mount structure.
129 */
130xfs_mount_t *
131xfs_mount_init(void)
132{
133 xfs_mount_t *mp;
134
135 mp = kmem_zalloc(sizeof(xfs_mount_t), KM_SLEEP);
136
137 if (xfs_icsb_init_counters(mp)) {
138 mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
139 }
140
141 spin_lock_init(&mp->m_sb_lock);
142 mutex_init(&mp->m_ilock);
143 mutex_init(&mp->m_growlock);
144 atomic_set(&mp->m_active_trans, 0);
145
146 return mp;
147}
148
149/*
150 * Free up the resources associated with a mount structure. Assume that 126 * Free up the resources associated with a mount structure. Assume that
151 * the structure was initially zeroed, so we can tell which fields got 127 * the structure was initially zeroed, so we can tell which fields got
152 * initialized. 128 * initialized.
153 */ 129 */
154void 130STATIC void
155xfs_mount_free( 131xfs_mount_free(
156 xfs_mount_t *mp) 132 xfs_mount_t *mp)
157{ 133{
@@ -177,8 +153,6 @@ xfs_mount_free(
177 kmem_free(mp->m_rtname); 153 kmem_free(mp->m_rtname);
178 if (mp->m_logname != NULL) 154 if (mp->m_logname != NULL)
179 kmem_free(mp->m_logname); 155 kmem_free(mp->m_logname);
180
181 xfs_icsb_destroy_counters(mp);
182} 156}
183 157
184/* 158/*
@@ -2093,7 +2067,7 @@ xfs_icsb_reinit_counters(
2093 xfs_icsb_unlock(mp); 2067 xfs_icsb_unlock(mp);
2094} 2068}
2095 2069
2096STATIC void 2070void
2097xfs_icsb_destroy_counters( 2071xfs_icsb_destroy_counters(
2098 xfs_mount_t *mp) 2072 xfs_mount_t *mp)
2099{ 2073{