Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35497
b: refs/heads/master
c: 54a7e75
h: refs/heads/master
i:
  35495: 8cd51ba
v: v3
  • Loading branch information
Mark Fasheh committed Sep 24, 2006
1 parent 9248af4 commit 79a1fea
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2a45f2d13e1dd91bc110801f5818379f2699509c
refs/heads/master: 54a7e7552e484c08db221e49c4519ccdeb8882d0
33 changes: 33 additions & 0 deletions trunk/fs/ocfs2/dlmglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ static void ocfs2_super_bast_func(void *opaque,
int level);
static void ocfs2_rename_bast_func(void *opaque,
int level);
static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres);
static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres);

/*
* Return value from ocfs2_convert_worker_t functions.
Expand Down Expand Up @@ -116,6 +118,11 @@ static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
* These fine tune the behavior of the generic dlmglue locking infrastructure.
*/
struct ocfs2_lock_res_ops {
/*
* Translate an ocfs2_lock_res * into an ocfs2_super *. Define
* this callback if ->l_priv is not an ocfs2_super pointer
*/
struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *);
void (*bast)(void *, int);
int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *);
void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *);
Expand Down Expand Up @@ -144,18 +151,21 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
ocfs2_convert_worker_t *worker);

static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
.get_osb = ocfs2_get_inode_osb,
.bast = ocfs2_inode_bast_func,
.unblock = ocfs2_unblock_inode_lock,
.flags = 0,
};

static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
.get_osb = ocfs2_get_inode_osb,
.bast = ocfs2_inode_bast_func,
.unblock = ocfs2_unblock_meta,
.flags = LOCK_TYPE_REQUIRES_REFRESH,
};

static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
.get_osb = ocfs2_get_inode_osb,
.bast = ocfs2_inode_bast_func,
.unblock = ocfs2_unblock_data,
.flags = 0,
Expand All @@ -174,6 +184,7 @@ static struct ocfs2_lock_res_ops ocfs2_rename_lops = {
};

static struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
.get_osb = ocfs2_get_dentry_osb,
.bast = ocfs2_dentry_bast_func,
.unblock = ocfs2_unblock_dentry_lock,
.post_unlock = ocfs2_dentry_post_unlock,
Expand Down Expand Up @@ -219,6 +230,14 @@ static inline struct ocfs2_dentry_lock *ocfs2_lock_res_dl(struct ocfs2_lock_res
return (struct ocfs2_dentry_lock *)lockres->l_priv;
}

static inline struct ocfs2_super *ocfs2_get_lockres_osb(struct ocfs2_lock_res *lockres)
{
if (lockres->l_ops->get_osb)
return lockres->l_ops->get_osb(lockres);

return (struct ocfs2_super *)lockres->l_priv;
}

static int ocfs2_lock_create(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level,
Expand Down Expand Up @@ -352,6 +371,13 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), res, type, ops, inode);
}

static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres)
{
struct inode *inode = ocfs2_lock_res_inode(lockres);

return OCFS2_SB(inode->i_sb);
}

static __u64 ocfs2_get_dentry_lock_ino(struct ocfs2_lock_res *lockres)
{
__be64 inode_blkno_be;
Expand All @@ -362,6 +388,13 @@ static __u64 ocfs2_get_dentry_lock_ino(struct ocfs2_lock_res *lockres)
return be64_to_cpu(inode_blkno_be);
}

static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres)
{
struct ocfs2_dentry_lock *dl = lockres->l_priv;

return OCFS2_SB(dl->dl_inode->i_sb);
}

void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
u64 parent, struct inode *inode)
{
Expand Down

0 comments on commit 79a1fea

Please sign in to comment.