unsigned int sa_attr_flags;
unsigned int sa_valid;
int sa_stripe_index;
+ struct ost_layout sa_layout;
const struct lu_fid *sa_parent_fid;
} ci_setattr;
struct cl_data_version_io {
dst->f_ver = __be32_to_cpu(fid_ver(src));
}
+static inline void ost_layout_cpu_to_le(struct ost_layout *dst,
+ const struct ost_layout *src)
+{
+ dst->ol_stripe_size = __cpu_to_le32(src->ol_stripe_size);
+ dst->ol_stripe_count = __cpu_to_le32(src->ol_stripe_count);
+ dst->ol_comp_start = __cpu_to_le64(src->ol_comp_start);
+ dst->ol_comp_end = __cpu_to_le64(src->ol_comp_end);
+ dst->ol_comp_id = __cpu_to_le32(src->ol_comp_id);
+}
+
+static inline void ost_layout_le_to_cpu(struct ost_layout *dst,
+ const struct ost_layout *src)
+{
+ dst->ol_stripe_size = __le32_to_cpu(src->ol_stripe_size);
+ dst->ol_stripe_count = __le32_to_cpu(src->ol_stripe_count);
+ dst->ol_comp_start = __le64_to_cpu(src->ol_comp_start);
+ dst->ol_comp_end = __le64_to_cpu(src->ol_comp_end);
+ dst->ol_comp_id = __le32_to_cpu(src->ol_comp_id);
+}
+
static inline void filter_fid_cpu_to_le(struct filter_fid *dst,
const struct filter_fid *src, int size)
{
fid_cpu_to_le(&dst->ff_parent, &src->ff_parent);
+ if (size < sizeof(struct filter_fid))
+ memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+ else
+ ost_layout_cpu_to_le(&dst->ff_layout, &src->ff_layout);
+
/* XXX: Add more if filter_fid is enlarged in the future. */
}
{
fid_le_to_cpu(&dst->ff_parent, &src->ff_parent);
+ if (size < sizeof(struct filter_fid))
+ memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+ else
+ ost_layout_le_to_cpu(&dst->ff_layout, &src->ff_layout);
+
/* XXX: Add more if filter_fid is enlarged in the future. */
}
/** \defgroup lu_fid lu_fid
* @{ */
-/**
- * Flags for lustre_mdt_attrs::lma_compat and lustre_mdt_attrs::lma_incompat.
- * Deprecated since HSM and SOM attributes are now stored in separate on-disk
- * xattr.
- */
-enum lma_compat {
- LMAC_HSM = 0x00000001,
-/* LMAC_SOM = 0x00000002, obsolete since 2.8.0 */
- LMAC_NOT_IN_OI = 0x00000004, /* the object does NOT need OI mapping */
- LMAC_FID_ON_OST = 0x00000008, /* For OST-object, its OI mapping is
- * under /O/<seq>/d<x>. */
-};
-
-/**
- * Masks for all features that should be supported by a Lustre version to
- * access a specific file.
- * This information is stored in lustre_mdt_attrs::lma_incompat.
- */
-enum lma_incompat {
- LMAI_RELEASED = 0x00000001, /* file is released */
- LMAI_AGENT = 0x00000002, /* agent inode */
- LMAI_REMOTE_PARENT = 0x00000004, /* the parent of the object
- is on the remote MDT */
- LMAI_STRIPED = 0x00000008, /* striped directory inode */
- LMAI_ORPHAN = 0x00000010, /* inode is orphan */
- LMA_INCOMPAT_SUPP = (LMAI_AGENT | LMAI_REMOTE_PARENT | \
- LMAI_STRIPED | LMAI_ORPHAN)
-};
-
extern void lustre_lma_swab(struct lustre_mdt_attrs *lma);
extern void lustre_lma_init(struct lustre_mdt_attrs *lma,
const struct lu_fid *fid,
__u32 compat, __u32 incompat);
+extern void lustre_loa_swab(struct lustre_ost_attrs *loa,
+ bool to_cpu);
+extern void lustre_loa_init(struct lustre_ost_attrs *loa,
+ const struct lu_fid *fid,
+ __u32 compat, __u32 incompat);
/* copytool uses a 32b bitmask field to encode archive-Ids during register
* with MDT thru kuc.
struct lu_orphan_rec loe_rec;
};
+struct lu_orphan_rec_v2 {
+ struct lu_orphan_rec lor_rec;
+ struct ost_layout lor_layout;
+ __u32 lor_padding;
+};
+
+struct lu_orphan_ent_v2 {
+ /* The orphan OST-object's FID */
+ struct lu_fid loe_key;
+ struct lu_orphan_rec_v2 loe_rec;
+};
+
/** @} lu_fid */
/** \defgroup lu_dir lu_dir
executed */
#define OBD_MD_DEFAULT_MEA (0x0040000000000000ULL) /* default MEA */
+#define OBD_MD_FLOSTLAYOUT (0x0080000000000000ULL) /* contain ost_layout */
#define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \
__u32 o_parent_ver;
struct lustre_handle o_handle; /* brw: lock handle to prolong
* locks */
- struct llog_cookie o_lcookie; /* destroy: unlink cookie from
- * MDS, obsolete in 2.8 */
+ /* Originally, the field is llog_cookie for destroy with unlink cookie
+ * from MDS, it is obsolete in 2.8. Then reuse it by client to transfer
+ * layout and PFL information in IO, setattr RPCs. Since llog_cookie is
+ * not used on wire any longer, remove it from the obdo, then it can be
+ * enlarged freely in the further without affect related RPCs.
+ *
+ * sizeof(ost_layout) + sieof(__u32) == sizeof(llog_cookie). */
+ struct ost_layout o_layout;
+ __u32 o_padding_3;
__u32 o_uid_h;
__u32 o_gid_h;
__u32 lr_flags2;
struct lu_fid lr_fid;
struct lu_fid lr_fid2;
- struct lu_fid lr_fid3;
+ __u32 lr_comp_id;
+ __u32 lr_padding_0;
__u64 lr_padding_1;
__u64 lr_padding_2;
+ __u64 lr_padding_3;
};
struct lfsck_reply {
* parent MDT-object's layout EA. */
#define f_stripe_idx f_ver
-struct filter_fid {
- struct lu_fid ff_parent; /* ff_parent.f_ver == file stripe number */
-};
+struct ost_layout {
+ __u32 ol_stripe_size;
+ __u32 ol_stripe_count;
+ __u64 ol_comp_start;
+ __u64 ol_comp_end;
+ __u32 ol_comp_id;
+} __attribute__((packed));
/* keep this one for compatibility */
struct filter_fid_old {
__u64 ff_seq;
};
+struct filter_fid {
+ struct lu_fid ff_parent;
+ struct ost_layout ff_layout;
+} __attribute__((packed));
+
/* Userspace should treat lu_fid as opaque, and only use the following methods
* to print or parse them. Other functions (e.g. compare, swab) could be moved
* here from lustre_idl.h if needed. */
typedef struct lu_fid lustre_fid;
+enum lma_compat {
+ LMAC_HSM = 0x00000001,
+/* LMAC_SOM = 0x00000002, obsolete since 2.8.0 */
+ LMAC_NOT_IN_OI = 0x00000004, /* the object does NOT need OI mapping */
+ LMAC_FID_ON_OST = 0x00000008, /* For OST-object, its OI mapping is
+ * under /O/<seq>/d<x>. */
+ LMAC_STRIPE_INFO = 0x00000010, /* stripe info in the LMA EA. */
+ LMAC_COMP_INFO = 0x00000020, /* Component info in the LMA EA. */
+};
+
+/**
+ * Masks for all features that should be supported by a Lustre version to
+ * access a specific file.
+ * This information is stored in lustre_mdt_attrs::lma_incompat.
+ */
+enum lma_incompat {
+ LMAI_RELEASED = 0x00000001, /* file is released */
+ LMAI_AGENT = 0x00000002, /* agent inode */
+ LMAI_REMOTE_PARENT = 0x00000004, /* the parent of the object
+ is on the remote MDT */
+ LMAI_STRIPED = 0x00000008, /* striped directory inode */
+ LMAI_ORPHAN = 0x00000010, /* inode is orphan */
+ LMA_INCOMPAT_SUPP = (LMAI_AGENT | LMAI_REMOTE_PARENT | \
+ LMAI_STRIPED | LMAI_ORPHAN)
+};
+
+
/**
* Following struct for object attributes, that will be kept inode's EA.
* Introduced in 2.0 release (please see b15993, for details)
struct lu_fid lma_self_fid;
};
+struct lustre_ost_attrs {
+ /* Use lustre_mdt_attrs directly for now, need a common header
+ * structure if want to change lustre_mdt_attrs in future. */
+ struct lustre_mdt_attrs loa_lma;
+
+ /* Below five elements are for OST-object's PFID EA, the
+ * lma_parent_fid::f_ver is composed of the stripe_count (high 16 bits)
+ * and the stripe_index (low 16 bits), the size should not exceed
+ * 5 * sizeof(__u64)) to be accessable by old Lustre. If the flag
+ * LMAC_STRIPE_INFO is set, then loa_parent_fid and loa_stripe_size
+ * are valid; if the flag LMAC_COMP_INFO is set, then the next three
+ * loa_comp_* elements are valid. */
+ struct lu_fid loa_parent_fid;
+ __u32 loa_stripe_size;
+ __u32 loa_comp_id;
+ __u64 loa_comp_start;
+ __u64 loa_comp_end;
+};
+
/**
* Prior to 2.4, the LMA structure also included SOM attributes which has since
* been moved to a dedicated xattr
__u16 lrl_padding0;
__u32 lrl_padding1;
struct lu_fid lrl_fid;
- struct lu_fid lrl_fid2;
- struct lu_fid lrl_fid3;
+ struct filter_fid lrl_ff_client;
+ struct filter_fid lrl_ff_local;
};
typedef int (*lfsck_out_notify)(const struct lu_env *env, void *data,
#include <lustre/lustre_idl.h>
void lustre_swab_orphan_ent(struct lu_orphan_ent *ent);
+void lustre_swab_orphan_ent_v2(struct lu_orphan_ent_v2 *ent);
void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
void lustre_swab_connect(struct obd_connect_data *ocd);
void lustre_swab_hsm_user_state(struct hsm_user_state *hus);
struct dt_object *llr_child;
__u32 llr_ost_idx;
__u32 llr_lov_idx; /* offset in LOV EA */
+ __u32 llr_comp_id;
};
struct lfsck_assistant_operations {
struct lu_attr lti_la;
struct lu_attr lti_la2;
struct ost_id lti_oi;
- union {
- struct lustre_mdt_attrs lti_lma;
- /* old LMA for compatibility */
- char lti_lma_old[LMA_OLD_SIZE];
- };
+ struct lustre_ost_attrs lti_loa;
struct dt_object_format lti_dof;
/* There will be '\0' at the end of the name. */
char lti_key[sizeof(struct lu_dirent) + NAME_MAX + 1];
union ldlm_policy_data lti_policy;
struct ldlm_enqueue_info lti_einfo;
struct ldlm_res_id lti_resid;
- union {
- struct filter_fid_old lti_old_pfid;
- struct filter_fid lti_new_pfid;
- };
+ struct filter_fid lti_ff;
struct dt_allocation_hint lti_hint;
- struct lu_orphan_rec lti_rec;
+ struct lu_orphan_rec_v2 lti_rec;
struct lov_user_md lti_lum;
struct dt_insert_rec lti_dt_rec;
struct lu_object_conf lti_conf;
{
struct seq_server_site *ss = lfsck_dev_site(lfsck);
struct lu_seq_range *range = &lfsck_env_info(env)->lti_range;
- struct lustre_mdt_attrs *lma;
+ struct lustre_ost_attrs *loa;
int rc;
fld_range_set_any(range);
return 0;
}
- lma = &lfsck_env_info(env)->lti_lma;
- rc = dt_xattr_get(env, obj, lfsck_buf_get(env, lma, sizeof(*lma)),
+ loa = &lfsck_env_info(env)->lti_loa;
+ rc = dt_xattr_get(env, obj, lfsck_buf_get(env, loa, sizeof(*loa)),
XATTR_NAME_LMA);
- if (rc == sizeof(*lma)) {
- lustre_lma_swab(lma);
+ if (rc >= sizeof(struct lustre_mdt_attrs)) {
+ lustre_lma_swab(&loa->loa_lma);
- return lma->lma_compat & LMAC_FID_ON_OST ? 1 : 0;
+ return loa->loa_lma.lma_compat & LMAC_FID_ON_OST ? 1 : 0;
}
rc = dt_xattr_get(env, obj, &LU_BUF_NULL, XATTR_NAME_FID);
const struct lu_fid *pfid, __u32 offset)
{
struct dt_device *dev = lfsck_obj2dev(child);
- struct filter_fid *ff = &lfsck_env_info(env)->lti_new_pfid;
+ struct filter_fid *ff = &lfsck_env_info(env)->lti_ff;
struct thandle *handle;
struct lu_buf buf = { NULL };
int rc;
static int lfsck_layout_recreate_parent(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_tgt_desc *ltd,
- struct lu_orphan_rec *rec,
+ struct lu_orphan_rec_v2 *rec,
struct lu_fid *cfid,
const char *infix,
const char *type,
struct lu_attr *la = &info->lti_la2;
struct dt_object_format *dof = &info->lti_dof;
struct lfsck_instance *lfsck = com->lc_lfsck;
- struct lu_fid *pfid = &rec->lor_fid;
+ struct lu_fid *pfid = &rec->lor_rec.lor_fid;
struct lu_fid *tfid = &info->lti_fid3;
struct dt_device *dev = lfsck->li_bottom;
struct dt_object *lpf = lfsck->li_lpf_obj;
LASSERT(type != NULL);
memset(la, 0, sizeof(*la));
- la->la_uid = rec->lor_uid;
- la->la_gid = rec->lor_gid;
+ la->la_uid = rec->lor_rec.lor_uid;
+ la->la_gid = rec->lor_rec.lor_gid;
la->la_mode = S_IFREG | S_IRUSR;
la->la_valid = LA_MODE | LA_UID | LA_GID;
static int lfsck_layout_conflict_create(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_tgt_desc *ltd,
- struct lu_orphan_rec *rec,
+ struct lu_orphan_rec_v2 *rec,
struct dt_object *parent,
struct lu_fid *cfid,
struct lu_buf *ea_buf,
/* No need the layout lock on the original parent. */
lfsck_ibits_unlock(&lh, LCK_EX);
- fid_zero(&rec->lor_fid);
+ fid_zero(&rec->lor_rec.lor_fid);
snprintf(info->lti_tmpbuf, sizeof(info->lti_tmpbuf),
"-"DFID"-%x", PFID(lu_object_fid(&parent->do_lu)),
ea_off);
static int lfsck_layout_recreate_lovea(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_tgt_desc *ltd,
- struct lu_orphan_rec *rec,
+ struct lu_orphan_rec_v2 *rec,
struct dt_object *parent,
struct lu_fid *cfid,
__u32 ost_idx, __u32 ea_off)
static int lfsck_layout_scan_orphan_one(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_tgt_desc *ltd,
- struct lu_orphan_rec *rec,
+ struct lu_orphan_rec_v2 *rec,
struct lu_fid *cfid)
{
struct lfsck_layout *lo = com->lc_file_ram;
- struct lu_fid *pfid = &rec->lor_fid;
+ struct lu_fid *pfid = &rec->lor_rec.lor_fid;
struct dt_object *parent = NULL;
__u32 ea_off = pfid->f_stripe_idx;
int rc = 0;
do {
struct dt_key *key;
- struct lu_orphan_rec *rec = &info->lti_rec;
+ struct lu_orphan_rec_v2 *rec = &info->lti_rec;
if (CFS_FAIL_TIMEOUT(OBD_FAIL_LFSCK_DELAY3, cfs_fail_val) &&
unlikely(!thread_is_running(&lfsck->li_thread)))
__u32 ea_off, __u32 ost_idx, bool log)
{
struct lfsck_thread_info *info = lfsck_env_info(env);
- struct filter_fid *ff = &info->lti_new_pfid;
+ struct filter_fid *ff = &info->lti_ff;
struct dt_object_format *dof = &info->lti_dof;
struct lu_attr *la = &info->lti_la;
struct lfsck_instance *lfsck = com->lc_lfsck;
struct lu_attr *la)
{
struct lfsck_thread_info *info = lfsck_env_info(env);
- struct filter_fid *pfid = &info->lti_new_pfid;
+ struct filter_fid *pfid = &info->lti_ff;
struct dt_object *child = llr->llr_child;
struct dt_device *dev = lfsck_obj2dev(child);
const struct lu_fid *tfid = lu_object_fid(&parent->do_lu);
struct lfsck_assistant_object *lso = lar->lar_parent;
struct lfsck_layout *lo = com->lc_file_ram;
struct lfsck_thread_info *info = lfsck_env_info(env);
- struct filter_fid_old *pea = &info->lti_old_pfid;
+ struct filter_fid *pea = &info->lti_ff;
struct lu_fid *pfid = &info->lti_fid;
struct lu_buf buf = { NULL };
struct dt_object *parent = NULL;
if (rc != 0)
GOTO(out, rc);
- lfsck_buf_init(&buf, pea, sizeof(struct filter_fid_old));
+ lfsck_buf_init(&buf, pea, sizeof(struct filter_fid));
rc = dt_xattr_get(env, child, &buf, XATTR_NAME_FID);
- if (unlikely(rc > 0 && rc != sizeof(struct filter_fid_old) &&
- rc != sizeof(struct filter_fid))) {
+ if (unlikely(rc > 0 && rc < sizeof(struct lu_fid))) {
type = LLIT_UNMATCHED_PAIR;
goto repair;
}
lfsck_is_dead_obj(obj)))
GOTO(unlock, rc = 0);
- rc = __lfsck_layout_update_pfid(env, obj, &lrl->lrl_fid2,
- lrl->lrl_fid2.f_ver);
+ rc = __lfsck_layout_update_pfid(env, obj, &lrl->lrl_ff_client.ff_parent,
+ lrl->lrl_ff_client.ff_parent.f_ver);
GOTO(unlock, rc);
log:
CDEBUG(D_LFSCK, "%s: layout LFSCK slave repaired pfid for "DFID
", parent "DFID": rc = %d\n", lfsck_lfsck2name(com->lc_lfsck),
- PFID(&lrl->lrl_fid), PFID(&lrl->lrl_fid2), rc);
+ PFID(&lrl->lrl_fid), PFID(&lrl->lrl_ff_client.ff_parent), rc);
return rc;
}
__u16 count;
ENTRY;
- lfsck_buf_init(&buf, &info->lti_old_pfid,
- sizeof(struct filter_fid_old));
+ lfsck_buf_init(&buf, &info->lti_ff, sizeof(struct filter_fid));
count = le16_to_cpu(lmm->lmm_stripe_count);
/* Currently, we only support LOV_MAGIC_V1/LOV_MAGIC_V3 which has
* been verified in lfsck_layout_verify_header() already. If some
* local stored PFID xattr recognizes the OST-object, then it
* must be that the client given PFID is wrong. */
rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
- &lrl->lrl_fid3);
+ &lrl->lrl_ff_local.ff_parent);
if (rc <= 0)
RETURN(0);
* given PFID information recognizes the OST-object or not. If
* matches, then need to update the OST-object's PFID xattr. */
rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
- &lrl->lrl_fid2);
+ &lrl->lrl_ff_client.ff_parent);
/* For rc < 0 case:
* We are not sure whether the client given PFID information
* is correct or not, do nothing to avoid improper fixing.
struct lfsck_rbtree_node *loi_lrn;
struct lfsck_layout_slave_target *loi_llst;
struct lu_fid loi_key;
- struct lu_orphan_rec loi_rec;
+ struct lu_orphan_rec_v2 loi_rec;
__u64 loi_hash;
unsigned int loi_over:1;
};
struct dt_it *di)
{
struct lfsck_thread_info *info = lfsck_env_info(env);
- struct filter_fid_old *pfid = &info->lti_old_pfid;
+ struct filter_fid *pfid = &info->lti_ff;
struct lu_attr *la = &info->lti_la;
struct lfsck_orphan_it *it = (struct lfsck_orphan_it *)di;
struct lu_fid *key = &it->loi_key;
- struct lu_orphan_rec *rec = &it->loi_rec;
+ struct lu_orphan_rec_v2 *rec = &it->loi_rec;
struct lfsck_component *com = it->loi_com;
struct lfsck_instance *lfsck = com->lc_lfsck;
struct lfsck_layout_slave_data *llsd = com->lc_data;
} else if (idx == 0) {
/* If the orphan OST-object has no parent information,
* regard it as referenced by the MDT-object on MDT0. */
- fid_zero(&rec->lor_fid);
- rec->lor_uid = la->la_uid;
- rec->lor_gid = la->la_gid;
+ fid_zero(&rec->lor_rec.lor_fid);
+ rec->lor_rec.lor_uid = la->la_uid;
+ rec->lor_rec.lor_gid = la->la_gid;
GOTO(out, rc = 0);
}
goto again1;
}
- if (rc < 0)
- GOTO(out, rc);
-
- if (rc != sizeof(struct filter_fid) &&
- rc != sizeof(struct filter_fid_old))
- GOTO(out, rc = -EINVAL);
+ if (rc < sizeof(struct lu_fid))
+ GOTO(out, rc = (rc < 0 ? rc : -EINVAL));
- fid_le_to_cpu(&rec->lor_fid, &pfid->ff_parent);
+ fid_le_to_cpu(&rec->lor_rec.lor_fid, &pfid->ff_parent);
/* Currently, the filter_fid::ff_parent::f_ver is not the real parent
* MDT-object's FID::f_ver, instead it is the OST-object index in its
* parent MDT-object's layout EA. */
- save = rec->lor_fid.f_stripe_idx;
- rec->lor_fid.f_ver = 0;
- rc = lfsck_fid_match_idx(env, lfsck, &rec->lor_fid, idx);
+ save = rec->lor_rec.lor_fid.f_stripe_idx;
+ rec->lor_rec.lor_fid.f_ver = 0;
+ rc = lfsck_fid_match_idx(env, lfsck, &rec->lor_rec.lor_fid, idx);
/* If the orphan OST-object does not claim the MDT, then next.
*
* If we do not know whether it matches or not, then return it
goto again1;
}
- rec->lor_fid.f_stripe_idx = save;
- rec->lor_uid = la->la_uid;
- rec->lor_gid = la->la_gid;
+ rec->lor_rec.lor_fid.f_stripe_idx = save;
+ rec->lor_rec.lor_uid = la->la_uid;
+ rec->lor_rec.lor_gid = la->la_gid;
CDEBUG(D_LFSCK, "%s: return orphan "DFID", PFID "DFID", owner %u:%u\n",
- lfsck_lfsck2name(com->lc_lfsck), PFID(key), PFID(&rec->lor_fid),
- rec->lor_uid, rec->lor_gid);
+ lfsck_lfsck2name(com->lc_lfsck), PFID(key),
+ PFID(&rec->lor_rec.lor_fid), rec->lor_rec.lor_uid,
+ rec->lor_rec.lor_gid);
GOTO(out, rc = 0);
{
struct lfsck_orphan_it *it = (struct lfsck_orphan_it *)di;
- *(struct lu_orphan_rec *)rec = it->loi_rec;
+ *(struct lu_orphan_rec_v2 *)rec = it->loi_rec;
return 0;
}
struct lustre_cfg lti_lustre_cfg;
/* used to store parent default striping in create */
struct lod_default_striping lti_def_striping;
+ struct filter_fid lti_ff;
};
extern const struct lu_device_operations lod_lu_ops;
int stripe_idx,
struct lod_obj_stripe_cb_data *data)
{
- struct lod_thread_info *info = lod_env_info(env);
- struct dt_object *obj = &lo->ldo_obj;
- struct lu_buf *buf = &info->lti_buf;
- struct filter_fid *ff = buf->lb_buf;
+ struct lod_thread_info *info = lod_env_info(env);
+ struct filter_fid *ff = &info->lti_ff;
+ struct lu_buf *buf = &info->lti_buf;
int rc;
+ buf->lb_buf = ff;
+ buf->lb_len = sizeof(*ff);
rc = dt_xattr_get(env, dt, buf, XATTR_NAME_FID);
- if (rc < 0)
+ if (rc == -ENODATA)
return 0;
- fid_le_to_cpu(&ff->ff_parent, &ff->ff_parent);
- ff->ff_parent.f_seq = lu_object_fid(&obj->do_lu)->f_seq;
- ff->ff_parent.f_oid = lu_object_fid(&obj->do_lu)->f_oid;
- fid_cpu_to_le(&ff->ff_parent, &ff->ff_parent);
+ if (rc < 0)
+ return rc;
+ ff->ff_parent = *lu_object_fid(&lo->ldo_obj.do_lu);
+ ff->ff_parent.f_ver = stripe_idx;
+ fid_cpu_to_le(&ff->ff_parent, &ff->ff_parent);
if (data->locd_declare)
rc = lod_sub_object_declare_xattr_set(env, dt, buf,
XATTR_NAME_FID,
return container_of0(lov, struct obd_device, u.lov);
}
+static inline void lov_lsm2layout(struct lov_stripe_md *lsm,
+ struct lov_stripe_md_entry *lsme,
+ struct ost_layout *ol)
+{
+ ol->ol_stripe_size = lsme->lsme_stripe_size;
+ ol->ol_stripe_count = lsme->lsme_stripe_count;
+ if (lsm->lsm_magic == LOV_MAGIC_COMP_V1) {
+ ol->ol_comp_start = lsme->lsme_extent.e_start;
+ ol->ol_comp_end = lsme->lsme_extent.e_end;
+ ol->ol_comp_id = lsme->lsme_id;
+ } else {
+ ol->ol_comp_start = 0;
+ ol->ol_comp_end = 0;
+ ol->ol_comp_id = 0;
+ }
+}
#endif
stripe);
io->u.ci_setattr.sa_attr.lvb_size = new_size;
}
+ lov_lsm2layout(lsm, lsm->lsm_entries[index],
+ &io->u.ci_setattr.sa_layout);
break;
}
case CIT_DATA_VERSION: {
struct cl_req_attr *attr)
{
struct lovsub_object *subobj = cl2lovsub(obj);
-
+ struct lov_stripe_md *lsm = subobj->lso_super->lo_lsm;
ENTRY;
cl_req_attr_set(env, &subobj->lso_super->lo_cl, attr);
* unconditionally. It never changes anyway.
*/
attr->cra_oa->o_stripe_idx = lov_comp_stripe(subobj->lso_index);
+ lov_lsm2layout(lsm, lsm->lsm_entries[lov_comp_entry(subobj->lso_index)],
+ &attr->cra_oa->o_layout);
+ attr->cra_oa->o_valid |= OBD_MD_FLOSTLAYOUT;
EXIT;
}
.dif_flags = 0,
.dif_keysize_min = sizeof(struct lu_fid),
.dif_keysize_max = sizeof(struct lu_fid),
- .dif_recsize_min = sizeof(struct lu_orphan_rec),
- .dif_recsize_max = sizeof(struct lu_orphan_rec),
+ .dif_recsize_min = sizeof(struct lu_orphan_rec_v2),
+ .dif_recsize_max = sizeof(struct lu_orphan_rec_v2),
.dif_ptrsize = 4
};
EXPORT_SYMBOL(dt_lfsck_layout_orphan_features);
LASSERT(sizeof(*lma) ==
(offsetof(struct lustre_mdt_attrs, lma_self_fid) +
sizeof(lma->lma_self_fid)));
-};
+}
EXPORT_SYMBOL(lustre_lma_init);
/**
__swab32s(&lma->lma_incompat);
lustre_swab_lu_fid(&lma->lma_self_fid);
#endif
-};
+}
EXPORT_SYMBOL(lustre_lma_swab);
+void lustre_loa_init(struct lustre_ost_attrs *loa, const struct lu_fid *fid,
+ __u32 compat, __u32 incompat)
+{
+ CLASSERT(sizeof(*loa) == LMA_OLD_SIZE);
+
+ memset(&loa->loa_parent_fid, 0,
+ sizeof(*loa) - offsetof(typeof(*loa), loa_parent_fid));
+ lustre_lma_init(&loa->loa_lma, fid, compat, incompat);
+}
+EXPORT_SYMBOL(lustre_loa_init);
+
+/**
+ * Swab, if needed, LOA (for OST-object only) structure with LMA EA and PFID EA
+ * combined together are stored on-disk in little-endian order.
+ *
+ * \param[in] loa - the pointer to the LOA structure to be swabbed.
+ * \param[in] to_cpu - to indicate swab for CPU order or not.
+ */
+void lustre_loa_swab(struct lustre_ost_attrs *loa, bool to_cpu)
+{
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+#ifdef __BIG_ENDIAN
+ __u32 compat = lma->lma_compat;
+#endif
+
+ lustre_lma_swab(lma);
+#ifdef __BIG_ENDIAN
+ if (to_cpu)
+ compat = lma->lma_compat;
+
+ if (compat & LMAC_STRIPE_INFO) {
+ lustre_swab_lu_fid(&loa->loa_parent_fid);
+ __swab32s(&loa->loa_stripe_size);
+ }
+ if (compat & LMAC_COMP_INFO) {
+ __swab32s(&loa->loa_comp_id);
+ __swab64s(&loa->loa_comp_start);
+ __swab64s(&loa->loa_comp_end);
+ }
+#endif
+}
+EXPORT_SYMBOL(lustre_loa_swab);
+
/**
* Swab, if needed, HSM structure which is stored on-disk in little-endian
* order.
__swab64s(&attrs->hsm_arch_id);
__swab64s(&attrs->hsm_arch_ver);
#endif
-};
+}
/*
* Swab and extract HSM attributes from on-disk xattr.
struct lu_attr fti_attr;
struct lu_attr fti_attr2;
struct ldlm_res_id fti_resid;
- union {
- struct filter_fid fti_mds_fid;
- struct filter_fid_old fti_mds_fid_old;
- };
+ struct filter_fid fti_mds_fid;
struct ost_id fti_ostid;
struct ofd_object *fti_obj;
union {
/* XXX: we are ignoring o_parent_ver here, since this should
* be the same for all objects in this fileset. */
ff->ff_parent.f_ver = cpu_to_le32(oa->o_stripe_idx);
+ if (oa->o_valid & OBD_MD_FLOSTLAYOUT)
+ ost_layout_cpu_to_le(&ff->ff_layout, &oa->o_layout);
+ else
+ memset(&ff->ff_layout, 0, sizeof(ff->ff_layout));
}
static inline int ofd_validate_seq(struct obd_export *exp, __u64 seq)
LASSERT(!fo->ofo_pfid_verified);
lrl->lrl_fid = fo->ofo_header.loh_fid; /* OST-object itself FID. */
- lrl->lrl_fid2 = client_ff->ff_parent; /* client given PFID. */
- lrl->lrl_fid3 = local_ff->ff_parent; /* OST local stored PFID. */
+ lrl->lrl_ff_client = *client_ff; /* client given PFID. */
+ lrl->lrl_ff_local = *local_ff; /* OST local stored PFID. */
rc = lfsck_in_notify_local(env, ofd->ofd_osd, lrl, NULL);
ofd_write_lock(env, fo);
ff->ff_parent.f_seq = oa->o_parent_seq;
ff->ff_parent.f_oid = oa->o_parent_oid;
ff->ff_parent.f_stripe_idx = oa->o_stripe_idx;
+ ff->ff_layout = oa->o_layout;
spin_lock(&ofd->ofd_inconsistency_lock);
if (fo->ofo_pfid_checking || fo->ofo_pfid_verified) {
oa->o_oi = loi->loi_oi;
obdo_set_parent_fid(oa, io->u.ci_setattr.sa_parent_fid);
oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index;
- oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
+ oa->o_layout = io->u.ci_setattr.sa_layout;
+ oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
+ OBD_MD_FLOSTLAYOUT;
if (ia_valid & ATTR_CTIME) {
oa->o_valid |= OBD_MD_FLCTIME;
oa->o_ctime = attr->cat_ctime;
{
struct osd_mdobj_map *omm = osd->od_mdt_map;
struct osd_thread_info *oti = osd_oti_get(env);
- struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &oti->oti_ost_attrs.loa_lma;
char *name = oti->oti_name;
struct osd_thread_info *info = osd_oti_get(env);
struct dentry *dentry;
/* Set REMOTE_PARENT in lma, so other process like unlink or lfsck
* can identify this object quickly */
- rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
- if (rc != 0)
+ rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry,
+ &oti->oti_ost_attrs);
+ if (rc)
RETURN(rc);
lma->lma_incompat |= LMAI_REMOTE_PARENT;
lustre_lma_swab(lma);
rc = __osd_xattr_set(oti, obj->oo_inode, XATTR_NAME_LMA, lma,
sizeof(*lma), XATTR_REPLACE);
- if (rc != 0)
+ if (rc)
RETURN(rc);
parent = omm->omm_remote_parent;
{
struct osd_mdobj_map *omm = osd->od_mdt_map;
struct osd_thread_info *oti = osd_oti_get(env);
- struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &oti->oti_ost_attrs.loa_lma;
char *name = oti->oti_name;
struct dentry *dentry;
struct dentry *parent;
int rc;
/* Check lma to see whether it is remote object */
- rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
+ rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry,
+ &oti->oti_ost_attrs);
if (rc != 0) {
/* No LMA if the directory is created before 2.0 */
if (rc == -ENODATA)
struct inode *inode;
struct dentry *dentry = &info->oti_obj_dentry;
struct osd_inode_id *oi_id = &info->oti_id3;
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
struct lu_fid *oi_fid = &lma->lma_self_fid;
int rc;
ENTRY;
goto update;
}
- rc = osd_get_lma(info, inode, dentry, lma);
+ rc = osd_get_lma(info, inode, dentry, &info->oti_ost_attrs);
if (rc == -ENODATA) {
rc = osd_get_idif(info, inode, dentry, oi_fid);
if (rc > 0 || rc == -ENODATA) {
#include <lustre_linkea.h>
+#define PFID_STRIPE_IDX_BITS 16
+#define PFID_STRIPE_COUNT_MASK ((1 << PFID_STRIPE_IDX_BITS) - 1)
+
int ldiskfs_pdo = 1;
module_param(ldiskfs_pdo, int, 0644);
MODULE_PARM_DESC(ldiskfs_pdo, "ldiskfs with parallel directory operations");
}
int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
- struct dentry *dentry, struct lustre_mdt_attrs *lma)
+ struct dentry *dentry, struct lustre_ost_attrs *loa)
{
int rc;
- CLASSERT(LMA_OLD_SIZE >= sizeof(*lma));
rc = __osd_xattr_get(inode, dentry, XATTR_NAME_LMA,
- info->oti_mdt_attrs_old, LMA_OLD_SIZE);
+ (void *)loa, sizeof(*loa));
if (rc > 0) {
- if ((void *)lma != (void *)info->oti_mdt_attrs_old)
- memcpy(lma, info->oti_mdt_attrs_old, sizeof(*lma));
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+
+ if (rc < sizeof(*lma))
+ return -EINVAL;
+
rc = 0;
- lustre_lma_swab(lma);
+ lustre_loa_swab(loa, true);
/* Check LMA compatibility */
if (lma->lma_incompat & ~LMA_INCOMPAT_SUPP) {
CWARN("%.16s: unsupported incompat LMA feature(s) %#x "
rc = __ldiskfs_add_entry(handle, child, inode, hlock);
if (rc == -ENOBUFS || rc == -ENOSPC) {
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
struct inode *parent = child->d_parent->d_inode;
struct lu_fid *fid = NULL;
- rc2 = osd_get_lma(info, parent, child->d_parent, lma);
- if (rc2 == 0) {
- fid = &lma->lma_self_fid;
+ rc2 = osd_get_lma(info, parent, child->d_parent, loa);
+ if (!rc2) {
+ fid = &loa->loa_lma.lma_self_fid;
} else if (rc2 == -ENODATA) {
if (unlikely(parent == inode->i_sb->s_root->d_inode)) {
fid = &info->oti_fid3;
osd_iget_fid(struct osd_thread_info *info, struct osd_device *dev,
struct osd_inode_id *id, struct lu_fid *fid)
{
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
- struct inode *inode;
- int rc;
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+ struct inode *inode;
+ int rc;
inode = osd_iget(info, dev, id);
if (IS_ERR(inode))
return inode;
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
- if (rc == 0) {
- *fid = lma->lma_self_fid;
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+ if (!rc) {
+ *fid = loa->loa_lma.lma_self_fid;
} else if (rc == -ENODATA) {
if (unlikely(inode == osd_sb(dev)->s_root->d_inode))
lu_local_obj_fid(fid, OSD_FS_ROOT_OID);
{
struct osd_thread_info *info = osd_oti_get(env);
struct osd_device *osd = osd_obj2dev(obj);
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
struct inode *inode = obj->oo_inode;
struct dentry *dentry = &info->oti_obj_dentry;
struct lu_fid *fid = NULL;
int rc;
ENTRY;
- CLASSERT(LMA_OLD_SIZE >= sizeof(*lma));
rc = __osd_xattr_get(inode, dentry, XATTR_NAME_LMA,
- info->oti_mdt_attrs_old, LMA_OLD_SIZE);
+ (void *)loa, sizeof(*loa));
if (rc == -ENODATA && !fid_is_igif(rfid) && osd->od_check_ff) {
fid = &lma->lma_self_fid;
rc = osd_get_idif(info, inode, dentry, fid);
obj->oo_dt.do_body_ops = &osd_body_ops_new;
if (result == 0 && obj->oo_inode != NULL) {
struct osd_thread_info *oti = osd_oti_get(env);
- struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
+ struct lustre_ost_attrs *loa = &oti->oti_ost_attrs;
osd_object_init0(obj);
result = osd_get_lma(oti, obj->oo_inode,
- &oti->oti_obj_dentry, lma);
- if (result == 0) {
+ &oti->oti_obj_dentry, loa);
+ if (!result) {
/* Convert LMAI flags to lustre LMA flags
* and cache it to oo_lma_flags */
obj->oo_lma_flags =
- lma_to_lustre_flags(lma->lma_incompat);
+ lma_to_lustre_flags(loa->loa_lma.lma_incompat);
} else if (result == -ENODATA) {
result = 0;
}
/* Let's check if there are extra flags need to be set into LMA */
if (attr->la_flags & LUSTRE_LMA_FL_MASKS) {
struct osd_thread_info *info = osd_oti_get(env);
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
- if (rc != 0)
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+ &info->oti_ost_attrs);
+ if (rc)
GOTO(out, rc);
lma->lma_incompat |=
int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
const struct lu_fid *fid, __u32 compat, __u32 incompat)
{
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
- int rc;
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+ int rc;
ENTRY;
if (OBD_FAIL_CHECK(OBD_FAIL_FID_INLMA))
if (OBD_FAIL_CHECK(OBD_FAIL_OSD_OST_EA_FID_SET))
rc = -ENOMEM;
- lustre_lma_init(lma, fid, compat, incompat);
- lustre_lma_swab(lma);
-
- rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma, sizeof(*lma),
- XATTR_CREATE);
+ lustre_loa_init(loa, fid, compat, incompat);
+ lustre_loa_swab(loa, false);
+
+ /* For the OST device with 256 bytes inode size by default,
+ * the PFID EA will be stored together with LMA EA to avoid
+ * performance trouble. Otherwise the PFID EA can be stored
+ * independently. LU-8998 */
+ if ((compat & LMAC_FID_ON_OST) &&
+ LDISKFS_INODE_SIZE(inode->i_sb) <= 256)
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+ sizeof(*loa), XATTR_CREATE);
+ else
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+ sizeof(*lma), XATTR_CREATE);
/* LMA may already exist, but we need to check that all the
* desired compat/incompat flags have been added. */
if (unlikely(rc == -EEXIST)) {
- if (compat == 0 && incompat == 0)
- RETURN(0);
-
rc = __osd_xattr_get(inode, &info->oti_obj_dentry,
- XATTR_NAME_LMA, info->oti_mdt_attrs_old,
- LMA_OLD_SIZE);
- if (rc <= 0)
+ XATTR_NAME_LMA, (void *)loa, sizeof(*loa));
+ if (rc < 0)
+ RETURN(rc);
+
+ if (rc < sizeof(*lma))
RETURN(-EINVAL);
- lustre_lma_swab(lma);
- if (!(~lma->lma_compat & compat) &&
- !(~lma->lma_incompat & incompat))
+ lustre_loa_swab(loa, true);
+ if (lu_fid_eq(fid, &lma->lma_self_fid) &&
+ ((compat == 0 && incompat == 0) ||
+ (!(~lma->lma_compat & compat) &&
+ !(~lma->lma_incompat & incompat))))
RETURN(0);
+ lma->lma_self_fid = *fid;
lma->lma_compat |= compat;
lma->lma_incompat |= incompat;
- lustre_lma_swab(lma);
- rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
- sizeof(*lma), XATTR_REPLACE);
+ if (rc == sizeof(*lma)) {
+ lustre_lma_swab(lma);
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+ sizeof(*lma), XATTR_REPLACE);
+ } else {
+ lustre_loa_swab(loa, false);
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+ sizeof(*loa), XATTR_REPLACE);
+ }
}
RETURN(rc);
}
/*
- * Get the 64-bit version for an inode.
- */
-static int osd_object_version_get(const struct lu_env *env,
- struct dt_object *dt, dt_obj_version_t *ver)
-{
- struct inode *inode = osd_dt_obj(dt)->oo_inode;
-
- CDEBUG(D_INODE, "Get version %#llx for inode %lu\n",
- LDISKFS_I(inode)->i_fs_version, inode->i_ino);
- *ver = LDISKFS_I(inode)->i_fs_version;
- return 0;
-}
-
-/*
* Concurrency: @dt is read locked.
*/
static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
bool cache_xattr = false;
int rc;
+ LASSERT(buf);
+
/* version get is not real XATTR but uses xattr API */
if (strcmp(name, XATTR_NAME_VERSION) == 0) {
+ dt_obj_version_t *ver = buf->lb_buf;
+
/* for version we are just using xattr API but change inode
* field instead */
if (buf->lb_len == 0)
if (buf->lb_len < sizeof(dt_obj_version_t))
return -ERANGE;
- osd_object_version_get(env, dt, buf->lb_buf);
+ CDEBUG(D_INODE, "Get version %#llx for inode %lu\n",
+ LDISKFS_I(inode)->i_fs_version, inode->i_ino);
+
+ *ver = LDISKFS_I(inode)->i_fs_version;
return sizeof(dt_obj_version_t);
}
}
rc = __osd_xattr_get(inode, dentry, name, buf->lb_buf, buf->lb_len);
+ if (rc == -ENODATA && strcmp(name, XATTR_NAME_FID) == 0) {
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+ struct filter_fid *ff;
+ struct ost_layout *ol;
+
+ LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+ if (rc)
+ return rc;
+
+ if (!(lma->lma_compat & LMAC_STRIPE_INFO)) {
+ rc = -ENODATA;
+ goto cache;
+ }
+
+ rc = sizeof(*ff);
+ if (buf->lb_len == 0 || !buf->lb_buf)
+ return rc;
+
+ if (buf->lb_len < rc)
+ return -ERANGE;
+
+ ff = buf->lb_buf;
+ ol = &ff->ff_layout;
+ ol->ol_stripe_count = cpu_to_le32(loa->loa_parent_fid.f_ver >>
+ PFID_STRIPE_IDX_BITS);
+ ol->ol_stripe_size = cpu_to_le32(loa->loa_stripe_size);
+ loa->loa_parent_fid.f_ver &= PFID_STRIPE_COUNT_MASK;
+ fid_cpu_to_le(&ff->ff_parent, &loa->loa_parent_fid);
+ if (lma->lma_compat & LMAC_COMP_INFO) {
+ ol->ol_comp_start = cpu_to_le64(loa->loa_comp_start);
+ ol->ol_comp_end = cpu_to_le64(loa->loa_comp_end);
+ ol->ol_comp_id = cpu_to_le32(loa->loa_comp_id);
+ } else {
+ ol->ol_comp_start = 0;
+ ol->ol_comp_end = 0;
+ ol->ol_comp_id = 0;
+ }
+ }
+
+cache:
if (cache_xattr) {
if (rc == -ENOENT || rc == -ENODATA)
osd_oxc_add(obj, name, NULL, 0);
int fl, struct thandle *handle)
{
struct osd_thandle *oh;
- int credits;
+ int credits = 0;
struct super_block *sb = osd_sb(osd_dev(dt->do_lu.lo_dev));
LASSERT(handle != NULL);
/* For non-upgrading case, the LMA is set first and
* usually fit inode. But for upgrade case, the LMA
* may be in another separated EA block. */
- if (!dt_object_exists(dt))
- credits = 0;
- else if (fl == LU_XATTR_REPLACE)
- credits = 1;
- else
- goto upgrade;
+ if (dt_object_exists(dt)) {
+ if (fl == LU_XATTR_REPLACE)
+ credits = 1;
+ else
+ goto upgrade;
+ }
} else if (strcmp(name, XATTR_NAME_VERSION) == 0) {
credits = 1;
+ } else if (strcmp(name, XATTR_NAME_FID) == 0) {
+ /* We may need to delete the old PFID EA. */
+ credits = LDISKFS_MAXQUOTAS_DEL_BLOCKS(sb);
+ if (fl == LU_XATTR_REPLACE)
+ credits += 1;
+ else
+ goto upgrade;
} else {
+
upgrade:
- credits = osd_dto_credits_noquota[DTO_XATTR_SET];
+ credits += osd_dto_credits_noquota[DTO_XATTR_SET];
if (buf != NULL) {
ssize_t buflen;
}
/*
- * Set the 64-bit version for object
- */
-static void osd_object_version_set(const struct lu_env *env,
- struct dt_object *dt,
- dt_obj_version_t *new_version)
-{
- struct inode *inode = osd_dt_obj(dt)->oo_inode;
-
- CDEBUG(D_INODE, "Set version %#llx (old %#llx) for inode %lu\n",
- *new_version, LDISKFS_I(inode)->i_fs_version, inode->i_ino);
-
- LDISKFS_I(inode)->i_fs_version = *new_version;
- /** Version is set after all inode operations are finished,
- * so we should mark it dirty here */
- ll_dirty_inode(inode, I_DIRTY_DATASYNC);
-}
-
-/*
* Concurrency: @dt is write locked.
*/
static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
const struct lu_buf *buf, const char *name, int fl,
struct thandle *handle)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct inode *inode = obj->oo_inode;
- struct osd_thread_info *info = osd_oti_get(env);
- int fs_flags = 0;
- int rc;
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct inode *inode = obj->oo_inode;
+ struct osd_thread_info *info = osd_oti_get(env);
+ struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+ int fs_flags = 0;
+ int len;
+ int rc;
ENTRY;
- LASSERT(handle != NULL);
+ LASSERT(handle);
+ LASSERT(buf);
/* version set is not real XATTR */
if (strcmp(name, XATTR_NAME_VERSION) == 0) {
+ dt_obj_version_t *version = buf->lb_buf;
+
/* for version we are just using xattr API but change inode
* field instead */
LASSERT(buf->lb_len == sizeof(dt_obj_version_t));
- osd_object_version_set(env, dt, buf->lb_buf);
- return sizeof(dt_obj_version_t);
+
+ CDEBUG(D_INODE, "Set version %#llx (old %#llx) for inode %lu\n",
+ *version, LDISKFS_I(inode)->i_fs_version, inode->i_ino);
+
+ LDISKFS_I(inode)->i_fs_version = *version;
+ /* Version is set after all inode operations are finished,
+ * so we should mark it dirty here */
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
+
+ RETURN(0);
}
CDEBUG(D_INODE, DFID" set xattr '%s' with size %zu\n",
PFID(lu_object_fid(&dt->do_lu)), name, buf->lb_len);
+ len = buf->lb_len;
osd_trans_exec_op(env, handle, OSD_OT_XATTR_SET);
if (fl & LU_XATTR_REPLACE)
fs_flags |= XATTR_REPLACE;
if (fl & LU_XATTR_CREATE)
fs_flags |= XATTR_CREATE;
- if (strcmp(name, XATTR_NAME_LMV) == 0) {
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ /* For the OST device with 256 bytes inode size by default,
+ * the PFID EA will be stored together with LMA EA to avoid
+ * performance trouble. Otherwise the PFID EA can be stored
+ * independently. LU-8998 */
+ if (strcmp(name, XATTR_NAME_FID) == 0 &&
+ LDISKFS_INODE_SIZE(inode->i_sb) <= 256) {
+ struct dentry *dentry = &info->oti_obj_dentry;
+ struct filter_fid *ff;
+ struct ost_layout *ol;
+ int fl;
+
+ LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+ ff = buf->lb_buf;
+ ol = &ff->ff_layout;
+ /* Old client does not send stripe information, store
+ * the PFID EA on disk directly. */
+ if (buf->lb_len == sizeof(struct lu_fid) ||
+ ol->ol_stripe_size == 0) {
+ len = sizeof(struct lu_fid);
+ goto set;
+ }
+
+ if (buf->lb_len != sizeof(*ff))
+ RETURN(-EINVAL);
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
- if (rc != 0)
+ rc = osd_get_lma(info, inode, dentry, loa);
+ if (unlikely(rc == -ENODATA)) {
+ /* Usually for upgarding from old device */
+ lustre_loa_init(loa, lu_object_fid(&dt->do_lu),
+ LMAC_FID_ON_OST, 0);
+ fl = XATTR_CREATE;
+ } else if (rc) {
+ RETURN(rc);
+ } else {
+ fl = XATTR_REPLACE;
+ }
+
+ fid_le_to_cpu(&loa->loa_parent_fid, &ff->ff_parent);
+ loa->loa_parent_fid.f_ver |= le32_to_cpu(ol->ol_stripe_count) <<
+ PFID_STRIPE_IDX_BITS;
+ loa->loa_stripe_size = le32_to_cpu(ol->ol_stripe_size);
+ lma->lma_compat |= LMAC_STRIPE_INFO;
+ if (ol->ol_comp_id != 0) {
+ loa->loa_comp_id = le32_to_cpu(ol->ol_comp_id);
+ loa->loa_comp_start = le64_to_cpu(ol->ol_comp_start);
+ loa->loa_comp_end = le64_to_cpu(ol->ol_comp_end);
+ lma->lma_compat |= LMAC_COMP_INFO;
+ }
+
+ lustre_loa_swab(loa, false);
+
+ /* Remove old PFID EA entry firstly. */
+ ll_vfs_dq_init(inode);
+ rc = inode->i_op->removexattr(dentry, name);
+ if (rc && rc != -ENODATA)
+ RETURN(rc);
+
+ /* Store the PFID EA inside the LMA EA. */
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+ sizeof(*loa), fl);
+
+ RETURN(rc);
+ } else if (strcmp(name, XATTR_NAME_LMV) == 0) {
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+ if (rc)
RETURN(rc);
lma->lma_incompat |= LMAI_STRIPED;
RETURN(rc);
}
- rc = __osd_xattr_set(info, inode, name, buf->lb_buf, buf->lb_len,
- fs_flags);
+set:
+ rc = __osd_xattr_set(info, inode, name, buf->lb_buf, len, fs_flags);
osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
if (rc == 0 &&
dentry->d_inode = inode;
dentry->d_sb = inode->i_sb;
rc = inode->i_op->removexattr(dentry, name);
+ if (rc == -ENODATA && strcmp(name, XATTR_NAME_FID) == 0) {
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
+
+ LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+ &info->oti_ost_attrs);
+ if (!rc) {
+ if (!(lma->lma_compat & LMAC_STRIPE_INFO)) {
+ rc = -ENODATA;
+ goto out;
+ }
+
+ lma->lma_compat &= ~(LMAC_STRIPE_INFO | LMAC_COMP_INFO);
+ lustre_lma_swab(lma);
+ rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+ sizeof(*lma), XATTR_REPLACE);
+ }
+ }
+
+out:
osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
if (rc == 0 &&
struct osd_idmap_cache *oic,
struct lu_fid *fid, __u32 ino)
{
- struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
- struct inode *inode;
- int rc;
+ struct lustre_ost_attrs *loa = &oti->oti_ost_attrs;
+ struct inode *inode;
+ int rc;
osd_id_gen(&oic->oic_lid, ino, OSD_OII_NOGEN);
inode = osd_iget(oti, dev, &oic->oic_lid);
return PTR_ERR(inode);
}
- rc = osd_get_lma(oti, inode, &oti->oti_obj_dentry, lma);
+ rc = osd_get_lma(oti, inode, &oti->oti_obj_dentry, loa);
iput(inode);
if (rc != 0)
fid_zero(&oic->oic_fid);
else
- *fid = oic->oic_fid = lma->lma_self_fid;
+ *fid = oic->oic_fid = loa->loa_lma.lma_self_fid;
return rc;
}
struct osd_inode_id *id, __u32 *attr)
{
struct osd_thread_info *info = osd_oti_get(env);
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
struct osd_device *dev = osd_obj2dev(obj);
struct super_block *sb = osd_sb(dev);
const char *devname = osd_name(dev);
dentry = osd_child_dentry_by_inode(env, dir, ent->oied_name,
ent->oied_namelen);
- rc = osd_get_lma(info, inode, dentry, lma);
+ rc = osd_get_lma(info, inode, dentry, &info->oti_ost_attrs);
if (rc == -ENODATA || !fid_is_sane(&lma->lma_self_fid))
lma = NULL;
else if (rc != 0)
struct lu_buf oti_big_buf;
/** used in osd_ea_fid_set() to set fid into common ea */
union {
- struct lustre_mdt_attrs oti_mdt_attrs;
- /* old LMA for compatibility */
- char oti_mdt_attrs_old[LMA_OLD_SIZE];
+ struct lustre_ost_attrs oti_ost_attrs;
struct filter_fid_old oti_ff;
struct filter_fid oti_ff_new;
};
int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
const struct lu_fid *fid, __u32 compat, __u32 incompat);
int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
- struct dentry *dentry, struct lustre_mdt_attrs *lma);
+ struct dentry *dentry, struct lustre_ost_attrs *loa);
void osd_add_oi_cache(struct osd_thread_info *info, struct osd_device *osd,
struct osd_inode_id *id, const struct lu_fid *fid);
int osd_get_idif(struct osd_thread_info *info, struct inode *inode,
(const struct dt_key *)oi_fid, th, true);
if (rc != 0) {
struct inode *inode;
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
if (rc != -EEXIST)
return rc;
goto update;
}
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+ &info->oti_ost_attrs);
iput(inode);
if (rc == -ENODATA)
goto update;
handle_t *jh;
int size = 0;
int rc;
- bool removed = false;
- bool reset = true;
+ bool reset = false;
ENTRY;
if (dev->od_scrub.os_file.sf_param & SP_DRYRUN)
/* 2) delete the old XATTR_NAME_FID */
ll_vfs_dq_init(inode);
rc = inode->i_op->removexattr(dentry, XATTR_NAME_FID);
- if (rc != 0)
+ if (rc)
GOTO(stop, rc);
- removed = true;
- } else if (unlikely(rc == -ENODATA)) {
- reset = false;
- } else if (rc != sizeof(struct filter_fid)) {
+ reset = true;
+ } else if (rc != -ENODATA && rc != sizeof(struct filter_fid)) {
GOTO(stop, rc = -EINVAL);
}
/* 3) make new LMA and add it */
rc = osd_ea_fid_set(info, inode, tfid, LMAC_FID_ON_OST, 0);
- if (rc == 0 && reset)
- size = sizeof(struct filter_fid);
- else if (rc != 0 && removed)
- /* If failed, we should try to add the old back. */
- size = sizeof(struct filter_fid_old);
+ if (reset) {
+ if (rc)
+ /* If failed, we should try to add the old back. */
+ size = sizeof(*ff);
+ else
+ /* The new PFID EA will only contains ::ff_parent */
+ size = sizeof(ff->ff_parent);
+ }
/* 4) generate new XATTR_NAME_FID with the saved parent FID and add it*/
if (size > 0) {
struct osd_device *dev, struct inode *inode,
struct lu_fid *fid, bool scrub)
{
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
- int rc;
- bool has_lma = false;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
+ int rc;
+ bool has_lma = false;
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+ &info->oti_ost_attrs);
if (rc == 0) {
has_lma = true;
if (lma->lma_compat & LMAC_NOT_IN_OI ||
osd_ios_scan_one(struct osd_thread_info *info, struct osd_device *dev,
struct inode *inode, const struct lu_fid *fid, int flags)
{
- struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+ struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
struct osd_inode_id *id = &info->oti_id;
struct osd_inode_id *id2 = &info->oti_id2;
struct osd_scrub *scrub = &dev->od_scrub;
int rc;
ENTRY;
- rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+ rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+ &info->oti_ost_attrs);
if (rc != 0 && rc != -ENODATA) {
CDEBUG(D_LFSCK, "%s: fail to get lma for init OI scrub: "
"rc = %d\n", osd_name(dev), rc);
__u32 ooi_pos_page;
__u32 ooi_pos_lu_page;
__u32 ooi_attr;
+ __u32 ooi_rec_size;
int ooi_pos_ent;
int ooi_total_npages;
int ooi_valid_npages;
GOTO(out, rc = -EINVAL);
}
+ it->ooi_rec_size = ii->ii_recsize;
it->ooi_valid_npages = npages;
if (ptlrpc_rep_need_swab(req))
it->ooi_swab = 1;
it->ooi_pos_ent++;
if (it->ooi_pos_ent < idxpage->lip_nr) {
- it->ooi_ent =
+ if (it->ooi_rec_size ==
+ sizeof(struct lu_orphan_rec_v2)) {
+ it->ooi_ent =
+ (struct lu_orphan_ent_v2 *)idxpage->lip_entries+
+ it->ooi_pos_ent;
+ if (it->ooi_swab)
+ lustre_swab_orphan_ent_v2(it->ooi_ent);
+ } else {
+ it->ooi_ent =
(struct lu_orphan_ent *)idxpage->lip_entries +
it->ooi_pos_ent;
- if (it->ooi_swab)
- lustre_swab_orphan_ent(it->ooi_ent);
+ if (it->ooi_swab)
+ lustre_swab_orphan_ent(it->ooi_ent);
+ }
RETURN(0);
}
}
static int osp_orphan_it_rec(const struct lu_env *env, const struct dt_it *di,
struct dt_rec *rec, __u32 attr)
{
- struct osp_it *it = (struct osp_it *)di;
- struct lu_orphan_ent *ent = (struct lu_orphan_ent *)it->ooi_ent;
+ struct osp_it *it = (struct osp_it *)di;
- if (likely(ent != NULL)) {
- *(struct lu_orphan_rec *)rec = ent->loe_rec;
+ if (likely(it->ooi_ent)) {
+ if (it->ooi_rec_size == sizeof(struct lu_orphan_rec_v2)) {
+ struct lu_orphan_ent_v2 *ent =
+ (struct lu_orphan_ent_v2 *)it->ooi_ent;
+
+ *(struct lu_orphan_rec_v2 *)rec = ent->loe_rec;
+ } else {
+ struct lu_orphan_ent *ent =
+ (struct lu_orphan_ent *)it->ooi_ent;
+
+ *(struct lu_orphan_rec *)rec = ent->loe_rec;
+ }
return 0;
}
CLASSERT(offsetof(typeof(*ocd), paddingF) != 0);
}
+static void lustre_swab_ost_layout(struct ost_layout *ol)
+{
+ __swab32s(&ol->ol_stripe_size);
+ __swab32s(&ol->ol_stripe_count);
+ __swab64s(&ol->ol_comp_start);
+ __swab64s(&ol->ol_comp_end);
+ __swab32s(&ol->ol_comp_id);
+}
+
void lustre_swab_obdo (struct obdo *o)
{
__swab64s (&o->o_valid);
__swab64s (&o->o_ioepoch);
__swab32s (&o->o_stripe_idx);
__swab32s (&o->o_parent_ver);
- /* o_handle is opaque */
- /* o_lcookie is swabbed elsewhere */
+ lustre_swab_ost_layout(&o->o_layout);
+ CLASSERT(offsetof(typeof(*o), o_padding_3) != 0);
__swab32s (&o->o_uid_h);
__swab32s (&o->o_gid_h);
__swab64s (&o->o_data_version);
__swab32s(&lr->lr_flags);
lustre_swab_lu_fid(&lr->lr_fid);
lustre_swab_lu_fid(&lr->lr_fid2);
- lustre_swab_lu_fid(&lr->lr_fid3);
+ __swab32s(&lr->lr_comp_id);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_0) != 0);
CLASSERT(offsetof(typeof(*lr), lr_padding_1) != 0);
CLASSERT(offsetof(typeof(*lr), lr_padding_2) != 0);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_3) != 0);
}
void lustre_swab_lfsck_reply(struct lfsck_reply *lr)
__swab64s(&lr->lr_repaired);
}
+static void lustre_swab_orphan_rec(struct lu_orphan_rec *rec)
+{
+ lustre_swab_lu_fid(&rec->lor_fid);
+ __swab32s(&rec->lor_uid);
+ __swab32s(&rec->lor_gid);
+}
+
void lustre_swab_orphan_ent(struct lu_orphan_ent *ent)
{
lustre_swab_lu_fid(&ent->loe_key);
- lustre_swab_lu_fid(&ent->loe_rec.lor_fid);
- __swab32s(&ent->loe_rec.lor_uid);
- __swab32s(&ent->loe_rec.lor_gid);
+ lustre_swab_orphan_rec(&ent->loe_rec);
}
EXPORT_SYMBOL(lustre_swab_orphan_ent);
+void lustre_swab_orphan_ent_v2(struct lu_orphan_ent_v2 *ent)
+{
+ lustre_swab_lu_fid(&ent->loe_key);
+ lustre_swab_orphan_rec(&ent->loe_rec.lor_rec);
+ lustre_swab_ost_layout(&ent->loe_rec.lor_layout);
+ CLASSERT(offsetof(typeof(ent->loe_rec), lor_padding) != 0);
+}
+EXPORT_SYMBOL(lustre_swab_orphan_ent_v2);
+
void lustre_swab_ladvise(struct lu_ladvise *ladvise)
{
__swab16s(&ladvise->lla_advice);
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
+ LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_HSM);
+ LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_NOT_IN_OI);
+ LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_FID_ON_OST);
+ LASSERTF(LMAC_STRIPE_INFO == 0x00000010UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_STRIPE_INFO);
+ LASSERTF(LMAC_COMP_INFO == 0x00000020UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_COMP_INFO);
LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)LMAI_RELEASED);
LASSERTF(LMAI_AGENT == 0x00000002UL, "found 0x%.8xUL\n",
(unsigned)LMAI_STRIPED);
LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
(unsigned)LMAI_ORPHAN);
- LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_HSM);
- LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_NOT_IN_OI);
- LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_FID_ON_OST);
+
+ /* Checks for struct lustre_ost_attrs */
+ LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
+ (long long)(int)sizeof(struct lustre_ost_attrs));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_lma) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_lma));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma) == 24, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_parent_fid) == 24, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_parent_fid));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_stripe_size) == 40, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_stripe_size));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_id) == 44, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_id));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_start) == 48, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_start));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_end) == 56, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_end));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end));
LASSERTF(OUT_CREATE == 1, "found %lld\n",
(long long)OUT_CREATE);
LASSERTF(OUT_DESTROY == 2, "found %lld\n",
LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32C);
+ /* Checks for struct ost_layout */
+ LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n",
+ (long long)(int)sizeof(struct ost_layout));
+ LASSERTF((int)offsetof(struct ost_layout, ol_stripe_size) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_stripe_size));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_size) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_size));
+ LASSERTF((int)offsetof(struct ost_layout, ol_stripe_count) == 4, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_stripe_count));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_count) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_count));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_start) == 8, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_start));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_start) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_start));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_end) == 16, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_end));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_end) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_end));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_id) == 24, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_id));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+
/* Checks for struct obdo */
LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
(long long)(int)sizeof(struct obdo));
(long long)(int)offsetof(struct obdo, o_handle));
LASSERTF((int)sizeof(((struct obdo *)0)->o_handle) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_handle));
- LASSERTF((int)offsetof(struct obdo, o_lcookie) == 136, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_lcookie));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_lcookie));
+ LASSERTF((int)offsetof(struct obdo, o_layout) == 136, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_layout));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_layout) == 28, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_layout));
+ LASSERTF((int)offsetof(struct obdo, o_padding_3) == 164, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_padding_3));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_uid_h));
LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, "found %lld\n",
OBD_MD_FLGETATTRLOCK);
LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
OBD_MD_FLDATAVERSION);
+ LASSERTF(OBD_MD_CLOSE_INTENT_EXECED == (0x0020000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_CLOSE_INTENT_EXECED);
+ LASSERTF(OBD_MD_DEFAULT_MEA == (0x0040000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_DEFAULT_MEA);
+ LASSERTF(OBD_MD_FLOSTLAYOUT == (0x0080000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_FLOSTLAYOUT);
CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, "found %lld\n",
(long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
- /* Checks for struct llog_cookie */
- LASSERTF((int)sizeof(struct llog_cookie) == 32, "found %lld\n",
- (long long)(int)sizeof(struct llog_cookie));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_index));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_padding));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding));
-
/* Checks for struct llogd_body */
LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n",
(long long)(int)sizeof(struct llogd_body));
(long long)(int)offsetof(struct lfsck_request, lr_fid2));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid2) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid2));
- LASSERTF((int)offsetof(struct lfsck_request, lr_fid3) == 64, "found %lld\n",
- (long long)(int)offsetof(struct lfsck_request, lr_fid3));
- LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid3) == 16, "found %lld\n",
- (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid3));
- LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 80, "found %lld\n",
+ LASSERTF((int)offsetof(struct lfsck_request, lr_comp_id) == 64, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_comp_id));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_comp_id));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_0) == 68, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_padding_0));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_0) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_0));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 72, "found %lld\n",
(long long)(int)offsetof(struct lfsck_request, lr_padding_1));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_1) == 8, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_1));
- LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 88, "found %lld\n",
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 80, "found %lld\n",
(long long)(int)offsetof(struct lfsck_request, lr_padding_2));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_2) == 8, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_2));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_3) == 88, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_padding_3));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_3) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_3));
LASSERTF(LFSCK_TYPE_SCRUB == 0x00000000UL, "found 0x%.8xUL\n",
(unsigned)LFSCK_TYPE_SCRUB);
LASSERTF(LFSCK_TYPE_LAYOUT == 0x00000001UL, "found 0x%.8xUL\n",
struct lu_buf qti_lb;
struct lu_attr qti_attr;
struct dt_object_format qti_dof;
- struct lustre_mdt_attrs qti_lma;
struct lu_fid qti_fid;
char qti_buf[LQUOTA_NAME_MAX];
};
local ff_pstripe
if echo $ff_parent | grep -q 'stripe='; then
ff_pstripe=$(echo $ff_parent | sed -e 's/.*stripe=//')
+ if echo $ff_pstripe | grep -q 'stripe_size='; then
+ ff_pstripe=$(echo $ff_pstripe | cut -d' ' -f1)
+ fi
else
#
# $LL_DECODE_FILTER_FID does not print "stripe="; look
sed -e 's/\]//')
fi
+ if echo $ff_parent | grep -q 'stripe_count='; then
+ local ff_scnt=$(echo $ff_parent |
+ sed -e 's/.*stripe_count=//' |
+ cut -d' ' -f1)
+
+ [ $lmm_count -eq $ff_scnt ] ||
+ error "FF stripe count $lmm_count != $ff_scnt"
+ fi
+
# compare lmm_seq and filter_fid->ff_parent.f_seq
[ $ff_pseq = $lmm_seq ] ||
error "FF parent SEQ $ff_pseq != $lmm_seq"
#include <asm/byteorder.h>
#include <lustre/lustre_user.h>
+#define PFID_STRIPE_IDX_BITS 16
+#define PFID_STRIPE_COUNT_MASK ((1 << PFID_STRIPE_IDX_BITS) - 1)
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+static void lustre_swab_lu_fid(struct lu_fid *fid)
+{
+ __swab64s(&fid->f_seq);
+ __swab32s(&fid->f_oid);
+ __swab32s(&fid->f_ver);
+}
+
+static void lustre_loa_swab(struct lustre_ost_attrs *loa)
+{
+ struct lustre_mdt_attrs *lma = &loa->loa_lma;
+
+ __swab32s(&lma->lma_compat);
+ __swab32s(&lma->lma_incompat);
+ lustre_swab_lu_fid(&lma->lma_self_fid);
+ if (lma->lma_compat & LMAC_STRIPE_INFO) {
+ lustre_swab_lu_fid(&loa->loa_parent_fid);
+ __swab32s(&loa->loa_stripe_size);
+ }
+ if (lma->lma_compat & LMAC_COMP_INFO) {
+ __swab32s(&loa->loa_comp_id);
+ __swab64s(&loa->loa_comp_start);
+ __swab64s(&loa->loa_comp_end);
+ }
+};
+#else
+static void lustre_loa_swab(struct lustre_ost_attrs *loa)
+{
+}
+#endif
+
int main(int argc, char *argv[])
{
int rc = 0;
int size;
size = getxattr(argv[i], "trusted.fid", buf,
- sizeof(struct filter_fid_old));
+ sizeof(struct filter_fid));
if (size < 0) {
+ if (errno == ENODATA) {
+ struct lustre_ost_attrs *loa = (void *)buf;
+ int rc1;
+
+ rc1 = getxattr(argv[i], "trusted.lma", loa,
+ sizeof(*loa));
+ if (rc1 < sizeof(*loa)) {
+ fprintf(stderr,
+ "%s: error reading fid: %s\n",
+ argv[i], strerror(ENODATA));
+ if (!rc)
+ rc = size;
+ continue;
+ }
+
+ lustre_loa_swab(loa);
+ if (!(loa->loa_lma.lma_compat &
+ LMAC_STRIPE_INFO)) {
+ fprintf(stderr,
+ "%s: not stripe info: %s\n",
+ argv[i], strerror(ENODATA));
+ if (!rc)
+ rc = size;
+ continue;
+ }
+
+ printf("%s: parent="DFID" stripe=%u "
+ "stripe_size=%u stripe_count=%u",
+ argv[i], loa->loa_parent_fid.f_seq,
+ loa->loa_parent_fid.f_oid, 0, /* ver */
+ loa->loa_parent_fid.f_stripe_idx &
+ PFID_STRIPE_COUNT_MASK,
+ loa->loa_stripe_size,
+ loa->loa_parent_fid.f_stripe_idx >>
+ PFID_STRIPE_IDX_BITS);
+ if (loa->loa_comp_id != 0)
+ printf(" component_id=%u "
+ "component_start=%llu "
+ "component_end=%llu",
+ loa->loa_comp_id,
+ loa->loa_comp_start,
+ loa->loa_comp_end);
+ printf("\n");
+ continue;
+ }
+
fprintf(stderr, "%s: error reading fid: %s\n",
argv[i], strerror(errno));
- if (rc == 0)
+ if (!rc)
rc = size;
continue;
}
- if (size > sizeof(struct filter_fid_old)) {
+
+ if (size != sizeof(struct filter_fid) &&
+ size != sizeof(struct filter_fid_old) &&
+ size != sizeof(struct lu_fid)) {
fprintf(stderr, "%s: warning: fid larger than expected"
" (%d bytes), recompile?\n", argv[i], size);
- } else if (size > sizeof(*ff)) {
+ continue;
+ }
+
+ printf("%s: ", argv[i]);
+ if (size == sizeof(struct filter_fid_old)) {
struct filter_fid_old *ffo = (void *)buf;
- /* old filter_fid */
- printf("%s: objid=%llu seq=%llu parent="DFID
- " stripe=%u\n", argv[i],
+ printf("objid=%llu seq=%llu ",
(unsigned long long)__le64_to_cpu(ffo->ff_objid),
- (unsigned long long)__le64_to_cpu(ffo->ff_seq),
- (unsigned long long)__le64_to_cpu(ffo->ff_parent.f_seq),
- le32toh(ffo->ff_parent.f_oid), 0 /* ver */,
- /* this is stripe_nr actually */
- le32toh(ffo->ff_parent.f_stripe_idx));
- } else {
- printf("%s: parent="DFID" stripe=%u\n", argv[i],
- (unsigned long long)__le64_to_cpu(ff->ff_parent.f_seq),
- __le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
- /* this is stripe_nr actually */
- __le32_to_cpu(ff->ff_parent.f_stripe_idx));
+ (unsigned long long)__le64_to_cpu(ffo->ff_seq));
+ }
+
+ printf("parent="DFID" stripe=%u",
+ (unsigned long long)__le64_to_cpu(ff->ff_parent.f_seq),
+ __le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
+ /* this is stripe_nr actually */
+ __le32_to_cpu(ff->ff_parent.f_stripe_idx));
+
+ if (size >= sizeof(struct filter_fid)) {
+ struct ost_layout *ol = &ff->ff_layout;
+
+ /* new filter_fid, support PFL */
+ printf(" stripe_size=%u stripe_count=%u",
+ __le32_to_cpu(ol->ol_stripe_size),
+ __le32_to_cpu(ol->ol_stripe_count));
+ if (ol->ol_comp_id != 0)
+ printf(" component_id=%u "
+ "component_start=%llu "
+ "component_end=%llu",
+ __le32_to_cpu(ol->ol_comp_id),
+ __le64_to_cpu(ol->ol_comp_start),
+ __le64_to_cpu(ol->ol_comp_end));
}
+
+ printf("\n");
}
return rc;
CHECK_MEMBER(lustre_mdt_attrs, lma_compat);
CHECK_MEMBER(lustre_mdt_attrs, lma_incompat);
CHECK_MEMBER(lustre_mdt_attrs, lma_self_fid);
+
+ CHECK_VALUE_X(LMAC_HSM);
+ CHECK_VALUE_X(LMAC_NOT_IN_OI);
+ CHECK_VALUE_X(LMAC_FID_ON_OST);
+ CHECK_VALUE_X(LMAC_STRIPE_INFO);
+ CHECK_VALUE_X(LMAC_COMP_INFO);
+
CHECK_VALUE_X(LMAI_RELEASED);
CHECK_VALUE_X(LMAI_AGENT);
CHECK_VALUE_X(LMAI_REMOTE_PARENT);
CHECK_VALUE_X(LMAI_STRIPED);
CHECK_VALUE_X(LMAI_ORPHAN);
+}
- CHECK_VALUE_X(LMAC_HSM);
- CHECK_VALUE_X(LMAC_NOT_IN_OI);
- CHECK_VALUE_X(LMAC_FID_ON_OST);
+static void
+check_lustre_ost_attrs(void)
+{
+ BLANK_LINE();
+ CHECK_STRUCT(lustre_ost_attrs);
+ CHECK_MEMBER(lustre_ost_attrs, loa_lma);
+ CHECK_MEMBER(lustre_ost_attrs, loa_parent_fid);
+ CHECK_MEMBER(lustre_ost_attrs, loa_stripe_size);
+ CHECK_MEMBER(lustre_ost_attrs, loa_comp_id);
+ CHECK_MEMBER(lustre_ost_attrs, loa_comp_start);
+ CHECK_MEMBER(lustre_ost_attrs, loa_comp_end);
}
static void
}
static void
+check_ost_layout(void)
+{
+ BLANK_LINE();
+ CHECK_STRUCT(ost_layout);
+ CHECK_MEMBER(ost_layout, ol_stripe_size);
+ CHECK_MEMBER(ost_layout, ol_stripe_count);
+ CHECK_MEMBER(ost_layout, ol_comp_start);
+ CHECK_MEMBER(ost_layout, ol_comp_end);
+ CHECK_MEMBER(ost_layout, ol_comp_id);
+}
+
+static void
check_obdo(void)
{
BLANK_LINE();
CHECK_MEMBER(obdo, o_stripe_idx);
CHECK_MEMBER(obdo, o_parent_ver);
CHECK_MEMBER(obdo, o_handle);
- CHECK_MEMBER(obdo, o_lcookie);
+ CHECK_MEMBER(obdo, o_layout);
+ CHECK_MEMBER(obdo, o_padding_3);
CHECK_MEMBER(obdo, o_uid_h);
CHECK_MEMBER(obdo, o_gid_h);
CHECK_MEMBER(obdo, o_data_version);
CHECK_DEFINE_64X(OBD_MD_FLCROSSREF);
CHECK_DEFINE_64X(OBD_MD_FLGETATTRLOCK);
CHECK_DEFINE_64X(OBD_MD_FLDATAVERSION);
+ CHECK_DEFINE_64X(OBD_MD_CLOSE_INTENT_EXECED);
+ CHECK_DEFINE_64X(OBD_MD_DEFAULT_MEA);
+ CHECK_DEFINE_64X(OBD_MD_FLOSTLAYOUT);
CHECK_CVALUE_X(OBD_FL_INLINEDATA);
CHECK_CVALUE_X(OBD_FL_OBDMDEXISTS);
}
static void
-check_llog_cookie(void)
-{
- BLANK_LINE();
- CHECK_STRUCT(llog_cookie);
- CHECK_MEMBER(llog_cookie, lgc_lgl);
- CHECK_MEMBER(llog_cookie, lgc_subsys);
- CHECK_MEMBER(llog_cookie, lgc_index);
- CHECK_MEMBER(llog_cookie, lgc_padding);
-}
-
-static void
check_llogd_body(void)
{
BLANK_LINE();
CHECK_MEMBER(lfsck_request, lr_flags);
CHECK_MEMBER(lfsck_request, lr_fid);
CHECK_MEMBER(lfsck_request, lr_fid2);
- CHECK_MEMBER(lfsck_request, lr_fid3);
+ CHECK_MEMBER(lfsck_request, lr_comp_id);
+ CHECK_MEMBER(lfsck_request, lr_padding_0);
CHECK_MEMBER(lfsck_request, lr_padding_1);
CHECK_MEMBER(lfsck_request, lr_padding_2);
+ CHECK_MEMBER(lfsck_request, lr_padding_3);
CHECK_VALUE_X(LFSCK_TYPE_SCRUB);
CHECK_VALUE_X(LFSCK_TYPE_LAYOUT);
CHECK_STRUCT(obd_uuid);
check_lu_seq_range();
check_lustre_mdt_attrs();
+ check_lustre_ost_attrs();
CHECK_VALUE(OUT_CREATE);
CHECK_VALUE(OUT_DESTROY);
check_lustre_msg_v2();
check_ptlrpc_body();
check_obd_connect_data();
+ check_ost_layout();
check_obdo();
check_lov_ost_data_v1();
check_lov_mds_md_v1();
check_llog_gen();
check_llog_gen_rec();
check_llog_log_hdr();
- check_llog_cookie();
check_llogd_body();
check_llogd_conn_body();
check_ll_fiemap_info_key();
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
+ LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_HSM);
+ LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_NOT_IN_OI);
+ LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_FID_ON_OST);
+ LASSERTF(LMAC_STRIPE_INFO == 0x00000010UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_STRIPE_INFO);
+ LASSERTF(LMAC_COMP_INFO == 0x00000020UL, "found 0x%.8xUL\n",
+ (unsigned)LMAC_COMP_INFO);
LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)LMAI_RELEASED);
LASSERTF(LMAI_AGENT == 0x00000002UL, "found 0x%.8xUL\n",
(unsigned)LMAI_STRIPED);
LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
(unsigned)LMAI_ORPHAN);
- LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_HSM);
- LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_NOT_IN_OI);
- LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
- (unsigned)LMAC_FID_ON_OST);
+
+ /* Checks for struct lustre_ost_attrs */
+ LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
+ (long long)(int)sizeof(struct lustre_ost_attrs));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_lma) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_lma));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma) == 24, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_parent_fid) == 24, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_parent_fid));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_stripe_size) == 40, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_stripe_size));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_id) == 44, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_id));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_start) == 48, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_start));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start));
+ LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_end) == 56, "found %lld\n",
+ (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_end));
+ LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end));
LASSERTF(OUT_CREATE == 1, "found %lld\n",
(long long)OUT_CREATE);
LASSERTF(OUT_DESTROY == 2, "found %lld\n",
LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32C);
+ /* Checks for struct ost_layout */
+ LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n",
+ (long long)(int)sizeof(struct ost_layout));
+ LASSERTF((int)offsetof(struct ost_layout, ol_stripe_size) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_stripe_size));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_size) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_size));
+ LASSERTF((int)offsetof(struct ost_layout, ol_stripe_count) == 4, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_stripe_count));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_count) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_count));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_start) == 8, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_start));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_start) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_start));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_end) == 16, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_end));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_end) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_end));
+ LASSERTF((int)offsetof(struct ost_layout, ol_comp_id) == 24, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout, ol_comp_id));
+ LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+
/* Checks for struct obdo */
LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
(long long)(int)sizeof(struct obdo));
(long long)(int)offsetof(struct obdo, o_handle));
LASSERTF((int)sizeof(((struct obdo *)0)->o_handle) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_handle));
- LASSERTF((int)offsetof(struct obdo, o_lcookie) == 136, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_lcookie));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_lcookie));
+ LASSERTF((int)offsetof(struct obdo, o_layout) == 136, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_layout));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_layout) == 28, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_layout));
+ LASSERTF((int)offsetof(struct obdo, o_padding_3) == 164, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_padding_3));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_uid_h));
LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, "found %lld\n",
OBD_MD_FLGETATTRLOCK);
LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
OBD_MD_FLDATAVERSION);
+ LASSERTF(OBD_MD_CLOSE_INTENT_EXECED == (0x0020000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_CLOSE_INTENT_EXECED);
+ LASSERTF(OBD_MD_DEFAULT_MEA == (0x0040000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_DEFAULT_MEA);
+ LASSERTF(OBD_MD_FLOSTLAYOUT == (0x0080000000000000ULL), "found 0x%.16llxULL\n",
+ OBD_MD_FLOSTLAYOUT);
CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, "found %lld\n",
(long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
- /* Checks for struct llog_cookie */
- LASSERTF((int)sizeof(struct llog_cookie) == 32, "found %lld\n",
- (long long)(int)sizeof(struct llog_cookie));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_index));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, "found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_padding));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, "found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding));
-
/* Checks for struct llogd_body */
LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n",
(long long)(int)sizeof(struct llogd_body));
(long long)(int)offsetof(struct lfsck_request, lr_fid2));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid2) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid2));
- LASSERTF((int)offsetof(struct lfsck_request, lr_fid3) == 64, "found %lld\n",
- (long long)(int)offsetof(struct lfsck_request, lr_fid3));
- LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid3) == 16, "found %lld\n",
- (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid3));
- LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 80, "found %lld\n",
+ LASSERTF((int)offsetof(struct lfsck_request, lr_comp_id) == 64, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_comp_id));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_comp_id) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_comp_id));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_0) == 68, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_padding_0));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_0) == 4, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_0));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 72, "found %lld\n",
(long long)(int)offsetof(struct lfsck_request, lr_padding_1));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_1) == 8, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_1));
- LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 88, "found %lld\n",
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 80, "found %lld\n",
(long long)(int)offsetof(struct lfsck_request, lr_padding_2));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_2) == 8, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_2));
+ LASSERTF((int)offsetof(struct lfsck_request, lr_padding_3) == 88, "found %lld\n",
+ (long long)(int)offsetof(struct lfsck_request, lr_padding_3));
+ LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_3) == 8, "found %lld\n",
+ (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_3));
LASSERTF(LFSCK_TYPE_SCRUB == 0x00000000UL, "found 0x%.8xUL\n",
(unsigned)LFSCK_TYPE_SCRUB);
LASSERTF(LFSCK_TYPE_LAYOUT == 0x00000001UL, "found 0x%.8xUL\n",