Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146917
b: refs/heads/master
c: 48c2b61
h: refs/heads/master
i:
  146915: b3f43c1
v: v3
  • Loading branch information
Steven Whitehouse committed May 13, 2009
1 parent 78bcdcb commit 22e65d1
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1c0643ff9f360a30644f6e3cd643ca2a5083aea
refs/heads/master: 48c2b613616235d7c97fda5982f50100a6c79166
1 change: 1 addition & 0 deletions trunk/fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ struct gfs2_args {
unsigned int ar_data:2; /* ordered/writeback */
unsigned int ar_meta:1; /* mount metafs */
unsigned int ar_discard:1; /* discard requests */
int ar_commit; /* Commit interval */
};

struct gfs2_tune {
Expand Down
10 changes: 10 additions & 0 deletions trunk/fs/gfs2/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum {
Opt_meta,
Opt_discard,
Opt_nodiscard,
Opt_commit,
Opt_err,
};

Expand Down Expand Up @@ -73,6 +74,7 @@ static const match_table_t tokens = {
{Opt_meta, "meta"},
{Opt_discard, "discard"},
{Opt_nodiscard, "nodiscard"},
{Opt_commit, "commit=%d"},
{Opt_err, NULL}
};

Expand All @@ -89,6 +91,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
char *o;
int token;
substring_t tmp[MAX_OPT_ARGS];
int rv;

/* Split the options into tokens with the "," character and
process them */
Expand Down Expand Up @@ -173,6 +176,13 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
case Opt_nodiscard:
args->ar_discard = 0;
break;
case Opt_commit:
rv = match_int(&tmp[0], &args->ar_commit);
if (rv || args->ar_commit <= 0) {
fs_info(sdp, "commit mount option requires a positive numeric argument\n");
return rv ? rv : -EINVAL;
}
break;
case Opt_err:
default:
fs_info(sdp, "invalid mount option: %s\n", o);
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
spin_lock_init(&gt->gt_spin);

gt->gt_incore_log_blocks = 1024;
gt->gt_log_flush_secs = 60;
gt->gt_recoverd_secs = 60;
gt->gt_logd_secs = 1;
gt->gt_quota_simul_sync = 64;
Expand Down Expand Up @@ -1165,6 +1164,7 @@ static int fill_super(struct super_block *sb, void *data, int silent)

sdp->sd_args.ar_quota = GFS2_QUOTA_DEFAULT;
sdp->sd_args.ar_data = GFS2_DATA_DEFAULT;
sdp->sd_args.ar_commit = 60;

error = gfs2_mount_args(sdp, &sdp->sd_args, data);
if (error) {
Expand All @@ -1191,6 +1191,8 @@ static int fill_super(struct super_block *sb, void *data, int silent)
GFS2_BASIC_BLOCK_SHIFT;
sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;

sdp->sd_tune.gt_log_flush_secs = sdp->sd_args.ar_commit;

error = init_names(sdp, silent);
if (error)
goto fail;
Expand Down
13 changes: 12 additions & 1 deletion trunk/fs/gfs2/ops_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,12 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
{
struct gfs2_sbd *sdp = sb->s_fs_info;
struct gfs2_args args = sdp->sd_args; /* Default to current settings */
struct gfs2_tune *gt = &sdp->sd_tune;
int error;

spin_lock(&gt->gt_spin);
args.ar_commit = gt->gt_log_flush_secs;
spin_unlock(&gt->gt_spin);
error = gfs2_mount_args(sdp, &args, data);
if (error)
return error;
Expand Down Expand Up @@ -473,6 +477,10 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
sb->s_flags |= MS_POSIXACL;
else
sb->s_flags &= ~MS_POSIXACL;
spin_lock(&gt->gt_spin);
gt->gt_log_flush_secs = args.ar_commit;
spin_unlock(&gt->gt_spin);

return 0;
}

Expand Down Expand Up @@ -550,6 +558,7 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
{
struct gfs2_sbd *sdp = mnt->mnt_sb->s_fs_info;
struct gfs2_args *args = &sdp->sd_args;
int lfsecs;

if (is_ancestor(mnt->mnt_root, sdp->sd_master_dir))
seq_printf(s, ",meta");
Expand Down Expand Up @@ -610,7 +619,9 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
}
if (args->ar_discard)
seq_printf(s, ",discard");

lfsecs = sdp->sd_tune.gt_log_flush_secs;
if (lfsecs != 60)
seq_printf(s, ",commit=%d", lfsecs);
return 0;
}

Expand Down
92 changes: 34 additions & 58 deletions trunk/fs/gfs2/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,36 @@
#include "util.h"
#include "glops.h"

struct gfs2_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
};

static ssize_t gfs2_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->show ? a->show(sdp, buf) : 0;
}

static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t len)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->store ? a->store(sdp, buf, len) : len;
}

static struct sysfs_ops gfs2_attr_ops = {
.show = gfs2_attr_show,
.store = gfs2_attr_store,
};


static struct kset *gfs2_kset;

static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%u:%u\n",
Expand Down Expand Up @@ -212,11 +242,6 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len
return len;
}

struct gfs2_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
};

#define GFS2_ATTR(name, mode, show, store) \
static struct gfs2_attr gfs2_attr_##name = __ATTR(name, mode, show, store)
Expand Down Expand Up @@ -246,49 +271,21 @@ static struct attribute *gfs2_attrs[] = {
NULL,
};

static ssize_t gfs2_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->show ? a->show(sdp, buf) : 0;
}

static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t len)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->store ? a->store(sdp, buf, len) : len;
}

static struct sysfs_ops gfs2_attr_ops = {
.show = gfs2_attr_show,
.store = gfs2_attr_store,
};

static struct kobj_type gfs2_ktype = {
.default_attrs = gfs2_attrs,
.sysfs_ops = &gfs2_attr_ops,
};

static struct kset *gfs2_kset;

/*
* display struct lm_lockstruct fields
*/

struct lockstruct_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
};

#define LOCKSTRUCT_ATTR(name, fmt) \
static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
{ \
return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_lockstruct.ls_##name); \
} \
static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name)
static struct gfs2_attr lockstruct_attr_##name = __ATTR_RO(name)

LOCKSTRUCT_ATTR(jid, "%u\n");
LOCKSTRUCT_ATTR(first, "%u\n");
Expand Down Expand Up @@ -401,14 +398,8 @@ static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf)
return sprintf(buf, "%d\n", ls->ls_recover_jid_status);
}

struct gdlm_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *sdp, char *);
ssize_t (*store)(struct gfs2_sbd *sdp, const char *, size_t);
};

#define GDLM_ATTR(_name,_mode,_show,_store) \
static struct gdlm_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store)
static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store)

GDLM_ATTR(proto_name, 0444, proto_name_show, NULL);
GDLM_ATTR(block, 0644, block_show, block_store);
Expand All @@ -434,21 +425,12 @@ static struct attribute *lock_module_attrs[] = {
NULL,
};

/*
* display struct gfs2_args fields
*/

struct args_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
};

#define ARGS_ATTR(name, fmt) \
static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
{ \
return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_args.ar_##name); \
} \
static struct args_attr args_attr_##name = __ATTR_RO(name)
static struct gfs2_attr args_attr_##name = __ATTR_RO(name)

ARGS_ATTR(lockproto, "%s\n");
ARGS_ATTR(locktable, "%s\n");
Expand Down Expand Up @@ -531,14 +513,8 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field,
return len;
}

struct tune_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
};

#define TUNE_ATTR_3(name, show, store) \
static struct tune_attr tune_attr_##name = __ATTR(name, 0644, show, store)
static struct gfs2_attr tune_attr_##name = __ATTR(name, 0644, show, store)

#define TUNE_ATTR_2(name, store) \
static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
Expand Down

0 comments on commit 22e65d1

Please sign in to comment.