From: James Simmons <jsimmons@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Andreas Dilger <andreas.dilger@intel.com>,
Oleg Drokin <oleg.drokin@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lustre Development List <lustre-devel@lists.lustre.org>,
wang di <di.wang@intel.com>,
James Simmons <jsimmons@infradead.org>
Subject: [PATCH 05/58] staging: lustre: lmv: add new lmv structures
Date: Thu, 21 Jul 2016 22:43:58 -0400 [thread overview]
Message-ID: <1469155491-15265-6-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1469155491-15265-1-git-send-email-jsimmons@infradead.org>
From: wang di <di.wang@intel.com>
Newer lustre version on metadata servers support different
version of lmv magic. This add the new data structures
to handle these new lmv magic versions.
Signed-off-by: wang di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/7043
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3531
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
.../lustre/lustre/include/lustre/lustre_idl.h | 81 +++++++++++++++++---
drivers/staging/lustre/lustre/include/lustre_lmv.h | 66 ++++++++++++++++
drivers/staging/lustre/lustre/lmv/lmv_internal.h | 1 +
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 1 +
drivers/staging/lustre/lustre/mdc/mdc_request.c | 1 +
5 files changed, 140 insertions(+), 10 deletions(-)
create mode 100644 drivers/staging/lustre/lustre/include/lustre_lmv.h
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 051864c..32471a6 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -2482,16 +2482,6 @@ struct lmv_desc {
struct obd_uuid ld_uuid;
};
-/* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
-struct lmv_stripe_md {
- __u32 mea_magic;
- __u32 mea_count;
- __u32 mea_master;
- __u32 mea_padding;
- char mea_pool_name[LOV_MAXPOOLNAME];
- struct lu_fid mea_ids[0];
-};
-
#define MEA_MAGIC_LAST_CHAR 0xb2221ca1
#define MEA_MAGIC_ALL_CHARS 0xb222a11c
#define MEA_MAGIC_HASH_SEGMENT 0xb222a11b
@@ -2500,6 +2490,77 @@ struct lmv_stripe_md {
#define MAX_HASH_SIZE 0x7fffffffffffffffULL
#define MAX_HASH_HIGHEST_BIT 0x1000000000000000ULL
+/* lmv structures */
+#define LMV_MAGIC_V1 0x0CD10CD0 /* normal stripe lmv magic */
+#define LMV_USER_MAGIC 0x0CD20CD0 /* default lmv magic*/
+#define LMV_MAGIC LMV_MAGIC_V1
+struct lmv_mds_md_v1 {
+ __u32 lmv_magic;
+ __u32 lmv_stripe_count; /* stripe count */
+ __u32 lmv_master_mdt_index; /* master MDT index */
+ __u32 lmv_hash_type; /* dir stripe policy, i.e. indicate
+ * which hash function to be used
+ */
+ __u32 lmv_layout_version; /* Used for directory restriping */
+ __u32 lmv_padding;
+ char lmv_pool_name[LOV_MAXPOOLNAME]; /* pool name */
+ struct lu_fid lmv_stripe_fids[0]; /* FIDs for each stripe */
+};
+
+union lmv_mds_md {
+ __u32 lmv_magic;
+ struct lmv_mds_md_v1 lmv_md_v1;
+ struct lmv_user_md lmv_user_md;
+};
+
+static inline ssize_t lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)
+{
+ ssize_t len = -EINVAL;
+
+ switch (lmm_magic) {
+ case LMV_MAGIC_V1: {
+ struct lmv_mds_md_v1 *lmm1;
+
+ len = sizeof(*lmm1);
+ len += stripe_count * sizeof(lmm1->lmv_stripe_fids[0]);
+ break; }
+ default:
+ break;
+ }
+ return len;
+}
+
+static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
+{
+ switch (le32_to_cpu(lmm->lmv_magic)) {
+ case LMV_MAGIC_V1:
+ return le32_to_cpu(lmm->lmv_md_v1.lmv_stripe_count);
+ case LMV_USER_MAGIC:
+ return le32_to_cpu(lmm->lmv_user_md.lum_stripe_count);
+ default:
+ return -EINVAL;
+ }
+}
+
+static inline int lmv_mds_md_stripe_count_set(union lmv_mds_md *lmm,
+ unsigned int stripe_count)
+{
+ int rc = 0;
+
+ switch (le32_to_cpu(lmm->lmv_magic)) {
+ case LMV_MAGIC_V1:
+ lmm->lmv_md_v1.lmv_stripe_count = cpu_to_le32(stripe_count);
+ break;
+ case LMV_USER_MAGIC:
+ lmm->lmv_user_md.lum_stripe_count = cpu_to_le32(stripe_count);
+ break;
+ default:
+ rc = -EINVAL;
+ break;
+ }
+ return rc;
+}
+
enum fld_rpc_opc {
FLD_QUERY = 900,
FLD_READ = 901,
diff --git a/drivers/staging/lustre/lustre/include/lustre_lmv.h b/drivers/staging/lustre/lustre/include/lustre_lmv.h
new file mode 100644
index 0000000..0620c8c
--- /dev/null
+++ b/drivers/staging/lustre/lustre/include/lustre_lmv.h
@@ -0,0 +1,66 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License version 2 for more details. A copy is
+ * included in the COPYING file that accompanied this code.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2013, Intel Corporation.
+ */
+/*
+ * lustre/include/lustre_lmv.h
+ *
+ * Lustre LMV structures and functions.
+ *
+ * Author: Di Wang <di.wang@intel.com>
+ */
+
+#ifndef _LUSTRE_LMV_H
+#define _LUSTRE_LMV_H
+#include "lustre/lustre_idl.h"
+
+struct lmv_oinfo {
+ struct lu_fid lmo_fid;
+ u32 lmo_mds;
+ struct inode *lmo_root;
+};
+
+struct lmv_stripe_md {
+ __u32 mea_magic;
+ __u32 mea_count;
+ __u32 mea_master;
+ __u32 mea_padding;
+ char mea_pool_name[LOV_MAXPOOLNAME];
+ struct lu_fid mea_ids[0];
+};
+
+union lmv_mds_md;
+
+int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
+ const union lmv_mds_md *lmm, int stripe_count);
+
+static inline int lmv_alloc_memmd(struct lmv_stripe_md **lsmp, int stripe_count)
+{
+ return lmv_unpack_md(NULL, lsmp, NULL, stripe_count);
+}
+
+static inline void lmv_free_memmd(struct lmv_stripe_md *lsm)
+{
+ lmv_unpack_md(NULL, &lsm, NULL, 0);
+}
+#endif
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
index 0beafc4..471470b 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h
+++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
@@ -35,6 +35,7 @@
#include "../include/lustre/lustre_idl.h"
#include "../include/obd.h"
+#include "../include/lustre_lmv.h"
#define LMV_MAX_TGT_COUNT 128
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index fac04f0..8e83263 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -46,6 +46,7 @@
#include "../include/lustre_lib.h"
#include "../include/lustre_net.h"
#include "../include/obd_class.h"
+#include "../include/lustre_lmv.h"
#include "../include/lprocfs_status.h"
#include "../include/lustre_lite.h"
#include "../include/lustre_fid.h"
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 4fc3f9b..ab78754 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -40,6 +40,7 @@
#include "../include/lustre_acl.h"
#include "../include/obd_class.h"
+#include "../include/lustre_lmv.h"
#include "../include/lustre_fid.h"
#include "../include/lprocfs_status.h"
#include "../include/lustre_param.h"
--
1.7.1
next prev parent reply other threads:[~2016-07-22 2:56 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 2:43 [PATCH 00/58] staging: lustre: bug fixes from lustre 2.5.[56-58] James Simmons
2016-07-22 2:43 ` [PATCH 01/58] staging: lustre: obd: expand op_cli_flags James Simmons
2016-07-22 2:43 ` [PATCH 02/58] staging: lustre: obd: rename struct lmv_stripe_md field mea to lmv James Simmons
2016-07-22 2:43 ` [PATCH 03/58] staging: lustre: ptlrpc: remove wirecheck for struct lmv_stripe_md James Simmons
2016-07-22 2:43 ` [PATCH 04/58] staging: lustre: llite: cache directory striping information James Simmons
2016-07-22 2:43 ` James Simmons [this message]
2016-07-22 2:43 ` [PATCH 06/58] staging: lustre: mdc: handle IT_READDIR operations James Simmons
2016-07-22 2:44 ` [PATCH 07/58] staging: lustre: llite: label the debug info James Simmons
2016-07-22 2:44 ` [PATCH 08/58] staging: lustre: llite: pass struct md_op_data to ll_dir_read James Simmons
2016-07-22 2:44 ` [PATCH 09/58] staging: lustre: llite: remove debug message in ll_dir_read James Simmons
2016-07-22 2:44 ` [PATCH 10/58] staging: lustre: llite: reduce indent " James Simmons
2016-07-22 2:44 ` [PATCH 11/58] staging: lustre: llite: set next only when needed " James Simmons
2016-07-22 2:44 ` [PATCH 12/58] staging: lustre: llite: handle done flags differently " James Simmons
2016-07-22 2:44 ` [PATCH 13/58] staging: lustre: llite: change done flag in ll_dir_read to bool James Simmons
2016-07-22 2:44 ` [PATCH 14/58] staging: lustre: llite: rename some variables for ll_dir_read James Simmons
2016-07-22 2:44 ` [PATCH 15/58] staging: lustre: llite: clarify some debug messages for statahead James Simmons
2016-07-22 2:44 ` [PATCH 16/58] staging: lustre: llite: remove code never called James Simmons
2016-07-22 2:44 ` [PATCH 17/58] staging: lustre: llite: pass in __u64 pos for ll_dir_read James Simmons
2016-07-22 2:44 ` [PATCH 18/58] staging: lustre: llite: do post work for statahead in readdir case James Simmons
2016-07-22 2:44 ` [PATCH 19/58] staging: lustre: llite: add md_op_data parameter to ll_get_dir_page James Simmons
2016-08-15 16:38 ` Greg Kroah-Hartman
2016-08-15 21:40 ` James Simmons
2016-08-16 10:51 ` Greg Kroah-Hartman
2016-07-22 2:44 ` [PATCH 20/58] staging: lustre: llite: remove comment from ll_dir_read James Simmons
2016-07-22 2:44 ` [PATCH 21/58] staging: lustre: llite: style cleanup for llite_internal.h James Simmons
2016-07-22 2:44 ` [PATCH 22/58] staging: lustre: llite: pass inode to ll_release_page James Simmons
2016-07-22 2:44 ` [PATCH 23/58] staging: lustre: llite: change remove parameter to bool James Simmons
2016-07-22 2:44 ` [PATCH 24/58] staging: lustre: mdc: don't take rpc lock for readdir case James Simmons
2016-07-22 2:44 ` [PATCH 25/58] staging: lustre: lmv: remove unused lmv_get_mea function James Simmons
2016-07-22 2:44 ` [PATCH 26/58] staging: lustre: lmv: remove duplicate MAX_HASH_* James Simmons
2016-07-22 2:44 ` [PATCH 27/58] staging: lustre: lmv: change handling of lmv striping information James Simmons
2016-07-22 2:44 ` [PATCH 28/58] staging: lustre: lmv: remove lmv_get_easize James Simmons
2016-07-22 2:44 ` [PATCH 29/58] staging: lustre: lmv: replace obd_free_memmd with lmv_free_memmd James Simmons
2016-07-22 2:44 ` [PATCH 30/58] staging: lustre: create striped directory James Simmons
2016-07-22 14:38 ` kbuild test robot
2016-07-26 16:36 ` [PATCH v2 " James Simmons
2016-07-26 16:59 ` Joe Perches
2016-07-26 18:09 ` James Simmons
2016-07-22 2:44 ` [PATCH 31/58] staging: lustre: llite: fix "getdirstripe" to show stripe info James Simmons
2016-07-22 2:44 ` [PATCH 32/58] staging: lustre: delete striped directory James Simmons
2016-07-22 2:44 ` [PATCH 33/58] staging: lustre: obdclass: fix lmd_parse() to handle comma-separated NIDs James Simmons
2016-07-22 2:44 ` [PATCH 34/58] staging: lustre: obdclass: bug fixes for lu_device_type handling James Simmons
2016-07-22 2:44 ` [PATCH 35/58] staging: lustre: add ability to migrate inodes James Simmons
2016-07-22 2:44 ` [PATCH 36/58] staging: lustre: lmv: fix issue found by Klocwork Insight tool James Simmons
2016-07-22 2:44 ` [PATCH 37/58] staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST James Simmons
2016-07-22 2:44 ` [PATCH 38/58] staging: lustre: llite: enable clients to inject error for lfsck James Simmons
2016-07-22 2:44 ` [PATCH 39/58] staging: lustre: osc: allow to call brw_commit() multiple times James Simmons
2016-07-22 2:44 ` [PATCH 40/58] staging: lustre: llite: a few fixes for migration James Simmons
2016-07-22 2:44 ` [PATCH 41/58] staging: lustre: mdc: fixup MDS_SWAP_LAYOUTS ELC handling James Simmons
2016-07-22 2:44 ` [PATCH 42/58] staging: lustre: don't need to const __u64 parameters for lustre_idl.h James Simmons
2016-07-22 2:44 ` [PATCH 43/58] staging: lustre: const correct FID/OSTID/... helpers James Simmons
2016-07-22 2:44 ` [PATCH 44/58] staging: lustre: use bool for several function in lustre_idl.h/lustre_fid.h James Simmons
2016-07-22 2:44 ` [PATCH 45/58] staging: lustre: simplify inline functions in lustre_fid.h James Simmons
2016-07-22 2:44 ` [PATCH 46/58] staging: lustre: lmv: access lum_stripe_offset as little endian James Simmons
2016-07-22 2:44 ` [PATCH 47/58] staging: lustre: lmv: lookup remote migrating object in LMV James Simmons
2016-07-22 2:44 ` [PATCH 48/58] staging: lustre: lmv: Ensure lmv_intent_lookup cleans up reqp James Simmons
2016-07-22 2:44 ` [PATCH 49/58] staging: lustre: llite: avoid a deadlock in page write James Simmons
2016-07-22 2:44 ` [PATCH 50/58] staging: lustre: lov: handle the case of stripe size is not power 2 James Simmons
2016-07-22 2:44 ` [PATCH 51/58] staging: lustre: lmv: cleanup req in lmv_getattr_name() James Simmons
2016-07-22 2:44 ` [PATCH 52/58] staging: lustre: lmv: rename request to preq " James Simmons
2016-07-22 2:44 ` [PATCH 53/58] staging: lustre: obdclass: unified flow control interfaces James Simmons
2016-07-22 2:44 ` [PATCH 54/58] staging: lustre: reorder LOV_MAGIC_* definition James Simmons
2016-07-22 2:44 ` [PATCH 55/58] staging: lustre: ldlm: flock completion fixes James Simmons
2016-07-22 2:44 ` [PATCH 56/58] staging: lustre: move ioctls to lustre_ioctl.h James Simmons
2016-07-22 2:44 ` [PATCH 57/58] staging: lustre: llite: add error handler in inode prepare phase James Simmons
2016-07-22 2:44 ` [PATCH 58/58] staging: lustre: ptlrpc: Early replies need to honor at_max James Simmons
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=1469155491-15265-6-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=di.wang@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).