NFS: Reduce stack footprint of nfs_setattr()
[safe/jmp/linux-2.6] / fs / gfs2 / ops_fstype.c
index 36b11cb..c1309ed 100644 (file)
@@ -63,13 +63,9 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
        gt->gt_quota_warn_period = 10;
        gt->gt_quota_scale_num = 1;
        gt->gt_quota_scale_den = 1;
-       gt->gt_quota_quantum = 60;
        gt->gt_new_files_jdata = 0;
        gt->gt_max_readahead = 1 << 18;
-       gt->gt_stall_secs = 600;
        gt->gt_complain_secs = 10;
-       gt->gt_statfs_quantum = 30;
-       gt->gt_statfs_slow = 0;
 }
 
 static struct gfs2_sbd *init_sbd(struct super_block *sb)
@@ -85,6 +81,8 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
 
        gfs2_tune_init(&sdp->sd_tune);
 
+       init_waitqueue_head(&sdp->sd_glock_wait);
+       atomic_set(&sdp->sd_glock_disposal, 0);
        spin_lock_init(&sdp->sd_statfs_spin);
 
        spin_lock_init(&sdp->sd_rindex_spin);
@@ -726,7 +724,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                goto fail;
        }
 
-       error = -EINVAL;
+       error = -EUSERS;
        if (!gfs2_jindex_size(sdp)) {
                fs_err(sdp, "no journals!\n");
                goto fail_jindex;
@@ -986,16 +984,24 @@ static const match_table_t nolock_tokens = {
        { Opt_err, NULL },
 };
 
+static void nolock_put_lock(struct kmem_cache *cachep, struct gfs2_glock *gl)
+{
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+       kmem_cache_free(cachep, gl);
+       if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+               wake_up(&sdp->sd_glock_wait);
+}
+
 static const struct lm_lockops nolock_ops = {
        .lm_proto_name = "lock_nolock",
-       .lm_put_lock = kmem_cache_free,
+       .lm_put_lock = nolock_put_lock,
        .lm_tokens = &nolock_tokens,
 };
 
 /**
  * gfs2_lm_mount - mount a locking protocol
  * @sdp: the filesystem
- * @args: mount arguements
+ * @args: mount arguments
  * @silent: if 1, don't complain if the FS isn't a GFS2 fs
  *
  * Returns: errno
@@ -1134,6 +1140,8 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
        }
        if (sdp->sd_args.ar_posix_acl)
                sb->s_flags |= MS_POSIXACL;
+       if (sdp->sd_args.ar_nobarrier)
+               set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
 
        sb->s_magic = GFS2_MAGIC;
        sb->s_op = &gfs2_super_ops;
@@ -1153,6 +1161,15 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
        sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
 
        sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit;
+       sdp->sd_tune.gt_quota_quantum = sdp->sd_args.ar_quota_quantum;
+       if (sdp->sd_args.ar_statfs_quantum) {
+               sdp->sd_tune.gt_statfs_slow = 0;
+               sdp->sd_tune.gt_statfs_quantum = sdp->sd_args.ar_statfs_quantum;
+       }
+       else {
+               sdp->sd_tune.gt_statfs_slow = 1;
+               sdp->sd_tune.gt_statfs_quantum = 30;
+       }
 
        error = init_names(sdp, silent);
        if (error)
@@ -1223,10 +1240,9 @@ fail_sb:
 fail_locking:
        init_locking(sdp, &mount_gh, UNDO);
 fail_lm:
+       invalidate_inodes(sb);
        gfs2_gl_hash_clear(sdp);
        gfs2_lm_unmount(sdp);
-       while (invalidate_inodes(sb))
-               yield();
 fail_sys:
        gfs2_sys_fs_del(sdp);
 fail:
@@ -1308,6 +1324,8 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
        args.ar_quota = GFS2_QUOTA_DEFAULT;
        args.ar_data = GFS2_DATA_DEFAULT;
        args.ar_commit = 60;
+       args.ar_statfs_quantum = 30;
+       args.ar_quota_quantum = 60;
        args.ar_errors = GFS2_ERRORS_DEFAULT;
 
        error = gfs2_mount_args(&args, data);