All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	jcl <jacques-charles.lafoucriere@cea.fr>,
	Peng Tao <tao.peng@emc.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: [PATCH 46/48] staging/lustre/mdt: HSM on disk actions record
Date: Tue, 23 Jul 2013 00:07:07 +0800	[thread overview]
Message-ID: <1374509230-3324-47-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1374509230-3324-1-git-send-email-bergwolf@gmail.com>

From: jcl <jacques-charles.lafoucriere@cea.fr>

HSM coordinator memorizes all actions in a llog
This patch implements the methods needed to create
update display these records.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3339
Lustre-change: http://review.whamcloud.com/6529
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/include/lprocfs_status.h |    3 --
 .../lustre/lustre/include/lustre/lustre_idl.h      |   47 ++++++++++++++++
 .../staging/lustre/lustre/include/lustre_disk.h    |   56 ++++++++++----------
 drivers/staging/lustre/lustre/include/obd.h        |    7 +--
 drivers/staging/lustre/lustre/obdclass/llog_swab.c |   17 ++++++
 5 files changed, 97 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 20633d4..d7f1be9 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -804,9 +804,6 @@ extern int lprocfs_quota_rd_qs_factor(char *page, char **start, loff_t off,
 extern int lprocfs_quota_wr_qs_factor(struct file *file,
 				      const char *buffer,
 				      unsigned long count, void *data);
-
-
-
 #else
 /* LPROCFS is not defined */
 
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 3aaa869..984235c 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -2986,6 +2986,7 @@ typedef enum {
 	/* LLOG_JOIN_REC	= LLOG_OP_MAGIC | 0x50000, obsolete  1.8.0 */
 	CHANGELOG_REC		= LLOG_OP_MAGIC | 0x60000,
 	CHANGELOG_USER_REC	= LLOG_OP_MAGIC | 0x70000,
+	HSM_AGENT_REC		= LLOG_OP_MAGIC | 0x80000,
 	LLOG_HDR_MAGIC		= LLOG_OP_MAGIC | 0x45539,
 	LLOG_LOGID_MAGIC	= LLOG_OP_MAGIC | 0x4553b,
 } llog_op_type;
@@ -3105,6 +3106,52 @@ struct llog_changelog_user_rec {
 	struct llog_rec_tail  cur_tail;
 } __attribute__((packed));
 
+enum agent_req_status {
+	ARS_WAITING,
+	ARS_STARTED,
+	ARS_FAILED,
+	ARS_CANCELED,
+	ARS_SUCCEED,
+};
+
+static inline char *agent_req_status2name(enum agent_req_status ars)
+{
+	switch (ars) {
+	case ARS_WAITING:
+		return "WAITING";
+	case ARS_STARTED:
+		return "STARTED";
+	case ARS_FAILED:
+		return "FAILED";
+	case ARS_CANCELED:
+		return "CANCELED";
+	case ARS_SUCCEED:
+		return "SUCCEED";
+	default:
+		return "UNKNOWN";
+	}
+}
+
+static inline bool agent_req_in_final_state(enum agent_req_status ars)
+{
+	return ((ars == ARS_SUCCEED) || (ars == ARS_FAILED) ||
+		(ars == ARS_CANCELED));
+}
+
+struct llog_agent_req_rec {
+	struct llog_rec_hdr	arr_hdr;	/**< record header */
+	__u32			arr_status;	/**< status of the request */
+						/* must match enum
+						 * agent_req_status */
+	__u32			arr_archive_id;	/**< backend archive number */
+	__u64			arr_flags;	/**< req flags */
+	__u64			arr_compound_id;	/**< compound cookie */
+	__u64			arr_req_create;	/**< req. creation time */
+	__u64			arr_req_change;	/**< req. status change time */
+	struct hsm_action_item	arr_hai;	/**< req. to the agent */
+	struct llog_rec_tail	arr_tail; /**< record tail for_sizezof_only */
+} __attribute__((packed));
+
 /* Old llog gen for compatibility */
 struct llog_gen {
 	__u64 mnt_cnt;
diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
index 8db6086..9228b16 100644
--- a/drivers/staging/lustre/lustre/include/lustre_disk.h
+++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
@@ -53,20 +53,21 @@
 
 /****************** on-disk files *********************/
 
-#define MDT_LOGS_DIR      "LOGS"  /* COMPAT_146 */
-#define MOUNT_CONFIGS_DIR "CONFIGS"
-#define CONFIGS_FILE      "mountdata"
+#define MDT_LOGS_DIR		"LOGS"  /* COMPAT_146 */
+#define MOUNT_CONFIGS_DIR	"CONFIGS"
+#define CONFIGS_FILE		"mountdata"
 /** Persistent mount data are stored on the disk in this file. */
-#define MOUNT_DATA_FILE    MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
-#define LAST_RCVD	 "last_rcvd"
-#define LOV_OBJID	 "lov_objid"
+#define MOUNT_DATA_FILE		MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
+#define LAST_RCVD		"last_rcvd"
+#define LOV_OBJID		"lov_objid"
 #define LOV_OBJSEQ		"lov_objseq"
-#define HEALTH_CHECK      "health_check"
-#define CAPA_KEYS	 "capa_keys"
-#define CHANGELOG_USERS   "changelog_users"
-#define MGS_NIDTBL_DIR    "NIDTBL_VERSIONS"
-#define QMT_DIR	   "quota_master"
-#define QSD_DIR	   "quota_slave"
+#define HEALTH_CHECK		"health_check"
+#define CAPA_KEYS		"capa_keys"
+#define CHANGELOG_USERS		"changelog_users"
+#define MGS_NIDTBL_DIR		"NIDTBL_VERSIONS"
+#define QMT_DIR			"quota_master"
+#define QSD_DIR			"quota_slave"
+#define HSM_ACTIONS		"hsm_actions"
 
 /****************** persistent mount data *********************/
 
@@ -226,21 +227,22 @@ struct lustre_mount_data {
 	char	*lmd_osd_type;      /* OSD type */
 };
 
-#define LMD_FLG_SERVER       0x0001  /* Mounting a server */
-#define LMD_FLG_CLIENT       0x0002  /* Mounting a client */
-#define LMD_FLG_ABORT_RECOV  0x0008  /* Abort recovery */
-#define LMD_FLG_NOSVC	0x0010  /* Only start MGS/MGC for servers,
-					no other services */
-#define LMD_FLG_NOMGS	0x0020  /* Only start target for servers, reusing
-					existing MGS services */
-#define LMD_FLG_WRITECONF    0x0040  /* Rewrite config log */
-#define LMD_FLG_NOIR	 0x0080  /* NO imperative recovery */
-#define LMD_FLG_NOSCRUB	     0x0100  /* Do not trigger scrub automatically */
-#define LMD_FLG_MGS	     0x0200  /* Also start MGS along with server */
-#define LMD_FLG_IAM	     0x0400  /* IAM dir */
-#define LMD_FLG_NO_PRIMNODE  0x0800  /* all nodes are service nodes */
-#define LMD_FLG_VIRGIN	     0x1000  /* the service registers first time */
-#define LMD_FLG_UPDATE	     0x2000  /* update parameters */
+#define LMD_FLG_SERVER		0x0001	/* Mounting a server */
+#define LMD_FLG_CLIENT		0x0002	/* Mounting a client */
+#define LMD_FLG_ABORT_RECOV	0x0008	/* Abort recovery */
+#define LMD_FLG_NOSVC		0x0010	/* Only start MGS/MGC for servers,
+					   no other services */
+#define LMD_FLG_NOMGS		0x0020	/* Only start target for servers, reusing
+					   existing MGS services */
+#define LMD_FLG_WRITECONF	0x0040	/* Rewrite config log */
+#define LMD_FLG_NOIR		0x0080	/* NO imperative recovery */
+#define LMD_FLG_NOSCRUB		0x0100	/* Do not trigger scrub automatically */
+#define LMD_FLG_MGS		0x0200	/* Also start MGS along with server */
+#define LMD_FLG_IAM		0x0400	/* IAM dir */
+#define LMD_FLG_NO_PRIMNODE	0x0800	/* all nodes are service nodes */
+#define LMD_FLG_VIRGIN		0x1000	/* the service registers first time */
+#define LMD_FLG_UPDATE		0x2000	/* update parameters */
+#define LMD_FLG_HSM		0x4000	/* Start coordinator */
 
 #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
 
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index be3a08f..094eb96 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -267,9 +267,10 @@ enum llog_ctxt_id {
 	LLOG_TEST_REPL_CTXT,
 	LLOG_LOVEA_ORIG_CTXT,
 	LLOG_LOVEA_REPL_CTXT,
-	LLOG_CHANGELOG_ORIG_CTXT,      /**< changelog generation on mdd */
-	LLOG_CHANGELOG_REPL_CTXT,      /**< changelog access on clients */
-	LLOG_CHANGELOG_USER_ORIG_CTXT, /**< for multiple changelog consumers */
+	LLOG_CHANGELOG_ORIG_CTXT,	/**< changelog generation on mdd */
+	LLOG_CHANGELOG_REPL_CTXT,	/**< changelog access on clients */
+	LLOG_CHANGELOG_USER_ORIG_CTXT,	/**< for multiple changelog consumers */
+	LLOG_AGENT_ORIG_CTXT,		/**< agent requests generation on cdt */
 	LLOG_MAX_CTXTS
 };
 
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c
index dedfecf..a75b04e 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c
@@ -203,6 +203,23 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
 		break;
 	}
 
+	case HSM_AGENT_REC: {
+		struct llog_agent_req_rec *arr =
+			(struct llog_agent_req_rec *)rec;
+
+		__swab32s(&arr->arr_hai.hai_len);
+		__swab32s(&arr->arr_hai.hai_action);
+		lustre_swab_lu_fid(&arr->arr_hai.hai_fid);
+		lustre_swab_lu_fid(&arr->arr_hai.hai_dfid);
+		__swab64s(&arr->arr_hai.hai_cookie);
+		__swab64s(&arr->arr_hai.hai_extent.offset);
+		__swab64s(&arr->arr_hai.hai_extent.length);
+		__swab64s(&arr->arr_hai.hai_gid);
+		/* no swabing for opaque data */
+		/* hai_data[0]; */
+		break;
+	}
+
 	case MDS_SETATTR64_REC:
 	{
 		struct llog_setattr64_rec *lsr =
-- 
1.7.9.5


  parent reply	other threads:[~2013-07-22 16:14 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 16:06 [PATCH 00/48] staging/lustre: minor cleanup and Intel Lustre sync Peng Tao
2013-07-22 16:06 ` [PATCH 01/48] staging/lustre: remove bogus ifndef EXPORT_SYMBOL Peng Tao
2013-07-22 16:06 ` [PATCH 02/48] staging/lustre/obdclass: restore lu_ref Peng Tao
2013-07-23 19:37   ` Greg Kroah-Hartman
2013-07-23 20:31     ` Dilger, Andreas
2013-07-23 20:52       ` Greg Kroah-Hartman
2013-07-24  6:06         ` Peng Tao
2013-07-22 16:06 ` [PATCH 03/48] staging/lustre/llite: use READ, WRITE around ll_rw_stats_tally() Peng Tao
2013-07-22 16:06 ` [PATCH 04/48] staging/lustre/llite: missing last bit in ll_have_md_lock Peng Tao
2013-07-22 16:06 ` [PATCH 05/48] staging/lustre: fix 'program hangs' errors Peng Tao
2013-07-22 16:06 ` [PATCH 06/48] staging/lustre/llite: check alloc in ll_file_data_get, ll_dir_ioctl Peng Tao
2013-07-22 16:06 ` [PATCH 07/48] staging/lustre/llite: A not locked mutex can be unlocked Peng Tao
2013-07-22 16:06 ` [PATCH 08/48] staging/lustre/llite: check ll_prep_md_op_data() using IS_ERR() Peng Tao
2013-07-22 16:06 ` [PATCH 09/48] staging/lustre/ldlm: print FID in lvbo_init(), lvbo_update Peng Tao
2013-07-22 16:06 ` [PATCH 10/48] staging/lustre/ptlrpc: race in pinger (use-after-free situation) Peng Tao
2013-07-22 16:06 ` [PATCH 11/48] staging/lustre/ptlrpc: Translate between host and network errnos Peng Tao
2013-07-22 16:29   ` Paul Bolle
2013-07-22 16:36     ` Peng Tao
2013-07-22 16:06 ` [PATCH 12/48] staging/lustre/mdc: layout lock rpc must not take rpc_lock Peng Tao
2013-07-22 16:06 ` [PATCH 13/48] staging/lustre/ldlm: split client namespaces into active and inactive Peng Tao
2013-07-22 16:06 ` [PATCH 14/48] staging/lustre: Only wake up ldlm_poold as frequently as the check interval Peng Tao
2013-07-22 16:06 ` [PATCH 15/48] staging/lustre: Make quota namespace refcounting consistent Peng Tao
2013-07-22 16:06 ` [PATCH 16/48] staging/lustre/dlmlock: compress out unused space Peng Tao
2013-07-22 16:06 ` [PATCH 17/48] staging/lustre/md: fix lu_ucred.c boilerplate Peng Tao
2013-07-22 16:06 ` [PATCH 18/48] staging/lustre/layout: introduce new layout for released files Peng Tao
2013-07-22 16:06 ` [PATCH 19/48] staging/lustre/mdt: add macros for fid string len Peng Tao
2013-07-22 16:06 ` [PATCH 20/48] staging/lustre/llapi: add user space method for lov_user_md Peng Tao
2013-07-22 16:06 ` [PATCH 21/48] staging/lustre/obdclass: use a dummy structure for lu_ref_link Peng Tao
2013-07-23 20:35   ` Greg Kroah-Hartman
2013-07-24  6:10     ` Peng Tao
2013-07-22 16:06 ` [PATCH 22/48] staging/lustre: fix 'code maintainability' errors Peng Tao
2013-07-22 16:06 ` [PATCH 23/48] staging/lustre/fid: prepare FID module for client server split Peng Tao
2013-07-22 16:06 ` [PATCH 24/48] staging/lustre/llite: force lvb_data update after layout change Peng Tao
2013-07-22 16:06 ` [PATCH 25/48] staging/lustre/lfsck: LFSCK 1.5 technical debts (3) Peng Tao
2013-07-22 16:06 ` [PATCH 26/48] staging/lustre/osc: Check return code for lu_kmem_init Peng Tao
2013-07-22 16:06 ` [PATCH 27/48] staging/lustre/ptlrpc: Race between start and stop service threads Peng Tao
2013-07-22 16:06 ` [PATCH 28/48] staging/lustre/crypto: add crc32c module loading to libcfs Peng Tao
2013-07-22 16:06 ` [PATCH 29/48] staging/lustre/mdt: duplicate link names in directory Peng Tao
2013-07-22 16:06 ` [PATCH 30/48] staging/lustre/llite: call simple_setattr() from ll_md_setattr() Peng Tao
2013-07-22 16:06 ` [PATCH 31/48] staging/lustre/ldlm: Fix flock deadlock detection race Peng Tao
2013-07-22 16:06 ` [PATCH 32/48] staging/lustre/lnet: remove empty file lnet/lnet/api-errno.c Peng Tao
2013-07-22 16:06 ` [PATCH 33/48] staging/lustre/fld: prepare FLD module for client server split Peng Tao
2013-07-22 16:06 ` [PATCH 34/48] staging/lustre/lmv: support DNE with HSM Peng Tao
2013-07-22 16:06 ` [PATCH 35/48] " Peng Tao
2013-07-23 20:39   ` Greg Kroah-Hartman
2013-07-22 16:06 ` [PATCH 36/48] staging/lustre/obdclass: add obd_target.h Peng Tao
2013-07-23 20:41   ` Greg Kroah-Hartman
2013-07-22 16:06 ` [PATCH 37/48] staging/lustre/procfs: return -ENOMEM from lprocfs_register() Peng Tao
2013-07-22 16:06 ` [PATCH 38/48] staging/lustre/lmv: fix duplicate directory entries Peng Tao
2013-07-22 16:07 ` [PATCH 39/48] staging/lustre/obdclass: be more careful processing server name Peng Tao
2013-07-22 16:07 ` [PATCH 40/48] staging/lustre/llite: return valid fsid for statfs Peng Tao
2013-07-22 16:07 ` [PATCH 41/48] staging/lustre/llite: error of listxattr when buffer is small Peng Tao
2013-07-22 16:07 ` [PATCH 42/48] staging/lustre/llite: Anonymous dentry incorrectly identified as root Peng Tao
2013-07-22 16:07 ` [PATCH 43/48] staging/lustre/build: fix 'data race condition' issues Peng Tao
2013-07-22 16:07 ` [PATCH 44/48] " Peng Tao
2013-07-23 20:44   ` Greg Kroah-Hartman
2013-07-22 16:07 ` [PATCH 45/48] staging/lustre/style: removes obsolete EXPORT_SYMTAB macros v2 Peng Tao
2013-07-22 16:07 ` Peng Tao [this message]
2013-07-22 16:07 ` [PATCH 47/48] staging/lustre/scrub: purge inconsistenct objects after OI scrub Peng Tao
2013-07-22 16:07 ` [PATCH 48/48] staging/lustre/mdc: Keep resend FLocks Peng Tao
2013-07-23 20:51 ` [PATCH 00/48] staging/lustre: minor cleanup and Intel Lustre sync Greg Kroah-Hartman
2013-07-24  6:05   ` Peng Tao

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=1374509230-3324-47-git-send-email-bergwolf@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacques-charles.lafoucriere@cea.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tao.peng@emc.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.