From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/3] ocfs2:freeze-thaw: add freeze cluster lock
Date: Thu, 14 Jan 2010 17:47:52 -0800 [thread overview]
Message-ID: <4B4FC948.7020800@oracle.com> (raw)
In-Reply-To: <201001091802.o09I2Z1v013097@rcsinet13.oracle.com>
Wengang Wang wrote:
> add cluster lock for freeze/thaw.
> change dlm version from 1.0 to 1.1
>
> Authored-by: Tiger Yang <tiger.yang@oracle.com>
> Authored-by: Wengang Wang <wen.gang.wang@oracle.com>
> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
>
Removed Authored by tags. Just note that these patches
were originally authored by Tiger.
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 0334000..6e8bcb6 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -128,10 +128,14 @@ static DECLARE_WAIT_QUEUE_HEAD(dlm_domain_events);
> * will have a negotiated version with the same major number and a minor
> * number equal or smaller. The dlm_ctxt->dlm_locking_proto field should
> * be used to determine what a running domain is actually using.
> + *
> + * dlm protocal history:
> + * 1.0: base
> + * 1.1: freeze lock support added
> */
> static const struct dlm_protocol_version dlm_protocol = {
> .pv_major = 1,
> - .pv_minor = 0,
> + .pv_minor = 1,
> };
>
Sorry. I told you to change the dlm protocol. But it should
be the fs protocol as we are adding a new lock type. We would
change the dlm protocol if were were adding a new dlm message
type, etc.
Same change. Up the minor by one.
>
> #define DLM_DOMAIN_BACKOFF_MS 200
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index c5e4a49..0caa69e 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -2894,6 +2894,34 @@ static const struct file_operations ocfs2_dlm_debug_fops = {
> .llseek = seq_lseek,
> };
>
> +int ocfs2_freeze_lock(struct ocfs2_super *osb, int ex)
> +{
> + int ret;
> + int level = ex ? LKM_EXMODE : LKM_PRMODE;
> + struct ocfs2_lock_res *lockres = &osb->osb_freeze_lockres;
> +
> + if (ocfs2_is_hard_readonly(osb))
> + return -EROFS;
> +
> + if (ocfs2_mount_local(osb))
> + return 0;
> +
> + ret = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
> + if (ret < 0)
> + mlog_errno(ret);
> +
> + return ret;
> +}
> +
> +void ocfs2_freeze_unlock(struct ocfs2_super *osb, int ex)
> +{
> + int level = ex ? LKM_EXMODE : LKM_PRMODE;
> + struct ocfs2_lock_res *lockres = &osb->osb_freeze_lockres;
> +
> + if (!ocfs2_mount_local(osb))
> + ocfs2_cluster_unlock(osb, lockres, level);
> +}
> +
> static int ocfs2_dlm_init_debug(struct ocfs2_super *osb)
> {
> int ret = 0;
> diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h
> index d1ce48e..8687b81 100644
> --- a/fs/ocfs2/dlmglue.h
> +++ b/fs/ocfs2/dlmglue.h
> @@ -155,6 +155,8 @@ struct ocfs2_refcount_tree;
> int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex);
> void ocfs2_refcount_unlock(struct ocfs2_refcount_tree *ref_tree, int ex);
>
> +int ocfs2_freeze_lock(struct ocfs2_super *osb, int ex);
> +void ocfs2_freeze_unlock(struct ocfs2_super *osb, int ex);
>
> void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres);
> void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index d963d86..bf66978 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -355,6 +355,7 @@ struct ocfs2_super
> struct ocfs2_lock_res osb_super_lockres;
> struct ocfs2_lock_res osb_rename_lockres;
> struct ocfs2_lock_res osb_nfs_sync_lockres;
> + struct ocfs2_lock_res osb_freeze_lockres;
> struct ocfs2_dlm_debug *osb_dlm_debug;
>
> struct dentry *osb_debug_root;
> diff --git a/fs/ocfs2/ocfs2_lockid.h b/fs/ocfs2/ocfs2_lockid.h
> index d277aab..3c29924 100644
> --- a/fs/ocfs2/ocfs2_lockid.h
> +++ b/fs/ocfs2/ocfs2_lockid.h
> @@ -50,6 +50,7 @@ enum ocfs2_lock_type {
> OCFS2_LOCK_TYPE_NFS_SYNC,
> OCFS2_LOCK_TYPE_ORPHAN_SCAN,
> OCFS2_LOCK_TYPE_REFCOUNT,
> + OCFS2_LOCK_TYPE_FREEZE,
> OCFS2_NUM_LOCK_TYPES
> };
>
OCFS2_LOCK_TYPE_FREEZEFS sounds better.
> @@ -93,6 +94,9 @@ static inline char ocfs2_lock_type_char(enum ocfs2_lock_type type)
> case OCFS2_LOCK_TYPE_REFCOUNT:
> c = 'T';
> break;
> + case OCFS2_LOCK_TYPE_FREEZE:
> + c = 'Z';
> + break;
> default:
> c = '\0';
> }
> @@ -115,6 +119,7 @@ static char *ocfs2_lock_type_strings[] = {
> [OCFS2_LOCK_TYPE_NFS_SYNC] = "NFSSync",
> [OCFS2_LOCK_TYPE_ORPHAN_SCAN] = "OrphanScan",
> [OCFS2_LOCK_TYPE_REFCOUNT] = "Refcount",
> + [OCFS2_LOCK_TYPE_FREEZE] = "Freeze",
> };
>
> static inline const char *ocfs2_lock_type_string(enum ocfs2_lock_type type)
>
next prev parent reply other threads:[~2010-01-15 1:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-09 18:00 [Ocfs2-devel] [PATCH 1/3] ocfs2:freeze-thaw: add freeze cluster lock Wengang Wang
2010-01-15 1:47 ` Sunil Mushran [this message]
2010-01-15 2:28 ` Wengang Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4FC948.7020800@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.