orphan lock fixes for local mode.
cover orphan lock fixes for local mode.
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
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.
--- fs/ocfs2/dlmglue.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
fs/ocfs2/dlmglue.c +4 -2
@@ -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,
Signature · 1 line
1.5.5
PATCH 2/2 ocfs2: Don't call dlm for orphan scan lock if volume is local.
In reply to Tao MaIf the volume is mkfsed and mounted locally, orphan scan lock and unlock don't need to call dlm. Just return directly like other operations.
--- fs/ocfs2/dlmglue.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
fs/ocfs2/dlmglue.c +8 -0
@@ -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 ;
Signature · 1 line
1.5.5
cover orphan lock fixes for local mode.
In reply to Tao MaQuoted 6 lines · Tao Ma
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
Signature · 9 lines
"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-8127cover orphan lock fixes for local mode.
Quoted 9 lines · Joel Becker
Quoted 7 lines · Tao Ma
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.
Quoted 3 lines
I would think we don't even need the orphan scan in local mode.
Joel
Tao, Good catch.
Yes, we don't need the orphan scan in local mount. The earlier patch that scans all the orphans slots mount should be sufficient.
Not calling ocfs2_orphan_scan_init() in ocfs2_initialize_super() should be sufficient. But we should add Tao's patch 2 too for completeness.
Sunil
cover orphan lock fixes for local mode.
Quoted 14 lines · Sunil Mushran
Quoted 9 lines · Joel Becker
Quoted 7 lines · Tao Ma
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.Quoted 3 lines
I would think we don't even need the orphan scan in local mode.
Joel
Quoted 7 lines
Tao, Good catch.
Yes, we don't need the orphan scan in local mount. The earlier patch that scans all the orphans slots mount should be sufficient.
Not calling
ocfs2_orphan_scan_init()inocfs2_initialize_super()should be sufficient. But we should add Tao's patch 2 too for completeness.
Do we need the hard_readonly check like other lock types?
Joel
Signature · 10 lines
"Baby, even the losers Get luck sometimes. Even the losers Keep a little bit of pride." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
cover orphan lock fixes for local mode.
Quoted 1 line · Joel Becker
Do we need the
hard_readonlycheck like other lock types?
That too. So local and hard ro. I would prefer it in lock and unlock also because we end up using existing code as template code.