Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133243
b: refs/heads/master
c: 64d576b
h: refs/heads/master
i:
  133241: f3c82df
  133239: e45c464
v: v3
  • Loading branch information
Steven Whitehouse authored and Steven Whitehouse committed Mar 24, 2009
1 parent e21c1af commit f4e8fc2
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 5 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: 02e3cc70ecbd4352ae4d26459929f43ab1547251
refs/heads/master: 64d576ba23bfd9b770cbb0279200f479272eb859
7 changes: 4 additions & 3 deletions trunk/fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,11 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
gl = search_bucket(hash, sdp, &name);
read_unlock(gl_lock_addr(hash));

if (gl || !create) {
*glp = gl;
*glp = gl;
if (gl)
return 0;
}
if (!create)
return -ENOENT;

gl = kmem_cache_alloc(gfs2_glock_cachep, GFP_KERNEL);
if (!gl)
Expand Down
12 changes: 12 additions & 0 deletions trunk/fs/gfs2/glops.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,15 @@ const struct gfs2_glock_operations gfs2_journal_glops = {
.go_type = LM_TYPE_JOURNAL,
};

const struct gfs2_glock_operations *gfs2_glops_list[] = {
[LM_TYPE_META] = &gfs2_meta_glops,
[LM_TYPE_INODE] = &gfs2_inode_glops,
[LM_TYPE_RGRP] = &gfs2_rgrp_glops,
[LM_TYPE_NONDISK] = &gfs2_trans_glops,
[LM_TYPE_IOPEN] = &gfs2_iopen_glops,
[LM_TYPE_FLOCK] = &gfs2_flock_glops,
[LM_TYPE_NONDISK] = &gfs2_nondisk_glops,
[LM_TYPE_QUOTA] = &gfs2_quota_glops,
[LM_TYPE_JOURNAL] = &gfs2_journal_glops,
};

1 change: 1 addition & 0 deletions trunk/fs/gfs2/glops.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ extern const struct gfs2_glock_operations gfs2_flock_glops;
extern const struct gfs2_glock_operations gfs2_nondisk_glops;
extern const struct gfs2_glock_operations gfs2_quota_glops;
extern const struct gfs2_glock_operations gfs2_journal_glops;
extern const struct gfs2_glock_operations *gfs2_glops_list[];

#endif /* __GLOPS_DOT_H__ */
2 changes: 1 addition & 1 deletion trunk/fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ static void gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
const unsigned int sects_per_blk = sdp->sd_sb.sb_bsize /
bdev_hardsect_size(sb->s_bdev);
u64 blk;
sector_t start;
sector_t start = 0;
sector_t nr_sects = 0;
int rv;
unsigned int x;
Expand Down
43 changes: 43 additions & 0 deletions trunk/fs/gfs2/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "glock.h"
#include "quota.h"
#include "util.h"
#include "glops.h"

static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
{
Expand Down Expand Up @@ -171,6 +172,46 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
return len;
}

static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
{
struct gfs2_glock *gl;
const struct gfs2_glock_operations *glops;
unsigned int glmode;
unsigned int gltype;
unsigned long long glnum;
char mode[16];
int rv;

if (!capable(CAP_SYS_ADMIN))
return -EACCES;

rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum,
mode);
if (rv != 3)
return -EINVAL;

if (strcmp(mode, "EX") == 0)
glmode = LM_ST_UNLOCKED;
else if ((strcmp(mode, "CW") == 0) || (strcmp(mode, "DF") == 0))
glmode = LM_ST_DEFERRED;
else if ((strcmp(mode, "PR") == 0) || (strcmp(mode, "SH") == 0))
glmode = LM_ST_SHARED;
else
return -EINVAL;

if (gltype > LM_TYPE_JOURNAL)
return -EINVAL;
glops = gfs2_glops_list[gltype];
if (glops == NULL)
return -EINVAL;
rv = gfs2_glock_get(sdp, glnum, glops, 0, &gl);
if (rv)
return rv;
gfs2_glock_cb(gl, glmode);
gfs2_glock_put(gl);
return len;
}

struct gfs2_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
Expand All @@ -189,6 +230,7 @@ GFS2_ATTR(statfs_sync, 0200, NULL, statfs_sync_store);
GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store);
GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store);
GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store);
GFS2_ATTR(demote_rq, 0200, NULL, demote_rq_store);

static struct attribute *gfs2_attrs[] = {
&gfs2_attr_id.attr,
Expand All @@ -200,6 +242,7 @@ static struct attribute *gfs2_attrs[] = {
&gfs2_attr_quota_sync.attr,
&gfs2_attr_quota_refresh_user.attr,
&gfs2_attr_quota_refresh_group.attr,
&gfs2_attr_demote_rq.attr,
NULL,
};

Expand Down

0 comments on commit f4e8fc2

Please sign in to comment.