[XFS] Resolve a namespace collision on vfs/vfsops for FreeBSD porters.
[cascardo/linux.git] / fs / xfs / xfs_vfsops.c
index 811a426..57ee2be 100644 (file)
@@ -190,18 +190,18 @@ xfs_cleanup(void)
        ktrace_free(xfs_alloc_trace_buf);
 #endif
 
-       kmem_cache_destroy(xfs_bmap_free_item_zone);
-       kmem_cache_destroy(xfs_btree_cur_zone);
-       kmem_cache_destroy(xfs_inode_zone);
-       kmem_cache_destroy(xfs_trans_zone);
-       kmem_cache_destroy(xfs_da_state_zone);
-       kmem_cache_destroy(xfs_dabuf_zone);
-       kmem_cache_destroy(xfs_buf_item_zone);
-       kmem_cache_destroy(xfs_efd_zone);
-       kmem_cache_destroy(xfs_efi_zone);
-       kmem_cache_destroy(xfs_ifork_zone);
-       kmem_cache_destroy(xfs_ili_zone);
-       kmem_cache_destroy(xfs_chashlist_zone);
+       kmem_zone_destroy(xfs_bmap_free_item_zone);
+       kmem_zone_destroy(xfs_btree_cur_zone);
+       kmem_zone_destroy(xfs_inode_zone);
+       kmem_zone_destroy(xfs_trans_zone);
+       kmem_zone_destroy(xfs_da_state_zone);
+       kmem_zone_destroy(xfs_dabuf_zone);
+       kmem_zone_destroy(xfs_buf_item_zone);
+       kmem_zone_destroy(xfs_efd_zone);
+       kmem_zone_destroy(xfs_efi_zone);
+       kmem_zone_destroy(xfs_ifork_zone);
+       kmem_zone_destroy(xfs_ili_zone);
+       kmem_zone_destroy(xfs_chashlist_zone);
 }
 
 /*
@@ -212,7 +212,7 @@ xfs_cleanup(void)
  */
 STATIC int
 xfs_start_flags(
-       struct vfs              *vfs,
+       struct bhv_vfs          *vfs,
        struct xfs_mount_args   *ap,
        struct xfs_mount        *mp)
 {
@@ -337,7 +337,7 @@ xfs_start_flags(
  */
 STATIC int
 xfs_finish_flags(
-       struct vfs              *vfs,
+       struct bhv_vfs          *vfs,
        struct xfs_mount_args   *ap,
        struct xfs_mount        *mp)
 {
@@ -423,7 +423,7 @@ xfs_mount(
        struct xfs_mount_args   *args,
        cred_t                  *credp)
 {
-       struct vfs              *vfsp = bhvtovfs(bhvp);
+       struct bhv_vfs          *vfsp = bhvtovfs(bhvp);
        struct bhv_desc         *p;
        struct xfs_mount        *mp = XFS_BHVTOM(bhvp);
        struct block_device     *ddev, *logdev, *rtdev;
@@ -442,6 +442,9 @@ xfs_mount(
        p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO);
        mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs;
 
+       if (args->flags & XFSMNT_QUIET)
+               flags |= XFS_MFSI_QUIET;
+
        /*
         * Open real time and log devices - order is important.
         */
@@ -492,7 +495,7 @@ xfs_mount(
        error = xfs_start_flags(vfsp, args, mp);
        if (error)
                goto error1;
-       error = xfs_readsb(mp);
+       error = xfs_readsb(mp, flags);
        if (error)
                goto error1;
        error = xfs_finish_flags(vfsp, args, mp);
@@ -549,7 +552,7 @@ xfs_unmount(
        int             flags,
        cred_t          *credp)
 {
-       struct vfs      *vfsp = bhvtovfs(bdp);
+       bhv_vfs_t       *vfsp = bhvtovfs(bdp);
        xfs_mount_t     *mp = XFS_BHVTOM(bdp);
        xfs_inode_t     *rip;
        vnode_t         *rvp;
@@ -632,7 +635,7 @@ xfs_quiesce_fs(
        xfs_mount_t             *mp)
 {
        int                     count = 0, pincount;
-               
+
        xfs_refcache_purge_mp(mp);
        xfs_flush_buftarg(mp->m_ddev_targp, 0);
        xfs_finish_reclaim_all(mp, 0);
@@ -643,7 +646,7 @@ xfs_quiesce_fs(
         * meta data (typically directory updates).
         * Which then must be flushed and logged before
         * we can write the unmount record.
-        */ 
+        */
        do {
                xfs_syncsub(mp, SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT, 0, NULL);
                pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
@@ -662,35 +665,25 @@ xfs_mntupdate(
        int                             *flags,
        struct xfs_mount_args           *args)
 {
-       struct vfs      *vfsp = bhvtovfs(bdp);
+       bhv_vfs_t       *vfsp = bhvtovfs(bdp);
        xfs_mount_t     *mp = XFS_BHVTOM(bdp);
-       int             error;
-
-       if (args->flags & XFSMNT_BARRIER)
-               mp->m_flags |= XFS_MOUNT_BARRIER;
-       else
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-
-       if ((vfsp->vfs_flag & VFS_RDONLY) &&
-           !(*flags & MS_RDONLY)) {
-               vfsp->vfs_flag &= ~VFS_RDONLY;
 
-               if (args->flags & XFSMNT_BARRIER)
+       if (!(*flags & MS_RDONLY)) {                    /* rw/ro -> rw */
+               if (vfsp->vfs_flag & VFS_RDONLY)
+                       vfsp->vfs_flag &= ~VFS_RDONLY;
+               if (args->flags & XFSMNT_BARRIER) {
+                       mp->m_flags |= XFS_MOUNT_BARRIER;
                        xfs_mountfs_check_barriers(mp);
-       }
-
-       if (!(vfsp->vfs_flag & VFS_RDONLY) &&
-           (*flags & MS_RDONLY)) {
-               VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
-
+               } else {
+                       mp->m_flags &= ~XFS_MOUNT_BARRIER;
+               }
+       } else if (!(vfsp->vfs_flag & VFS_RDONLY)) {    /* rw -> ro */
+               bhv_vfs_sync(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL);
                xfs_quiesce_fs(mp);
-
-               /* Ok now write out an unmount record */
                xfs_log_unmount_write(mp);
                xfs_unmountfs_writesb(mp);
                vfsp->vfs_flag |= VFS_RDONLY;
        }
-
        return 0;
 }
 
@@ -880,10 +873,10 @@ xfs_statvfs(
  *                    determine if they should be flushed sync, async, or
  *                    delwri.
  *      SYNC_CLOSE   - This flag is passed when the system is being
- *                    unmounted.  We should sync and invalidate everthing.
+ *                    unmounted.  We should sync and invalidate everything.
  *      SYNC_FSDATA  - This indicates that the caller would like to make
  *                    sure the superblock is safe on disk.  We can ensure
- *                    this by simply makeing sure the log gets flushed
+ *                    this by simply making sure the log gets flushed
  *                    if SYNC_BDFLUSH is set, and by actually writing it
  *                    out otherwise.
  *
@@ -906,9 +899,9 @@ xfs_sync(
 /*
  * xfs sync routine for internal use
  *
- * This routine supports all of the flags defined for the generic VFS_SYNC
+ * This routine supports all of the flags defined for the generic vfs_sync
  * interface as explained above under xfs_sync.  In the interests of not
- * changing interfaces within the 6.5 family, additional internallly-
+ * changing interfaces within the 6.5 family, additional internally-
  * required functions are specified within a separate xflags parameter,
  * only available by calling this routine.
  *
@@ -1090,7 +1083,7 @@ xfs_sync_inodes(
                 * If this is just vfs_sync() or pflushd() calling
                 * then we can skip inodes for which it looks like
                 * there is nothing to do.  Since we don't have the
-                * inode locked this is racey, but these are periodic
+                * inode locked this is racy, but these are periodic
                 * calls so it doesn't matter.  For the others we want
                 * to know for sure, so we at least try to lock them.
                 */
@@ -1427,9 +1420,9 @@ xfs_sync_inodes(
 /*
  * xfs sync routine for internal use
  *
- * This routine supports all of the flags defined for the generic VFS_SYNC
+ * This routine supports all of the flags defined for the generic vfs_sync
  * interface as explained above under xfs_sync.  In the interests of not
- * changing interfaces within the 6.5 family, additional internallly-
+ * changing interfaces within the 6.5 family, additional internally-
  * required functions are specified within a separate xflags parameter,
  * only available by calling this routine.
  *
@@ -1692,17 +1685,15 @@ xfs_parseargs(
        struct xfs_mount_args   *args,
        int                     update)
 {
-       struct vfs              *vfsp = bhvtovfs(bhv);
+       bhv_vfs_t               *vfsp = bhvtovfs(bhv);
        char                    *this_char, *value, *eov;
        int                     dsunit, dswidth, vol_dsunit, vol_dswidth;
        int                     iosize;
 
+       args->flags |= XFSMNT_IDELETE;
+       args->flags |= XFSMNT_BARRIER;
        args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
 
-#if 0  /* XXX: off by default, until some remaining issues ironed out */
-       args->flags |= XFSMNT_IDELETE; /* default to on */
-#endif
-
        if (!options)
                goto done;
 
@@ -1716,42 +1707,48 @@ xfs_parseargs(
 
                if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        args->logbufs = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        args->logbufsize = suffix_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->logname, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_MTPT)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->mtpt, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->rtname, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1760,7 +1757,8 @@ xfs_parseargs(
                        args->iosizelog = (uint8_t) iosize;
                } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1769,7 +1767,8 @@ xfs_parseargs(
                        args->iosizelog = ffs(iosize) - 1;
                } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1790,7 +1789,8 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_INO64)) {
                        args->flags |= XFSMNT_INO64;
 #if !XFS_BIG_INUMS
-                       printk("XFS: %s option not allowed on this system\n",
+                       cmn_err(CE_WARN,
+                               "XFS: %s option not allowed on this system",
                                this_char);
                        return EINVAL;
 #endif
@@ -1800,14 +1800,16 @@ xfs_parseargs(
                        args->flags |= XFSMNT_SWALLOC;
                } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        dsunit = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1815,7 +1817,8 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
                        args->flags &= ~XFSMNT_32BITINODES;
 #if !XFS_BIG_INUMS
-                       printk("XFS: %s option not allowed on this system\n",
+                       cmn_err(CE_WARN,
+                               "XFS: %s option not allowed on this system",
                                this_char);
                        return EINVAL;
 #endif
@@ -1839,36 +1842,41 @@ xfs_parseargs(
                        args->flags &= ~XFSMNT_ATTR2;
                } else if (!strcmp(this_char, "osyncisdsync")) {
                        /* no-op, this is now the default */
-printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
+                       cmn_err(CE_WARN,
+       "XFS: osyncisdsync is now the default, option is deprecated.");
                } else if (!strcmp(this_char, "irixsgid")) {
-printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n");
+                       cmn_err(CE_WARN,
+       "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
                } else {
-                       printk("XFS: unknown mount option [%s].\n", this_char);
+                       cmn_err(CE_WARN,
+                               "XFS: unknown mount option [%s].", this_char);
                        return EINVAL;
                }
        }
 
        if (args->flags & XFSMNT_NORECOVERY) {
                if ((vfsp->vfs_flag & VFS_RDONLY) == 0) {
-                       printk("XFS: no-recovery mounts must be read-only.\n");
+                       cmn_err(CE_WARN,
+                               "XFS: no-recovery mounts must be read-only.");
                        return EINVAL;
                }
        }
 
        if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) {
-               printk(
-       "XFS: sunit and swidth options incompatible with the noalign option\n");
+               cmn_err(CE_WARN,
+       "XFS: sunit and swidth options incompatible with the noalign option");
                return EINVAL;
        }
 
        if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
-               printk("XFS: sunit and swidth must be specified together\n");
+               cmn_err(CE_WARN,
+                       "XFS: sunit and swidth must be specified together");
                return EINVAL;
        }
 
        if (dsunit && (dswidth % dsunit != 0)) {
-               printk(
-       "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)\n",
+               cmn_err(CE_WARN,
+       "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)",
                        dswidth, dsunit);
                return EINVAL;
        }
@@ -1911,12 +1919,11 @@ xfs_showargs(
                { XFS_MOUNT_NOUUID,             "," MNTOPT_NOUUID },
                { XFS_MOUNT_NORECOVERY,         "," MNTOPT_NORECOVERY },
                { XFS_MOUNT_OSYNCISOSYNC,       "," MNTOPT_OSYNCISOSYNC },
-               { XFS_MOUNT_IDELETE,            "," MNTOPT_NOIKEEP },
                { 0, NULL }
        };
        struct proc_xfs_info    *xfs_infop;
        struct xfs_mount        *mp = XFS_BHVTOM(bhv);
-       struct vfs              *vfsp = XFS_MTOVFS(mp);
+       struct bhv_vfs          *vfsp = XFS_MTOVFS(mp);
 
        for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) {
                if (mp->m_flags & xfs_infop->flag)
@@ -1947,10 +1954,10 @@ xfs_showargs(
                seq_printf(m, "," MNTOPT_SWIDTH "=%d",
                                (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
 
+       if (!(mp->m_flags & XFS_MOUNT_IDELETE))
+               seq_printf(m, "," MNTOPT_IKEEP);
        if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE))
                seq_printf(m, "," MNTOPT_LARGEIO);
-       if (mp->m_flags & XFS_MOUNT_BARRIER)
-               seq_printf(m, "," MNTOPT_BARRIER);
 
        if (!(vfsp->vfs_flag & VFS_32BITINODES))
                seq_printf(m, "," MNTOPT_64BITINODE);
@@ -1976,7 +1983,7 @@ xfs_freeze(
 }
 
 
-vfsops_t xfs_vfsops = {
+bhv_vfsops_t xfs_vfsops = {
        BHV_IDENTITY_INIT(VFS_BHV_XFS,VFS_POSITION_XFS),
        .vfs_parseargs          = xfs_parseargs,
        .vfs_showargs           = xfs_showargs,