Hi Joel/Srini, Here are 2 patches for orphan lock in local mode. patch 1: In local mode, we don't need lvb, so don't init it. patch 2: In local mode, orphan lock and unlock don't need to go to dlm part. Regards, Tao
Tao Ma
2009-Jun-18 07:53 UTC
[Ocfs2-devel] [PATCH 1/2] ocfs2: Don't init lvb of orphan lock in local mode.
If the volume is mkfsed and used locally, we only need to intialize orphan_scan_lock, but no lvb is needed. Signed-off-by: Tao Ma <tao.ma at oracle.com> --- fs/ocfs2/dlmglue.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index b4b5ea3..5760f58 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -667,8 +667,10 @@ static void ocfs2_orphan_scan_lock_res_init(struct ocfs2_lock_res *res, ocfs2_build_lock_name(OCFS2_LOCK_TYPE_ORPHAN_SCAN, 0, 0, res->l_name); ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_ORPHAN_SCAN, &ocfs2_orphan_scan_lops, osb); - lvb = ocfs2_dlm_lvb(&res->l_lksb); - lvb->lvb_version = OCFS2_ORPHAN_LVB_VERSION; + if (!ocfs2_mount_local(osb)) { + lvb = ocfs2_dlm_lvb(&res->l_lksb); + lvb->lvb_version = OCFS2_ORPHAN_LVB_VERSION; + } } void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres, -- 1.5.5
Tao Ma
2009-Jun-18 07:53 UTC
[Ocfs2-devel] [PATCH 2/2] ocfs2: Don't call dlm for orphan scan lock if volume is local.
If the volume is mkfsed and mounted locally, orphan scan lock and unlock don't need to call dlm. Just return directly like other operations. Signed-off-by: Tao Ma <tao.ma at oracle.com> --- fs/ocfs2/dlmglue.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 5760f58..8210091 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -2427,6 +2427,9 @@ int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno, int ex) int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; int status = 0; + if (ocfs2_mount_local(osb)) + goto bail; + lockres = &osb->osb_orphan_scan.os_lockres; status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); if (status < 0) @@ -2435,6 +2438,8 @@ int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno, int ex) lvb = ocfs2_dlm_lvb(&lockres->l_lksb); if (lvb->lvb_version == OCFS2_ORPHAN_LVB_VERSION) *seqno = be32_to_cpu(lvb->lvb_os_seqno); + +bail: return status; } @@ -2444,6 +2449,9 @@ void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno, int ex) struct ocfs2_orphan_scan_lvb *lvb; int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; + if (ocfs2_mount_local(osb)) + return; + lockres = &osb->osb_orphan_scan.os_lockres; lvb = ocfs2_dlm_lvb(&lockres->l_lksb); lvb->lvb_version = OCFS2_ORPHAN_LVB_VERSION; -- 1.5.5
Joel Becker
2009-Jun-18 15:06 UTC
[Ocfs2-devel] [PATCH 0/2] orphan lock fixes for local mode.
On Thu, Jun 18, 2009 at 03:48:08PM +0800, Tao Ma wrote:> Hi Joel/Srini, > Here are 2 patches for orphan lock in local mode. > patch 1: > In local mode, we don't need lvb, so don't init it. > patch 2: > In local mode, orphan lock and unlock don't need to go to dlm part.I would think we don't even need the orphan scan in local mode. Joel -- "Every day I get up and look through the Forbes list of the richest people in America. If I'm not there, I go to work." - Robert Orben Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127