Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35505
b: refs/heads/master
c: cc567d8
h: refs/heads/master
i:
  35503: 50762bc
v: v3
  • Loading branch information
Mark Fasheh committed Sep 24, 2006
1 parent 858939e commit a94cf1c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 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: 08280f11de91beac2f5234ce5fc2ed246dfe6a86
refs/heads/master: cc567d89b3af4294580c9c97610d2c1018032e33
50 changes: 32 additions & 18 deletions trunk/fs/ocfs2/dlmglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ 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.
* Return value from ->downconvert_worker functions.
*
* These control the precise actions of ocfs2_generic_unblock_lock()
* and ocfs2_process_blocked_lock()
Expand All @@ -98,16 +98,23 @@ static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres);

static int ocfs2_unblock_data(struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl);
static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
int blocking);

static int ocfs2_unblock_inode_lock(struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl);

static int ocfs2_unblock_dentry_lock(struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl);
static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl);
static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
int blocking);

static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);

static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl);

/*
* OCFS2 Lock Resource Operations
*
Expand Down Expand Up @@ -145,6 +152,17 @@ struct ocfs2_lock_res_ops {
*/
void (*set_lvb)(struct ocfs2_lock_res *);

/*
* Called from the downconvert thread when it is determined
* that a lock will be downconverted. This is called without
* any locks held so the function can do work that might
* schedule (syncing out data, etc).
*
* This should return any one of the ocfs2_unblock_action
* values, depending on what it wants the thread to do.
*/
int (*downconvert_worker)(struct ocfs2_lock_res *, int);

/*
* LOCK_TYPE_* flags which describe the specific requirements
* of a lock type. Descriptions of each individual flag follow.
Expand All @@ -168,11 +186,9 @@ struct ocfs2_lock_res_ops {
*/
#define LOCK_TYPE_USES_LVB 0x2

typedef int (ocfs2_convert_worker_t)(struct ocfs2_lock_res *, int);
static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl,
ocfs2_convert_worker_t *worker);
struct ocfs2_unblock_ctl *ctl);

static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
.get_osb = ocfs2_get_inode_osb,
Expand All @@ -191,6 +207,7 @@ static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
.get_osb = ocfs2_get_inode_osb,
.unblock = ocfs2_unblock_data,
.downconvert_worker = ocfs2_data_convert_worker,
.flags = 0,
};

Expand All @@ -208,6 +225,7 @@ static struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
.get_osb = ocfs2_get_dentry_osb,
.unblock = ocfs2_unblock_dentry_lock,
.post_unlock = ocfs2_dentry_post_unlock,
.downconvert_worker = ocfs2_dentry_convert_worker,
.flags = 0,
};

Expand Down Expand Up @@ -2537,8 +2555,7 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb,

static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl,
ocfs2_convert_worker_t *worker)
struct ocfs2_unblock_ctl *ctl)
{
unsigned long flags;
int blocking;
Expand Down Expand Up @@ -2594,7 +2611,7 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
/* If we get here, then we know that there are no more
* incompatible holders (and anyone asking for an incompatible
* lock is blocked). We can now downconvert the lock */
if (!worker)
if (!lockres->l_ops->downconvert_worker)
goto downconvert;

/* Some lockres types want to do a bit of work before
Expand All @@ -2604,7 +2621,7 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
blocking = lockres->l_blocking;
spin_unlock_irqrestore(&lockres->l_lock, flags);

ctl->unblock_action = worker(lockres, blocking);
ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking);

if (ctl->unblock_action == UNBLOCK_STOP_POST)
goto leave;
Expand Down Expand Up @@ -2692,8 +2709,7 @@ int ocfs2_unblock_data(struct ocfs2_lock_res *lockres,
mlog(0, "unblock inode %llu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno);

status = ocfs2_generic_unblock_lock(osb, lockres, ctl,
ocfs2_data_convert_worker);
status = ocfs2_generic_unblock_lock(osb, lockres, ctl);
if (status < 0)
mlog_errno(status);

Expand All @@ -2717,7 +2733,7 @@ static int ocfs2_unblock_inode_lock(struct ocfs2_lock_res *lockres,
inode = ocfs2_lock_res_inode(lockres);

status = ocfs2_generic_unblock_lock(OCFS2_SB(inode->i_sb),
lockres, ctl, NULL);
lockres, ctl);
if (status < 0)
mlog_errno(status);

Expand Down Expand Up @@ -2762,7 +2778,7 @@ static int ocfs2_unblock_meta(struct ocfs2_lock_res *lockres,
(unsigned long long)OCFS2_I(inode)->ip_blkno);

status = ocfs2_generic_unblock_lock(OCFS2_SB(inode->i_sb),
lockres, ctl, NULL);
lockres, ctl);
if (status < 0)
mlog_errno(status);

Expand Down Expand Up @@ -2907,8 +2923,7 @@ static int ocfs2_unblock_dentry_lock(struct ocfs2_lock_res *lockres,

ret = ocfs2_generic_unblock_lock(osb,
lockres,
ctl,
ocfs2_dentry_convert_worker);
ctl);
if (ret < 0)
mlog_errno(ret);

Expand All @@ -2933,8 +2948,7 @@ static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres,

status = ocfs2_generic_unblock_lock(osb,
lockres,
ctl,
NULL);
ctl);
if (status < 0)
mlog_errno(status);

Expand Down

0 comments on commit a94cf1c

Please sign in to comment.