linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / xfs / xfs_vfsops.c
index 0cbe005..09665b7 100644 (file)
@@ -55,7 +55,7 @@
 #include "xfs_clnt.h"
 #include "xfs_fsops.h"
 
-STATIC int     xfs_sync(bhv_desc_t *, int, cred_t *);
+STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);
 
 int
 xfs_init(void)
@@ -77,12 +77,11 @@ xfs_init(void)
                                                 "xfs_bmap_free_item");
        xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t),
                                            "xfs_btree_cur");
+       xfs_inode_zone = kmem_zone_init(sizeof(xfs_inode_t), "xfs_inode");
        xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans");
        xfs_da_state_zone =
                kmem_zone_init(sizeof(xfs_da_state_t), "xfs_da_state");
        xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf");
-       xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
-       xfs_acl_zone_init(xfs_acl_zone, "xfs_acl");
 
        /*
         * The size of the zone allocated buf log item is the maximum
@@ -94,30 +93,17 @@ xfs_init(void)
                                (((XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK) /
                                  NBWORD) * sizeof(int))),
                               "xfs_buf_item");
-       xfs_efd_zone =
-               kmem_zone_init((sizeof(xfs_efd_log_item_t) +
-                              ((XFS_EFD_MAX_FAST_EXTENTS - 1) *
-                                sizeof(xfs_extent_t))),
+       xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) +
+                                      ((XFS_EFD_MAX_FAST_EXTENTS - 1) * sizeof(xfs_extent_t))),
                                      "xfs_efd_item");
-       xfs_efi_zone =
-               kmem_zone_init((sizeof(xfs_efi_log_item_t) +
-                              ((XFS_EFI_MAX_FAST_EXTENTS - 1) *
-                                sizeof(xfs_extent_t))),
+       xfs_efi_zone = kmem_zone_init((sizeof(xfs_efi_log_item_t) +
+                                      ((XFS_EFI_MAX_FAST_EXTENTS - 1) * sizeof(xfs_extent_t))),
                                      "xfs_efi_item");
-
-       /*
-        * These zones warrant special memory allocator hints
-        */
-       xfs_inode_zone =
-               kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode",
-                                       KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
-                                       KM_ZONE_SPREAD, NULL);
-       xfs_ili_zone =
-               kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili",
-                                       KM_ZONE_SPREAD, NULL);
-       xfs_chashlist_zone =
-               kmem_zone_init_flags(sizeof(xfs_chashlist_t), "xfs_chashlist",
-                                       KM_ZONE_SPREAD, NULL);
+       xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
+       xfs_ili_zone = kmem_zone_init(sizeof(xfs_inode_log_item_t), "xfs_ili");
+       xfs_chashlist_zone = kmem_zone_init(sizeof(xfs_chashlist_t),
+                                           "xfs_chashlist");
+       xfs_acl_zone_init(xfs_acl_zone, "xfs_acl");
 
        /*
         * Allocate global trace buffers.
@@ -190,18 +176,18 @@ xfs_cleanup(void)
        ktrace_free(xfs_alloc_trace_buf);
 #endif
 
-       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);
+       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);
 }
 
 /*
@@ -272,6 +258,8 @@ xfs_start_flags(
                mp->m_inoadd = XFS_INO64_OFFSET;
        }
 #endif
+       if (ap->flags & XFSMNT_NOATIME)
+               mp->m_flags |= XFS_MOUNT_NOATIME;
        if (ap->flags & XFSMNT_RETERR)
                mp->m_flags |= XFS_MOUNT_RETERR;
        if (ap->flags & XFSMNT_NOALIGN)
@@ -446,9 +434,6 @@ 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.
         */
@@ -499,7 +484,7 @@ xfs_mount(
        error = xfs_start_flags(vfsp, args, mp);
        if (error)
                goto error1;
-       error = xfs_readsb(mp, flags);
+       error = xfs_readsb(mp);
        if (error)
                goto error1;
        error = xfs_finish_flags(vfsp, args, mp);
@@ -639,7 +624,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);
@@ -650,7 +635,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);
@@ -673,22 +658,36 @@ xfs_mntupdate(
        xfs_mount_t     *mp = XFS_BHVTOM(bdp);
        int             error;
 
-       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;
+       if (args->flags & XFSMNT_NOATIME)
+               mp->m_flags |= XFS_MOUNT_NOATIME;
+       else
+               mp->m_flags &= ~XFS_MOUNT_NOATIME;
+
+       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)
                        xfs_mountfs_check_barriers(mp);
-               } else {
-                       mp->m_flags &= ~XFS_MOUNT_BARRIER;
-               }
-       } else if (!(vfsp->vfs_flag & VFS_RDONLY)) {    /* rw -> ro */
+       }
+
+       if (!(vfsp->vfs_flag & VFS_RDONLY) &&
+           (*flags & MS_RDONLY)) {
                VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
+
                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;
 }
 
@@ -819,7 +818,6 @@ xfs_statvfs(
 
        statp->f_type = XFS_SB_MAGIC;
 
-       xfs_icsb_sync_counters_lazy(mp);
        s = XFS_SB_LOCK(mp);
        statp->f_bsize = sbp->sb_blocksize;
        lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0;
@@ -878,10 +876,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 everything.
+ *                    unmounted.  We should sync and invalidate everthing.
  *      SYNC_FSDATA  - This indicates that the caller would like to make
  *                    sure the superblock is safe on disk.  We can ensure
- *                    this by simply making sure the log gets flushed
+ *                    this by simply makeing sure the log gets flushed
  *                    if SYNC_BDFLUSH is set, and by actually writing it
  *                    out otherwise.
  *
@@ -906,7 +904,7 @@ xfs_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 internally-
+ * changing interfaces within the 6.5 family, additional internallly-
  * required functions are specified within a separate xflags parameter,
  * only available by calling this routine.
  *
@@ -1088,7 +1086,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 racy, but these are periodic
+                * inode locked this is racey, 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.
                 */
@@ -1227,7 +1225,7 @@ xfs_sync_inodes(
                                        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
                                        error = xfs_itobp(mp, NULL, ip,
-                                                         &dip, &bp, 0, 0);
+                                                         &dip, &bp, 0);
                                        if (!error) {
                                                xfs_buf_relse(bp);
                                        } else {
@@ -1427,7 +1425,7 @@ xfs_sync_inodes(
  *
  * 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 internally-
+ * changing interfaces within the 6.5 family, additional internallly-
  * required functions are specified within a separate xflags parameter,
  * only available by calling this routine.
  *
@@ -1696,10 +1694,12 @@ xfs_parseargs(
        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;
 
@@ -1912,6 +1912,7 @@ 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;
@@ -1947,10 +1948,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);