RETURN(rc);
}
+/** Call mdo_lum_lmm_cmp() on next layer */
+static int cml_lum_lmm_cmp(const struct lu_env *env, struct md_object *mo_c,
+ const struct md_op_spec *spec, struct md_attr *ma)
+{
+ int rc;
+ ENTRY;
+
+ rc = mdo_lum_lmm_cmp(env, md_object_next(mo_c), spec, ma);
+ RETURN(rc);
+}
+
/**
* \ingroup cmm
* Get mode of object.
.mdo_create = cml_create,
.mdo_link = cml_link,
.mdo_unlink = cml_unlink,
+ .mdo_lum_lmm_cmp = cml_lum_lmm_cmp,
.mdo_name_insert = cml_name_insert,
.mdo_rename = cml_rename,
.mdo_rename_tgt = cml_rename_tgt,
return -EREMOTE;
}
+static int cmr_lum_lmm_cmp(const struct lu_env *env, struct md_object *mo_c,
+ const struct md_op_spec *spec, struct md_attr *ma)
+{
+ return -EREMOTE;
+}
+
/** Set of md_object_operations for cmr. */
static const struct md_object_operations cmr_mo_ops = {
.moo_permission = cmr_permission,
.mdo_create = cmr_create,
.mdo_link = cmr_link,
.mdo_unlink = cmr_unlink,
+ .mdo_lum_lmm_cmp = cmr_lum_lmm_cmp,
.mdo_rename = cmr_rename,
.mdo_rename_tgt = cmr_rename_tgt
};
#define HAVE_LLAPI_FILE_LOOKUP
extern int llapi_file_lookup(int dirfd, const char *name);
-#define VERBOSE_COUNT 0x1
-#define VERBOSE_SIZE 0x2
-#define VERBOSE_OFFSET 0x4
-#define VERBOSE_POOL 0x8
-#define VERBOSE_DETAIL 0x10
-#define VERBOSE_OBJID 0x20
-#define VERBOSE_ALL (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \
- VERBOSE_POOL | VERBOSE_OBJID)
+#define VERBOSE_COUNT 0x1
+#define VERBOSE_SIZE 0x2
+#define VERBOSE_OFFSET 0x4
+#define VERBOSE_POOL 0x8
+#define VERBOSE_DETAIL 0x10
+#define VERBOSE_OBJID 0x20
+#define VERBOSE_GENERATION 0x40
+#define VERBOSE_ALL (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \
+ VERBOSE_POOL | VERBOSE_OBJID | VERBOSE_GENERATION)
struct find_param {
unsigned int maxdepth;
__u64 lmm_object_id; /* LOV object ID */
__u64 lmm_object_seq; /* LOV object seq number */
__u32 lmm_stripe_size; /* size of stripe in bytes */
- __u32 lmm_stripe_count; /* num stripes in use for this object */
+ /* lmm_stripe_count used to be __u32 */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ __u16 lmm_layout_gen; /* layout generation number */
struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
};
__u64 lmm_object_id; /* LOV object ID */
__u64 lmm_object_seq; /* LOV object seq number */
__u32 lmm_stripe_size; /* size of stripe in bytes */
- __u32 lmm_stripe_count; /* num stripes in use for this object */
+ /* lmm_stripe_count used to be __u32 */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ __u16 lmm_layout_gen; /* layout generation number */
char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */
struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
};
*
* (max buffer size - lov+rpc header) / sizeof(struct lov_ost_data_v1) */
#define LOV_MAX_STRIPE_COUNT 2000 /* ((12 * 4096 - 256) / 24) */
+#define LOV_ALL_STRIPES 0xffff /* only valid for directories */
#define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */
#define LOV_MAX_UUID_BUFFER_SIZE 8192
} __attribute__((packed));
#define lov_user_md lov_user_md_v1
+#define lmm_stripe_offset u.lum_stripe_offset
struct lov_user_md_v1 { /* LOV EA user data (host-endian) */
__u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V1 */
__u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
__u64 lmm_object_seq; /* LOV object seq */
__u32 lmm_stripe_size; /* size of stripe in bytes */
__u16 lmm_stripe_count; /* num stripes in use for this object */
- __u16 lmm_stripe_offset; /* starting stripe offset in lmm_objects */
+ union {
+ __u16 lum_stripe_offset; /* starting stripe offset in
+ * lmm_objects, use when writing */
+ __u16 lum_layout_gen; /* layout generation number
+ * used when reading */
+ } u;
struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
} __attribute__((packed, __may_alias__));
__u64 lmm_object_seq; /* LOV object seq */
__u32 lmm_stripe_size; /* size of stripe in bytes */
__u16 lmm_stripe_count; /* num stripes in use for this object */
- __u16 lmm_stripe_offset; /* starting stripe offset in lmm_objects */
+ union {
+ __u16 lum_stripe_offset; /* starting stripe offset in
+ * lmm_objects, use when writing */
+ __u16 lum_layout_gen; /* layout generation number
+ * used when reading */
+ } u;
char lmm_pool_name[LOV_MAXPOOLNAME]; /* pool name */
struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
} __attribute__((packed));
#define OBD_INCOMPAT_IAM_DIR 0x00000040
/** LMA attribute contains per-inode incompatible flags */
#define OBD_INCOMPAT_LMA 0x00000080
-
+/** lmm_stripe_count has been shrunk from __u32 to __u16 and the remaining 16
+ * bits are now used to store a generation. Once we start changing the layout
+ * and bumping the generation, old versions expecting a 32-bit lmm_stripe_count
+ * will be confused by interpreting stripe_count | gen << 16 as the actual
+ * stripe count */
+#define OBD_INCOMPAT_LMM_VER 0x00000100
/* Data stored per server at the head of the last_rcvd file. In le32 order.
This should be common to filter_internal.h, lustre_mds.h */
MA_LMV = (1 << 4),
MA_ACL_DEF = (1 << 5),
MA_LOV_DEF = (1 << 6),
-/* (Layout lock will used #7 here) */
+ MA_LAY_GEN = (1 << 7),
MA_HSM = (1 << 8),
MA_SOM = (1 << 9),
MA_PFID = (1 << 10)
__u64 ma_need;
__u64 ma_attr_flags;
struct lu_attr ma_attr;
+ struct lu_fid ma_pfid;
+ struct md_hsm ma_hsm;
struct lov_mds_md *ma_lmm;
- int ma_lmm_size;
struct lmv_stripe_md *ma_lmv;
- int ma_lmv_size;
void *ma_acl;
- int ma_acl_size;
struct llog_cookie *ma_cookie;
- int ma_cookie_size;
struct lustre_capa *ma_capa;
- struct md_hsm ma_hsm;
struct md_som_data *ma_som;
- struct lu_fid ma_pfid;
+ int ma_lmm_size;
+ int ma_lmv_size;
+ int ma_acl_size;
+ int ma_cookie_size;
+ __u16 ma_layout_gen;
};
/** Additional parameters for create */
struct md_object *cobj, const struct lu_name *lname,
struct md_attr *ma);
+ /** This method is used to compare a requested layout to an existing
+ * layout (struct lov_mds_md_v1/3 vs struct lov_mds_md_v1/3) */
+ int (*mdo_lum_lmm_cmp)(const struct lu_env *env,
+ struct md_object *cobj,
+ const struct md_op_spec *spec,
+ struct md_attr *ma);
+
/** partial ops for cross-ref case */
int (*mdo_name_insert)(const struct lu_env *env,
struct md_object *obj,
return c->mo_dir_ops->mdo_unlink(env, p, c, lname, ma);
}
+static inline int mdo_lum_lmm_cmp(const struct lu_env *env,
+ struct md_object *c,
+ const struct md_op_spec *spec,
+ struct md_attr *ma)
+{
+ LASSERT(c->mo_dir_ops->mdo_lum_lmm_cmp);
+ return c->mo_dir_ops->mdo_lum_lmm_cmp(env, c, spec, ma);
+}
+
static inline int mdo_name_insert(const struct lu_env *env,
struct md_object *p,
const struct lu_name *lname,
__u32 lw_magic;
__u32 lw_stripe_size; /* size of the stripe */
__u32 lw_pattern; /* striping pattern (RAID0, RAID1) */
- unsigned lw_stripe_count; /* number of objects being striped over */
+ __u16 lw_stripe_count; /* number of objects being striped over */
+ __u16 lw_layout_gen; /* generation of the layout */
char lw_pool_name[LOV_MAXPOOLNAME]; /* pool name */
} lsm_wire;
#define lsm_object_id lsm_wire.lw_object_id
#define lsm_object_seq lsm_wire.lw_object_seq
#define lsm_magic lsm_wire.lw_magic
+#define lsm_layout_gen lsm_wire.lw_layout_gen
#define lsm_stripe_size lsm_wire.lw_stripe_size
#define lsm_pattern lsm_wire.lw_pattern
#define lsm_stripe_count lsm_wire.lw_stripe_count
return memcmp(&m1->lsm_wire, &m2->lsm_wire, sizeof m1->lsm_wire);
}
+static inline int lov_lum_lsm_cmp(struct lov_user_md *lum,
+ struct lov_stripe_md *lsm)
+{
+ if (lsm->lsm_magic != lum->lmm_magic)
+ return 1;
+ if ((lsm->lsm_stripe_count != 0) && (lum->lmm_stripe_count != 0) &&
+ (lsm->lsm_stripe_count != lum->lmm_stripe_count))
+ return 2;
+ if ((lsm->lsm_stripe_size != 0) && (lum->lmm_stripe_size != 0) &&
+ (lsm->lsm_stripe_size != lum->lmm_stripe_size))
+ return 3;
+ if ((lsm->lsm_pattern != 0) && (lum->lmm_pattern != 0) &&
+ (lsm->lsm_pattern != lum->lmm_pattern))
+ return 4;
+ if ((lsm->lsm_magic == LOV_MAGIC_V3) &&
+ (strncmp(lsm->lsm_pool_name,
+ ((struct lov_user_md_v3 *)lum)->lmm_pool_name,
+ LOV_MAXPOOLNAME) != 0))
+ return 5;
+ return 0;
+}
+
+static inline int lov_lum_swab_if_needed(struct lov_user_md_v3 *lumv3,
+ int *lmm_magic,
+ struct lov_user_md *lum)
+{
+ if (lum && cfs_copy_from_user(lumv3, lum,sizeof(struct lov_user_md_v1)))
+ return -EFAULT;
+
+ *lmm_magic = lumv3->lmm_magic;
+
+ if (*lmm_magic == __swab32(LOV_USER_MAGIC_V1)) {
+ lustre_swab_lov_user_md_v1((struct lov_user_md_v1 *)lumv3);
+ *lmm_magic = LOV_USER_MAGIC_V1;
+ } else if (*lmm_magic == LOV_USER_MAGIC_V3) {
+ if (lum && cfs_copy_from_user(lumv3, lum, sizeof(*lumv3)))
+ return -EFAULT;
+ } else if (*lmm_magic == __swab32(LOV_USER_MAGIC_V3)) {
+ if (lum && cfs_copy_from_user(lumv3, lum, sizeof(*lumv3)))
+ return -EFAULT;
+ lustre_swab_lov_user_md_v3(lumv3);
+ *lmm_magic = LOV_USER_MAGIC_V3;
+ } else if (*lmm_magic != LOV_USER_MAGIC_V1) {
+ CDEBUG(D_IOCTL,
+ "bad userland LOV MAGIC: %#08x != %#08x nor %#08x\n",
+ *lmm_magic, LOV_USER_MAGIC_V1, LOV_USER_MAGIC_V3);
+ return -EINVAL;
+ }
+ return 0;
+}
+
void lov_stripe_lock(struct lov_stripe_md *md);
void lov_stripe_unlock(struct lov_stripe_md *md);
void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *,
obd_off *);
int (*lsm_lmm_verify) (struct lov_mds_md *lmm, int lmm_bytes,
- int *stripe_count);
+ __u16 *stripe_count);
int (*lsm_unpackmd) (struct lov_obd *lov, struct lov_stripe_md *lsm,
struct lov_mds_md *lmm);
};
#ifndef _OBD_LOV_H__
#define _OBD_LOV_H__
-static inline int lov_stripe_md_size(int stripes)
+static inline int lov_stripe_md_size(__u16 stripes)
{
return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo*);
}
-static inline __u32 lov_mds_md_size(int stripes, __u32 lmm_magic)
+static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
{
if (lmm_magic == LOV_MAGIC_V3)
return sizeof(struct lov_mds_md_v3) +
__u32 valsize = sizeof(struct lov_desc);
int rc, easize, def_easize, cookiesize;
struct lov_desc desc;
- __u32 stripes;
+ __u16 stripes;
ENTRY;
rc = obd_get_info(dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
};
static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes,
- int stripe_count)
+ __u16 stripe_count)
{
if (stripe_count == 0 || stripe_count > LOV_V1_INSANE_STRIPE_COUNT) {
return 0;
}
-struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size)
+struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size)
{
struct lov_stripe_md *lsm;
- int i, oinfo_ptrs_size;
- struct lov_oinfo *loi;
+ struct lov_oinfo *loi;
+ int i, oinfo_ptrs_size;
- LASSERT(stripe_count > 0);
+ LASSERT(stripe_count <= LOV_MAX_STRIPE_COUNT);
oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count;
*size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size;
lsm->lsm_oinfo[i] = loi;
}
lsm->lsm_stripe_count = stripe_count;
- lsm->lsm_pool_name[0] = '\0';
return lsm;
err:
void lsm_free_plain(struct lov_stripe_md *lsm)
{
- int stripe_count = lsm->lsm_stripe_count;
+ __u16 stripe_count = lsm->lsm_stripe_count;
int i;
for (i = 0; i < stripe_count; i++)
lsm->lsm_object_seq = le64_to_cpu(lmm->lmm_object_seq);
lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern);
+ lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen);
lsm->lsm_pool_name[0] = '\0';
}
}
static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes,
- int *stripe_count)
+ __u16 *stripe_count)
{
if (lmm_bytes < sizeof(*lmm)) {
CERROR("lov_mds_md_v1 too small: %d, need at least %d\n",
return -EINVAL;
}
- *stripe_count = le32_to_cpu(lmm->lmm_stripe_count);
+ *stripe_count = le16_to_cpu(lmm->lmm_stripe_count);
if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V1)) {
CERROR("LOV EA V1 too small: %d, need %d\n",
};
static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes,
- int *stripe_count)
+ __u16 *stripe_count)
{
struct lov_mds_md_v3 *lmm;
return -EINVAL;
}
- *stripe_count = le32_to_cpu(lmm->lmm_stripe_count);
+ *stripe_count = le16_to_cpu(lmm->lmm_stripe_count);
if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V3)) {
CERROR("LOV EA V3 too small: %d, need %d\n",
void lov_fix_desc_stripe_count(__u32 *val);
void lov_fix_desc_pattern(__u32 *val);
void lov_fix_desc_qos_maxage(__u32 *val);
-__u32 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u32 stripe_count);
+__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count);
int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
struct obd_connect_data *data);
int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
struct lov_user_md *lump);
int lov_getstripe(struct obd_export *exp,
struct lov_stripe_md *lsm, struct lov_user_md *lump);
-int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count,
+int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count,
int pattern, int magic);
void lov_free_memmd(struct lov_stripe_md **lsmp);
void lov_dump_lmm(int level, void *lmm);
/* lov_ea.c */
-struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size);
+struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size);
void lsm_free_plain(struct lov_stripe_md *lsm);
int lovea_destroy_object(struct lov_obd *lov, struct lov_stripe_md *lsm,
(__u64)le64_to_cpu(lmm->lmm_object_id),
le32_to_cpu(lmm->lmm_magic),
le32_to_cpu(lmm->lmm_pattern));
- CDEBUG(level,"stripe_size %u, stripe_count %u\n",
+ CDEBUG(level,"stripe_size %u, stripe_count %u, layout_gen %u\n",
le32_to_cpu(lmm->lmm_stripe_size),
- le32_to_cpu(lmm->lmm_stripe_count));
+ le16_to_cpu(lmm->lmm_stripe_count),
+ le16_to_cpu(lmm->lmm_layout_gen));
}
static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod,
{
lov_dump_lmm_common(level, lmm);
lov_dump_lmm_objects(level, lmm->lmm_objects,
- le32_to_cpu(lmm->lmm_stripe_count));
+ le16_to_cpu(lmm->lmm_stripe_count));
}
void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm)
lov_dump_lmm_common(level, lmm);
CDEBUG(level,"pool_name "LOV_POOLNAMEF"\n", lmm->lmm_pool_name);
lov_dump_lmm_objects(level, lmm->lmm_objects,
- le32_to_cpu(lmm->lmm_stripe_count));
+ le16_to_cpu(lmm->lmm_stripe_count));
}
void lov_dump_lmm(int level, void *lmm)
struct lov_obd *lov = &obd->u.lov;
struct lov_mds_md_v1 *lmmv1;
struct lov_mds_md_v3 *lmmv3;
- int stripe_count;
+ __u16 stripe_count;
struct lov_ost_data_v1 *lmm_objects;
int lmm_size, lmm_magic;
int i;
RETURN(lmm_size);
if (*lmmp && !lsm) {
- stripe_count = le32_to_cpu((*lmmp)->lmm_stripe_count);
+ stripe_count = le16_to_cpu((*lmmp)->lmm_stripe_count);
lmm_size = lov_mds_md_size(stripe_count, lmm_magic);
OBD_FREE_LARGE(*lmmp, lmm_size);
*lmmp = NULL;
lmmv1->lmm_object_id = cpu_to_le64(lsm->lsm_object_id);
lmmv1->lmm_object_seq = cpu_to_le64(lsm->lsm_object_seq);
lmmv1->lmm_stripe_size = cpu_to_le32(lsm->lsm_stripe_size);
- lmmv1->lmm_stripe_count = cpu_to_le32(stripe_count);
+ lmmv1->lmm_stripe_count = cpu_to_le16(stripe_count);
lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_pattern);
+ lmmv1->lmm_layout_gen = cpu_to_le16(lsm->lsm_layout_gen);
if (lsm->lsm_magic == LOV_MAGIC_V3) {
strncpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name,
LOV_MAXPOOLNAME);
}
/* Find the max stripecount we should use */
-__u32 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u32 stripe_count)
+__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count)
{
__u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD;
}
-static int lov_verify_lmm(void *lmm, int lmm_bytes, int *stripe_count)
+static int lov_verify_lmm(void *lmm, int lmm_bytes, __u16 *stripe_count)
{
int rc;
return rc;
}
-int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count,
+int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count,
int pattern, int magic)
{
int i, lsm_size;
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count;
(*lsmp)->lsm_pattern = pattern;
(*lsmp)->lsm_pool_name[0] = '\0';
+ (*lsmp)->lsm_layout_gen = 0;
(*lsmp)->lsm_oinfo[0]->loi_ost_idx = ~0;
for (i = 0; i < stripe_count; i++)
{
struct obd_device *obd = class_exp2obd(exp);
struct lov_obd *lov = &obd->u.lov;
- int rc = 0, stripe_count, lsm_size;
+ int rc = 0, lsm_size;
+ __u16 stripe_count;
__u32 magic;
ENTRY;
struct lov_user_md_v3 *lumv3 = (struct lov_user_md_v3 *)&buffer[0];
struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&buffer[0];
int lmm_magic;
- int stripe_count;
+ __u16 stripe_count;
int rc;
ENTRY;
- if (cfs_copy_from_user(lumv3, lump, sizeof(struct lov_user_md_v1)))
- RETURN(-EFAULT);
-
- lmm_magic = lumv1->lmm_magic;
-
- if (lmm_magic == __swab32(LOV_USER_MAGIC_V1)) {
- lustre_swab_lov_user_md_v1(lumv1);
- lmm_magic = LOV_USER_MAGIC_V1;
- } else if (lmm_magic == LOV_USER_MAGIC_V3) {
- if (cfs_copy_from_user(lumv3, lump, sizeof(*lumv3)))
- RETURN(-EFAULT);
- } else if (lmm_magic == __swab32(LOV_USER_MAGIC_V3)) {
- if (cfs_copy_from_user(lumv3, lump, sizeof(*lumv3)))
- RETURN(-EFAULT);
- lustre_swab_lov_user_md_v3(lumv3);
- lmm_magic = LOV_USER_MAGIC_V3;
- } else if (lmm_magic != LOV_USER_MAGIC_V1) {
- CDEBUG(D_IOCTL,
- "bad userland LOV MAGIC: %#08x != %#08x nor %#08x\n",
- lmm_magic, LOV_USER_MAGIC_V1, LOV_USER_MAGIC_V3);
- RETURN(-EINVAL);
- }
+ rc = lov_lum_swab_if_needed(lumv3, &lmm_magic, lump);
+ if (rc)
+ RETURN(rc);
/* in the rest of the tests, as *lumv1 and lumv3 have the same
* fields, we use lumv1 to avoid code duplication */
* So we have to re-order the data before copy to user.
*/
lum.lmm_stripe_count = lmmk->lmm_stripe_count;
- ((struct lov_user_md*)lmmk)->lmm_stripe_offset = 0;
+ lum.u.lum_layout_gen = lmmk->lmm_layout_gen;
+ ((struct lov_user_md*)lmmk)->u.lum_layout_gen = lum.u.lum_layout_gen;
((struct lov_user_md*)lmmk)->lmm_stripe_count = lum.lmm_stripe_count;
if (cfs_copy_to_user(lump, lmmk, lmm_size))
rc = -EFAULT;
struct lov_request *req,
struct obd_trans_info *oti)
{
- int stripe;
+ __u16 stripe;
int rc = -EIO;
ENTRY;
LASSERT(src_oa->o_valid & OBD_MD_FLGROUP);
if (set->set_oi->oi_md == NULL) {
- __u32 stripes_def = lov_get_stripecnt(lov, LOV_MAGIC, 0);
+ __u16 stripes_def = lov_get_stripecnt(lov, LOV_MAGIC, 0);
/* If the MDS file was truncated up to some size, stripe over
* enough OSTs to allow the file to be created at that size.
lsm = set->set_oi->oi_md;
lsm->lsm_object_id = src_oa->o_id;
lsm->lsm_object_seq = src_oa->o_seq;
+ lsm->lsm_layout_gen = 0; /* actual generation set in mdd_lov_create() */
if (!lsm->lsm_stripe_size)
lsm->lsm_stripe_size = lov->desc.ld_default_stripe_size;
struct mdd_device *mdd = mdo2mdd(cobj);
struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
struct mdd_object *son = md2mdd_obj(cobj);
- struct lu_attr *attr = &ma->ma_attr;
struct lov_mds_md *lmm = NULL;
int lmm_size = 0;
struct thandle *handle;
if (!md_should_create(spec->sp_cr_flags))
RETURN(0);
lmm_size = ma->ma_lmm_size;
- rc = mdd_lov_create(env, mdd, mdd_pobj, son, &lmm, &lmm_size,
- spec, attr);
+
+ rc = mdd_lov_create(env, mdd, mdd_pobj, son, &lmm, &lmm_size, spec, ma);
if (rc)
RETURN(rc);
mdd_trans_stop(env, mdd, rc, handle);
out_free:
/* Finish mdd_lov_create() stuff. */
+ /* if no_create == 0 (not replay), we free lmm allocated by
+ * mdd_lov_create() */
mdd_lov_create_finish(env, mdd, lmm, lmm_size, spec);
RETURN(rc);
}
if (S_ISREG(attr->la_mode)) {
lmm_size = ma->ma_lmm_size;
rc = mdd_lov_create(env, mdd, mdd_pobj, son, &lmm, &lmm_size,
- spec, attr);
+ spec, ma);
if (rc)
GOTO(out_pending, rc);
}
.mdo_rename = mdd_rename,
.mdo_link = mdd_link,
.mdo_unlink = mdd_unlink,
+ .mdo_lum_lmm_cmp = mdd_lum_lmm_cmp,
.mdo_name_insert = mdd_name_insert,
.mdo_name_remove = mdd_name_remove,
.mdo_rename_tgt = mdd_rename_tgt,
int mdd_lov_create(const struct lu_env *env, struct mdd_device *mdd,
struct mdd_object *parent, struct mdd_object *child,
struct lov_mds_md **lmm, int *lmm_size,
- const struct md_op_spec *spec, struct lu_attr *la);
+ const struct md_op_spec *spec, struct md_attr *ma);
int mdd_lov_objid_prepare(struct mdd_device *mdd, struct lov_mds_md *lmm);
int mdd_declare_lov_objid_update(const struct lu_env *, struct mdd_device *,
struct thandle *);
struct lustre_handle *lockh);
int mdd_file_unlock(const struct lu_env *env, struct md_object *obj,
struct lov_mds_md *lmm, struct lustre_handle *lockh);
+int mdd_lum_lmm_cmp(const struct lu_env *env, struct md_object *cobj,
+ const struct md_op_spec *spec, struct md_attr *ma);
int mdd_get_md(const struct lu_env *env, struct mdd_object *obj,
void *md, int *md_size, const char *name);
int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj,
LASSERT(S_ISDIR(mdd_object_type(obj)));
lum = (struct lov_user_md*)buf->lb_buf;
- /* if { size, offset, count } = { 0, -1, 0 } and no pool (i.e. all default
- * values specified) then delete default striping from dir. */
+ /* if { size, offset, count } = { 0, -1, 0 } and no pool
+ * (i.e. all default values specified) then delete default
+ * striping from dir. */
if (LOVEA_DELETE_VALUES(lum->lmm_stripe_size, lum->lmm_stripe_count,
lum->lmm_stripe_offset) &&
lum->lmm_magic != LOV_USER_MAGIC_V3) {
if (rc > 0) {
buf = mdd_buf_get(env, lmm, size);
rc = mdd_xattr_set_txn(env, child, buf,
- XATTR_NAME_LOV, 0, handle);
+ XATTR_NAME_LOV, 0,
+ handle);
if (rc)
CERROR("error on copy stripe info: rc "
"= %d\n", rc);
int mdd_lov_create(const struct lu_env *env, struct mdd_device *mdd,
struct mdd_object *parent, struct mdd_object *child,
struct lov_mds_md **lmm, int *lmm_size,
- const struct md_op_spec *spec, struct lu_attr *la)
+ const struct md_op_spec *spec, struct md_attr *ma)
{
struct obd_device *obd = mdd2obd_dev(mdd);
struct obd_export *lov_exp = obd->u.mds.mds_lov_exp;
const void *eadata = spec->u.sp_ea.eadata;
__u64 create_flags = spec->sp_cr_flags;
struct obd_trans_info *oti = &mdd_env_info(env)->mti_oti;
+ struct lu_attr *la = &ma->ma_attr;
int rc = 0;
ENTRY;
0, &lsm, (void*)eadata);
if (rc)
GOTO(out_oti, rc);
- } else if (parent != NULL) {
+ } else {
/* get lov ea from parent and set to lov */
struct lov_mds_md *_lmm;
int _lmm_size;
+ LASSERT(parent != NULL);
+
_lmm_size = mdd_lov_mdsize(env, mdd);
_lmm = mdd_max_lmm_get(env, mdd);
}
GOTO(out_oti, rc);
}
+
+ if (ma->ma_valid & MA_LAY_GEN)
+ /* If we already have a lsm, the file is not new and we
+ * are about to change the layout, so we have to bump
+ * the generation. It is worth noting that old versions
+ * will be confused by a non-zero gen, that's why
+ * OBD_INCOMPAT_LMM_VER has been introduced */
+ lsm->lsm_layout_gen = ma->ma_layout_gen + 1;
+ else
+ /* Start with a null generation for backward
+ * compatiblity with old versions */
+ lsm->lsm_layout_gen = 0;
+
LASSERT_SEQ_IS_MDT(lsm->lsm_object_seq);
} else {
LASSERT(eadata != NULL);
if (rc)
GOTO(out_oti, rc);
+ if (ma->ma_valid & MA_LAY_GEN)
+ lsm->lsm_layout_gen = ma->ma_layout_gen;
+ else
+ lsm->lsm_layout_gen = 0;
}
lsm->lsm_object_id = fid_ver_oid(mdd_object_fid(child));
struct md_attr *ma, struct thandle *handle)
{
struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
- int rc, stripe, i;
+ int rc, i;
+ __u16 stripe;
LASSERT(obj);
LASSERT(ma);
return -EINVAL;
}
- if ((int)le32_to_cpu(ma->ma_lmm->lmm_stripe_count) < 0)
+ stripe = le16_to_cpu(ma->ma_lmm->lmm_stripe_count);
+ if (stripe == LOV_ALL_STRIPES);
stripe = mdd2obd_dev(mdd)->u.mds.mds_lov_desc.ld_tgt_count;
- else
- stripe = le32_to_cpu(ma->ma_lmm->lmm_stripe_count);
for (i = 0; i < stripe; i++) {
rc = mdd_declare_llog_record(env, mdd,
RETURN(rc);
}
+
+/* file lov is in ma->ma_lmm */
+/* requested lov is in info->mti_spec.u.sp_ea.eadata */
+int mdd_lum_lmm_cmp(const struct lu_env *env, struct md_object *cobj,
+ const struct md_op_spec *spec, struct md_attr *ma)
+{
+ struct obd_export *lov_exp =
+ mdd2obd_dev(mdo2mdd(cobj))->u.mds.mds_lov_exp;
+ struct lov_mds_md *lmm = ma->ma_lmm;
+ struct lov_user_md_v3 *lum =
+ (struct lov_user_md_v3 *)(spec->u.sp_ea.eadata);
+ struct lov_stripe_md *lsm = NULL;
+ int lmm_magic, rc;
+ ENTRY;
+
+ rc = obd_unpackmd(lov_exp, &lsm, lmm,
+ lov_mds_md_size(lmm->lmm_stripe_count,
+ lmm->lmm_magic));
+ ma->ma_layout_gen = lsm->lsm_layout_gen;
+ ma->ma_valid |= MA_LAY_GEN;
+
+ rc = lov_lum_swab_if_needed(lum, &lmm_magic, NULL);
+ if (rc)
+ GOTO(out, rc);
+
+ rc = lov_lum_lsm_cmp((struct lov_user_md *)lum, lsm);
+ if (rc)
+ GOTO(out, rc); /* keep GOTO to for traces */
+
+out:
+ /* free lsm */
+ obd_unpackmd(lov_exp, &lsm, NULL, 0);
+ return rc;
+}
rc = mdd_get_default_md(mdd_obj, ma->ma_lmm);
if (rc > 0) {
ma->ma_lmm_size = rc;
- ma->ma_valid |= MA_LOV;
+ ma->ma_layout_gen = ma->ma_lmm->lmm_layout_gen;
+ ma->ma_valid |= MA_LOV | MA_LAY_GEN;
rc = 0;
}
RETURN(rc);
struct thandle *handle)
{
struct lu_buf *buf = &mdd_env_info(env)->mti_buf;
- int rc, stripe, i;
+ int rc, i;
rc = mdo_declare_attr_set(env, obj, &ma->ma_attr, handle);
if (rc)
/* basically the log is the same as in unlink case */
if (lmm) {
+ __u16 stripe;
+
if (le32_to_cpu(lmm->lmm_magic) != LOV_MAGIC_V1 &&
le32_to_cpu(lmm->lmm_magic) != LOV_MAGIC_V3) {
CERROR("%s: invalid LOV_MAGIC %08x on object "DFID"\n",
return -EINVAL;
}
- stripe = mdd2obd_dev(mdd)->u.mds.mds_lov_desc.ld_tgt_count;
- if ((int)le32_to_cpu(lmm->lmm_stripe_count) >= 0)
- stripe = le32_to_cpu(lmm->lmm_stripe_count);
+ stripe = le16_to_cpu(lmm->lmm_stripe_count);
+ if (stripe == LOV_ALL_STRIPES) {
+ struct lov_desc *ldesc;
+
+ ldesc = &mdd->mdd_obd_dev->u.mds.mds_lov_desc;
+ LASSERT(ldesc != NULL);
+ stripe = ldesc->ld_tgt_count;
+ }
for (i = 0; i < stripe; i++) {
rc = mdd_declare_llog_record(env, mdd,
int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm)
{
struct lov_ost_data_v1 *data;
- __u32 count;
+ __u16 count;
int rc = 0;
__u32 j;
switch (le32_to_cpu(lmm->lmm_magic)) {
case LOV_MAGIC_V1:
- count = le32_to_cpu(((struct lov_mds_md_v1*)lmm)->lmm_stripe_count);
+ count = le16_to_cpu(((struct lov_mds_md_v1*)lmm)->lmm_stripe_count);
data = &(((struct lov_mds_md_v1*)lmm)->lmm_objects[0]);
break;
case LOV_MAGIC_V3:
- count = le32_to_cpu(((struct lov_mds_md_v3*)lmm)->lmm_stripe_count);
+ count = le16_to_cpu(((struct lov_mds_md_v3*)lmm)->lmm_stripe_count);
data = &(((struct lov_mds_md_v3*)lmm)->lmm_objects[0]);
break;
default:
* after use
*/
static int mds_log_lost_precreated(struct obd_device *obd,
- struct lov_stripe_md **lsmp, int *stripes,
+ struct lov_stripe_md **lsmp, __u16 *stripes,
obd_id id, obd_count count, int idx)
{
struct lov_stripe_md *lsm = *lsmp;
int j;
struct lov_ost_data_v1 *obj;
struct lov_stripe_md *lsm = NULL;
- int stripes = 0;
+ __u16 stripes = 0;
int count;
ENTRY;
switch (le32_to_cpu(lmm->lmm_magic)) {
case LOV_MAGIC_V1:
- count = le32_to_cpu(((struct lov_mds_md_v1*)lmm)->lmm_stripe_count);
+ count = le16_to_cpu(((struct lov_mds_md_v1*)lmm)->lmm_stripe_count);
obj = ((struct lov_mds_md_v1*)lmm)->lmm_objects;
break;
case LOV_MAGIC_V3:
- count = le32_to_cpu(((struct lov_mds_md_v3*)lmm)->lmm_stripe_count);
+ count = le16_to_cpu(((struct lov_mds_md_v3*)lmm)->lmm_stripe_count);
obj = ((struct lov_mds_md_v3*)lmm)->lmm_objects;
break;
default:
(S_ISDIR(la->la_mode) && (body->valid & OBD_MD_FLDIREA )) );
}
+void mdt_client_compatibility(struct mdt_thread_info *info)
+{
+ struct mdt_body *body;
+ struct ptlrpc_request *req = mdt_info_req(info);
+ struct obd_export *exp = req->rq_export;
+ struct md_attr *ma = &info->mti_attr;
+ struct lu_attr *la = &ma->ma_attr;
+ ENTRY;
+
+ if (exp->exp_connect_flags & OBD_CONNECT_LAYOUTLOCK)
+ /* the client can deal with 16-bit lmm_stripe_count */
+ RETURN_EXIT;
+
+ body = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
+
+ if (!mdt_body_has_lov(la, body))
+ RETURN_EXIT;
+
+ /* now we have a reply with a lov for a client not compatible with the
+ * layout lock so we have to clean the layout generation number */
+ if (S_ISREG(la->la_mode))
+ ma->ma_lmm->lmm_layout_gen = 0;
+ EXIT;
+}
+
+
static int mdt_getattr_internal(struct mdt_thread_info *info,
struct mdt_object *o, int ma_need)
{
if (rc == 0)
mdt_counter_incr(req->rq_export, LPROC_MDT_GETATTR);
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
return rc;
}
mdt_exit_ucred(info);
EXIT;
out_shrink:
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
return rc;
}
out_ucred:
mdt_exit_ucred(info);
out_shrink:
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
return rc;
}
out_ucred:
mdt_exit_ucred(info);
out_shrink:
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
return rc;
}
#define MDT_SERVICE_WATCHDOG_FACTOR (2)
#define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID)
#define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR | \
- OBD_INCOMPAT_FID | OBD_INCOMPAT_IAM_DIR)
+ OBD_INCOMPAT_FID | OBD_INCOMPAT_IAM_DIR | \
+ OBD_INCOMPAT_LMM_VER)
#define MDT_COS_DEFAULT (0)
struct mdt_object {
struct mdt_lock_handle *,
int decref);
+void mdt_client_compatibility(struct mdt_thread_info *info);
+
int mdt_close_unpack(struct mdt_thread_info *info);
int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op);
int mdt_reint_rec(struct mdt_thread_info *, struct mdt_lock_handle *);
void mdt_dump_lmm(int level, const struct lov_mds_md *lmm)
{
const struct lov_ost_data_v1 *lod;
- int i;
- __s16 stripe_count =
- le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
+ int i;
+ __u16 count;
+
+ count = le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
CDEBUG(level, "objid "LPX64", magic 0x%08X, pattern %#X\n",
le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic),
le32_to_cpu(lmm->lmm_pattern));
CDEBUG(level,"stripe_size=0x%x, stripe_count=0x%x\n",
- le32_to_cpu(lmm->lmm_stripe_size),
- le32_to_cpu(lmm->lmm_stripe_count));
- LASSERT(stripe_count <= (__s16)LOV_MAX_STRIPE_COUNT);
- for (i = 0, lod = lmm->lmm_objects; i < stripe_count; i++, lod++) {
+ le32_to_cpu(lmm->lmm_stripe_size), count);
+ if (count == LOV_ALL_STRIPES)
+ return;
+ LASSERT(count <= LOV_MAX_STRIPE_COUNT);
+ for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++)
CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
i, le32_to_cpu(lod->l_ost_idx),
le64_to_cpu(lod->l_object_seq),
le64_to_cpu(lod->l_object_id));
- }
}
void mdt_shrink_reply(struct mdt_thread_info *info)
info->mti_mdt->mdt_max_cookiesize);
rc = req_capsule_server_pack(info->mti_pill);
if (mdt_check_resent(info, mdt_reconstruct_generic, NULL)) {
+ mdt_client_compatibility(info);
if (rc == 0)
mdt_shrink_reply(info);
RETURN(lustre_msg_get_status(req->rq_repmsg));
mdt_empty_transno(info);
mdt_object_put(info->mti_env, o);
}
- if (repbody != NULL)
+ if (repbody != NULL) {
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
+ }
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_CLOSE_PACK))
RETURN(err_serious(-ENOMEM));
if (rc == 0)
mdt_counter_incr(req->rq_export, LPROC_MDT_SETATTR);
+ mdt_client_compatibility(info);
mdt_shrink_reply(info);
return rc;
}
void dump_lsm(int level, struct lov_stripe_md *lsm)
{
CDEBUG(level, "lsm %p, objid "LPX64", maxbytes "LPX64", magic 0x%08X, "
- "stripe_size %u, stripe_count %u pool "LOV_POOLNAMEF"\n", lsm,
+ "stripe_size %u, stripe_count %u, "
+ "layout_gen %u, pool ["LOV_POOLNAMEF"]\n", lsm,
lsm->lsm_object_id, lsm->lsm_maxbytes, lsm->lsm_magic,
lsm->lsm_stripe_size, lsm->lsm_stripe_count,
- lsm->lsm_pool_name);
+ lsm->lsm_layout_gen, lsm->lsm_pool_name);
}
#define LPDS sizeof(__u64)
CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lum->lmm_object_seq);
CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lum->lmm_stripe_size);
CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lum->lmm_stripe_count);
- CDEBUG(D_OTHER, "\tlmm_stripe_offset: %#x\n", lum->lmm_stripe_offset);
+ CDEBUG(D_OTHER, "\tlmm_stripe_offset/lmm_layout_gen: %#x\n",
+ lum->u.lum_stripe_offset);
}
static void lustre_swab_lov_user_md_common(struct lov_user_md_v1 *lum)
__swab64s(&lum->lmm_object_seq);
__swab32s(&lum->lmm_stripe_size);
__swab16s(&lum->lmm_stripe_count);
- __swab16s(&lum->lmm_stripe_offset);
+ __swab16s(&lum->u.lum_stripe_offset);
print_lum(lum);
EXIT;
}
__swab64s(&lmm->lmm_object_id);
__swab64s(&lmm->lmm_object_seq);
__swab32s(&lmm->lmm_stripe_size);
- __swab32s(&lmm->lmm_stripe_count);
+ __swab16s(&lmm->lmm_stripe_count);
+ __swab16s(&lmm->lmm_layout_gen);
EXIT;
}
{
/* Wire protocol assertions generated by 'wirecheck'
* (make -C lustre/utils newwiretest)
- * running on Linux RHEL5 2.6.18-238.9.1 #1 SMP i686 i386 GNU/Linux
- * with gcc version 4.1.1 20070105 (Red Hat 4.1.1-52) */
+ * running on Linux centos5 2.6.18-238.9.1.el5-head #2 SMP Wed Jun 29 18:35:58 CEST 2011 x86_
+ * with gcc version 4.1.2 20080704 (Red Hat 4.1.2-46) */
/* Constants... */
(long long)SEC_CTX_FINI);
LASSERTF(SEC_LAST_OPC == 804, "found %lld\n",
(long long)SEC_LAST_OPC);
+ LASSERTF(LDF_EMPTY == 1, " found %lld\n",
+ (long long)LDF_EMPTY);
+ LASSERTF(LDF_COLLIDE == 2, " found %lld\n",
+ (long long)LDF_COLLIDE);
+ LASSERTF(LU_PAGE_SIZE == 4096, " found %lld\n",
+ (long long)LU_PAGE_SIZE);
/* Sizes and Offsets */
/* Checks for struct obd_uuid */
(long long)(int)offsetof(struct obdo, o_gid_h));
LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_gid_h));
- LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, "found %lld\n",
+ LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_3));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, "found %lld\n",
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
LASSERTF((int)offsetof(struct obdo, o_padding_4) == 184, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_4));
(long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size));
LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 2, " found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count));
+ LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_layout_gen) == 30, "found %lld\n",
+ (long long)(int)offsetof(struct lov_mds_md_v1, lmm_layout_gen));
+ LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+ (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen));
LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_objects[0]) == 32, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0]));
LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_size));
LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_stripe_count) == 28, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v3, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 2, " found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count));
+ LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_layout_gen) == 30, "found %lld\n",
+ (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen));
+ LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+ (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen));
CLASSERT(LOV_MAXPOOLNAME == 16);
LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]) == 48, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]));
[ "$FSTYPE" != "ldiskfs" ] && skip "can not check trusted.fid FSTYPE=$FSTYPE" && return 0
# check the trusted.fid attribute of the OST objects of the file
- for (( i=0, j=19; i < ${lmm[8]}; i++, j+=4 )); do
+ for (( i=0, j=21; i < ${lmm[8]}; i++, j+=4 )); do
local obdidx=${lmm[$j]}
local devnum=$((obdidx + 1))
local objid=${lmm[$((j+1))]}
struct option long_opts[] = {
{"count", 0, 0, 'c'},
{"directory", 0, 0, 'd'},
+ {"generation", 0, 0, 'g'},
{"index", 0, 0, 'i'},
{"mdt", 0, 0, 'M'},
{"offset", 0, 0, 'o'},
param.maxdepth = 1;
optind = 0;
- while ((c = getopt_long(argc, argv, "cdhiMoO:pqrRsv",
+ while ((c = getopt_long(argc, argv, "cdghiMoO:pqrRsv",
long_opts, NULL)) != -1) {
switch (c) {
case 'O':
param.maxdepth = 0;
}
break;
+ case 'g':
+ if (!(param.verbose & VERBOSE_DETAIL)) {
+ param.verbose |= VERBOSE_GENERATION;
+ param.maxdepth = 0;
+ }
+ break;
case 'M':
param.get_mdt_index = 1;
break;
lum->lmm_pattern, nl);
}
+ if ((verbose & VERBOSE_GENERATION) && !is_dir) {
+ if (verbose & ~VERBOSE_GENERATION)
+ llapi_printf(LLAPI_MSG_NORMAL, "%slayout_gen: ",
+ prefix);
+ llapi_printf(LLAPI_MSG_NORMAL, "%u%c",
+ (int)lum->u.lum_layout_gen, nl);
+ }
+
if (verbose & VERBOSE_OFFSET) {
if (verbose & ~VERBOSE_OFFSET)
llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_offset: ",
/* Check if file is accepted. */
if (param->atime) {
ret = find_value_cmp(st->st_atime, param->atime,
- param->asign, param->exclude_atime,
+ param->asign, param->exclude_atime,
24 * 60 * 60, mds);
if (ret < 0)
return ret;
if (param->mtime) {
ret = find_value_cmp(st->st_mtime, param->mtime,
- param->msign, param->exclude_mtime,
+ param->msign, param->exclude_mtime,
24 * 60 * 60, mds);
if (ret < 0)
return ret;
{
/* Wire protocol assertions generated by 'wirecheck'
* (make -C lustre/utils newwiretest)
- * running on Linux RHEL5 2.6.18-238.9.1 #1 SMP i686 i386 GNU/Linux
- * with gcc version 4.1.1 20070105 (Red Hat 4.1.1-52) */
+ * running on Linux centos5 2.6.18-238.9.1.el5-head #2 SMP Wed Jun 29 18:35:58 CEST 2011 x86_
+ * with gcc version 4.1.2 20080704 (Red Hat 4.1.2-46) */
/* Constants... */
(long long)SEC_CTX_FINI);
LASSERTF(SEC_LAST_OPC == 804, "found %lld\n",
(long long)SEC_LAST_OPC);
+ LASSERTF(LDF_EMPTY == 1, " found %lld\n",
+ (long long)LDF_EMPTY);
+ LASSERTF(LDF_COLLIDE == 2, " found %lld\n",
+ (long long)LDF_COLLIDE);
+ LASSERTF(LU_PAGE_SIZE == 4096, " found %lld\n",
+ (long long)LU_PAGE_SIZE);
+
/* Sizes and Offsets */
/* Checks for struct obd_uuid */
(long long)(int)offsetof(struct obdo, o_gid_h));
LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_gid_h));
- LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, "found %lld\n",
+ LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_3));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, "found %lld\n",
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
LASSERTF((int)offsetof(struct obdo, o_padding_4) == 184, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_4));
(long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size));
LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 2, " found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count));
+ LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_layout_gen) == 30, "found %lld\n",
+ (long long)(int)offsetof(struct lov_mds_md_v1, lmm_layout_gen));
+ LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+ (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen));
LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_objects[0]) == 32, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0]));
LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_size));
LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_stripe_count) == 28, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v3, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 2, " found %lld\n",
(long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count));
+ LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_layout_gen) == 30, "found %lld\n",
+ (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen));
+ LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+ (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen));
CLASSERT(LOV_MAXPOOLNAME == 16);
LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]) == 48, "found %lld\n",
(long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]));
LASSERTF((int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location) == 16, "found %lld\n",
(long long)(int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location));
}
-