[XFS] don't call xfs_freesb from xfs_unmountfs
[pandora-kernel.git] / fs / xfs / xfs_mount.c
index c67f8a9..4d41615 100644 (file)
@@ -51,7 +51,6 @@ STATIC void   xfs_unmountfs_wait(xfs_mount_t *);
 
 
 #ifdef HAVE_PERCPU_SB
-STATIC void    xfs_icsb_destroy_counters(xfs_mount_t *);
 STATIC void    xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t,
                                                int);
 STATIC 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);
 
 #else
 
-#define xfs_icsb_destroy_counters(mp)                  do { } while (0)
 #define xfs_icsb_balance_counter(mp, a, b)             do { } while (0)
 #define xfs_icsb_balance_counter_locked(mp, a, b)      do { } while (0)
 #define xfs_icsb_modify_counters(mp, a, b, c)          do { } while (0)
@@ -124,34 +122,12 @@ static const struct {
     { sizeof(xfs_sb_t),                         0 }
 };
 
-/*
- * Return a pointer to an initialized xfs_mount structure.
- */
-xfs_mount_t *
-xfs_mount_init(void)
-{
-       xfs_mount_t *mp;
-
-       mp = kmem_zalloc(sizeof(xfs_mount_t), KM_SLEEP);
-
-       if (xfs_icsb_init_counters(mp)) {
-               mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
-       }
-
-       spin_lock_init(&mp->m_sb_lock);
-       mutex_init(&mp->m_ilock);
-       mutex_init(&mp->m_growlock);
-       atomic_set(&mp->m_active_trans, 0);
-
-       return mp;
-}
-
 /*
  * Free up the resources associated with a mount structure.  Assume that
  * the structure was initially zeroed, so we can tell which fields got
  * initialized.
  */
-void
+STATIC void
 xfs_mount_free(
        xfs_mount_t     *mp)
 {
@@ -170,15 +146,6 @@ xfs_mount_free(
        mutex_destroy(&mp->m_growlock);
        if (mp->m_quotainfo)
                XFS_QM_DONE(mp);
-
-       if (mp->m_fsname != NULL)
-               kmem_free(mp->m_fsname);
-       if (mp->m_rtname != NULL)
-               kmem_free(mp->m_rtname);
-       if (mp->m_logname != NULL)
-               kmem_free(mp->m_logname);
-
-       xfs_icsb_destroy_counters(mp);
 }
 
 /*
@@ -284,6 +251,19 @@ xfs_mount_validate_sb(
                return XFS_ERROR(EFSCORRUPTED);
        }
 
+       /*
+        * Until this is fixed only page-sized or smaller data blocks work.
+        */
+       if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
+               xfs_fs_mount_cmn_err(flags,
+                       "file system with blocksize %d bytes",
+                       sbp->sb_blocksize);
+               xfs_fs_mount_cmn_err(flags,
+                       "only pagesize (%ld) or less will currently work.",
+                       PAGE_SIZE);
+               return XFS_ERROR(ENOSYS);
+       }
+
        if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
            xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
                xfs_fs_mount_cmn_err(flags,
@@ -305,19 +285,6 @@ xfs_mount_validate_sb(
                return XFS_ERROR(ENOSYS);
        }
 
-       /*
-        * Until this is fixed only page-sized or smaller data blocks work.
-        */
-       if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "file system with blocksize %d bytes",
-                       sbp->sb_blocksize);
-               xfs_fs_mount_cmn_err(flags,
-                       "only pagesize (%ld) or less will currently work.",
-                       PAGE_SIZE);
-               return XFS_ERROR(ENOSYS);
-       }
-
        return 0;
 }
 
@@ -730,11 +697,11 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
  * Update alignment values based on mount options and sb values
  */
 STATIC int
-xfs_update_alignment(xfs_mount_t *mp, int mfsi_flags, __uint64_t *update_flags)
+xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags)
 {
        xfs_sb_t        *sbp = &(mp->m_sb);
 
-       if (mp->m_dalign && !(mfsi_flags & XFS_MFSI_SECOND)) {
+       if (mp->m_dalign) {
                /*
                 * If stripe unit and stripe width are not multiples
                 * of the fs blocksize turn off alignment.
@@ -890,7 +857,7 @@ xfs_set_inoalignment(xfs_mount_t *mp)
  * Check that the data (and log if separate) are an ok size.
  */
 STATIC int
-xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
+xfs_check_sizes(xfs_mount_t *mp)
 {
        xfs_buf_t       *bp;
        xfs_daddr_t     d;
@@ -913,8 +880,7 @@ xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
                return error;
        }
 
-       if (((mfsi_flags & XFS_MFSI_CLIENT) == 0) &&
-           mp->m_logdev_targp != mp->m_ddev_targp) {
+       if (mp->m_logdev_targp != mp->m_ddev_targp) {
                d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
                if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
                        cmn_err(CE_WARN, "XFS: size check 3 failed");
@@ -949,8 +915,7 @@ xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
  */
 int
 xfs_mountfs(
-       xfs_mount_t     *mp,
-       int             mfsi_flags)
+       xfs_mount_t     *mp)
 {
        xfs_sb_t        *sbp = &(mp->m_sb);
        xfs_inode_t     *rip;
@@ -1011,7 +976,7 @@ xfs_mountfs(
         * allocator alignment is within an ag, therefore ag has
         * to be aligned at stripe boundary.
         */
-       error = xfs_update_alignment(mp, mfsi_flags, &update_flags);
+       error = xfs_update_alignment(mp, &update_flags);
        if (error)
                goto error1;
 
@@ -1030,8 +995,7 @@ xfs_mountfs(
         * since a single partition filesystem is identical to a single
         * partition volume/filesystem.
         */
-       if ((mfsi_flags & XFS_MFSI_SECOND) == 0 &&
-           (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
+       if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
                if (xfs_uuid_mount(mp)) {
                        error = XFS_ERROR(EINVAL);
                        goto error1;
@@ -1059,7 +1023,7 @@ xfs_mountfs(
        /*
         * Check that the data (and log if separate) are an ok size.
         */
-       error = xfs_check_sizes(mp, mfsi_flags);
+       error = xfs_check_sizes(mp);
        if (error)
                goto error1;
 
@@ -1072,13 +1036,6 @@ xfs_mountfs(
                goto error1;
        }
 
-       /*
-        * For client case we are done now
-        */
-       if (mfsi_flags & XFS_MFSI_CLIENT) {
-               return 0;
-       }
-
        /*
         *  Copies the low order bits of the timestamp and the randomly
         *  set "sequence" number out of a UUID.
@@ -1216,7 +1173,7 @@ xfs_mountfs(
         * delayed until after the root and real-time bitmap inodes
         * were consistently read in.
         */
-       error = xfs_log_mount_finish(mp, mfsi_flags);
+       error = xfs_log_mount_finish(mp);
        if (error) {
                cmn_err(CE_WARN, "XFS: log mount finish failed");
                goto error4;
@@ -1225,7 +1182,7 @@ xfs_mountfs(
        /*
         * Complete the quota initialisation, post-log-replay component.
         */
-       error = XFS_QM_MOUNT(mp, quotamount, quotaflags, mfsi_flags);
+       error = XFS_QM_MOUNT(mp, quotamount, quotaflags);
        if (error)
                goto error4;
 
@@ -1272,16 +1229,17 @@ xfs_mountfs(
 }
 
 /*
- * xfs_unmountfs
- *
  * This flushes out the inodes,dquots and the superblock, unmounts the
  * log and makes sure that incore structures are freed.
  */
-int
-xfs_unmountfs(xfs_mount_t *mp)
+void
+xfs_unmountfs(
+       struct xfs_mount        *mp)
 {
-       __uint64_t      resblks;
-       int             error = 0;
+       __uint64_t              resblks;
+       int                     error;
+
+       IRELE(mp->m_rootip);
 
        /*
         * We can potentially deadlock here if we have an inode cluster
@@ -1338,8 +1296,6 @@ xfs_unmountfs(xfs_mount_t *mp)
        xfs_unmountfs_wait(mp);                 /* wait for async bufs */
        xfs_log_unmount(mp);                    /* Done! No more fs ops. */
 
-       xfs_freesb(mp);
-
        /*
         * All inodes from this mount point should be freed.
         */
@@ -1348,11 +1304,10 @@ xfs_unmountfs(xfs_mount_t *mp)
        if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)
                uuid_table_remove(&mp->m_sb.sb_uuid);
 
-#if defined(DEBUG) || defined(INDUCE_IO_ERROR)
+#if defined(DEBUG)
        xfs_errortag_clearall(mp, 0);
 #endif
        xfs_mount_free(mp);
-       return 0;
 }
 
 STATIC void
@@ -2093,7 +2048,7 @@ xfs_icsb_reinit_counters(
        xfs_icsb_unlock(mp);
 }
 
-STATIC void
+void
 xfs_icsb_destroy_counters(
        xfs_mount_t     *mp)
 {