Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / fs / xfs / xfs_vfsops.c
index f22bebf8f51322305cefd70a16ae0a848c6e89cb..504d2a80747a70be21686fee02cf6fb87f32cd46 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,11 +77,12 @@ 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
@@ -93,17 +94,30 @@ 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");
-       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");
+
+       /*
+        * 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);
 
        /*
         * Allocate global trace buffers.
@@ -176,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);
 }
 
 /*
@@ -258,8 +272,6 @@ 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)
@@ -333,10 +345,11 @@ xfs_finish_flags(
 
        /* Fail a mount where the logbuf is smaller then the log stripe */
        if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
-               if ((ap->logbufsize == -1) &&
+               if ((ap->logbufsize <= 0) &&
                    (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) {
                        mp->m_logbsize = mp->m_sb.sb_logsunit;
-               } else if (ap->logbufsize < mp->m_sb.sb_logsunit) {
+               } else if (ap->logbufsize > 0 &&
+                          ap->logbufsize < mp->m_sb.sb_logsunit) {
                        cmn_err(CE_WARN,
        "XFS: logbuf size must be greater than or equal to log stripe size");
                        return XFS_ERROR(EINVAL);
@@ -619,7 +632,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);
@@ -630,7 +643,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);
@@ -653,11 +666,6 @@ xfs_mntupdate(
        xfs_mount_t     *mp = XFS_BHVTOM(bdp);
        int             error;
 
-       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
@@ -813,6 +821,7 @@ 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;
@@ -871,10 +880,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.
  *
@@ -899,7 +908,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 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.
  *
@@ -1081,7 +1090,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.
                 */
@@ -1220,7 +1229,7 @@ xfs_sync_inodes(
                                        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
                                        error = xfs_itobp(mp, NULL, ip,
-                                                         &dip, &bp, 0);
+                                                         &dip, &bp, 0, 0);
                                        if (!error) {
                                                xfs_buf_relse(bp);
                                        } else {
@@ -1420,7 +1429,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 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.
  *
@@ -1689,10 +1698,7 @@ xfs_parseargs(
        int                     iosize;
 
        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
+       args->flags |= XFSMNT_IDELETE;
 
        if (!options)
                goto done;
@@ -1902,7 +1908,6 @@ 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;
@@ -1938,6 +1943,8 @@ 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)