@@ -55,7 +55,6 @@ struct lmv_stripe_md {
struct lmv_oinfo lsm_md_oinfo[0];
};
-/* NB: LMV_HASH_TYPE_SPACE is set in default LMV only */
static inline bool lmv_is_known_hash_type(u32 type)
{
return (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_FNV_1A_64 ||
@@ -91,9 +90,9 @@ static inline bool lmv_dir_bad_hash(const struct lmv_stripe_md *lsm)
}
/* NB, this is checking directory default LMV */
-static inline bool lmv_dir_space_hashed(const struct lmv_stripe_md *lsm)
+static inline bool lmv_dir_qos_mkdir(const struct lmv_stripe_md *lsm)
{
- return lsm && lsm->lsm_md_hash_type == LMV_HASH_TYPE_SPACE;
+ return lsm && (lsm->lsm_md_hash_type & LMV_HASH_FLAG_SPACE);
}
static inline bool
@@ -1187,7 +1187,7 @@ static u32 lmv_placement_policy(struct obd_device *obd,
mdt = le32_to_cpu(lum->lum_stripe_offset);
} else if (op_data->op_code == LUSTRE_OPC_MKDIR &&
!lmv_dir_striped(op_data->op_mea1) &&
- lmv_dir_space_hashed(op_data->op_default_mea1)) {
+ lmv_dir_qos_mkdir(op_data->op_default_mea1)) {
mdt = op_data->op_mds;
} else if (op_data->op_code == LUSTRE_OPC_MKDIR &&
op_data->op_default_mea1 &&
@@ -1716,7 +1716,7 @@ struct lmv_tgt_desc *
op_data->op_mds = oinfo->lmo_mds;
tgt = lmv_get_target(lmv, oinfo->lmo_mds, NULL);
} else if (op_data->op_code == LUSTRE_OPC_MKDIR &&
- lmv_dir_space_hashed(op_data->op_default_mea1) &&
+ lmv_dir_qos_mkdir(op_data->op_default_mea1) &&
!lmv_dir_striped(lsm)) {
tgt = lmv_locate_tgt_qos(lmv, &op_data->op_mds);
if (tgt == ERR_PTR(-EAGAIN))
@@ -1661,8 +1661,8 @@ void lustre_assert_wire_constants(void)
BUILD_BUG_ON(LMV_MAGIC_V1 != 0x0CD20CD0);
BUILD_BUG_ON(LMV_MAGIC_STRIPE != 0x0CD40CD0);
BUILD_BUG_ON(LMV_HASH_TYPE_MASK != 0x0000ffff);
+ BUILD_BUG_ON(LMV_HASH_FLAG_SPACE != 0x08000000);
BUILD_BUG_ON(LMV_HASH_FLAG_MIGRATION != 0x80000000);
- BUILD_BUG_ON(LMV_HASH_FLAG_DEAD != 0x40000000);
/* Checks for struct obd_statfs */
LASSERTF((int)sizeof(struct obd_statfs) == 144, "found %lld\n",
@@ -2001,16 +2001,6 @@ struct lmv_foreign_md {
#define LMV_MAGIC_STRIPE 0x0CD40CD0 /* magic for dir sub_stripe */
#define LMV_MAGIC_FOREIGN 0x0CD50CD0 /* magic for lmv foreign */
-/*
- *Right now only the lower part(0-16bits) of lmv_hash_type is being used,
- * and the higher part will be the flag to indicate the status of object,
- * for example the object is being migrated. And the hash function
- * might be interpreted differently with different flags.
- */
-#define LMV_HASH_TYPE_MASK 0x0000ffff
-
-#define LMV_HASH_FLAG_MIGRATION 0x80000000
-#define LMV_HASH_FLAG_DEAD 0x40000000
/**
* The FNV-1a hash algorithm is as follows:
@@ -655,16 +655,37 @@ enum lmv_hash_type {
LMV_HASH_TYPE_UNKNOWN = 0, /* 0 is reserved for testing purpose */
LMV_HASH_TYPE_ALL_CHARS = 1,
LMV_HASH_TYPE_FNV_1A_64 = 2,
- LMV_HASH_TYPE_SPACE = 3, /*
- * distribute subdirs among all MDTs
- * with balanced space usage.
- */
LMV_HASH_TYPE_MAX,
};
-#define LMV_HASH_NAME_ALL_CHARS "all_char"
-#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64"
-#define LMV_HASH_NAME_SPACE "space"
+#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_FNV_1A_64
+
+#define LMV_HASH_NAME_ALL_CHARS "all_char"
+#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64"
+
+/* not real hash type, but exposed to user as "space" hash type */
+#define LMV_HASH_NAME_SPACE "space"
+
+/* Right now only the lower part(0-16bits) of lmv_hash_type is being used,
+ * and the higher part will be the flag to indicate the status of object,
+ * for example the object is being migrated. And the hash function
+ * might be interpreted differently with different flags.
+ */
+#define LMV_HASH_TYPE_MASK 0x0000ffff
+
+/* once this is set on a plain directory default layout, newly created
+ * subdirectories will be distributed on all MDTs by space usage.
+ */
+#define LMV_HASH_FLAG_SPACE 0x08000000
+
+/* The striped directory has ever lost its master LMV EA, then LFSCK
+ * re-generated it. This flag is used to indicate such case. It is an
+ * on-disk flag.
+ */
+#define LMV_HASH_FLAG_LOST_LMV 0x10000000
+
+#define LMV_HASH_FLAG_BAD_TYPE 0x20000000
+#define LMV_HASH_FLAG_MIGRATION 0x80000000
struct lustre_foreign_type {
uint32_t lft_type;