};
extern void lustre_hsm_swab(struct hsm_attrs *attrs);
-static inline void ostid_cpu_to_le(struct ost_id *src_oi,
- struct ost_id *dst_oi)
-{
- dst_oi->oi_id = cpu_to_le64(src_oi->oi_id);
- dst_oi->oi_seq = cpu_to_le64(src_oi->oi_seq);
-}
-
-static inline void ostid_le_to_cpu(struct ost_id *src_oi,
- struct ost_id *dst_oi)
-{
- dst_oi->oi_id = le64_to_cpu(src_oi->oi_id);
- dst_oi->oi_seq = le64_to_cpu(src_oi->oi_seq);
-}
-
-extern void lustre_swab_ost_id(struct ost_id *oid);
-
/**
* fid constants
*/
return seq == FID_SEQ_DOT_LUSTRE;
}
+static inline int fid_seq_is_default(const __u64 seq)
+{
+ return seq == FID_SEQ_LOV_DEFAULT;
+}
+
static inline int fid_is_mdt0(const struct lu_fid *fid)
{
return fid_seq_is_mdt0(fid_seq(fid));
return (fid_seq(fid) >> 16) & 0xffff;
}
-/* unpack an ostid (id/seq) from a wire/disk structure into an IDIF FID */
-static inline void ostid_idif_unpack(struct ost_id *ostid,
- struct lu_fid *fid, __u32 ost_idx)
+/* extract OST sequence (group) from a wire ost_id (id/seq) pair */
+static inline obd_seq ostid_seq(const struct ost_id *ostid)
{
- fid->f_seq = fid_idif_seq(ostid->oi_id, ost_idx);
- fid->f_oid = ostid->oi_id; /* truncate to 32 bits by assignment */
- fid->f_ver = ostid->oi_id >> 48; /* in theory, not currently used */
+ if (fid_seq_is_mdt0(ostid->oi.oi_seq))
+ return FID_SEQ_OST_MDT0;
+
+ if (fid_seq_is_default(ostid->oi.oi_seq))
+ return FID_SEQ_LOV_DEFAULT;
+
+ if (fid_is_idif(&ostid->oi_fid))
+ return FID_SEQ_OST_MDT0;
+
+ return fid_seq(&ostid->oi_fid);
}
-/* unpack an ostid (id/seq) from a wire/disk structure into a non-IDIF FID */
-static inline void ostid_fid_unpack(struct ost_id *ostid, struct lu_fid *fid)
+/* extract OST objid from a wire ost_id (id/seq) pair */
+static inline obd_id ostid_id(const struct ost_id *ostid)
{
- fid->f_seq = ostid->oi_seq;
- fid->f_oid = ostid->oi_id; /* truncate to 32 bits by assignment */
- fid->f_ver = ostid->oi_id >> 32; /* in theory, not currently used */
+ if (fid_seq_is_mdt0(ostid_seq(ostid)))
+ return ostid->oi.oi_id & IDIF_OID_MASK;
+
+ if (fid_is_idif(&ostid->oi_fid))
+ return fid_idif_id(fid_seq(&ostid->oi_fid),
+ fid_oid(&ostid->oi_fid), 0);
+
+ return fid_oid(&ostid->oi_fid);
}
-/* Unpack an OST object id/seq (group) into a FID. This is needed for
- * converting all obdo, lmm, lsm, etc. 64-bit id/seq pairs into proper
- * FIDs. Note that if an id/seq is already in FID/IDIF format it will
- * be passed through unchanged. Only legacy OST objects in "group 0"
- * will be mapped into the IDIF namespace so that they can fit into the
- * struct lu_fid fields without loss. For reference see:
- * http://arch.lustre.org/index.php?title=Interoperability_fids_zfs
- */
-static inline int fid_ostid_unpack(struct lu_fid *fid, struct ost_id *ostid,
- __u32 ost_idx)
+static inline void ostid_set_seq(struct ost_id *oi, __u64 seq)
{
- if (ost_idx > 0xffff) {
- CERROR("bad ost_idx, seq:"LPU64" id:"LPU64" ost_idx:%u\n",
- ostid->oi_seq, ostid->oi_id, ost_idx);
- return -EBADF;
- }
-
- if (fid_seq_is_mdt0(ostid->oi_seq)) {
- /* This is a "legacy" (old 1.x/2.early) OST object in "group 0"
- * that we map into the IDIF namespace. It allows up to 2^48
- * objects per OST, as this is the object namespace that has
- * been in production for years. This can handle create rates
- * of 1M objects/s/OST for 9 years, or combinations thereof. */
- if (ostid->oi_id >= IDIF_MAX_OID) {
- CERROR("bad MDT0 id, seq:"LPU64" id:"LPU64" ost_idx:%u\n",
- ostid->oi_seq, ostid->oi_id, ost_idx);
- return -EBADF;
- }
- ostid_idif_unpack(ostid, fid, ost_idx);
-
- } else if (fid_seq_is_rsvd(ostid->oi_seq)) {
- /* These are legacy OST objects for LLOG/ECHO and CMD testing.
- * We only support 2^32 objects in these groups, and cannot
- * uniquely identify them in the system (i.e. they are the
- * duplicated on all OSTs), but this is not strictly required
- * for the old object protocol, which has a separate ost_idx. */
- if (ostid->oi_id >= 0xffffffffULL) {
- CERROR("bad RSVD id, seq:"LPU64" id:"LPU64" ost_idx:%u\n",
- ostid->oi_seq, ostid->oi_id, ost_idx);
- return -EBADF;
- }
- ostid_fid_unpack(ostid, fid);
-
- } else if (unlikely(fid_seq_is_igif(ostid->oi_seq))) {
- /* This is an MDT inode number, which should never collide with
- * proper OST object IDs, and is probably a broken filesystem */
- CERROR("bad IGIF, seq:"LPU64" id:"LPU64" ost_idx:%u\n",
- ostid->oi_seq, ostid->oi_id, ost_idx);
- return -EBADF;
-
- } else /* if (fid_seq_is_idif(seq) || fid_seq_is_norm(seq)) */ {
- /* This is either an IDIF object, which identifies objects across
- * all OSTs, or a regular FID. The IDIF namespace maps legacy
- * OST objects into the FID namespace. In both cases, we just
- * pass the FID through, no conversion needed. */
- ostid_fid_unpack(ostid, fid);
- }
+ if (fid_seq_is_mdt0(seq) || fid_seq_is_default(seq)) {
+ oi->oi.oi_seq = seq;
+ } else {
+ oi->oi_fid.f_seq = seq;
+ /* Note: if f_oid + f_ver is zero, we need init it
+ * to be 1, otherwise, ostid_seq will treat this
+ * as old ostid (oi_seq == 0) */
+ if (oi->oi_fid.f_oid == 0 && oi->oi_fid.f_ver == 0)
+ oi->oi_fid.f_oid = LUSTRE_FID_INIT_OID;
+ }
+}
- return 0;
+static inline void ostid_set_seq_mdt0(struct ost_id *oi)
+{
+ ostid_set_seq(oi, FID_SEQ_OST_MDT0);
}
-/* pack an IDIF FID into an ostid (id/seq) for the wire/disk */
-static inline void ostid_idif_pack(const struct lu_fid *fid,
- struct ost_id *ostid)
+static inline void ostid_set_seq_echo(struct ost_id *oi)
{
- ostid->oi_seq = FID_SEQ_OST_MDT0;
- ostid->oi_id = fid_idif_id(fid->f_seq, fid->f_oid, fid->f_ver);
+ ostid_set_seq(oi, FID_SEQ_ECHO);
}
-/* pack a non-IDIF FID into an ostid (id/seq) for the wire/disk */
-static inline void ostid_normal_fid_pack(const struct lu_fid *fid,
- struct ost_id *ostid)
+static inline void ostid_set_seq_llog(struct ost_id *oi)
{
- ostid->oi_seq = fid_seq(fid);
- ostid->oi_id = fid_ver_oid(fid);
+ ostid_set_seq(oi, FID_SEQ_LLOG);
}
-/* pack any OST FID into an ostid (id/seq) for the wire/disk */
-static inline int fid_ostid_pack(const struct lu_fid *fid,
- struct ost_id *ostid)
+/**
+ * Note: we need check oi_seq to decide where to set oi_id,
+ * so oi_seq should always be set ahead of oi_id.
+ */
+static inline void ostid_set_id(struct ost_id *oi, __u64 oid)
+{
+ if (fid_seq_is_mdt0(ostid_seq(oi))) {
+ if (oid >= IDIF_MAX_OID) {
+ CERROR("Bad "LPU64" to set "DOSTID"\n",
+ oid, POSTID(oi));
+ return;
+ }
+ oi->oi.oi_id = oid;
+ } else {
+ if (oid > OBIF_MAX_OID) {
+ CERROR("Bad "LPU64" to set "DOSTID"\n",
+ oid, POSTID(oi));
+ return;
+ }
+ oi->oi_fid.f_oid = oid;
+ }
+}
+
+static inline void ostid_inc_id(struct ost_id *oi)
{
- if (unlikely(fid_seq_is_igif(fid->f_seq))) {
- CERROR("bad IGIF, "DFID"\n", PFID(fid));
- return -EBADF;
+ if (fid_seq_is_mdt0(ostid_seq(oi))) {
+ if (unlikely(ostid_id(oi) + 1 > IDIF_MAX_OID)) {
+ CERROR("Bad inc "DOSTID"\n", POSTID(oi));
+ return;
+ }
+ oi->oi.oi_id++;
+ } else {
+ oi->oi_fid.f_oid++;
}
+}
- if (fid_is_idif(fid))
- ostid_idif_pack(fid, ostid);
+static inline void ostid_dec_id(struct ost_id *oi)
+{
+ if (fid_seq_is_mdt0(ostid_seq(oi)))
+ oi->oi.oi_id--;
else
- ostid_normal_fid_pack(fid, ostid);
-
- return 0;
+ oi->oi_fid.f_oid--;
}
-/* extract OST sequence (group) from a wire ost_id (id/seq) pair */
-static inline obd_seq ostid_seq(struct ost_id *ostid)
+/**
+ * Unpack an OST object id/seq (group) into a FID. This is needed for
+ * converting all obdo, lmm, lsm, etc. 64-bit id/seq pairs into proper
+ * FIDs. Note that if an id/seq is already in FID/IDIF format it will
+ * be passed through unchanged. Only legacy OST objects in "group 0"
+ * will be mapped into the IDIF namespace so that they can fit into the
+ * struct lu_fid fields without loss. For reference see:
+ * http://arch.lustre.org/index.php?title=Interoperability_fids_zfs
+ */
+static inline int ostid_to_fid(struct lu_fid *fid, struct ost_id *ostid,
+ __u32 ost_idx)
{
- if (unlikely(fid_seq_is_igif(ostid->oi_seq)))
- CWARN("bad IGIF, oi_seq: "LPU64" oi_id: "LPX64"\n",
- ostid->oi_seq, ostid->oi_id);
+ if (ost_idx > 0xffff) {
+ CERROR("bad ost_idx, "DOSTID" ost_idx:%u\n", POSTID(ostid),
+ ost_idx);
+ return -EBADF;
+ }
- if (unlikely(fid_seq_is_idif(ostid->oi_seq)))
- return FID_SEQ_OST_MDT0;
+ if (fid_seq_is_mdt0(ostid_seq(ostid))) {
+ /* This is a "legacy" (old 1.x/2.early) OST object in "group 0"
+ * that we map into the IDIF namespace. It allows up to 2^48
+ * objects per OST, as this is the object namespace that has
+ * been in production for years. This can handle create rates
+ * of 1M objects/s/OST for 9 years, or combinations thereof. */
+ if (ostid_id(ostid) >= IDIF_MAX_OID) {
+ CERROR("bad MDT0 id, "DOSTID" ost_idx:%u\n",
+ POSTID(ostid), ost_idx);
+ return -EBADF;
+ }
+ fid->f_seq = fid_idif_seq(ostid_id(ostid), ost_idx);
+ /* truncate to 32 bits by assignment */
+ fid->f_oid = ostid_id(ostid);
+ /* in theory, not currently used */
+ fid->f_ver = ostid_id(ostid) >> 48;
+ } else /* if (fid_seq_is_idif(seq) || fid_seq_is_norm(seq)) */ {
+ /* This is either an IDIF object, which identifies objects across
+ * all OSTs, or a regular FID. The IDIF namespace maps legacy
+ * OST objects into the FID namespace. In both cases, we just
+ * pass the FID through, no conversion needed. */
+ if (ostid->oi_fid.f_ver != 0) {
+ CERROR("bad MDT0 id, "DOSTID" ost_idx:%u\n",
+ POSTID(ostid), ost_idx);
+ return -EBADF;
+ }
+ *fid = ostid->oi_fid;
+ }
- return ostid->oi_seq;
+ return 0;
}
-/* extract OST objid from a wire ost_id (id/seq) pair */
-static inline obd_id ostid_id(struct ost_id *ostid)
+/* pack any OST FID into an ostid (id/seq) for the wire/disk */
+static inline int fid_to_ostid(const struct lu_fid *fid, struct ost_id *ostid)
{
- if (ostid->oi_seq == FID_SEQ_OST_MDT0)
- return ostid->oi_id & IDIF_OID_MASK;
-
- if (fid_seq_is_rsvd(ostid->oi_seq))
- return ostid->oi_id & OBIF_OID_MASK;
+ if (unlikely(fid_seq_is_igif(fid->f_seq))) {
+ CERROR("bad IGIF, "DFID"\n", PFID(fid));
+ return -EBADF;
+ }
- if (fid_seq_is_idif(ostid->oi_seq))
- return fid_idif_id(ostid->oi_seq, ostid->oi_id, 0);
+ if (fid_is_idif(fid)) {
+ ostid_set_seq_mdt0(ostid);
+ ostid_set_id(ostid, fid_idif_id(fid_seq(fid), fid_oid(fid),
+ fid_ver(fid)));
+ } else {
+ ostid->oi_fid = *fid;
+ }
- return ostid->oi_id;
+ return 0;
}
/* Check whether the fid is for LAST_ID */
return fid_seq(fid);
}
+extern void lustre_swab_ost_id(struct ost_id *oid);
+
/**
* Get inode generation from a igif.
* \param fid a igif to get inode generation from.
__diff_normalize(fid_ver(f0), fid_ver(f1));
}
+static inline void ostid_cpu_to_le(struct ost_id *src_oi,
+ struct ost_id *dst_oi)
+{
+ if (fid_seq_is_mdt0(ostid_seq(src_oi))) {
+ dst_oi->oi.oi_id = cpu_to_le64(src_oi->oi.oi_id);
+ dst_oi->oi.oi_seq = cpu_to_le64(src_oi->oi.oi_seq);
+ } else {
+ fid_cpu_to_le(&dst_oi->oi_fid, &src_oi->oi_fid);
+ }
+}
+
+static inline void ostid_le_to_cpu(struct ost_id *src_oi,
+ struct ost_id *dst_oi)
+{
+ if (fid_seq_is_mdt0(ostid_seq(src_oi))) {
+ dst_oi->oi.oi_id = le64_to_cpu(src_oi->oi.oi_id);
+ dst_oi->oi.oi_seq = le64_to_cpu(src_oi->oi.oi_seq);
+ } else {
+ fid_le_to_cpu(&dst_oi->oi_fid, &src_oi->oi_fid);
+ }
+}
+
/** @} lu_fid */
/** \defgroup lu_dir lu_dir
#define ioobj_max_brw_set(ioo, num) \
do { (ioo)->ioo_max_brw = ((num) - 1) << IOOBJ_MAX_BRW_BITS; } while (0)
-#define ioo_id ioo_oid.oi_id
-#define ioo_seq ioo_oid.oi_seq
-
extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
/* multiple of 8 bytes => can array */
/** Identifier for a single log object */
struct llog_logid {
- __u64 lgl_oid;
- __u64 lgl_oseq;
+ struct ost_id lgl_oi;
__u32 lgl_ogen;
} __attribute__((packed));
struct llog_setattr64_rec {
struct llog_rec_hdr lsr_hdr;
- obd_id lsr_oid;
- obd_seq lsr_oseq;
+ struct ost_id lsr_oi;
__u32 lsr_uid;
__u32 lsr_uid_h;
__u32 lsr_gid;
/* Note: 64-bit types are 64-bit aligned in structure */
struct obdo {
obd_valid o_valid; /* hot fields in this obdo */
- struct ost_id o_oi;
+ struct ost_id o_oi;
obd_id o_parent_seq;
obd_size o_size; /* o_size-o_blocks == ost_lvb */
obd_time o_mtime;
__u64 o_padding_6;
};
-#define o_id o_oi.oi_id
-#define o_seq o_oi.oi_seq
#define o_dirty o_blocks
#define o_undirty o_mode
#define o_dropped o_misc
};
/**
- * OST object IDentifier.
- */
-struct ost_id {
- __u64 oi_id;
- __u64 oi_seq;
-};
-
-#define DOSTID LPX64":"LPU64
-#define POSTID(oi) (oi)->oi_seq, (oi)->oi_id
-
-/**
* File IDentifier.
*
* FID is a cluster-wide unique identifier of a file or an object (stripe).
*/
#define LMA_OLD_SIZE (sizeof(struct lustre_mdt_attrs) + 5 * sizeof(__u64))
+/**
+ * OST object IDentifier.
+ */
+struct ost_id {
+ union {
+ struct ostid {
+ __u64 oi_id;
+ __u64 oi_seq;
+ } oi;
+ struct lu_fid oi_fid;
+ };
+};
+
+#define DOSTID LPX64":"LPU64
+#define POSTID(oi) ostid_seq(oi), ostid_id(oi)
+
/*
* The ioctl naming rules:
* LL_* - works on the currently opened filehandle instead of parent dir
__u32 l_ost_gen; /* generation of this OST index */
__u32 l_ost_idx; /* OST index in LOV */
} __attribute__((packed));
-#define l_object_id l_ost_oi.oi_id
-#define l_object_seq l_ost_oi.oi_seq
#define lov_user_md lov_user_md_v1
struct lov_user_md_v1 { /* LOV EA user data (host-endian) */
* Build DLM resource name from object id & seq, which will be removed
* finally, when we replace ost_id with FID in data stack.
*
- * To keep the compatibility, res[0] = oid, res[1] = seq
+ * Currently, resid from the old client, whose res[0] = object_id,
+ * res[1] = object_seq, is just oposite with Metatdata
+ * resid, where, res[0] = fid->f_seq, res[1] = fid->f_oid.
+ * To unifiy the resid identification, we will reverse the data
+ * resid to keep it same with Metadata resid, i.e.
+ *
+ * For resid from the old client,
+ * res[0] = objid, res[1] = 0, still keep the original order,
+ * for compatiblity.
+ *
+ * For new resid
+ * res will be built from normal FID directly, i.e. res[0] = f_seq,
+ * res[1] = f_oid + f_ver.
*/
-static inline void ostid_build_res_name(struct ost_id *oid,
+static inline void ostid_build_res_name(struct ost_id *oi,
struct ldlm_res_id *name)
{
memset(name, 0, sizeof *name);
- name->name[LUSTRE_RES_ID_SEQ_OFF] = oid->oi_id;
- name->name[LUSTRE_RES_ID_VER_OID_OFF] = oid->oi_seq;
+ if (fid_seq_is_mdt0(ostid_seq(oi))) {
+ name->name[LUSTRE_RES_ID_SEQ_OFF] = ostid_id(oi);
+ name->name[LUSTRE_RES_ID_VER_OID_OFF] = ostid_seq(oi);
+ } else {
+ fid_build_reg_res_name((struct lu_fid *)oi, name);
+ }
}
-static inline void ostid_res_name_to_id(struct ost_id *oid,
+static inline void ostid_res_name_to_id(struct ost_id *oi,
struct ldlm_res_id *name)
{
- oid->oi_id = name->name[LUSTRE_RES_ID_SEQ_OFF];
- oid->oi_seq = name->name[LUSTRE_RES_ID_VER_OID_OFF];
+ if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_SEQ_OFF])) {
+ /* old resid */
+ ostid_set_seq(oi, name->name[LUSTRE_RES_ID_VER_OID_OFF]);
+ ostid_set_id(oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
+ } else {
+ /* new resid */
+ fid_build_from_res_name((struct lu_fid *)oi, name);
+ }
}
/**
* Return true if the resource is for the object identified by this id & group.
*/
-static inline int ostid_res_name_eq(struct ost_id *oid,
+static inline int ostid_res_name_eq(struct ost_id *oi,
struct ldlm_res_id *name)
{
- return name->name[LUSTRE_RES_ID_SEQ_OFF] == oid->oi_id &&
- name->name[LUSTRE_RES_ID_VER_OID_OFF] == oid->oi_seq;
+ /* Note: it is just a trick here to save some effort, probably the
+ * correct way would be turn them into the FID and compare */
+ if (fid_seq_is_mdt0(ostid_seq(oi))) {
+ return name->name[LUSTRE_RES_ID_SEQ_OFF] == ostid_id(oi) &&
+ name->name[LUSTRE_RES_ID_VER_OID_OFF] == ostid_seq(oi);
+ } else {
+ return name->name[LUSTRE_RES_ID_SEQ_OFF] == ostid_seq(oi) &&
+ name->name[LUSTRE_RES_ID_VER_OID_OFF] == ostid_id(oi);
+ }
+}
+
+/* The same as osc_build_res_name() */
+static inline void ost_fid_build_resid(const struct lu_fid *fid,
+ struct ldlm_res_id *resname)
+{
+ if (fid_is_mdt0(fid) || fid_is_idif(fid)) {
+ struct ost_id oi;
+ if (fid_to_ostid(fid, &oi) != 0)
+ return;
+ ostid_build_res_name(&oi, resname);
+ } else {
+ fid_build_reg_res_name(fid, resname);
+ }
+}
+
+static inline void ost_fid_from_resid(struct lu_fid *fid,
+ const struct ldlm_res_id *name)
+{
+ if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_VER_OID_OFF])) {
+ /* old resid */
+ struct ost_id oi;
+ ostid_set_seq(&oi, name->name[LUSTRE_RES_ID_VER_OID_OFF]);
+ ostid_set_id(&oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
+ ostid_to_fid(fid, &oi, 0);
+ } else {
+ /* new resid */
+ fid_build_from_res_name(fid, name);
+ }
}
/**
/* For compatibility purposes we identify pre-OSD (~< 2.3.51 MDS)
* logid's by non-zero ogen (inode generation) and convert them
* into IGIF */
- if (id->lgl_ogen == 0) {
- fid->f_seq = id->lgl_oseq;
- fid->f_oid = id->lgl_oid;
- fid->f_ver = 0;
+ if (id->lgl_ogen == 0)
+ ostid_to_fid(fid, &id->lgl_oi, 0);
+ else
+ lu_igif_build(fid, ostid_id(&id->lgl_oi), id->lgl_ogen);
+}
+
+static inline void fid_to_logid(struct lu_fid *fid, struct llog_logid *id)
+{
+ if (fid_is_igif(fid)) {
+ /* See above lu_igif_build */
+ ostid_set_id(&id->lgl_oi, fid->f_seq);
+ id->lgl_ogen = fid->f_oid;
} else {
- lu_igif_build(fid, id->lgl_oid, id->lgl_ogen);
+ fid_to_ostid(fid, &id->lgl_oi);
+ id->lgl_ogen = 0;
}
}
-static inline void fid_to_logid(struct lu_fid *fid, struct llog_logid *id)
+static inline void logid_set_id(struct llog_logid *log_id, __u64 id)
{
- id->lgl_oseq = fid->f_seq;
- id->lgl_oid = fid->f_oid;
- id->lgl_ogen = 0;
+ if (log_id->lgl_ogen == 0)
+ ostid_set_id(&log_id->lgl_oi, id);
+ else
+ log_id->lgl_oi.oi.oi_id = id;
+}
+
+static inline __u64 logid_id(struct llog_logid *log_id)
+{
+ if (log_id->lgl_ogen == 0)
+ return ostid_id(&log_id->lgl_oi);
+ else
+ return log_id->lgl_oi.oi.oi_id;
}
struct llog_handle;
};
struct lov_oinfo { /* per-stripe data structure */
- struct ost_id loi_oi; /* object ID/Sequence on the target OST */
- int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */
- int loi_ost_gen; /* generation of this loi_ost_idx */
-
- unsigned long loi_kms_valid:1;
- __u64 loi_kms; /* known minimum size */
- struct ost_lvb loi_lvb;
- struct osc_async_rc loi_ar;
+ struct ost_id loi_oi; /* object ID/Sequence on the target OST */
+ int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */
+ int loi_ost_gen; /* generation of this loi_ost_idx */
+
+ unsigned long loi_kms_valid:1;
+ __u64 loi_kms; /* known minimum size */
+ struct ost_lvb loi_lvb;
+ struct osc_async_rc loi_ar;
};
-#define loi_id loi_oi.oi_id
-#define loi_seq loi_oi.oi_seq
static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms)
{
}
static inline struct dentry *
-obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
+obd_lvfs_fid2dentry(struct obd_export *exp, struct ost_id *oi, __u32 gen)
{
struct lvfs_run_ctxt *ctxt = &exp->exp_obd->obd_lvfs_ctxt;
LASSERT(exp->exp_obd);
- return ctxt->cb_ops.l_fid2dentry(id_ino, gen, gr, exp->exp_obd);
+ return ctxt->cb_ops.l_fid2dentry(ostid_id(oi), gen, ostid_seq(oi),
+ exp->exp_obd);
}
/* @max_age is the oldest time in jiffies that we accept using a cached data.
valid &= src->o_valid;
- LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
- OBD_MD_FLID | OBD_MD_FLGROUP)),
- "object "LPU64"/"LPU64", valid %x\n",
- src->o_id, src->o_seq, valid);
+ LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
+ OBD_MD_FLID | OBD_MD_FLGROUP)),
+ "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
CDEBUG(D_INODE,"valid "LPX64", cur time "CFS_TIME_T"/"CFS_TIME_T
OBD_MD_FLMTIME | OBD_MD_FLCTIME |
OBD_MD_FLSIZE;
- obdo_refresh_inode(inode, oinfo.oi_oa, oinfo.oi_oa->o_valid);
- CDEBUG(D_INODE, "objid "LPX64" size %llu, blocks %llu, "
- "blksize %llu\n", oinfo.oi_oa->o_id,
+ obdo_refresh_inode(inode, oinfo.oi_oa, oinfo.oi_oa->o_valid);
+ CDEBUG(D_INODE, "objid "DOSTID" size %llu, blocks %llu, "
+ "blksize %llu\n", POSTID(&oinfo.oi_oa->o_oi),
(long long unsigned)llu_i2stat(inode)->st_size,
(long long unsigned)llu_i2stat(inode)->st_blocks,
(long long unsigned)llu_i2stat(inode)->st_blksize);
printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size);
printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern);
- for (index = 0; index < lum->lmm_stripe_count; index++) {
- lo = lum->lmm_objects + index;
- printf("object %d:\n", index);
- printf("\tobject_seq: "LPX64"\n", lo->l_object_seq);
- printf("\tobject_id: "LPX64"\n", lo->l_object_id);
- printf("\tost_gen: %#x\n", lo->l_ost_gen);
- printf("\tost_idx: %u\n", lo->l_ost_idx);
- }
+ for (index = 0; index < lum->lmm_stripe_count; index++) {
+ lo = lum->lmm_objects + index;
+ printf("object %d:\n", index);
+ printf("\tobject_oid: "DOSTID"\n",
+ POSTID(&lo->l_ost_oi));
+ printf("\tost_gen: %#x\n", lo->l_ost_gen);
+ printf("\tost_idx: %u\n", lo->l_ost_idx);
+ }
}
if (lum->lmm_magic != LOV_USER_MAGIC ||
printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size);
printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern);
- for (index = 0; index < lum->lmm_stripe_count; index++) {
- lo = lum->lmm_objects + index;
- printf("object %d:\n", index);
- printf("\tobject_seq: "LPX64"\n", lo->l_object_seq);
- printf("\tobject_id: "LPX64"\n", lo->l_object_id);
- printf("\tost_gen: %#x\n", lo->l_ost_gen);
- printf("\tost_idx: %u\n", lo->l_ost_idx);
- }
+ for (index = 0; index < lum->lmm_stripe_count; index++) {
+ lo = lum->lmm_objects + index;
+ printf("object %d:\n", index);
+ printf("\tobject_oid: "DOSTID"\n",
+ POSTID(&lo->l_ost_oi));
+ printf("\tost_gen: %#x\n", lo->l_ost_gen);
+ printf("\tost_idx: %u\n", lo->l_ost_idx);
+ }
}
if (lum->lmm_magic != LOV_USER_MAGIC ||
}
#endif
-static int ll_lov_recreate(struct inode *inode, obd_id id, obd_seq seq,
+static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
obd_count ost_idx)
{
struct obd_export *exp = ll_i2dtexp(inode);
if (lsm2 == NULL)
GOTO(out, rc = -ENOMEM);
- oa->o_id = id;
- oa->o_seq = seq;
+ oa->o_oi = *oi;
oa->o_nlink = ost_idx;
oa->o_flags |= OBD_FL_RECREATE_OBJS;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
{
struct ll_recreate_obj ucreat;
+ struct ost_id oi;
ENTRY;
if (!cfs_capable(CFS_CAP_SYS_ADMIN))
sizeof(ucreat)))
RETURN(-EFAULT);
- RETURN(ll_lov_recreate(inode, ucreat.lrc_id, 0,
- ucreat.lrc_ost_idx));
+ ostid_set_seq_mdt0(&oi);
+ ostid_set_id(&oi, ucreat.lrc_id);
+ RETURN(ll_lov_recreate(inode, &oi, ucreat.lrc_ost_idx));
}
static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
{
struct lu_fid fid;
- obd_id id;
+ struct ost_id oi;
obd_count ost_idx;
ENTRY;
if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
RETURN(-EFAULT);
- id = fid_oid(&fid) | ((fid_seq(&fid) & 0xffff) << 32);
+ fid_to_ostid(&fid, &oi);
ost_idx = (fid_seq(&fid) >> 16) & 0xffff;
- RETURN(ll_lov_recreate(inode, id, 0, ost_idx));
+ RETURN(ll_lov_recreate(inode, &oi, ost_idx));
}
int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
lmm->lmm_magic = cpu_to_le32(magic);
lmm->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0);
- fid_ostid_pack(fid, &lmm->lmm_oi);
+ fid_to_ostid(fid, &lmm->lmm_oi);
ostid_cpu_to_le(&lmm->lmm_oi, &lmm->lmm_oi);
lmm->lmm_stripe_size = cpu_to_le32(lo->ldo_stripe_size);
lmm->lmm_stripe_count = cpu_to_le16(lo->ldo_stripenr);
LASSERT(lo->ldo_stripe[i]);
fid = lu_object_fid(&lo->ldo_stripe[i]->do_lu);
- rc = fid_ostid_pack(fid, &info->lti_ostid);
+ rc = fid_to_ostid(fid, &info->lti_ostid);
LASSERT(rc == 0);
ostid_cpu_to_le(&info->lti_ostid, &objs[i].l_ost_oi);
for (i = 0; i < lo->ldo_stripenr; i++) {
ostid_le_to_cpu(&objs[i].l_ost_oi, &info->lti_ostid);
idx = le64_to_cpu(objs[i].l_ost_idx);
- fid_ostid_unpack(&info->lti_fid, &info->lti_ostid, idx);
+ ostid_to_fid(&info->lti_fid, &info->lti_ostid, idx);
LASSERTF(fid_is_sane(&info->lti_fid), ""DFID" insane!\n",
PFID(&info->lti_fid));
/*
rc = sizeof(struct lov_user_md_v1);
} else if (buf->lb_len >= sizeof(struct lov_user_md_v1)) {
lum->lmm_magic = LOV_USER_MAGIC_V1;
- lum->lmm_oi.oi_seq = FID_SEQ_LOV_DEFAULT;
+ ostid_set_seq(&lum->lmm_oi, FID_SEQ_LOV_DEFAULT);
lum->lmm_pattern = desc->ld_pattern;
lum->lmm_stripe_size = desc->ld_default_stripe_size;
lum->lmm_stripe_count = desc->ld_default_stripe_count;
v3->lmm_magic = cpu_to_le32(LOV_MAGIC_V3);
v3->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0);
- fid_ostid_pack(lu_object_fid(&dt->do_lu), &v3->lmm_oi);
+ fid_to_ostid(lu_object_fid(&dt->do_lu), &v3->lmm_oi);
ostid_cpu_to_le(&v3->lmm_oi, &v3->lmm_oi);
v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size);
v3->lmm_stripe_count = cpu_to_le32(lo->ldo_def_stripenr);
switch (rec->lrh_type) {
case MDS_UNLINK_REC: {
struct llog_unlink_rec *lur = (struct llog_unlink_rec *)rec;
- lur->lur_oid = loi->loi_id;
- lur->lur_oseq = loi->loi_seq;
+ lur->lur_oid = ostid_id(&loi->loi_oi);
+ lur->lur_oseq = (__u32)ostid_seq(&loi->loi_oi);
break;
}
case MDS_SETATTR64_REC: {
struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec;
- lsr->lsr_oid = loi->loi_id;
- lsr->lsr_oseq = loi->loi_seq;
+ lsr->lsr_oi = loi->loi_oi;
break;
}
default:
obd_time current_ctime = lvb->lvb_ctime;
int i;
int rc = 0;
- struct lu_fid fid;
+ struct lu_fid fid = {0};
LASSERT_SPIN_LOCKED(&lsm->lsm_lock);
#ifdef __KERNEL__
LASSERT(lsm->lsm_lock_owner == cfs_curproc_pid());
#endif
- ostid_fid_unpack(&lsm->lsm_oi, &fid);
+ ostid_to_fid(&fid, &lsm->lsm_oi, 0);
CDEBUG(D_INODE, "MDT FID "DFID" initial value: s="LPU64" m="LPU64
" a="LPU64" c="LPU64" b="LPU64"\n", PFID(&fid), lvb->lvb_size,
lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
int lov_merge_lvb(struct obd_export *exp,
struct lov_stripe_md *lsm, struct ost_lvb *lvb, int kms_only)
{
- struct lu_fid fid;
+ struct lu_fid fid = {0};
int rc;
__u64 kms;
if (kms_only)
lvb->lvb_size = kms;
- ostid_fid_unpack(&lsm->lsm_oi, &fid);
+ ostid_to_fid(&fid, &lsm->lsm_oi, 0);
CDEBUG(D_INODE, "merged for FID "DFID" s="LPU64" m="LPU64" a="LPU64
" c="LPU64" b="LPU64"\n", PFID(&fid), lvb->lvb_size,
lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
!lov->lov_tgts[ost_idx])
GOTO(out, rc = -EINVAL);
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (lsm->lsm_oinfo[i]->loi_ost_idx == ost_idx) {
- if (lsm->lsm_oinfo[i]->loi_id != src_oa->o_id)
- GOTO(out, rc = -EINVAL);
- break;
- }
- }
+ for (i = 0; i < lsm->lsm_stripe_count; i++) {
+ if (lsm->lsm_oinfo[i]->loi_ost_idx == ost_idx) {
+ if (ostid_id(&lsm->lsm_oinfo[i]->loi_oi) !=
+ ostid_id(&src_oa->o_oi))
+ GOTO(out, rc = -EINVAL);
+ break;
+ }
+ }
if (i == lsm->lsm_stripe_count)
GOTO(out, rc = -EINVAL);
fm_local->fm_mapped_extents = 0;
fm_local->fm_flags = fiemap->fm_flags;
- fm_key->oa.o_id = lsm->lsm_oinfo[cur_stripe]->loi_id;
- fm_key->oa.o_seq = lsm->lsm_oinfo[cur_stripe]->loi_seq;
+ fm_key->oa.o_oi = lsm->lsm_oinfo[cur_stripe]->loi_oi;
ost_index = lsm->lsm_oinfo[cur_stripe]->loi_ost_idx;
if (ost_index < 0 || ost_index >=lov->desc.ld_tgt_count)
parent = subhdr->coh_parent;
oinfo = lov->lo_lsm->lsm_oinfo[idx];
- CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: id: "LPU64" seq: "LPU64
- " idx: %d gen: %d\n",
- PFID(&subhdr->coh_lu.loh_fid), subhdr, idx,
- PFID(&hdr->coh_lu.loh_fid), hdr,
- oinfo->loi_id, oinfo->loi_seq,
- oinfo->loi_ost_idx, oinfo->loi_ost_gen);
+ CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: ostid: "DOSTID
+ " idx: %d gen: %d\n",
+ PFID(&subhdr->coh_lu.loh_fid), subhdr, idx,
+ PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi),
+ oinfo->loi_ost_idx, oinfo->loi_ost_gen);
if (parent == NULL) {
subhdr->coh_parent = hdr;
struct lov_oinfo *oinfo = lsm->lsm_oinfo[i];
int ost_idx = oinfo->loi_ost_idx;
- fid_ostid_unpack(ofid, &oinfo->loi_oi,
- oinfo->loi_ost_idx);
+ ostid_to_fid(ofid, &oinfo->loi_oi, oinfo->loi_ost_idx);
subdev = lovsub2cl_dev(dev->ld_target[ost_idx]);
subconf->u.coc_oinfo = oinfo;
LASSERTF(subdev != NULL, "not init ost %d\n", ost_idx);
for (i = 0; i < stripe_count; i++) {
struct lov_oinfo *loi = lsm->lsm_oinfo[i];
/* XXX LOV STACKING call down to osc_packmd() to do packing */
- LASSERTF(loi->loi_id != 0, "lmm_oi "DOSTID" stripe %u/%u"
- " idx %u\n", POSTID(&lmmv1->lmm_oi), i, stripe_count,
- loi->loi_ost_idx);
+ LASSERTF(ostid_id(&loi->loi_oi) != 0, "lmm_oi "DOSTID
+ " stripe %u/%u idx %u\n", POSTID(&lmmv1->lmm_oi),
+ i, stripe_count, loi->loi_ost_idx);
ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi);
lmm_objects[i].l_ost_gen = cpu_to_le32(loi->loi_ost_gen);
lmm_objects[i].l_ost_idx = cpu_to_le32(loi->loi_ost_idx);
&len, &last_id, NULL);
if (rc)
RETURN(rc);
- if (lmm_objects[i].l_object_id > last_id) {
- CERROR("Setting EA for object > than last id on "
- "ost idx %d "LPD64" > "LPD64" \n",
- lmm_objects[i].l_ost_idx,
- lmm_objects[i].l_object_id, last_id);
- RETURN(-EINVAL);
- }
+ if (ostid_id(&lmm_objects[i].l_ost_oi) > last_id) {
+ CERROR("Setting EA for object > than last id on"
+ " ost idx %d "DOSTID" > "LPD64" \n",
+ lmm_objects[i].l_ost_idx,
+ POSTID(&lmm_objects[i].l_ost_oi), last_id);
+ RETURN(-EINVAL);
+ }
}
rc = lov_setstripe(exp, 0, lsmp, lump);
for (i = 0; i < lump->lmm_stripe_count; i++) {
(*lsmp)->lsm_oinfo[i]->loi_ost_idx =
lmm_objects[i].l_ost_idx;
- (*lsmp)->lsm_oinfo[i]->loi_id = lmm_objects[i].l_object_id;
- (*lsmp)->lsm_oinfo[i]->loi_seq = lmm_objects[i].l_object_seq;
+ (*lsmp)->lsm_oinfo[i]->loi_oi = lmm_objects[i].l_ost_oi;
}
RETURN(0);
}
lov_lockhp = set->set_lockh->llh_handles + i;
if (!lustre_handle_is_used(lov_lockhp)) {
- CDEBUG(D_INFO, "lov idx %d subobj "LPX64" no lock\n",
- loi->loi_ost_idx, loi->loi_id);
+ CDEBUG(D_INFO, "lov idx %d subobj "DOSTID" no lock\n",
+ loi->loi_ost_idx, POSTID(&loi->loi_oi));
continue;
}
GOTO(out, rc = -EIO);
}
- tmp_oa->o_id = set->set_oi->oi_oa->o_id;
+ tmp_oa->o_oi = set->set_oi->oi_oa->o_oi;
memcpy(set->set_oi->oi_oa, tmp_oa, sizeof(*set->set_oi->oi_oa));
out:
if (tmp_oa)
memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
sizeof(*req->rq_oi.oi_oa));
}
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq = loi->loi_seq;
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
req->rq_oi.oi_oa->o_stripe_idx = i;
req->rq_buflen = sizeof(*req->rq_oi.oi_md);
}
memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
sizeof(*req->rq_oi.oi_oa));
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq = loi->loi_seq;
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
req->rq_oi.oi_cb_up = cb_getattr_update;
req->rq_oi.oi_capa = oinfo->oi_capa;
GOTO(out_set, rc = -ENOMEM);
}
memcpy(req->rq_oi.oi_oa, src_oa, sizeof(*req->rq_oi.oi_oa));
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq = loi->loi_seq;
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
lov_set_add_req(req, set);
}
if (!set->set_count)
OBD_FREE(req, sizeof(*req));
GOTO(out_set, rc = -ENOMEM);
}
- memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
- sizeof(*req->rq_oi.oi_oa));
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq= loi->loi_seq;
- req->rq_oi.oi_oa->o_stripe_idx = i;
- req->rq_oi.oi_cb_up = cb_setattr_update;
- req->rq_oi.oi_capa = oinfo->oi_capa;
+ memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
+ sizeof(*req->rq_oi.oi_oa));
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
+ req->rq_oi.oi_oa->o_stripe_idx = i;
+ req->rq_oi.oi_cb_up = cb_setattr_update;
+ req->rq_oi.oi_capa = oinfo->oi_capa;
if (oinfo->oi_oa->o_valid & OBD_MD_FLSIZE) {
int off = lov_stripe_offset(oinfo->oi_md,
}
memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
sizeof(*req->rq_oi.oi_oa));
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq = loi->loi_seq;
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
req->rq_oi.oi_oa->o_valid |= OBD_MD_FLGROUP;
req->rq_oi.oi_oa->o_stripe_idx = i;
GOTO(out_set, rc = -ENOMEM);
}
*req->rq_oi.oi_oa = *oinfo->oi_oa;
- req->rq_oi.oi_oa->o_id = loi->loi_id;
- req->rq_oi.oi_oa->o_seq = loi->loi_seq;
+ req->rq_oi.oi_oa->o_oi = loi->loi_oi;
req->rq_oi.oi_oa->o_stripe_idx = i;
req->rq_oi.oi_policy.l_extent.start = rs;
static int changelog_init_cb(const struct lu_env *env, struct llog_handle *llh,
struct llog_rec_hdr *hdr, void *data)
{
- struct mdd_device *mdd = (struct mdd_device *)data;
- struct llog_changelog_rec *rec = (struct llog_changelog_rec *)hdr;
+ struct mdd_device *mdd = (struct mdd_device *)data;
+ struct llog_changelog_rec *rec = (struct llog_changelog_rec *)hdr;
- LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
- LASSERT(rec->cr_hdr.lrh_type == CHANGELOG_REC);
+ LASSERT(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN);
+ LASSERT(rec->cr_hdr.lrh_type == CHANGELOG_REC);
- CDEBUG(D_INFO,
- "seeing record at index %d/%d/"LPU64" t=%x %.*s in log "LPX64"\n",
- hdr->lrh_index, rec->cr_hdr.lrh_index, rec->cr.cr_index,
- rec->cr.cr_type, rec->cr.cr_namelen, rec->cr.cr_name,
- llh->lgh_id.lgl_oid);
+ CDEBUG(D_INFO,
+ "seeing record at index %d/%d/"LPU64" t=%x %.*s in log"
+ DOSTID"\n", hdr->lrh_index, rec->cr_hdr.lrh_index,
+ rec->cr.cr_index, rec->cr.cr_type, rec->cr.cr_namelen,
+ rec->cr.cr_name, POSTID(&llh->lgh_id.lgl_oi));
- mdd->mdd_cl.mc_index = rec->cr.cr_index;
- return LLOG_PROC_BREAK;
+ mdd->mdd_cl.mc_index = rec->cr.cr_index;
+ return LLOG_PROC_BREAK;
}
static int changelog_user_init_cb(const struct lu_env *env,
LASSERT(rec->cur_hdr.lrh_type == CHANGELOG_USER_REC);
CDEBUG(D_INFO, "seeing user at index %d/%d id=%d endrec="LPU64
- " in log "LPX64"\n", hdr->lrh_index, rec->cur_hdr.lrh_index,
- rec->cur_id, rec->cur_endrec, llh->lgh_id.lgl_oid);
+ " in log "DOSTID"\n", hdr->lrh_index, rec->cur_hdr.lrh_index,
+ rec->cur_id, rec->cur_endrec, POSTID(&llh->lgh_id.lgl_oi));
spin_lock(&mdd->mdd_cl.mc_user_lock);
mdd->mdd_cl.mc_lastuser = rec->cur_id;
/* 0 or 1 means we're done */
rc = 0;
else
- CERROR("%s: cancel idx %u of catalog "LPX64" rc=%d\n",
+ CERROR("%s: cancel idx %u of catalog "DOSTID" rc=%d\n",
ctxt->loc_obd->obd_name, cathandle->lgh_last_idx,
- cathandle->lgh_id.lgl_oid, rc);
+ POSTID(&cathandle->lgh_id.lgl_oi), rc);
RETURN(rc);
}
{
valid &= src->o_valid;
- LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
- OBD_MD_FLID | OBD_MD_FLGROUP)),
- "object "LPU64"/"LPU64", valid %x\n",
- src->o_id, src->o_seq, valid);
+ LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
+ OBD_MD_FLID | OBD_MD_FLGROUP)),
+ "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
CDEBUG(D_INODE,
int rc = 0;
ENTRY;
- CDEBUG(D_RPCTRACE, "Canceling %d in log "LPX64"\n",
- index, loghandle->lgh_id.lgl_oid);
+ CDEBUG(D_RPCTRACE, "Canceling %d in log "DOSTID"\n",
+ index, POSTID(&loghandle->lgh_id.lgl_oi));
if (index == 0) {
CERROR("Can't cancel index 0 which is header\n");
spin_unlock(&loghandle->lgh_hdr_lock);
rc = llog_destroy(env, loghandle);
if (rc < 0) {
- CERROR("%s: can't destroy empty llog #"LPX64"#"LPX64
+ CERROR("%s: can't destroy empty llog #"DOSTID
"#%08x: rc = %d\n",
loghandle->lgh_ctxt->loc_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_oseq,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, rc);
GOTO(out_err, rc);
}
rc = llog_write(env, loghandle, &llh->llh_hdr, NULL, 0, NULL, 0);
if (rc < 0) {
- CERROR("%s: fail to write header for llog #"LPX64"#"LPX64
+ CERROR("%s: fail to write header for llog #"DOSTID
"#%08x: rc = %d\n",
loghandle->lgh_ctxt->loc_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_oseq,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, rc);
GOTO(out_err, rc);
}
cathandle->lgh_last_idx = index;
llh->llh_tail.lrt_index = index;
- CDEBUG(D_RPCTRACE,"new recovery log "LPX64":%x for index %u of catalog "
- LPX64"\n", loghandle->lgh_id.lgl_oid, loghandle->lgh_id.lgl_ogen,
- index, cathandle->lgh_id.lgl_oid);
+ CDEBUG(D_RPCTRACE,"new recovery log "DOSTID":%x for index %u of catalog"
+ DOSTID"\n", POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen, index,
+ POSTID(&cathandle->lgh_id.lgl_oi));
/* build the record for this log in the catalog */
rec.lid_hdr.lrh_len = sizeof(rec);
rec.lid_hdr.lrh_index = index;
u.phd.phd_entry) {
struct llog_logid *cgl = &loghandle->lgh_id;
- if (cgl->lgl_oid == logid->lgl_oid) {
+ if (ostid_id(&cgl->lgl_oi) == ostid_id(&logid->lgl_oi) &&
+ ostid_seq(&cgl->lgl_oi) == ostid_seq(&logid->lgl_oi)) {
if (cgl->lgl_ogen != logid->lgl_ogen) {
- CERROR("%s: log "LPX64" generation %x != %x\n",
+ CERROR("%s: log "DOSTID" generation %x != %x\n",
loghandle->lgh_ctxt->loc_obd->obd_name,
- logid->lgl_oid, cgl->lgl_ogen,
+ POSTID(&logid->lgl_oi), cgl->lgl_ogen,
logid->lgl_ogen);
continue;
}
rc = llog_open(env, cathandle->lgh_ctxt, &loghandle, logid, NULL,
LLOG_OPEN_EXISTS);
if (rc < 0) {
- CERROR("%s: error opening log id "LPX64":%x: rc = %d\n",
+ CERROR("%s: error opening log id "DOSTID":%x: rc = %d\n",
cathandle->lgh_ctxt->loc_obd->obd_name,
- logid->lgl_oid, logid->lgl_ogen, rc);
+ POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
RETURN(rc);
}
rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
if (rc) {
- CERROR("%s: cannot find handle for llog "LPX64": %d\n",
+ CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cathandle->lgh_ctxt->loc_obd->obd_name,
- lgl->lgl_oid, rc);
+ POSTID(&lgl->lgl_oi), rc);
failed++;
continue;
}
CERROR("invalid record in catalog\n");
RETURN(-EINVAL);
}
- CDEBUG(D_HA, "processing log "LPX64":%x at index %u of catalog "
- LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
- rec->lrh_index, cat_llh->lgh_id.lgl_oid);
+ CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
+ DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
+ rec->lrh_index, POSTID(&cat_llh->lgh_id.lgl_oi));
rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
if (rc) {
- CERROR("%s: cannot find handle for llog "LPX64": %d\n",
+ CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cat_llh->lgh_ctxt->loc_obd->obd_name,
- lir->lid_id.lgl_oid, rc);
+ POSTID(&lir->lid_id.lgl_oi), rc);
RETURN(rc);
}
if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
struct llog_process_cat_data cd;
- CWARN("catlog "LPX64" crosses index zero\n",
- cat_llh->lgh_id.lgl_oid);
+ CWARN("catlog "DOSTID" crosses index zero\n",
+ POSTID(&cat_llh->lgh_id.lgl_oi));
cd.lpcd_first_idx = llh->llh_cat_idx;
cd.lpcd_last_idx = 0;
struct llog_handle *cat_llh,
struct llog_rec_hdr *rec, void *data)
{
- struct llog_process_data *d = data;
- struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
- struct llog_handle *llh;
- int rc;
+ struct llog_process_data *d = data;
+ struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
+ struct llog_handle *llh;
+ int rc;
- if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
- CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
- }
- CDEBUG(D_HA, "processing log "LPX64":%x at index %u of catalog "
- LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
- le32_to_cpu(rec->lrh_index), cat_llh->lgh_id.lgl_oid);
+ if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
+ CERROR("invalid record in catalog\n");
+ RETURN(-EINVAL);
+ }
+ CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
+ DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
+ le32_to_cpu(rec->lrh_index), POSTID(&cat_llh->lgh_id.lgl_oi));
rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
if (rc) {
- CERROR("%s: cannot find handle for llog "LPX64": %d\n",
+ CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cat_llh->lgh_ctxt->loc_obd->obd_name,
- lir->lid_id.lgl_oid, rc);
+ POSTID(&lir->lid_id.lgl_oi), rc);
RETURN(rc);
}
d.lpd_data = data;
d.lpd_cb = cb;
- if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
- CWARN("catalog "LPX64" crosses index zero\n",
- cat_llh->lgh_id.lgl_oid);
+ if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
+ CWARN("catalog "DOSTID" crosses index zero\n",
+ POSTID(&cat_llh->lgh_id.lgl_oi));
cd.lpcd_first_idx = 0;
cd.lpcd_last_idx = cat_llh->lgh_last_idx;
}
}
out:
- CDEBUG(D_RPCTRACE, "set catlog "LPX64" first idx %u\n",
- cathandle->lgh_id.lgl_oid, llh->llh_cat_idx);
- }
+ CDEBUG(D_RPCTRACE, "set catlog "DOSTID" first idx %u\n",
+ POSTID(&cathandle->lgh_id.lgl_oi), llh->llh_cat_idx);
+ }
- RETURN(0);
+ RETURN(0);
}
/* Cleanup deleted plain llog traces from catalog */
rc = llog_cancel_rec(env, cathandle, index);
if (rc == 0)
CDEBUG(D_HA, "cancel plain log at index"
- " %u of catalog "LPX64"\n",
- index, cathandle->lgh_id.lgl_oid);
+ " %u of catalog "DOSTID"\n",
+ index, POSTID(&cathandle->lgh_id.lgl_oi));
return rc;
}
CERROR("invalid record in catalog\n");
RETURN(-EINVAL);
}
- CDEBUG(D_HA, "processing log "LPX64":%x at index %u of catalog "
- LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
- rec->lrh_index, cathandle->lgh_id.lgl_oid);
+
+ CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
+ DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
+ rec->lrh_index, POSTID(&cathandle->lgh_id.lgl_oi));
rc = llog_cat_id2handle(env, cathandle, &loghandle, &lir->lid_id);
if (rc) {
- CERROR("%s: cannot find handle for llog "LPX64": %d\n",
+ CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cathandle->lgh_ctxt->loc_obd->obd_name,
- lir->lid_id.lgl_oid, rc);
+ POSTID(&lir->lid_id.lgl_oi), rc);
if (rc == -ENOENT || rc == -ESTALE) {
/* remove index from catalog */
llog_cat_cleanup(env, cathandle, NULL, rec->lrh_index);
return lgi;
}
+static inline void
+lustre_build_llog_lvfs_oid(struct llog_logid *logid, __u64 ino, __u32 gen)
+{
+ ostid_set_seq_llog(&logid->lgl_oi);
+ ostid_set_id(&logid->lgl_oi, ino);
+ logid->lgl_ogen = gen;
+}
+
int llog_info_init(void);
void llog_info_fini(void);
static int str2logid(struct llog_logid *logid, char *str, int len)
{
char *start, *end, *endp;
+ __u64 id, seq;
ENTRY;
start = str;
RETURN(-EINVAL);
*end = '\0';
- logid->lgl_oid = simple_strtoull(start, &endp, 0);
+ id = simple_strtoull(start, &endp, 0);
if (endp != end)
RETURN(-EINVAL);
RETURN(-EINVAL);
*end = '\0';
- logid->lgl_oseq = simple_strtoull(start, &endp, 0);
+ seq = simple_strtoull(start, &endp, 0);
if (endp != end)
RETURN(-EINVAL);
- start = ++end;
+ ostid_set_seq(&logid->lgl_oi, seq);
+ ostid_set_id(&logid->lgl_oi, id);
+
+ start = ++end;
if (start - str >= len - 1)
RETURN(-EINVAL);
logid->lgl_ogen = simple_strtoul(start, &endp, 16);
RETURN(-EOPNOTSUPP);
rc = llog_cat_id2handle(env, handle, &loghandle, &lir->lid_id);
if (rc) {
- CDEBUG(D_IOCTL,
- "cannot find log #"LPX64"#"LPX64"#%08x\n",
- lir->lid_id.lgl_oid, lir->lid_id.lgl_oseq,
+ CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
+ POSTID(&lir->lid_id.lgl_oi),
lir->lid_id.lgl_ogen);
RETURN(rc);
}
RETURN(-EINVAL);
}
- l = snprintf(out, remains,
- "[index]: %05d [logid]: #"LPX64"#"LPX64"#%08x\n",
- cur_index, lir->lid_id.lgl_oid,
- lir->lid_id.lgl_oseq, lir->lid_id.lgl_ogen);
+ l = snprintf(out, remains,
+ "[index]: %05d [logid]: #"DOSTID"#%08x\n",
+ cur_index, POSTID(&lir->lid_id.lgl_oi),
+ lir->lid_id.lgl_ogen);
} else if (rec->lrh_type == OBD_CFG_REC) {
int rc;
rc = llog_cat_id2handle(env, cat, &log, logid);
if (rc) {
- CDEBUG(D_IOCTL, "cannot find log #"LPX64"#"LPX64"#%08x\n",
- logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen);
+ CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
+ POSTID(&logid->lgl_oi), logid->lgl_ogen);
RETURN(-ENOENT);
}
cfs_size_round(data->ioc_inllen1);
char *out = data->ioc_bulk;
- l = snprintf(out, remains,
- "logid: #"LPX64"#"LPX64"#%08x\n"
- "flags: %x (%s)\n"
- "records count: %d\n"
- "last index: %d\n",
- handle->lgh_id.lgl_oid, handle->lgh_id.lgl_oseq,
- handle->lgh_id.lgl_ogen,
- handle->lgh_hdr->llh_flags,
- handle->lgh_hdr->llh_flags &
- LLOG_F_IS_CAT ? "cat" : "plain",
- handle->lgh_hdr->llh_count,
- handle->lgh_last_idx);
+ l = snprintf(out, remains,
+ "logid: #"DOSTID"#%08x\n"
+ "flags: %x (%s)\n"
+ "records count: %d\n"
+ "last index: %d\n",
+ POSTID(&handle->lgh_id.lgl_oi),
+ handle->lgh_id.lgl_ogen,
+ handle->lgh_hdr->llh_flags,
+ handle->lgh_hdr->llh_flags &
+ LLOG_F_IS_CAT ? "cat" : "plain",
+ handle->lgh_hdr->llh_count,
+ handle->lgh_last_idx);
out += l;
remains -= l;
if (remains <= 0) {
/* We assume that caller has set lgh_cur_* */
saved_offset = loghandle->lgh_cur_offset;
CDEBUG(D_OTHER,
- "modify record "LPX64": idx:%d/%u/%d, len:%u "
+ "modify record "DOSTID": idx:%d/%u/%d, len:%u "
"offset %llu\n",
- loghandle->lgh_id.lgl_oid, idx, rec->lrh_index,
+ POSTID(&loghandle->lgh_id.lgl_oi), idx, rec->lrh_index,
loghandle->lgh_cur_idx, rec->lrh_len,
(long long)(saved_offset - sizeof(*llh)));
if (rec->lrh_index != loghandle->lgh_cur_idx) {
if (rc)
RETURN(rc);
- CDEBUG(D_RPCTRACE, "added record "LPX64": idx: %u, %u \n",
- loghandle->lgh_id.lgl_oid, index, rec->lrh_len);
+ CDEBUG(D_RPCTRACE, "added record "DOSTID": idx: %u, %u \n",
+ POSTID(&loghandle->lgh_id.lgl_oi), index, rec->lrh_len);
if (rc == 0 && reccookie) {
reccookie->lgc_lgl = loghandle->lgh_id;
reccookie->lgc_index = index;
loghandle->lgh_file, buf, llen,
cur_offset);
if (rc < 0) {
- CERROR("Cant read llog block at log id "LPU64
- "/%u offset "LPU64"\n",
- loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_ogen,
- *cur_offset);
- RETURN(rc);
- }
+ CERROR("Cant read llog block at log id "DOSTID
+ "/%u offset "LPU64"\n",
+ POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen,
+ *cur_offset);
+ RETURN(rc);
+ }
/* put number of bytes read into rc to make code simpler */
rc = *cur_offset - ppos;
if (rc == 0) /* end of file, nothing to do */
RETURN(0);
- if (rc < sizeof(*tail)) {
- CERROR("Invalid llog block at log id "LPU64"/%u offset "
- LPU64"\n", loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_ogen, *cur_offset);
- RETURN(-EINVAL);
- }
+ if (rc < sizeof(*tail)) {
+ CERROR("Invalid llog block at log id "DOSTID"/%u offset"
+ LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen, *cur_offset);
+ RETURN(-EINVAL);
+ }
rec = buf;
if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
*cur_idx = tail->lrt_index;
- /* this shouldn't happen */
- if (tail->lrt_index == 0) {
- CERROR("Invalid llog tail at log id "LPU64"/%u offset "
- LPU64"\n", loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_ogen, *cur_offset);
- RETURN(-EINVAL);
- }
+ /* this shouldn't happen */
+ if (tail->lrt_index == 0) {
+ CERROR("Invalid llog tail at log id "DOSTID"/%u offset "
+ LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen, *cur_offset);
+ RETURN(-EINVAL);
+ }
if (tail->lrt_index < next_idx)
continue;
loghandle->lgh_file, buf, len,
&cur_offset);
if (rc < 0) {
- CERROR("Cant read llog block at log id "LPU64
- "/%u offset "LPU64"\n",
- loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_ogen,
- cur_offset);
- RETURN(rc);
- }
+ CERROR("Cant read llog block at log id "DOSTID
+ "/%u offset "LPU64"\n",
+ POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen,
+ cur_offset);
+ RETURN(rc);
+ }
/* put number of bytes read into rc to make code simpler */
rc = cur_offset - ppos;
RETURN(0);
if (rc < sizeof(*tail)) {
- CERROR("Invalid llog block at log id "LPU64"/%u offset "
- LPU64"\n", loghandle->lgh_id.lgl_oid,
+ CERROR("Invalid llog block at log id "DOSTID"/%u offset"
+ LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, cur_offset);
RETURN(-EINVAL);
}
lustre_swab_llog_rec(last_rec);
LASSERT(last_rec->lrh_index == tail->lrt_index);
- /* this shouldn't happen */
- if (tail->lrt_index == 0) {
- CERROR("Invalid llog tail at log id "LPU64"/%u offset "
- LPU64"\n", loghandle->lgh_id.lgl_oid,
- loghandle->lgh_id.lgl_ogen, cur_offset);
- RETURN(-EINVAL);
- }
+ /* this shouldn't happen */
+ if (tail->lrt_index == 0) {
+ CERROR("Invalid llog tail at log id "DOSTID"/%u offset"
+ LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
+ loghandle->lgh_id.lgl_ogen, cur_offset);
+ RETURN(-EINVAL);
+ }
if (tail->lrt_index < prev_idx)
continue;
LASSERT(handle);
if (logid != NULL) {
- dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, logid->lgl_oid,
- logid->lgl_ogen, logid->lgl_oseq);
+ dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, &logid->lgl_oi,
+ logid->lgl_ogen);
if (IS_ERR(dchild)) {
rc = PTR_ERR(dchild);
- CERROR("%s: error looking up logfile #"LPX64"#"
- LPX64"#%08x: rc = %d\n",
- ctxt->loc_obd->obd_name, logid->lgl_oid,
- logid->lgl_oseq, logid->lgl_ogen, rc);
+ CERROR("%s: error looking up logfile #"DOSTID "#%08x:"
+ " rc = %d\n", ctxt->loc_obd->obd_name,
+ POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
GOTO(out, rc);
}
if (dchild->d_inode == NULL) {
l_dput(dchild);
rc = -ENOENT;
- CERROR("%s: nonexistent llog #"LPX64"#"LPX64"#%08x: "
+ CERROR("%s: nonexistent llog #"DOSTID"#%08x:"
"rc = %d\n", ctxt->loc_obd->obd_name,
- logid->lgl_oid, logid->lgl_oseq,
- logid->lgl_ogen, rc);
+ POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
GOTO(out, rc);
}
handle->lgh_file = l_dentry_open(&obd->obd_lvfs_ctxt, dchild,
if (IS_ERR(handle->lgh_file)) {
rc = PTR_ERR(handle->lgh_file);
handle->lgh_file = NULL;
- CERROR("%s: error opening llog #"LPX64"#"LPX64"#%08x: "
+ CERROR("%s: error opening llog #"DOSTID"#%08x:"
"rc = %d\n", ctxt->loc_obd->obd_name,
- logid->lgl_oid, logid->lgl_oseq,
- logid->lgl_ogen, rc);
+ POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
GOTO(out, rc);
}
handle->lgh_id = *logid;
GOTO(out, rc);
}
} else {
- handle->lgh_id.lgl_oseq = FID_SEQ_LLOG;
- handle->lgh_id.lgl_oid =
- handle->lgh_file->f_dentry->d_inode->i_ino;
- handle->lgh_id.lgl_ogen =
- handle->lgh_file->f_dentry->d_inode->i_generation;
+ lustre_build_llog_lvfs_oid(&handle->lgh_id,
+ handle->lgh_file->f_dentry->d_inode->i_ino,
+ handle->lgh_file->f_dentry->d_inode->i_generation);
}
} else {
LASSERTF(open_param == LLOG_OPEN_NEW, "%#x\n", open_param);
if (IS_ERR(file))
RETURN(PTR_ERR(file));
- handle->lgh_id.lgl_oseq = FID_SEQ_LLOG;
- handle->lgh_id.lgl_oid = file->f_dentry->d_inode->i_ino;
- handle->lgh_id.lgl_ogen =
- file->f_dentry->d_inode->i_generation;
+ lustre_build_llog_lvfs_oid(&handle->lgh_id,
+ file->f_dentry->d_inode->i_ino,
+ file->f_dentry->d_inode->i_generation);
handle->lgh_file = file;
} else {
OBDO_ALLOC(oa);
if (oa == NULL)
RETURN(-ENOMEM);
- oa->o_seq = FID_SEQ_LLOG;
+ ostid_set_seq_llog(&oa->o_oi);
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
rc = obd_create(NULL, ctxt->loc_exp, oa, NULL, NULL);
* this API along with mds_obd_{create,destroy}.
* Hopefully it is only an internal API issue. */
#define o_generation o_parent_oid
- dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, oa->o_id,
- oa->o_generation, oa->o_seq);
+ dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, &oa->o_oi,
+ oa->o_generation);
if (IS_ERR(dchild))
GOTO(out, rc = PTR_ERR(dchild));
l_dput(dchild);
if (IS_ERR(file))
GOTO(out, rc = PTR_ERR(file));
- handle->lgh_id.lgl_oseq = oa->o_seq;
- handle->lgh_id.lgl_oid = oa->o_id;
+ handle->lgh_id.lgl_oi = oa->o_oi;
handle->lgh_id.lgl_ogen = oa->o_generation;
handle->lgh_file = file;
out:
RETURN(0);
rc = filp_close(handle->lgh_file, 0);
if (rc)
- CERROR("%s: error closing llog #"LPX64"#"LPX64"#%08x: "
+ CERROR("%s: error closing llog #"DOSTID"#%08x: "
"rc = %d\n", handle->lgh_ctxt->loc_obd->obd_name,
- handle->lgh_id.lgl_oid, handle->lgh_id.lgl_oseq,
+ POSTID(&handle->lgh_id.lgl_oi),
handle->lgh_id.lgl_ogen, rc);
handle->lgh_file = NULL;
if (handle->lgh_name) {
if (oa == NULL)
RETURN(-ENOMEM);
- oa->o_id = handle->lgh_id.lgl_oid;
- oa->o_seq = handle->lgh_id.lgl_oseq;
- oa->o_generation = handle->lgh_id.lgl_ogen;
+ oa->o_oi = handle->lgh_id.lgl_oi;
+ oa->o_generation = handle->lgh_id.lgl_ogen;
#undef o_generation
oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLGENER;
/* We assume that caller has set lgh_cur_* */
lgi->lgi_off = loghandle->lgh_cur_offset;
CDEBUG(D_OTHER,
- "modify record "LPX64": idx:%d/%u/%d, len:%u "
+ "modify record "DOSTID": idx:%d/%u/%d, len:%u "
"offset %llu\n",
- loghandle->lgh_id.lgl_oid, idx, rec->lrh_index,
+ POSTID(&loghandle->lgh_id.lgl_oi), idx,
+ rec->lrh_index,
loghandle->lgh_cur_idx, rec->lrh_len,
(long long)(lgi->lgi_off - sizeof(*llh)));
if (rec->lrh_index != loghandle->lgh_cur_idx) {
&lgi->lgi_off, th);
}
- CDEBUG(D_RPCTRACE, "added record "LPX64": idx: %u, %u\n",
- loghandle->lgh_id.lgl_oid, index, rec->lrh_len);
+ CDEBUG(D_RPCTRACE, "added record "DOSTID": idx: %u, %u\n",
+ POSTID(&loghandle->lgh_id.lgl_oi), index, rec->lrh_len);
if (rc == 0 && reccookie) {
reccookie->lgc_lgl = loghandle->lgh_id;
reccookie->lgc_index = index;
GOTO(out, rc);
if (rc < sizeof(*tail)) {
- CERROR("%s: invalid llog block at log id "LPU64"/%u "
+ CERROR("%s: invalid llog block at log id "DOSTID"/%u "
"offset "LPU64"\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, *cur_offset);
GOTO(out, rc = -EINVAL);
}
/* this shouldn't happen */
if (tail->lrt_index == 0) {
- CERROR("%s: invalid llog tail at log id "LPU64"/%u "
+ CERROR("%s: invalid llog tail at log id "DOSTID"/%u "
"offset "LPU64"\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, *cur_offset);
GOTO(out, rc = -EINVAL);
}
GOTO(out, rc);
if (rc < sizeof(*tail)) {
- CERROR("%s: invalid llog block at log id "LPU64"/%u "
+ CERROR("%s: invalid llog block at log id "DOSTID"/%u "
"offset "LPU64"\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, cur_offset);
GOTO(out, rc = -EINVAL);
}
/* this shouldn't happen */
if (tail->lrt_index == 0) {
- CERROR("%s: invalid llog tail at log id "LPU64"/%u "
+ CERROR("%s: invalid llog tail at log id "DOSTID"/%u "
"offset "LPU64"\n",
o->do_lu.lo_dev->ld_obd->obd_name,
- loghandle->lgh_id.lgl_oid,
+ POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, cur_offset);
GOTO(out, rc = -EINVAL);
}
static void print_llogd_body(struct llogd_body *d)
{
CDEBUG(D_OTHER, "llogd body: %p\n", d);
- CDEBUG(D_OTHER, "\tlgd_logid.lgl_oid: "LPX64"\n", d->lgd_logid.lgl_oid);
- CDEBUG(D_OTHER, "\tlgd_logid.lgl_oseq: "LPX64"\n", d->lgd_logid.lgl_oseq);
+ CDEBUG(D_OTHER, "\tlgd_logid.lgl_oi: "DOSTID"\n",
+ POSTID(&d->lgd_logid.lgl_oi));
CDEBUG(D_OTHER, "\tlgd_logid.lgl_ogen: %#x\n", d->lgd_logid.lgl_ogen);
CDEBUG(D_OTHER, "\tlgd_ctxt_idx: %#x\n", d->lgd_ctxt_idx);
CDEBUG(D_OTHER, "\tlgd_llh_flags: %#x\n", d->lgd_llh_flags);
CDEBUG(D_OTHER, "\tlgd_cur_offset: "LPX64"\n", d->lgd_cur_offset);
}
+void lustre_swab_lu_fid(struct lu_fid *fid)
+{
+ __swab64s (&fid->f_seq);
+ __swab32s (&fid->f_oid);
+ __swab32s (&fid->f_ver);
+}
+EXPORT_SYMBOL(lustre_swab_lu_fid);
+
+void lustre_swab_ost_id(struct ost_id *oid)
+{
+ if (fid_seq_is_mdt0(oid->oi.oi_seq)) {
+ __swab64s(&oid->oi.oi_id);
+ __swab64s(&oid->oi.oi_seq);
+ } else {
+ lustre_swab_lu_fid(&oid->oi_fid);
+ }
+}
+EXPORT_SYMBOL(lustre_swab_ost_id);
+
void lustre_swab_llogd_body (struct llogd_body *d)
{
ENTRY;
print_llogd_body(d);
- __swab64s (&d->lgd_logid.lgl_oid);
- __swab64s (&d->lgd_logid.lgl_oseq);
+ lustre_swab_ost_id(&d->lgd_logid.lgl_oi);
__swab32s (&d->lgd_logid.lgl_ogen);
__swab32s (&d->lgd_ctxt_idx);
__swab32s (&d->lgd_llh_flags);
{
__swab64s (&d->lgdc_gen.mnt_cnt);
__swab64s (&d->lgdc_gen.conn_cnt);
- __swab64s (&d->lgdc_logid.lgl_oid);
- __swab64s (&d->lgdc_logid.lgl_oseq);
+ lustre_swab_ost_id(&d->lgdc_logid.lgl_oi);
__swab32s (&d->lgdc_logid.lgl_ogen);
__swab32s (&d->lgdc_ctxt_idx);
}
}
EXPORT_SYMBOL(lustre_swab_ll_fid);
-void lustre_swab_lu_fid(struct lu_fid *fid)
-{
- __swab64s (&fid->f_seq);
- __swab32s (&fid->f_oid);
- __swab32s (&fid->f_ver);
-}
-EXPORT_SYMBOL(lustre_swab_lu_fid);
-
void lustre_swab_lu_seq_range(struct lu_seq_range *range)
{
__swab64s (&range->lsr_start);
struct llog_setattr64_rec *lsr =
(struct llog_setattr64_rec *)rec;
- __swab64s(&lsr->lsr_oid);
- __swab64s(&lsr->lsr_oseq);
+ lustre_swab_ost_id(&lsr->lsr_oi);
__swab32s(&lsr->lsr_uid);
__swab32s(&lsr->lsr_uid_h);
__swab32s(&lsr->lsr_gid);
}
case LLOG_LOGID_MAGIC:
{
- struct llog_logid_rec *lid = (struct llog_logid_rec *)rec;
+ struct llog_logid_rec *lid = (struct llog_logid_rec *)rec;
- __swab64s(&lid->lid_id.lgl_oid);
- __swab64s(&lid->lid_id.lgl_oseq);
- __swab32s(&lid->lid_id.lgl_ogen);
+ lustre_swab_ost_id(&lid->lid_id.lgl_oi);
+ __swab32s(&lid->lid_id.lgl_ogen);
tail = &lid->lid_tail;
- break;
- }
+ break;
+ }
case LLOG_GEN_REC:
{
struct llog_gen_rec *lgr = (struct llog_gen_rec *)rec;
struct llog_rec_hdr *rec, void *data)
{
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
- struct lu_fid fid;
+ struct lu_fid fid = {0};
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
static int plain_print_cb(const struct lu_env *env, struct llog_handle *llh,
struct llog_rec_hdr *rec, void *data)
{
- struct lu_fid fid;
+ struct lu_fid fid = {0};
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
static int test_7_print_cb(const struct lu_env *env, struct llog_handle *llh,
struct llog_rec_hdr *rec, void *data)
{
- struct lu_fid fid;
+ struct lu_fid fid = {0};
logid_to_fid(&llh->lgh_id, &fid);
void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid)
{
#ifdef __KERNEL__
- CDEBUG(D_INODE, "src obdo "LPX64" valid "LPX64", dst obdo "LPX64"\n",
- src->o_id, src->o_valid, dst->o_id);
+ CDEBUG(D_INODE, "src obdo "DOSTID" valid "LPX64", dst obdo "DOSTID"\n",
+ POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
#endif
if (valid & OBD_MD_FLATIME)
dst->o_atime = src->o_atime;
void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
{
- ioobj->ioo_id = oa->o_id;
- if (oa->o_valid & OBD_MD_FLGROUP)
- ioobj->ioo_seq = oa->o_seq;
- else
- ioobj->ioo_seq = 0;
+ ioobj->ioo_oid = oa->o_oi;
+ if (unlikely(!(oa->o_valid & OBD_MD_FLGROUP)))
+ ostid_set_seq_mdt0(&ioobj->ioo_oid);
+
/* Since 2.4 this does not contain o_mode in the low 16 bits.
* Instead, it holds (bd_md_max_brw - 1) for multi-bulk BRW RPCs */
ioobj->ioo_max_brw = 0;
return -EINVAL;
}
- oa->o_id = echo_next_id(obd);
- oa->o_valid = OBD_MD_FLID;
+ ostid_set_seq_echo(&oa->o_oi);
+ ostid_set_id(&oa->o_oi, echo_next_id(obd));
+ oa->o_valid = OBD_MD_FLID;
- return 0;
+ return 0;
}
static int echo_destroy(const struct lu_env *env, struct obd_export *exp,
RETURN(-EINVAL);
}
- if (oa->o_id > obd->u.echo.eo_lastino || oa->o_id < ECHO_INIT_OID) {
- CERROR("bad destroy objid: "LPX64"\n", oa->o_id);
- RETURN(-EINVAL);
- }
+ if (ostid_id(&oa->o_oi) > obd->u.echo.eo_lastino ||
+ ostid_id(&oa->o_oi) < ECHO_INIT_OID) {
+ CERROR("bad destroy objid: "DOSTID"\n", POSTID(&oa->o_oi));
+ RETURN(-EINVAL);
+ }
RETURN(0);
}
static int echo_getattr(const struct lu_env *env, struct obd_export *exp,
struct obd_info *oinfo)
{
- struct obd_device *obd = class_exp2obd(exp);
- obd_id id = oinfo->oi_oa->o_id;
+ struct obd_device *obd = class_exp2obd(exp);
+ obd_id id = ostid_id(&oinfo->oi_oa->o_oi);
ENTRY;
if (!obd) {
RETURN(-EINVAL);
}
- obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
- oinfo->oi_oa->o_id = id;
+ obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
+ ostid_set_seq_echo(&oinfo->oi_oa->o_oi);
+ ostid_set_id(&oinfo->oi_oa->o_oi, id);
- RETURN(0);
+ RETURN(0);
}
static int echo_setattr(const struct lu_env *env, struct obd_export *exp,
memcpy(&obd->u.echo.eo_oa, oinfo->oi_oa, sizeof(*oinfo->oi_oa));
- if (oinfo->oi_oa->o_id & 4) {
+ if (ostid_id(&oinfo->oi_oa->o_oi) & 4) {
/* Save lock to force ACKed reply */
ldlm_lock_addref (&obd->u.echo.eo_nl_lock, LCK_NL);
oti->oti_ack_locks[0].mode = LCK_NL;
struct niobuf_remote *nb, int *pages,
struct niobuf_local *lb, int cmd, int *left)
{
- int gfp_mask = (obj->ioo_id & 1) ? CFS_ALLOC_HIGHUSER : CFS_ALLOC_STD;
- int ispersistent = obj->ioo_id == ECHO_PERSISTENT_OBJID;
- int debug_setup = (!ispersistent &&
- (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
- (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
- struct niobuf_local *res = lb;
- obd_off offset = nb->offset;
- int len = nb->len;
+ int gfp_mask = (ostid_id(&obj->ioo_oid) & 1) ?
+ CFS_ALLOC_HIGHUSER : CFS_ALLOC_STD;
+ int ispersistent = ostid_id(&obj->ioo_oid) == ECHO_PERSISTENT_OBJID;
+ int debug_setup = (!ispersistent &&
+ (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
+ (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
+ struct niobuf_local *res = lb;
+ obd_off offset = nb->offset;
+ int len = nb->len;
while (len > 0) {
int plen = CFS_PAGE_SIZE - (offset & (CFS_PAGE_SIZE-1));
} else {
OBD_PAGE_ALLOC(res->page, gfp_mask);
if (res->page == NULL) {
- CERROR("can't get page for id " LPU64"\n",
- obj->ioo_id);
+ CERROR("can't get page for id " DOSTID"\n",
+ POSTID(&obj->ioo_oid));
return -ENOMEM;
}
}
if (cmd & OBD_BRW_READ)
res->rc = res->len;
- if (debug_setup)
- echo_page_debug_setup(res->page, cmd, obj->ioo_id,
+ if (debug_setup)
+ echo_page_debug_setup(res->page, cmd,
+ ostid_id(&obj->ioo_oid),
res->lnb_file_offset, res->len);
offset += plen;
cfs_page_t *page = res->page;
void *addr;
- if (page == NULL) {
- CERROR("null page objid "LPU64":%p, buf %d/%d\n",
- obj->ioo_id, page, i, obj->ioo_bufcnt);
- return -EFAULT;
- }
+ if (page == NULL) {
+ CERROR("null page objid "LPU64":%p, buf %d/%d\n",
+ ostid_id(&obj->ioo_oid), page, i,
+ obj->ioo_bufcnt);
+ return -EFAULT;
+ }
addr = cfs_kmap(page);
CDEBUG(D_PAGE, "$$$$ use page %p, addr %p@"LPU64"\n",
res->page, addr, res->lnb_file_offset);
- if (verify) {
- int vrc = echo_page_debug_check(page, obj->ioo_id,
+ if (verify) {
+ int vrc = echo_page_debug_check(page,
+ ostid_id(&obj->ioo_oid),
res->lnb_file_offset,
res->len);
- /* check all the pages always */
- if (vrc != 0 && rc == 0)
- rc = vrc;
- }
+ /* check all the pages always */
+ if (vrc != 0 && rc == 0)
+ rc = vrc;
+ }
cfs_kunmap(page);
/* NB see comment above regarding persistent pages */
LASSERT(oti == NULL || oti->oti_handle == (void *)DESC_PRIV);
- for (i = 0; i < objcount; i++, obj++) {
- int verify = (rc == 0 &&
- obj->ioo_id != ECHO_PERSISTENT_OBJID &&
- (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
- (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
- int j;
-
- for (j = 0 ; j < obj->ioo_bufcnt ; j++, rb++) {
- int vrc = echo_finalize_lb(oa, obj, rb, &pgs, &res[pgs], verify);
+ for (i = 0; i < objcount; i++, obj++) {
+ int verify = (rc == 0 &&
+ ostid_id(&obj->ioo_oid) != ECHO_PERSISTENT_OBJID &&
+ (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
+ (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
+ int j;
- if (vrc == 0)
- continue;
+ for (j = 0 ; j < obj->ioo_bufcnt ; j++, rb++) {
+ int vrc = echo_finalize_lb(oa, obj, rb, &pgs, &res[pgs],
+ verify);
+ if (vrc == 0)
+ continue;
- if (vrc == -EFAULT)
- GOTO(commitrw_cleanup, rc = vrc);
+ if (vrc == -EFAULT)
+ GOTO(commitrw_cleanup, rc = vrc);
- if (rc == 0)
- rc = vrc;
- }
+ if (rc == 0)
+ rc = vrc;
+ }
- }
+ }
cfs_atomic_sub(pgs, &obd->u.echo.eo_prep);
loi_init((*lsmp)->lsm_oinfo[0]);
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES;
- (*lsmp)->lsm_oi.oi_seq = FID_SEQ_ECHO;
+ ostid_set_seq_echo(&(*lsmp)->lsm_oi);
RETURN(lsm_size);
}
conf->eoc_md = lsmp;
fid = &info->eti_fid;
- ostid_fid_unpack(&lsm->lsm_oi, fid);
+ ostid_to_fid(fid, &lsm->lsm_oi, 0);
/* In the function below, .hs_keycmp resolves to
* lu_obj_hop_keycmp() */
#define ECHO_MD_CTX_TAG (LCT_REMEMBER | LCT_MD_THREAD)
#define ECHO_MD_SES_TAG (LCT_REMEMBER | LCT_SESSION)
static int echo_md_handler(struct echo_device *ed, int command,
- char *path, int path_len, int id, int count,
- struct obd_ioctl_data *data)
+ char *path, int path_len, __u64 id, int count,
+ struct obd_ioctl_data *data)
{
struct echo_thread_info *info;
struct lu_device *ld = ed->ed_next;
int stripe_count = (int)data->ioc_obdo2.o_misc;
int stripe_index = (int)data->ioc_obdo2.o_stripe_idx;
- fid->f_seq = data->ioc_obdo1.o_seq;
- fid->f_oid = (__u32)data->ioc_obdo1.o_id;
- fid->f_ver = 0;
+ ostid_to_fid(fid, &data->ioc_obdo1.o_oi, 0);
/* In the function below, .hs_keycmp resolves to
* lu_obj_hop_keycmp() */
/* coverity[overrun-buffer-val] */
/* setup stripes: indices + default ids if required */
for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (lsm->lsm_oinfo[i]->loi_id == 0)
+ if (ostid_id(&lsm->lsm_oinfo[i]->loi_oi) == 0)
lsm->lsm_oinfo[i]->loi_oi = lsm->lsm_oi;
lsm->lsm_oinfo[i]->loi_ost_idx =
}
/* setup object ID here for !on_target and LOV hint */
- if (oa->o_valid & OBD_MD_FLID)
- lsm->lsm_oi.oi_id = oa->o_id;
+ if (oa->o_valid & OBD_MD_FLID) {
+ LASSERT(oa->o_valid & OBD_MD_FLGROUP);
+ lsm->lsm_oi = oa->o_oi;
+ }
if (ostid_id(&lsm->lsm_oi) == 0)
- lsm->lsm_oi.oi_id = ++last_object_id;
+ ostid_set_id(&lsm->lsm_oi, ++last_object_id);
rc = 0;
- if (on_target) {
- /* Only echo objects are allowed to be created */
- LASSERT((oa->o_valid & OBD_MD_FLGROUP) &&
- (oa->o_seq == FID_SEQ_ECHO));
- rc = obd_create(env, ec->ec_exp, oa, &lsm, oti);
- if (rc != 0) {
- CERROR("Cannot create objects: rc = %d\n", rc);
- GOTO(failed, rc);
- }
- created = 1;
- }
+ if (on_target) {
+ /* Only echo objects are allowed to be created */
+ LASSERT((oa->o_valid & OBD_MD_FLGROUP) &&
+ (ostid_seq(&oa->o_oi) == FID_SEQ_ECHO));
+ rc = obd_create(env, ec->ec_exp, oa, &lsm, oti);
+ if (rc != 0) {
+ CERROR("Cannot create objects: rc = %d\n", rc);
+ GOTO(failed, rc);
+ }
+ created = 1;
+ }
/* See what object ID we were given */
oa->o_oi = lsm->lsm_oi;
GOTO(failed, rc = PTR_ERR(eco));
cl_echo_object_put(eco);
- CDEBUG(D_INFO, "oa->o_id = %lx\n", (long)oa->o_id);
+ CDEBUG(D_INFO, "oa oid "DOSTID"\n", POSTID(&oa->o_oi));
EXIT;
failed:
int rc;
ENTRY;
- if ((oa->o_valid & OBD_MD_FLID) == 0 ||
- oa->o_id == 0) /* disallow use of object id 0 */
- {
+ if ((oa->o_valid & OBD_MD_FLID) == 0 || ostid_id(&oa->o_oi) == 0) {
+ /* disallow use of object id 0 */
CERROR ("No valid oid\n");
RETURN(-EINVAL);
}
lsm->lsm_oi = oa->o_oi;
if (!(oa->o_valid & OBD_MD_FLGROUP))
- lsm->lsm_oi.oi_seq = FID_SEQ_ECHO;
+ ostid_set_seq_echo(&lsm->lsm_oi);
rc = 0;
eco = cl_echo_object_find(ed, &lsm);
stripe_index = woffset / stripe_size;
- *idp = lsm->lsm_oinfo[stripe_index]->loi_id;
- *offp = offset * stripe_size + woffset % stripe_size;
+ *idp = ostid_id(&lsm->lsm_oinfo[stripe_index]->loi_oi);
+ *offp = offset * stripe_size + woffset % stripe_size;
}
static void
int brw_flags = 0;
ENTRY;
- verify = ((oa->o_id) != ECHO_PERSISTENT_OBJID &&
+ verify = (ostid_id(&oa->o_oi) != ECHO_PERSISTENT_OBJID &&
(oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
(oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
- gfp_mask = ((oa->o_id & 2) == 0) ? CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER;
+ gfp_mask = ((ostid_id(&oa->o_oi) & 2) == 0) ? CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER;
LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
LASSERT(lsm != NULL);
pgp->off = off;
pgp->flag = brw_flags;
- if (verify)
- echo_client_page_debug_setup(lsm, pgp->pg, rw,
- oa->o_id, off, pgp->count);
+ if (verify)
+ echo_client_page_debug_setup(lsm, pgp->pg, rw,
+ ostid_id(&oa->o_oi), off,
+ pgp->count);
}
/* brw mode can only be used at client */
if (pgp->pg == NULL)
continue;
- if (verify) {
- int vrc;
- vrc = echo_client_page_debug_check(lsm, pgp->pg, oa->o_id,
- pgp->off, pgp->count);
- if (vrc != 0 && rc == 0)
- rc = vrc;
- }
- OBD_PAGE_FREE(pgp->pg);
+ if (verify) {
+ int vrc;
+ vrc = echo_client_page_debug_check(lsm, pgp->pg,
+ ostid_id(&oa->o_oi),
+ pgp->off, pgp->count);
+ if (vrc != 0 && rc == 0)
+ rc = vrc;
+ }
+ OBD_PAGE_FREE(pgp->pg);
}
OBD_FREE(pga, npages * sizeof(*pga));
OBD_FREE(pages, npages * sizeof(*pages));
if (async)
lnb[i].flags |= OBD_BRW_ASYNC;
- if (oa->o_id == ECHO_PERSISTENT_OBJID ||
- (oa->o_valid & OBD_MD_FLFLAGS) == 0 ||
- (oa->o_flags & OBD_FL_DEBUG_CHECK) == 0)
- continue;
-
- if (rw == OBD_BRW_WRITE)
- echo_client_page_debug_setup(lsm, page, rw,
- oa->o_id,
- rnb[i].offset,
- rnb[i].len);
- else
- echo_client_page_debug_check(lsm, page,
- oa->o_id,
- rnb[i].offset,
- rnb[i].len);
- }
+ if (ostid_id(&oa->o_oi) == ECHO_PERSISTENT_OBJID ||
+ (oa->o_valid & OBD_MD_FLFLAGS) == 0 ||
+ (oa->o_flags & OBD_FL_DEBUG_CHECK) == 0)
+ continue;
+
+ if (rw == OBD_BRW_WRITE)
+ echo_client_page_debug_setup(lsm, page, rw,
+ ostid_id(&oa->o_oi),
+ rnb[i].offset,
+ rnb[i].len);
+ else
+ echo_client_page_debug_check(lsm, page,
+ ostid_id(&oa->o_oi),
+ rnb[i].offset,
+ rnb[i].len);
+ }
ret = obd_commitrw(env, rw, exp, oa, 1, &ioo,
rnb, npages, lnb, oti, ret);
memset(&dummy_oti, 0, sizeof(dummy_oti));
- oa = &data->ioc_obdo1;
- if (!(oa->o_valid & OBD_MD_FLGROUP)) {
- oa->o_valid |= OBD_MD_FLGROUP;
- oa->o_seq = FID_SEQ_ECHO;
- }
+ oa = &data->ioc_obdo1;
+ if (!(oa->o_valid & OBD_MD_FLGROUP)) {
+ oa->o_valid |= OBD_MD_FLGROUP;
+ ostid_set_seq_echo(&oa->o_oi);
+ }
/* This FID is unpacked just for validation at this point */
- rc = fid_ostid_unpack(&fid, &oa->o_oi, 0);
+ rc = ostid_to_fid(&fid, &oa->o_oi, 0);
if (rc < 0)
RETURN(rc);
data->ioc_plen1, &dummy_oti);
GOTO(out, rc);
- case OBD_IOC_ECHO_MD: {
- int count;
- int cmd;
- char *dir = NULL;
- int dirlen;
- __u64 id;
+ case OBD_IOC_ECHO_MD: {
+ int count;
+ int cmd;
+ char *dir = NULL;
+ int dirlen;
+ __u64 id;
- if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- GOTO(out, rc = -EPERM);
+ if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+ GOTO(out, rc = -EPERM);
- count = data->ioc_count;
- cmd = data->ioc_command;
+ count = data->ioc_count;
+ cmd = data->ioc_command;
- id = data->ioc_obdo2.o_id;
+ id = ostid_id(&data->ioc_obdo2.o_oi);
- dirlen = data->ioc_plen1;
- OBD_ALLOC(dir, dirlen + 1);
- if (dir == NULL)
- GOTO(out, rc = -ENOMEM);
+ dirlen = data->ioc_plen1;
+ OBD_ALLOC(dir, dirlen + 1);
+ if (dir == NULL)
+ GOTO(out, rc = -ENOMEM);
- if (cfs_copy_from_user(dir, data->ioc_pbuf1, dirlen)) {
- OBD_FREE(dir, data->ioc_plen1 + 1);
- GOTO(out, rc = -EFAULT);
- }
+ if (cfs_copy_from_user(dir, data->ioc_pbuf1, dirlen)) {
+ OBD_FREE(dir, data->ioc_plen1 + 1);
+ GOTO(out, rc = -EFAULT);
+ }
- rc = echo_md_handler(ed, cmd, dir, dirlen, id, count, data);
- OBD_FREE(dir, dirlen + 1);
- GOTO(out, rc);
- }
+ rc = echo_md_handler(ed, cmd, dir, dirlen, id, count, data);
+ OBD_FREE(dir, dirlen + 1);
+ GOTO(out, rc);
+ }
case OBD_IOC_ECHO_ALLOC_SEQ: {
struct lu_env *cl_env;
int refcheck;
read_lock(&ofd->ofd_seq_list_lock);
cfs_list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) {
- rc = snprintf(page, count, LPX64": "LPX64"\n",
- oseq->os_seq, ofd_seq_last_oid(oseq));
+ rc = snprintf(page, count, DOSTID"\n", POSTID(&oseq->os_oi));
if (rc < 0) {
retval = rc;
break;
read_lock(&ofd->ofd_seq_list_lock);
cfs_list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) {
- if (oseq->os_seq == seq) {
+ if (ostid_seq(&oseq->os_oi) == seq) {
cfs_atomic_inc(&oseq->os_refc);
read_unlock(&ofd->ofd_seq_list_lock);
return oseq;
write_lock(&ofd->ofd_seq_list_lock);
cfs_list_for_each_entry(os, &ofd->ofd_seq_list, os_list) {
- if (os->os_seq == new_seq->os_seq) {
+ if (ostid_seq(&os->os_oi) == ostid_seq(&new_seq->os_oi)) {
cfs_atomic_inc(&os->os_refc);
write_unlock(&ofd->ofd_seq_list_lock);
/* The seq has not been added to the list */
obd_id id;
spin_lock(&oseq->os_last_oid_lock);
- id = oseq->os_last_oid;
+ id = ostid_id(&oseq->os_oi);
spin_unlock(&oseq->os_last_oid_lock);
return id;
void ofd_seq_last_oid_set(struct ofd_seq *oseq, obd_id id)
{
spin_lock(&oseq->os_last_oid_lock);
- if (likely(oseq->os_last_oid < id))
- oseq->os_last_oid = id;
+ if (likely(ostid_id(&oseq->os_oi) < id))
+ ostid_set_id(&oseq->os_oi, id);
spin_unlock(&oseq->os_last_oid_lock);
}
ENTRY;
+ tmp = cpu_to_le64(ofd_seq_last_oid(oseq));
+
info->fti_buf.lb_buf = &tmp;
info->fti_buf.lb_len = sizeof(tmp);
info->fti_off = 0;
- CDEBUG(D_INODE, "%s: write last_objid for seq "LPX64" : "LPX64"\n",
- ofd_name(ofd), oseq->os_seq, ofd_seq_last_oid(oseq));
-
- tmp = cpu_to_le64(ofd_seq_last_oid(oseq));
-
rc = ofd_record_write(env, ofd, oseq->os_lastid_obj, &info->fti_buf,
&info->fti_off);
+
+ CDEBUG(D_INODE, "%s: write last_objid "DOSTID": rc = %d\n",
+ ofd_name(ofd), POSTID(&oseq->os_oi), rc);
+
RETURN(rc);
}
CFS_INIT_LIST_HEAD(&oseq->os_list);
mutex_init(&oseq->os_create_lock);
spin_lock_init(&oseq->os_last_oid_lock);
- oseq->os_seq = seq;
+ ostid_set_seq(&oseq->os_oi, seq);
cfs_atomic_set(&oseq->os_refc, 1);
if (info->fti_attr.la_size == 0) {
/* object is just created, initialize last id */
- oseq->os_last_oid = OFD_INIT_OBJID;
+ ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID);
ofd_seq_last_oid_write(env, ofd, oseq);
} else if (info->fti_attr.la_size == sizeof(lastid)) {
info->fti_off = 0;
ofd_name(ofd), rc);
GOTO(cleanup, rc);
}
- oseq->os_last_oid = le64_to_cpu(lastid);
+ ofd_seq_last_oid_set(oseq, le64_to_cpu(lastid));
} else {
CERROR("%s: corrupted size "LPU64" LAST_ID of seq "LPX64"\n",
ofd_name(ofd), (__u64)info->fti_attr.la_size, seq);
struct ofd_seq {
cfs_list_t os_list;
- struct ost_id os_oi;
+ struct ost_id os_oi;
spinlock_t os_last_oid_lock;
struct mutex os_create_lock;
cfs_atomic_t os_refc;
unsigned long os_destroys_in_progress:1;
};
-#define os_seq os_oi.oi_seq
-#define os_last_oid os_oi.oi_id
-
struct ofd_device {
struct dt_device ofd_dt_dev;
struct dt_device *ofd_osd;
return info;
}
-/* The same as osc_build_res_name() */
-static inline void ofd_build_resid(const struct lu_fid *fid,
- struct ldlm_res_id *resname)
-{
- struct ost_id oid;
-
- if (fid_is_idif(fid)) {
- oid.oi_id = fid_idif_id(fid_seq(fid), fid_oid(fid),
- fid_ver(fid));
- oid.oi_seq = FID_SEQ_OST_MDT0;
- } else {
- oid.oi_id = fid_oid(fid);
- oid.oi_seq = fid_seq(fid);
- }
- ostid_build_res_name(&oid, resname);
-}
-
-static inline void ofd_fid_from_resid(struct lu_fid *fid,
- const struct ldlm_res_id *name)
-{
- /* To keep compatiblity, res[0] = oi_id, res[1] = oi_seq. */
- struct ost_id ostid;
-
- ostid.oi_id = name->name[LUSTRE_RES_ID_SEQ_OFF];
- ostid.oi_seq = name->name[LUSTRE_RES_ID_VER_OID_OFF];
- fid_ostid_unpack(fid, &ostid, 0);
-}
-
static inline void ofd_oti2info(struct ofd_thread_info *info,
struct obd_trans_info *oti)
{
static inline void ofd_prepare_fidea(struct filter_fid *ff, struct obdo *oa)
{
if (!(oa->o_valid & OBD_MD_FLGROUP))
- oa->o_seq = 0;
+ ostid_set_seq_mdt0(&oa->o_oi);
/* packing fid and converting it to LE for storing into EA.
* Here ->o_stripe_idx should be filled by LOV and rest of
* fields - by client. */
ofd_read_lock(env, fo);
if (!ofd_object_exists(fo)) {
- CERROR("%s: BRW to missing obj "LPU64"/"LPU64"\n",
- exp->exp_obd->obd_name, obj->ioo_id, obj->ioo_seq);
+ CERROR("%s: BRW to missing obj "DOSTID"\n",
+ exp->exp_obd->obd_name, POSTID(&obj->ioo_oid));
ofd_read_unlock(env, fo);
ofd_object_put(env, fo);
GOTO(out, rc = -ENOENT);
if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOENT)) {
struct ofd_seq *oseq;
- oseq = ofd_seq_load(env, ofd, oa->o_seq);
+ oseq = ofd_seq_load(env, ofd, ostid_seq(&oa->o_oi));
if (IS_ERR(oseq)) {
- CERROR("%s: Can not find seq for "LPU64":"LPU64
- ": rc = %ld\n", ofd_name(ofd), oa->o_seq,
- oa->o_id, PTR_ERR(oseq));
+ CERROR("%s: Can not find seq for "DOSTID
+ ": rc = %ld\n", ofd_name(ofd), POSTID(&oa->o_oi),
+ PTR_ERR(oseq));
RETURN(-EINVAL);
}
LASSERT(objcount == 1);
LASSERT(obj->ioo_bufcnt > 0);
- fid_ostid_unpack(&info->fti_fid, &oa->o_oi, 0);
+ ostid_to_fid(&info->fti_fid, &oa->o_oi, 0);
if (cmd == OBD_BRW_WRITE) {
- rc = ofd_auth_capa(exp, &info->fti_fid, oa->o_seq,
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oa->o_oi),
capa, CAPA_OPC_OSS_WRITE);
if (rc == 0) {
la_from_obdo(&info->fti_attr, oa, OBD_MD_FLGETATTR);
obj, rnb, nr_local, lnb, oti);
}
} else if (cmd == OBD_BRW_READ) {
- rc = ofd_auth_capa(exp, &info->fti_fid, oa->o_seq,
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oa->o_oi),
capa, CAPA_OPC_OSS_READ);
if (rc == 0) {
ofd_grant_prepare_read(env, exp, oa);
LASSERT(npages > 0);
- fid_ostid_unpack(&info->fti_fid, &oa->o_oi, 0);
+ ostid_to_fid(&info->fti_fid, &oa->o_oi, 0);
if (cmd == OBD_BRW_WRITE) {
/* Don't update timestamps if this write is older than a
* setattr which modifies the timestamps. b=10150 */
if (oa && ns && ns->ns_lvbo && ns->ns_lvbo->lvbo_update) {
struct ldlm_resource *rs = NULL;
- ofd_build_resid(&info->fti_fid, &info->fti_resid);
+ ost_fid_build_resid(&info->fti_fid, &info->fti_resid);
rs = ldlm_resource_get(ns, NULL, &info->fti_resid,
LDLM_EXTENT, 0);
if (rs != NULL) {
res->lr_lvb_len = sizeof(*lvb);
info = ofd_info_init(&env, NULL);
- ofd_fid_from_resid(&info->fti_fid, &res->lr_name);
+ ost_fid_from_resid(&info->fti_fid, &res->lr_name);
fo = ofd_object_find(&env, ofd, &info->fti_fid);
if (IS_ERR(fo))
GOTO(out, rc = PTR_ERR(fo));
disk_update:
/* Update the LVB from the disk inode */
- ofd_fid_from_resid(&info->fti_fid, &res->lr_name);
+ ost_fid_from_resid(&info->fti_fid, &res->lr_name);
fo = ofd_object_find(&env, ofd, &info->fti_fid);
if (IS_ERR(fo))
GOTO(out_env, rc = PTR_ERR(fo));
}
info = ofd_info_init(env, exp);
-
- fid_ostid_unpack(&info->fti_fid, &fm_key->oa.o_oi, 0);
-
+ ostid_to_fid(&info->fti_fid, &fm_key->oa.o_oi, 0);
CDEBUG(D_INODE, "get FIEMAP of object "DFID"\n",
PFID(&info->fti_fid));
struct lu_env env;
struct ofd_device *ofd = ofd_exp(exp);
struct ofd_seq *oseq;
- struct ost_id *oid = val;
+ struct lu_fid *fid = val;
int rc;
- if (oid == NULL) {
- *vallen = sizeof(struct ost_id);
+ if (fid == NULL) {
+ *vallen = sizeof(struct lu_fid);
RETURN(0);
}
- if (*vallen < sizeof(*oid))
+ if (*vallen < sizeof(*fid))
RETURN(-EOVERFLOW);
rc = lu_env_init(&env, LCT_DT_THREAD);
RETURN(rc);
ofd_info_init(&env, exp);
- ostid_le_to_cpu(oid, oid);
+ fid_le_to_cpu(fid, fid);
- oseq = ofd_seq_load(&env, ofd, oid->oi_seq);
+ oseq = ofd_seq_load(&env, ofd, ostid_seq((struct ost_id *)fid));
if (IS_ERR(oseq))
GOTO(out_fini, rc = PTR_ERR(oseq));
- CDEBUG(D_HA, "LAST FID is "DOSTID"\n", POSTID(&oseq->os_oi));
+ ostid_to_fid(fid, &oseq->os_oi,
+ ofd->ofd_lut.lut_lsd.lsd_osd_index);
- *oid = oseq->os_oi;
- *vallen = sizeof(*oid);
+ CDEBUG(D_HA, "%s: LAST FID is "DFID"\n", ofd_name(ofd),
+ PFID(fid));
+ *vallen = sizeof(*fid);
ofd_seq_put(&env, oseq);
out_fini:
lu_env_fini(&env);
info = ofd_info_init(env, exp);
ofd_oti2info(info, oti);
- fid_ostid_unpack(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
- ofd_build_resid(&info->fti_fid, &info->fti_resid);
+ ostid_to_fid(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
+ ost_fid_build_resid(&info->fti_fid, &info->fti_resid);
- rc = ofd_auth_capa(exp, &info->fti_fid, oa->o_seq,
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oa->o_oi),
oinfo_capa(oinfo), CAPA_OPC_META_WRITE);
if (rc)
GOTO(out, rc);
info = ofd_info_init(env, exp);
ofd_oti2info(info, oti);
- fid_ostid_unpack(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
- ofd_build_resid(&info->fti_fid, &info->fti_resid);
+ ostid_to_fid(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
+ ost_fid_build_resid(&info->fti_fid, &info->fti_resid);
CDEBUG(D_INODE, "calling punch for object "DFID", valid = "LPX64
", start = "LPD64", end = "LPD64"\n", PFID(&info->fti_fid),
oinfo->oi_oa->o_valid, oinfo->oi_policy.l_extent.start,
oinfo->oi_policy.l_extent.end);
- rc = ofd_auth_capa(exp, &info->fti_fid, oinfo->oi_oa->o_seq,
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oinfo->oi_oa->o_oi),
oinfo_capa(oinfo), CAPA_OPC_OSS_TRUNC);
if (rc)
GOTO(out_env, rc);
/* Tell the clients that the object is gone now and that they should
* throw away any cached pages. */
- ofd_build_resid(fid, &info->fti_resid);
+ ost_fid_build_resid(fid, &info->fti_resid);
rc = ldlm_cli_enqueue_local(ofd->ofd_namespace, &info->fti_resid,
LDLM_EXTENT, &policy, LCK_PW, &flags,
ldlm_blocking_ast, ldlm_completion_ast,
ofd_oti2info(info, oti);
if (!(oa->o_valid & OBD_MD_FLGROUP))
- oa->o_seq = 0;
+ ostid_set_seq_mdt0(&oa->o_oi);
/* check that o_misc makes sense */
if (oa->o_valid & OBD_MD_FLOBJCOUNT)
*/
if (info->fti_transno == 0) /* not replay */
info->fti_mult_trans = 1;
+
+ CDEBUG(D_HA, "%s: Destroy object "DOSTID" count %d\n", ofd_name(ofd),
+ POSTID(&oa->o_oi), count);
while (count > 0) {
int lrc;
- fid_ostid_unpack(&info->fti_fid, &oa->o_oi, 0);
+ ostid_to_fid(&info->fti_fid, &oa->o_oi, 0);
lrc = ofd_destroy_by_fid(env, ofd, &info->fti_fid, 0);
if (lrc == -ENOENT) {
CDEBUG(D_INODE,
rc = lrc;
}
count--;
- oa->o_id++;
+ ostid_inc_id(&oa->o_oi);
}
/* if we have transaction then there were some deletions, we don't
int skip_orphan;
int rc = 0;
struct ost_id oi = oa->o_oi;
+ __u64 end_id = ostid_id(&oa->o_oi);
struct ofd_seq *oseq;
ENTRY;
- oseq = ofd_seq_get(ofd, oa->o_seq);
+ oseq = ofd_seq_get(ofd, ostid_seq(&oa->o_oi));
if (oseq == NULL) {
- CERROR("%s: Can not find seq for "LPU64":"LPU64"\n",
- ofd_name(ofd), oa->o_seq, oa->o_id);
+ CERROR("%s: Can not find seq for "DOSTID"\n",
+ ofd_name(ofd), POSTID(&oa->o_oi));
RETURN(-EINVAL);
}
last = ofd_seq_last_oid(oseq);
LCONSOLE_INFO("%s: deleting orphan objects from "LPX64":"LPU64
- " to "LPU64"\n", ofd_name(ofd), oa->o_seq,
- oa->o_id + 1, last);
+ " to "LPU64"\n", ofd_name(ofd), ostid_seq(&oa->o_oi),
+ end_id + 1, last);
- for (oi.oi_id = last; oi.oi_id > oa->o_id; oi.oi_id--) {
- fid_ostid_unpack(&info->fti_fid, &oi, 0);
+ for (ostid_set_id(&oi, last); ostid_id(&oi) > end_id;
+ ostid_dec_id(&oi)) {
+ ostid_to_fid(&info->fti_fid, &oi, 0);
rc = ofd_destroy_by_fid(env, ofd, &info->fti_fid, 1);
if (rc && rc != -ENOENT) /* this is pretty fatal... */
- CEMERG("error destroying precreated id "LPU64": %d\n",
- oi.oi_id, rc);
+ CEMERG("error destroying precreated id "DOSTID": %d\n",
+ POSTID(&oi), rc);
if (!skip_orphan) {
- ofd_seq_last_oid_set(oseq, oi.oi_id - 1);
+ ofd_seq_last_oid_set(oseq, ostid_id(&oi) - 1);
/* update last_id on disk periodically so that if we
* restart * we don't need to re-scan all of the just
* deleted objects. */
- if ((oi.oi_id & 511) == 0)
+ if ((ostid_id(&oi) & 511) == 0)
ofd_seq_last_oid_write(env, ofd, oseq);
}
}
- CDEBUG(D_HA, "%s: after destroy: set last_objids["LPU64"] = "LPU64"\n",
- ofd_obd(ofd)->obd_name, oa->o_seq, oa->o_id);
+ CDEBUG(D_HA, "%s: after destroy: set last_objids"DOSTID"\n",
+ ofd_obd(ofd)->obd_name, POSTID(&oa->o_oi));
if (!skip_orphan) {
rc = ofd_seq_last_oid_write(env, ofd, oseq);
} else {
/* don't reuse orphan object, return last used objid */
- oa->o_id = last;
+ ostid_set_id(&oa->o_oi, last);
rc = 0;
}
ofd_seq_put(env, oseq);
{
struct ofd_device *ofd = ofd_exp(exp);
struct ofd_thread_info *info;
- obd_seq seq = oa->o_seq;
+ obd_seq seq = ostid_seq(&oa->o_oi);
struct ofd_seq *oseq;
int rc = 0, diff;
int sync_trans = 0;
info = ofd_info_init(env, exp);
ofd_oti2info(info, oti);
- LASSERT(oa->o_seq >= FID_SEQ_OST_MDT0);
+ LASSERT(ostid_seq(&oa->o_oi) >= FID_SEQ_OST_MDT0);
LASSERT(oa->o_valid & OBD_MD_FLGROUP);
- CDEBUG(D_INFO, "ofd_create(oa->o_seq="LPU64",oa->o_id="LPU64")\n",
- seq, oa->o_id);
+ CDEBUG(D_INFO, "ofd_create("DOSTID")\n", POSTID(&oa->o_oi));
oseq = ofd_seq_load(env, ofd, seq);
if (IS_ERR(oseq)) {
if ((oa->o_valid & OBD_MD_FLFLAGS) &&
(oa->o_flags & OBD_FL_RECREATE_OBJS)) {
if (!ofd_obd(ofd)->obd_recovering ||
- oa->o_id > ofd_seq_last_oid(oseq)) {
- CERROR("recreate objid "LPU64" > last id "LPU64"\n",
- oa->o_id, ofd_seq_last_oid(oseq));
+ ostid_id(&oa->o_oi) > ofd_seq_last_oid(oseq)) {
+ CERROR("recreate objid "DOSTID" > last id "LPU64"\n",
+ POSTID(&oa->o_oi), ofd_seq_last_oid(oseq));
GOTO(out_nolock, rc = -EINVAL);
}
/* do nothing because we create objects during first write */
oseq->os_destroys_in_progress = 1;
mutex_lock(&oseq->os_create_lock);
if (!oseq->os_destroys_in_progress) {
- CERROR("%s:["LPU64"] destroys_in_progress already cleared\n",
- exp->exp_obd->obd_name, oa->o_seq);
+ CERROR("%s:["LPU64"] destroys_in_progress already"
+ " cleared\n", exp->exp_obd->obd_name,
+ ostid_seq(&oa->o_oi));
GOTO(out, rc = 0);
}
- diff = oa->o_id - ofd_seq_last_oid(oseq);
+ diff = ostid_id(&oa->o_oi) - ofd_seq_last_oid(oseq);
CDEBUG(D_HA, "ofd_last_id() = "LPU64" -> diff = %d\n",
ofd_seq_last_oid(oseq), diff);
if (-diff > OST_MAX_PRECREATE) {
}
/* only precreate if seq is 0, IDIF or normal and also o_id
* must be specfied */
- if ((!fid_seq_is_mdt(oa->o_seq) &&
- !fid_seq_is_norm(oa->o_seq) &&
- !fid_seq_is_idif(oa->o_seq)) || oa->o_id == 0) {
+ if ((!fid_seq_is_mdt(ostid_seq(&oa->o_oi)) &&
+ !fid_seq_is_norm(ostid_seq(&oa->o_oi)) &&
+ !fid_seq_is_idif(ostid_seq(&oa->o_oi))) ||
+ ostid_id(&oa->o_oi) == 0) {
diff = 1; /* shouldn't we create this right now? */
} else {
- diff = oa->o_id - ofd_seq_last_oid(oseq);
+ diff = ostid_id(&oa->o_oi) - ofd_seq_last_oid(oseq);
/* Do sync create if the seq is about to used up */
- if (fid_seq_is_idif(oa->o_seq) ||
- fid_seq_is_mdt0(oa->o_seq)) {
- if (unlikely(oa->o_id >= IDIF_MAX_OID - 1))
+ if (fid_seq_is_idif(ostid_seq(&oa->o_oi)) ||
+ fid_seq_is_mdt0(ostid_seq(&oa->o_oi))) {
+ if (unlikely(ostid_id(&oa->o_oi) >= IDIF_MAX_OID - 1))
sync_trans = 1;
- } else if (fid_seq_is_norm(oa->o_seq)) {
- if (unlikely(oa->o_id >=
+ } else if (fid_seq_is_norm(ostid_seq(&oa->o_oi))) {
+ if (unlikely(ostid_id(&oa->o_oi) >=
LUSTRE_DATA_SEQ_MAX_WIDTH - 1))
sync_trans = 1;
} else {
- CERROR("%s : invalid o_seq "LPX64": rc = %d\n",
- ofd_name(ofd), oa->o_seq, -EINVAL);
+ CERROR("%s : invalid o_seq "DOSTID": rc = %d\n",
+ ofd_name(ofd), POSTID(&oa->o_oi), -EINVAL);
GOTO(out, rc = -EINVAL);
}
}
next_id = ofd_seq_last_oid(oseq) + 1;
count = ofd_precreate_batch(ofd, diff);
- CDEBUG(D_HA, "%s: reserve %d objects in group "LPU64
+ CDEBUG(D_HA, "%s: reserve %d objects in group "LPX64
" at "LPU64"\n", ofd_obd(ofd)->obd_name,
- count, oa->o_seq, next_id);
+ count, ostid_seq(&oa->o_oi), next_id);
if (cfs_time_after(jiffies, enough_time)) {
LCONSOLE_WARN("%s: Slow creates, %d/%d objects"
CERROR("%s: unable to precreate: rc = %d\n",
ofd_name(ofd), rc);
- oa->o_id = ofd_seq_last_oid(oseq);
+ ostid_set_id(&oa->o_oi, ofd_seq_last_oid(oseq));
oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
info = ofd_info_init(env, exp);
- fid_ostid_unpack(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
- rc = ofd_auth_capa(exp, &info->fti_fid, oinfo->oi_oa->o_seq,
+ ostid_to_fid(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oinfo->oi_oa->o_oi),
oinfo_capa(oinfo), CAPA_OPC_META_READ);
if (rc)
GOTO(out, rc);
}
info = ofd_info_init(env, exp);
- fid_ostid_unpack(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
+ ostid_to_fid(&info->fti_fid, &oinfo->oi_oa->o_oi, 0);
- rc = ofd_auth_capa(exp, &info->fti_fid, oinfo->oi_oa->o_seq,
+ rc = ofd_auth_capa(exp, &info->fti_fid, ostid_seq(&oinfo->oi_oa->o_oi),
oinfo_capa(oinfo), CAPA_OPC_OSS_TRUNC);
if (rc)
GOTO(out, rc);
data->ioc_inllen4 == sizeof(__u64)) {
struct ost_id ostid;
- ostid.oi_id = *(__u64 *)data->ioc_inlbuf3;
- ostid.oi_seq = *(__u64 *)data->ioc_inlbuf4;
- rc = fid_ostid_unpack(&fid, &ostid, 0);
+ ostid_set_seq(&ostid, *(__u64 *)data->ioc_inlbuf4);
+ ostid_set_id(&ostid, *(__u64 *)data->ioc_inlbuf3);
+ rc = ostid_to_fid(&fid, &ostid, 0);
if (rc != 0)
GOTO(out, rc);
} else {
ENTRY;
/* Don't create objects beyond the valid range for this SEQ */
- if (unlikely(fid_seq_is_mdt0(oseq->os_seq) && (id + nr) >= IDIF_MAX_OID)) {
+ if (unlikely(fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) &&
+ (id + nr) >= IDIF_MAX_OID)) {
CERROR("%s:"DOSTID" hit the IDIF_MAX_OID (1<<48)!\n",
- ofd_name(ofd), id, oseq->os_seq);
+ ofd_name(ofd), id, ostid_seq(&oseq->os_oi));
RETURN(rc = -ENOSPC);
- } else if (unlikely(!fid_seq_is_mdt0(oseq->os_seq) &&
+ } else if (unlikely(!fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) &&
(id + nr) >= OBIF_MAX_OID)) {
CERROR("%s:"DOSTID" hit the OBIF_MAX_OID (1<<32)!\n",
- ofd_name(ofd), id, oseq->os_seq);
+ ofd_name(ofd), id, ostid_seq(&oseq->os_oi));
RETURN(rc = -ENOSPC);
}
info->fti_attr.la_ctime = 0;
/* prepare objects */
+ ostid_set_seq(&info->fti_ostid, ostid_seq(&oseq->os_oi));
for (i = 0; i < nr; i++) {
- info->fti_ostid.oi_id = id + i;
- info->fti_ostid.oi_seq = oseq->os_seq;
-
- rc = fid_ostid_unpack(&info->fti_fid, &info->fti_ostid, 0);
+ ostid_set_id(&info->fti_ostid, id + i);
+ rc = ostid_to_fid(&info->fti_fid, &info->fti_ostid, 0);
if (rc) {
if (i == 0)
GOTO(out, rc = PTR_ERR(fo));
if (unlikely(ofd_object_exists(fo))) {
/* object may exist being re-created by write replay */
CDEBUG(D_INODE, "object "LPX64"/"LPX64" exists: "
- DFID"\n", oseq->os_seq, id,
+ DFID"\n", ostid_seq(&oseq->os_oi), id,
PFID(&info->fti_fid));
continue;
}
if (rc)
GOTO(trans_stop, rc);
- CDEBUG(D_OTHER, "create new object "DFID"\n", PFID(&info->fti_fid));
+ CDEBUG(D_OTHER, "%s: create new object "DFID" nr %d\n",
+ ofd_name(ofd), PFID(&info->fti_fid), nr);
for (i = 0; i < nr; i++) {
fo = batch[i];
}
memset(oa, 0, sizeof(*oa));
if (result == 0) {
- oa->o_id = loi->loi_id;
- oa->o_seq = loi->loi_seq;
- oa->o_mtime = attr->cat_mtime;
- oa->o_atime = attr->cat_atime;
- oa->o_ctime = attr->cat_ctime;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
- OBD_MD_FLCTIME | OBD_MD_FLMTIME;
+ oa->o_oi = loi->loi_oi;
+ oa->o_mtime = attr->cat_mtime;
+ oa->o_atime = attr->cat_atime;
+ oa->o_ctime = attr->cat_ctime;
+ oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
+ OBD_MD_FLCTIME | OBD_MD_FLMTIME;
if (ia_valid & ATTR_SIZE) {
oa->o_size = size;
oa->o_blocks = OBD_OBJECT_EOF;
ENTRY;
memset(oa, 0, sizeof(*oa));
- oa->o_id = loi->loi_id;
- oa->o_seq = loi->loi_seq;
+ oa->o_oi = loi->loi_oi;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
/* reload size abd blocks for start and end of sync range */
oa->o_ctime = lvb->lvb_ctime;
oa->o_valid |= OBD_MD_FLCTIME;
}
- if (flags & OBD_MD_FLID) {
- oa->o_id = oinfo->loi_id;
- oa->o_valid |= OBD_MD_FLID;
- }
- if (flags & OBD_MD_FLGROUP) {
- oa->o_seq = oinfo->loi_seq;
- oa->o_valid |= OBD_MD_FLGROUP;
- }
- if (flags & OBD_MD_FLHANDLE) {
+ if (flags & OBD_MD_FLGROUP) {
+ ostid_set_seq(&oa->o_oi, ostid_seq(&oinfo->loi_oi));
+ oa->o_valid |= OBD_MD_FLGROUP;
+ }
+ if (flags & OBD_MD_FLID) {
+ ostid_set_id(&oa->o_oi, ostid_id(&oinfo->loi_oi));
+ oa->o_valid |= OBD_MD_FLID;
+ }
+ if (flags & OBD_MD_FLHANDLE) {
clerq = slice->crs_req;
LASSERT(!cfs_list_empty(&clerq->crq_pages));
apage = container_of(clerq->crq_pages.next,
static int osc_object_print(const struct lu_env *env, void *cookie,
lu_printer_t p, const struct lu_object *obj)
{
- struct osc_object *osc = lu2osc(obj);
- struct lov_oinfo *oinfo = osc->oo_oinfo;
- struct osc_async_rc *ar = &oinfo->loi_ar;
-
- (*p)(env, cookie, "id: "LPU64" gr: "LPU64" "
- "idx: %d gen: %d kms_valid: %u kms "LPU64" "
- "rc: %d force_sync: %d min_xid: "LPU64" ",
- oinfo->loi_id, oinfo->loi_seq, oinfo->loi_ost_idx,
- oinfo->loi_ost_gen, oinfo->loi_kms_valid, oinfo->loi_kms,
- ar->ar_rc, ar->ar_force_sync, ar->ar_min_xid);
- osc_lvb_print(env, cookie, p, &oinfo->loi_lvb);
- return 0;
+ struct osc_object *osc = lu2osc(obj);
+ struct lov_oinfo *oinfo = osc->oo_oinfo;
+ struct osc_async_rc *ar = &oinfo->loi_ar;
+
+ (*p)(env, cookie, "id: "DOSTID" "
+ "idx: %d gen: %d kms_valid: %u kms "LPU64" "
+ "rc: %d force_sync: %d min_xid: "LPU64" ",
+ POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx,
+ oinfo->loi_ost_gen, oinfo->loi_kms_valid, oinfo->loi_kms,
+ ar->ar_rc, ar->ar_force_sync, ar->ar_min_xid);
+ osc_lvb_print(env, cookie, p, &oinfo->loi_lvb);
+ return 0;
}
RETURN(osc_real_create(exp, oa, ea, oti));
}
- if (!fid_seq_is_mdt(oa->o_seq))
+ if (!fid_seq_is_mdt(ostid_seq(&oa->o_oi)))
RETURN(osc_real_create(exp, oa, ea, oti));
/* we should not get here anymore */
msg = "changed in transit AND doesn't match the original - "
"likely false positive due to mmap IO (bug 11742)";
- LCONSOLE_ERROR_MSG(0x132, "BAD WRITE CHECKSUM: %s: from %s inode "DFID
- " object "LPU64"/"LPU64" extent ["LPU64"-"LPU64"]\n",
- msg, libcfs_nid2str(peer->nid),
- oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (__u64)0,
- oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0,
- oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0,
- oa->o_id,
- oa->o_valid & OBD_MD_FLGROUP ? oa->o_seq : (__u64)0,
- pga[0]->off,
- pga[page_count-1]->off + pga[page_count-1]->count - 1);
- CERROR("original client csum %x (type %x), server csum %x (type %x), "
- "client csum now %x\n", client_cksum, client_cksum_type,
- server_cksum, cksum_type, new_cksum);
- return 1;
+ LCONSOLE_ERROR_MSG(0x132, "BAD WRITE CHECKSUM: %s: from %s inode "DFID
+ " object "DOSTID" extent ["LPU64"-"LPU64"]\n",
+ msg, libcfs_nid2str(peer->nid),
+ oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (__u64)0,
+ oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0,
+ oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0,
+ POSTID(&oa->o_oi), pga[0]->off,
+ pga[page_count-1]->off + pga[page_count-1]->count - 1);
+ CERROR("original client csum %x (type %x), server csum %x (type %x), "
+ "client csum now %x\n", client_cksum, client_cksum_type,
+ server_cksum, cksum_type, new_cksum);
+ return 1;
}
/* Note rc enters this function as number of bytes transferred */
router = libcfs_nid2str(req->rq_bulk->bd_sender);
}
- if (server_cksum == ~0 && rc > 0) {
- CERROR("Protocol error: server %s set the 'checksum' "
- "bit, but didn't send a checksum. Not fatal, "
- "but please notify on http://bugs.whamcloud.com/\n",
- libcfs_nid2str(peer->nid));
- } else if (server_cksum != client_cksum) {
- LCONSOLE_ERROR_MSG(0x133, "%s: BAD READ CHECKSUM: from "
- "%s%s%s inode "DFID" object "
- LPU64"/"LPU64" extent "
- "["LPU64"-"LPU64"]\n",
- req->rq_import->imp_obd->obd_name,
- libcfs_nid2str(peer->nid),
- via, router,
- body->oa.o_valid & OBD_MD_FLFID ?
- body->oa.o_parent_seq : (__u64)0,
- body->oa.o_valid & OBD_MD_FLFID ?
- body->oa.o_parent_oid : 0,
- body->oa.o_valid & OBD_MD_FLFID ?
- body->oa.o_parent_ver : 0,
- body->oa.o_id,
- body->oa.o_valid & OBD_MD_FLGROUP ?
- body->oa.o_seq : (__u64)0,
- aa->aa_ppga[0]->off,
- aa->aa_ppga[aa->aa_page_count-1]->off +
- aa->aa_ppga[aa->aa_page_count-1]->count -
- 1);
- CERROR("client %x, server %x, cksum_type %x\n",
- client_cksum, server_cksum, cksum_type);
- cksum_counter = 0;
- aa->aa_oa->o_cksum = client_cksum;
- rc = -EAGAIN;
- } else {
- cksum_counter++;
- CDEBUG(D_PAGE, "checksum %x confirmed\n", client_cksum);
- rc = 0;
- }
+ if (server_cksum == ~0 && rc > 0) {
+ CERROR("Protocol error: server %s set the 'checksum' "
+ "bit, but didn't send a checksum. Not fatal, "
+ "but please notify on http://bugs.whamcloud.com/\n",
+ libcfs_nid2str(peer->nid));
+ } else if (server_cksum != client_cksum) {
+ LCONSOLE_ERROR_MSG(0x133, "%s: BAD READ CHECKSUM: from "
+ "%s%s%s inode "DFID" object "DOSTID
+ " extent ["LPU64"-"LPU64"]\n",
+ req->rq_import->imp_obd->obd_name,
+ libcfs_nid2str(peer->nid),
+ via, router,
+ body->oa.o_valid & OBD_MD_FLFID ?
+ body->oa.o_parent_seq : (__u64)0,
+ body->oa.o_valid & OBD_MD_FLFID ?
+ body->oa.o_parent_oid : 0,
+ body->oa.o_valid & OBD_MD_FLFID ?
+ body->oa.o_parent_ver : 0,
+ POSTID(&body->oa.o_oi),
+ aa->aa_ppga[0]->off,
+ aa->aa_ppga[aa->aa_page_count-1]->off +
+ aa->aa_ppga[aa->aa_page_count-1]->count -
+ 1);
+ CERROR("client %x, server %x, cksum_type %x\n",
+ client_cksum, server_cksum, cksum_type);
+ cksum_counter = 0;
+ aa->aa_oa->o_cksum = client_cksum;
+ rc = -EAGAIN;
+ } else {
+ cksum_counter++;
+ CDEBUG(D_PAGE, "checksum %x confirmed\n", client_cksum);
+ rc = 0;
+ }
} else if (unlikely(client_cksum)) {
static int cksum_missed;
if (rc != -EINPROGRESS &&
!client_should_resend(resends, &exp->exp_obd->u.cli)) {
CERROR("%s: too many resend retries for object: "
- ""LPU64":"LPU64", rc = %d.\n",
- exp->exp_obd->obd_name, oa->o_id, oa->o_seq, rc);
- goto out;
- }
- if (generation !=
- exp->exp_obd->u.cli.cl_import->imp_generation) {
- CDEBUG(D_HA, "%s: resend cross eviction for object: "
- ""LPU64":"LPU64", rc = %d.\n",
- exp->exp_obd->obd_name, oa->o_id, oa->o_seq, rc);
+ ""DOSTID", rc = %d.\n", exp->exp_obd->obd_name,
+ POSTID(&oa->o_oi), rc);
goto out;
}
+ if (generation !=
+ exp->exp_obd->u.cli.cl_import->imp_generation) {
+ CDEBUG(D_HA, "%s: resend cross eviction for object: "
+ ""DOSTID", rc = %d.\n", exp->exp_obd->obd_name,
+ POSTID(&oa->o_oi), rc);
+ goto out;
+ }
lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends), NULL, NULL,
NULL);
CDEBUG(D_INODE, "request %p aa %p rc %d\n", req, aa, rc);
/* When server return -EINPROGRESS, client should always retry
* regardless of the number of times the bulk was resent already. */
- if (osc_recoverable_error(rc)) {
- if (req->rq_import_generation !=
- req->rq_import->imp_generation) {
- CDEBUG(D_HA, "%s: resend cross eviction for object: "
- ""LPU64":"LPU64", rc = %d.\n",
- req->rq_import->imp_obd->obd_name,
- aa->aa_oa->o_id, aa->aa_oa->o_seq, rc);
- } else if (rc == -EINPROGRESS ||
- client_should_resend(aa->aa_resends, aa->aa_cli)) {
- rc = osc_brw_redo_request(req, aa, rc);
- } else {
- CERROR("%s: too many resent retries for object: "
- ""LPU64":"LPU64", rc = %d.\n",
- req->rq_import->imp_obd->obd_name,
- aa->aa_oa->o_id, aa->aa_oa->o_seq, rc);
- }
+ if (osc_recoverable_error(rc)) {
+ if (req->rq_import_generation !=
+ req->rq_import->imp_generation) {
+ CDEBUG(D_HA, "%s: resend cross eviction for object: "
+ ""DOSTID", rc = %d.\n",
+ req->rq_import->imp_obd->obd_name,
+ POSTID(&aa->aa_oa->o_oi), rc);
+ } else if (rc == -EINPROGRESS ||
+ client_should_resend(aa->aa_resends, aa->aa_cli)) {
+ rc = osc_brw_redo_request(req, aa, rc);
+ } else {
+ CERROR("%s: too many resent retries for object: "
+ ""LPU64":"LPU64", rc = %d.\n",
+ req->rq_import->imp_obd->obd_name,
+ POSTID(&aa->aa_oa->o_oi), rc);
+ }
- if (rc == 0)
- RETURN(0);
- else if (rc == -EAGAIN || rc == -EINPROGRESS)
- rc = -EIO;
- }
+ if (rc == 0)
+ RETURN(0);
+ else if (rc == -EAGAIN || rc == -EINPROGRESS)
+ rc = -EIO;
+ }
if (aa->aa_ocapa) {
capa_put(aa->aa_ocapa);
LASSERT(map);
LASSERT(map->om_root);
- fid_ostid_pack(fid, ostid);
- osd_seq = osd_seq_load(dev, ostid->oi_seq);
+ fid_to_ostid(fid, ostid);
+ osd_seq = osd_seq_load(dev, ostid_seq(ostid));
if (IS_ERR(osd_seq))
RETURN(PTR_ERR(osd_seq));
- dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1);
+ dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1);
d_seq = osd_seq->oos_dirs[dirn];
LASSERT(d_seq);
- osd_oid_name(name, fid, ostid->oi_id);
+ osd_oid_name(name, fid, ostid_id(ostid));
child = &info->oti_child_dentry;
child->d_parent = d_seq;
LASSERT(map);
/* map fid to seq:objid */
- fid_ostid_pack(fid, ostid);
+ fid_to_ostid(fid, ostid);
- osd_seq = osd_seq_load(osd, ostid->oi_seq);
+ osd_seq = osd_seq_load(osd, ostid_seq(ostid));
if (IS_ERR(osd_seq))
RETURN(PTR_ERR(osd_seq));
- dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1);
+ dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1);
d = osd_seq->oos_dirs[dirn];
LASSERT(d);
- osd_oid_name(name, fid, ostid->oi_id);
+ osd_oid_name(name, fid, ostid_id(ostid));
rc = osd_obj_add_entry(info, osd, d, name, id, th);
RETURN(rc);
LASSERT(map);
/* map fid to seq:objid */
- fid_ostid_pack(fid, ostid);
+ fid_to_ostid(fid, ostid);
- osd_seq = osd_seq_load(osd, ostid->oi_seq);
+ osd_seq = osd_seq_load(osd, ostid_seq(ostid));
if (IS_ERR(osd_seq))
GOTO(cleanup, rc = PTR_ERR(osd_seq));
- dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1);
+ dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1);
d = osd_seq->oos_dirs[dirn];
LASSERT(d);
- osd_oid_name(name, fid, ostid->oi_id);
+ osd_oid_name(name, fid, ostid_id(ostid));
rc = osd_obj_del_entry(info, osd, d, name, th);
cleanup:
RETURN(rc);
PFID(fid));
return PTR_ERR(osd_seq);
}
- rc = fid_ostid_pack(fid, &osd_oti_get(env)->oti_ostid);
+
+ rc = fid_to_ostid(fid, &osd_oti_get(env)->oti_ostid);
LASSERT(rc == 0); /* we should not get here with IGIF */
- b = osd_oti_get(env)->oti_ostid.oi_id % OSD_OST_MAP_SIZE;
+ b = ostid_id(&osd_oti_get(env)->oti_ostid) % OSD_OST_MAP_SIZE;
LASSERT(osd_seq->os_compat_dirs[b]);
- sprintf(buf, LPU64, osd_oti_get(env)->oti_ostid.oi_id);
+ sprintf(buf, LPU64, ostid_id(&osd_oti_get(env)->oti_ostid));
return osd_seq->os_compat_dirs[b];
}
struct osp_thread_info *info = osp_env_info(env);
struct ost_id *oi = &info->osi_oi;
- fid_ostid_pack(fid, oi);
- return oi->oi_id == IDIF_MAX_OID;
+ fid_to_ostid(fid, oi);
+ return ostid_id(oi) == IDIF_MAX_OID;
} else {
return fid_oid(fid) == LUSTRE_DATA_SEQ_MAX_WIDTH;
}
spin_lock(&d->opd_pre_lock);
if (d->opd_gap_count > 0) {
int count = d->opd_gap_count;
- osi->osi_oi.oi_id = fid_oid(&d->opd_gap_start_fid);
+
+ ostid_set_id(&osi->osi_oi,
+ fid_oid(&d->opd_gap_start_fid));
d->opd_gap_count = 0;
spin_unlock(&d->opd_pre_lock);
struct ost_id *oi2 = &osp_env_info(env)->osi_oi2;
LASSERT(fid_is_idif(fid1) && fid_is_idif(fid2));
- ostid_idif_pack(fid1, oi1);
- ostid_idif_pack(fid2, oi2);
- LASSERT(oi1->oi_id >= oi2->oi_id);
+ fid_to_ostid(fid1, oi1);
+ fid_to_ostid(fid2, oi2);
+ LASSERT(ostid_id(oi1) >= ostid_id(oi2));
- return oi1->oi_id - oi2->oi_id;
+ return ostid_id(oi1) - ostid_id(oi2);
}
return fid_oid(fid1) - fid_oid(fid2);
spin_lock(&osp->opd_pre_lock);
last_fid = &osp->opd_pre_last_created_fid;
- ostid_idif_pack(last_fid, oi);
- end = min(oi->oi_id + *grow, IDIF_MAX_OID);
- *grow = end - oi->oi_id;
- oi->oi_id += *grow;
+ fid_to_ostid(last_fid, oi);
+ end = min(ostid_id(oi) + *grow, IDIF_MAX_OID);
+ *grow = end - ostid_id(oi);
+ ostid_set_id(oi, ostid_id(oi) + *grow);
spin_unlock(&osp->opd_pre_lock);
if (*grow == 0)
return 1;
- ostid_idif_unpack(oi, fid, osp->opd_index);
+ ostid_to_fid(fid, oi, osp->opd_index);
return 0;
}
fid->f_seq = 0;
}
- fid_ostid_pack(fid, &body->oa.o_oi);
+ fid_to_ostid(fid, &body->oa.o_oi);
body->oa.o_valid = OBD_MD_FLGROUP;
ptlrpc_request_set_replen(req);
if (body == NULL)
GOTO(out_req, rc = -EPROTO);
- fid_ostid_unpack(fid, &body->oa.o_oi, d->opd_index);
+ ostid_to_fid(fid, &body->oa.o_oi, d->opd_index);
LASSERTF(lu_fid_diff(fid, &d->opd_pre_used_fid) > 0,
"reply fid "DFID" pre used fid "DFID"\n", PFID(fid),
PFID(&d->opd_pre_used_fid));
- CDEBUG(D_HA, "%s: new last_created "DFID"\n", d->opd_obd->obd_name,
- PFID(fid));
-
diff = lu_fid_diff(fid, &d->opd_pre_last_created_fid);
spin_lock(&d->opd_pre_lock);
d->opd_pre_last_created_fid = *fid;
spin_unlock(&d->opd_pre_lock);
- CDEBUG(D_OTHER, "current precreated pool: "DFID"-"DFID"\n",
- PFID(&d->opd_pre_used_fid), PFID(&d->opd_pre_last_created_fid));
+ CDEBUG(D_HA, "%s: current precreated pool: "DFID"-"DFID"\n",
+ d->opd_obd->obd_name, PFID(&d->opd_pre_used_fid),
+ PFID(&d->opd_pre_last_created_fid));
out_req:
/* now we can wakeup all users awaiting for objects */
osp_pre_update_status(d, rc);
static int osp_get_lastfid_from_ost(const struct lu_env *env,
struct osp_device *d)
{
- struct ost_id *oi = &osp_env_info(env)->osi_oi;
struct ptlrpc_request *req = NULL;
struct obd_import *imp;
- struct lu_fid *last_fid = &d->opd_last_used_fid;
+ struct lu_fid *last_fid;
char *tmp;
int rc;
ENTRY;
sizeof(KEY_LAST_FID));
req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_VAL, RCL_CLIENT,
- sizeof(*oi));
+ sizeof(struct lu_fid));
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GET_INFO);
if (rc) {
memcpy(tmp, KEY_LAST_FID, sizeof(KEY_LAST_FID));
req->rq_no_delay = req->rq_no_resend = 1;
- fid_ostid_pack(last_fid, oi);
- ostid_cpu_to_le(oi, oi);
tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL);
- memcpy(tmp, oi, sizeof(*oi));
+ fid_cpu_to_le((struct lu_fid *)tmp, &d->opd_last_used_fid);
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
GOTO(out, rc);
}
- oi = req_capsule_server_get(&req->rq_pill, &RMF_OST_ID);
- if (oi == NULL) {
+ last_fid = req_capsule_server_get(&req->rq_pill, &RMF_FID);
+ if (last_fid == NULL) {
CERROR("%s: Got last_fid failed.\n", d->opd_obd->obd_name);
GOTO(out, rc = -EPROTO);
}
- rc = fid_ostid_unpack(last_fid, oi, d->opd_index);
- if (rc != 0 || !fid_is_sane(last_fid)) {
+ if (!fid_is_sane(last_fid)) {
CERROR("%s: Got insane last_fid "DFID"\n",
d->opd_obd->obd_name, PFID(last_fid));
GOTO(out, rc = -EPROTO);
body->oa.o_flags = OBD_FL_DELORPHAN;
body->oa.o_valid = OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
- fid_ostid_pack(&d->opd_last_used_fid, &body->oa.o_oi);
+ fid_to_ostid(&d->opd_last_used_fid, &body->oa.o_oi);
ptlrpc_request_set_replen(req);
/*
* OST provides us with id new pool starts from in body->oa.o_id
*/
- fid_ostid_unpack(last_fid, &body->oa.o_oi, d->opd_index);
- CDEBUG(D_INFO, "%s: last_fid "DFID" server last fid "DFID"\n",
- d->opd_obd->obd_name, PFID(&d->opd_last_used_fid),
- PFID(last_fid));
+ ostid_to_fid(last_fid, &body->oa.o_oi, d->opd_index);
spin_lock(&d->opd_pre_lock);
diff = lu_fid_diff(&d->opd_last_used_fid, last_fid);
if (oa == NULL)
GOTO(out, rc = -ENOMEM);
- rc = fid_ostid_pack(lu_object_fid(&dt->do_lu), &oa->o_oi);
+ rc = fid_to_ostid(lu_object_fid(&dt->do_lu), &oa->o_oi);
LASSERT(rc == 0);
oa->o_size = size;
oa->o_blocks = OBD_OBJECT_EOF;
osi->osi_unlink.lur_count = count;
break;
case MDS_SETATTR64_REC:
- rc = fid_ostid_pack(fid, &osi->osi_oi);
+ rc = fid_to_ostid(fid, &osi->osi_oi);
LASSERT(rc == 0);
osi->osi_hdr.lrh_len = sizeof(osi->osi_setattr);
osi->osi_hdr.lrh_type = MDS_SETATTR64_REC;
- osi->osi_setattr.lsr_oid = osi->osi_oi.oi_id;
- osi->osi_setattr.lsr_oseq = osi->osi_oi.oi_seq;
+ osi->osi_setattr.lsr_oi = osi->osi_oi;
LASSERT(attr);
osi->osi_setattr.lsr_uid = attr->la_uid;
osi->osi_setattr.lsr_gid = attr->la_gid;
NULL, th);
llog_ctxt_put(ctxt);
- CDEBUG(D_OTHER, "%s: new record %lu:%lu:%lu/%lu: %d\n",
- d->opd_obd->obd_name,
- (unsigned long) osi->osi_cookie.lgc_lgl.lgl_oid,
- (unsigned long) osi->osi_cookie.lgc_lgl.lgl_oseq,
+ CDEBUG(D_OTHER, "%s: new record "DOSTID":%lu/%lu: %d\n",
+ d->opd_obd->obd_name, POSTID(&osi->osi_cookie.lgc_lgl.lgl_oi),
(unsigned long) osi->osi_cookie.lgc_lgl.lgl_ogen,
(unsigned long) osi->osi_cookie.lgc_index, rc);
body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
LASSERT(body);
- body->oa.o_id = rec->lsr_oid;
- body->oa.o_seq = rec->lsr_oseq;
+ body->oa.o_oi = rec->lsr_oi;
body->oa.o_uid = rec->lsr_uid;
body->oa.o_gid = rec->lsr_gid;
body->oa.o_valid = OBD_MD_FLGROUP | OBD_MD_FLID |
body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
LASSERT(body);
- body->oa.o_id = rec->lur_oid;
- body->oa.o_seq = rec->lur_oseq;
+ ostid_set_seq(&body->oa.o_oi, rec->lur_oseq);
+ ostid_set_id(&body->oa.o_oi, rec->lur_oid);
body->oa.o_misc = rec->lur_count;
body->oa.o_valid = OBD_MD_FLGROUP | OBD_MD_FLID;
if (rec->lur_count)
body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
if (body == NULL)
RETURN(-EFAULT);
- rc = fid_ostid_pack(&rec->lur_fid, &body->oa.o_oi);
+ rc = fid_to_ostid(&rec->lur_fid, &body->oa.o_oi);
if (rc < 0)
RETURN(rc);
body->oa.o_misc = rec->lur_count;
static int osp_sync_llog_init(const struct lu_env *env, struct osp_device *d)
{
struct osp_thread_info *osi = osp_env_info(env);
- struct llog_handle *lgh;
+ struct llog_handle *lgh = NULL;
struct obd_device *obd = d->opd_obd;
struct llog_ctxt *ctxt;
int rc;
RETURN(rc);
}
- CDEBUG(D_INFO, "%s: Init llog for %d - catid "LPX64"/"LPX64":%x\n",
- obd->obd_name, d->opd_index, osi->osi_cid.lci_logid.lgl_oid,
- osi->osi_cid.lci_logid.lgl_oseq,
+ CDEBUG(D_INFO, "%s: Init llog for %d - catid "DOSTID":%x\n",
+ obd->obd_name, d->opd_index,
+ POSTID(&osi->osi_cid.lci_logid.lgl_oi),
osi->osi_cid.lci_logid.lgl_ogen);
rc = llog_setup(env, obd, &obd->obd_olg, LLOG_MDS_OST_ORIG_CTXT, obd,
ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
LASSERT(ctxt);
- if (likely(osi->osi_cid.lci_logid.lgl_oid != 0)) {
+ if (likely(ostid_id(&osi->osi_cid.lci_logid.lgl_oi) != 0)) {
rc = llog_open(env, ctxt, &lgh, &osi->osi_cid.lci_logid, NULL,
LLOG_OPEN_EXISTS);
/* re-create llog if it is missing */
if (rc == -ENOENT)
- osi->osi_cid.lci_logid.lgl_oid = 0;
+ logid_set_id(&osi->osi_cid.lci_logid, 0);
else if (rc < 0)
GOTO(out_cleanup, rc);
}
- if (unlikely(osi->osi_cid.lci_logid.lgl_oid == 0)) {
+ if (unlikely(logid_id(&osi->osi_cid.lci_logid) == 0)) {
rc = llog_open_create(env, ctxt, &lgh, NULL, NULL);
if (rc < 0)
GOTO(out_cleanup, rc);
osi->osi_cid.lci_logid = lgh->lgh_id;
}
+ LASSERT(lgh != NULL);
ctxt->loc_handle = lgh;
rc = llog_cat_init_and_process(env, lgh);
struct obd_ioobj *ioobj)
{
if (unlikely(oa != NULL && !(oa->o_valid & OBD_MD_FLGROUP))) {
- oa->o_seq = FID_SEQ_OST_MDT0;
+ ostid_set_seq_mdt0(&oa->o_oi);
if (ioobj)
- ioobj->ioo_seq = FID_SEQ_OST_MDT0;
- } else if (unlikely(oa == NULL || !(fid_seq_is_idif(oa->o_seq) ||
- fid_seq_is_mdt(oa->o_seq) ||
- fid_seq_is_echo(oa->o_seq)))) {
+ ostid_set_seq_mdt0(&ioobj->ioo_oid);
+ } else if (unlikely(oa == NULL ||
+ !(fid_seq_is_idif(ostid_seq(&oa->o_oi)) ||
+ fid_seq_is_mdt(ostid_seq(&oa->o_oi)) ||
+ fid_seq_is_echo(ostid_seq(&oa->o_oi))))) {
CERROR("%s: client %s sent bad object "DOSTID": rc = -EPROTO\n",
exp->exp_obd->obd_name, obd_export_nid2str(exp),
- oa ? oa->o_id : -1, oa ? oa->o_seq : -1);
+ oa ? ostid_seq(&oa->o_oi) : -1,
+ oa ? ostid_id(&oa->o_oi) : -1);
return -EPROTO;
}
- obdo_from_ostid(oa, &oa->o_oi);
if (ioobj != NULL) {
unsigned max_brw = ioobj_max_brw_get(ioobj);
POSTID(&oa->o_oi));
return -EPROTO;
}
- ioobj_from_obdo(ioobj, oa);
+ ioobj->ioo_oid = oa->o_oi;
}
return 0;
}
if (body == NULL)
RETURN(-EFAULT);
- if (body->oa.o_id == 0)
- RETURN(-EPROTO);
+ if (ostid_id(&body->oa.o_oi) == 0)
+ RETURN(-EPROTO);
rc = ost_validate_obdo(exp, &body->oa, NULL);
if (rc)
if (rc != 0)
GOTO(out_tls, rc);
- /*
- * If getting the lock took more time than
- * client was willing to wait, drop it. b=11330
- */
- if (cfs_time_current_sec() > req->rq_deadline ||
- OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
- no_reply = 1;
- CERROR("Dropping timed-out read from %s because locking"
- "object "LPX64" took %ld seconds (limit was %ld).\n",
- libcfs_id2str(req->rq_peer), ioo->ioo_id,
- cfs_time_current_sec() - req->rq_arrival_time.tv_sec,
- req->rq_deadline - req->rq_arrival_time.tv_sec);
- GOTO(out_lock, rc = -ETIMEDOUT);
- }
+ /*
+ * If getting the lock took more time than
+ * client was willing to wait, drop it. b=11330
+ */
+ if (cfs_time_current_sec() > req->rq_deadline ||
+ OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
+ no_reply = 1;
+ CERROR("Dropping timed-out read from %s because locking"
+ "object "DOSTID" took %ld seconds (limit was %ld).\n",
+ libcfs_id2str(req->rq_peer), POSTID(&ioo->ioo_oid),
+ cfs_time_current_sec() - req->rq_arrival_time.tv_sec,
+ req->rq_deadline - req->rq_arrival_time.tv_sec);
+ GOTO(out_lock, rc = -ETIMEDOUT);
+ }
repbody = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
memcpy(&repbody->oa, &body->oa, sizeof(repbody->oa));
}
LCONSOLE_ERROR_MSG(0x168, "BAD WRITE CHECKSUM: %s from %s%s%s inode "
- DFID" object "LPU64"/"LPU64" extent ["LPU64"-"LPU64
+ DFID" object "DOSTID" extent ["LPU64"-"LPU64
"]: client csum %x, server csum %x\n",
exp->exp_obd->obd_name, libcfs_id2str(req->rq_peer),
via, router,
body->oa.o_parent_oid : 0,
body->oa.o_valid & OBD_MD_FLFID ?
body->oa.o_parent_ver : 0,
- body->oa.o_id,
- body->oa.o_valid & OBD_MD_FLGROUP ?
- body->oa.o_seq : (__u64)0,
+ POSTID(&body->oa.o_oi),
local_nb[0].lnb_file_offset,
local_nb[npages-1].lnb_file_offset +
local_nb[npages-1].len - 1,
if (rc != 0)
GOTO(out_tls, rc);
- /*
- * If getting the lock took more time than
- * client was willing to wait, drop it. b=11330
- */
- if (cfs_time_current_sec() > req->rq_deadline ||
- OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
- no_reply = 1;
- CERROR("Dropping timed-out write from %s because locking "
- "object "LPX64" took %ld seconds (limit was %ld).\n",
- libcfs_id2str(req->rq_peer), ioo->ioo_id,
- cfs_time_current_sec() - req->rq_arrival_time.tv_sec,
- req->rq_deadline - req->rq_arrival_time.tv_sec);
- GOTO(out_lock, rc = -ETIMEDOUT);
- }
+ /*
+ * If getting the lock took more time than
+ * client was willing to wait, drop it. b=11330
+ */
+ if (cfs_time_current_sec() > req->rq_deadline ||
+ OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
+ no_reply = 1;
+ CERROR("Dropping timed-out write from %s because locking "
+ "object "DOSTID" took %ld seconds (limit was %ld).\n",
+ libcfs_id2str(req->rq_peer), POSTID(&ioo->ioo_oid),
+ cfs_time_current_sec() - req->rq_arrival_time.tv_sec,
+ req->rq_deadline - req->rq_arrival_time.tv_sec);
+ GOTO(out_lock, rc = -ETIMEDOUT);
+ }
/* obd_preprw clobbers oa->valid, so save what we need */
if (body->oa.o_valid & OBD_MD_FLCKSUM) {
}
#endif
-/* Here "ostid" maybe part of "oa", the return value of "ostid_id()" depends on
- * the original "ostid->oi_seq", which maybe changed by the assignment of
- * "oa->o_seq = ostid_seq(ostid)", so keep the order of setting "oa->o_id" and
- * "oa->o_seq". */
-static inline void obdo_from_ostid(struct obdo *oa, struct ost_id *ostid)
-{
- oa->o_id = ostid_id(ostid);
- oa->o_seq = ostid_seq(ostid);
-}
-
-static inline void ioobj_from_obdo(struct obd_ioobj *ioobj, struct obdo *oa)
-{
- ioobj->ioo_id = oa->o_id;
- ioobj->ioo_seq = oa->o_seq;
-}
-
#endif /* OST_INTERNAL_H */
static const struct req_msg_field *ost_get_last_fid_server[] = {
&RMF_PTLRPC_BODY,
- &RMF_OST_ID
+ &RMF_FID,
};
static const struct req_msg_field *ost_get_fiemap_client[] = {
if (body == NULL)
RETURN(-EFAULT);
- if (body->lgd_logid.lgl_oid > 0)
- logid = &body->lgd_logid;
+ if (ostid_id(&body->lgd_logid.lgl_oi) > 0)
+ logid = &body->lgd_logid;
if (req_capsule_field_present(&req->rq_pill, &RMF_NAME, RCL_CLIENT)) {
name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
if (body == NULL)
RETURN(-EFAULT);
- if (body->lgd_logid.lgl_oid > 0)
- logid = &body->lgd_logid;
+ if (ostid_id(&body->lgd_logid.lgl_oi) > 0)
+ logid = &body->lgd_logid;
if (!(body->lgd_llh_flags & LLOG_F_IS_PLAIN))
CERROR("%s: wrong llog flags %x\n",
CLASSERT(offsetof(typeof(*ocd), paddingF) != 0);
}
-void lustre_swab_ost_id(struct ost_id *oid)
-{
- __swab64s(&oid->oi_id);
- __swab64s(&oid->oi_seq);
-}
-EXPORT_SYMBOL(lustre_swab_ost_id);
-
void lustre_swab_obdo (struct obdo *o)
{
__swab64s (&o->o_valid);
void lustre_swab_obd_ioobj(struct obd_ioobj *ioo)
{
- __swab64s(&ioo->ioo_id);
- __swab64s(&ioo->ioo_seq);
+ lustre_swab_ost_id(&ioo->ioo_oid);
__swab32s(&ioo->ioo_max_brw);
__swab32s(&ioo->ioo_bufcnt);
}
int i;
ENTRY;
for (i = 0; i < stripe_count; i++) {
- __swab64s(&(lod[i].l_object_id));
- __swab64s(&(lod[i].l_object_seq));
+ lustre_swab_ost_id(&(lod[i].l_ost_oi));
__swab32s(&(lod[i].l_ost_gen));
__swab32s(&(lod[i].l_ost_idx));
}
void dump_ioo(struct obd_ioobj *ioo)
{
CDEBUG(D_RPCTRACE,
- "obd_ioobj: ioo_id="LPD64", ioo_seq="LPD64", ioo_max_brw=%#x, "
- "ioo_bufct=%d\n", ioo->ioo_id, ioo->ioo_seq, ioo->ioo_max_brw,
+ "obd_ioobj: ioo_oid="DOSTID", ioo_max_brw=%#x, "
+ "ioo_bufct=%d\n", POSTID(&ioo->ioo_oid), ioo->ioo_max_brw,
ioo->ioo_bufcnt);
}
EXPORT_SYMBOL(dump_ioo);
void dump_obdo(struct obdo *oa)
{
- __u32 valid = oa->o_valid;
+ __u32 valid = oa->o_valid;
- CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid);
- if (valid & OBD_MD_FLID)
- CDEBUG(D_RPCTRACE, "obdo: o_id = "LPD64"\n", oa->o_id);
- if (valid & OBD_MD_FLGROUP)
- CDEBUG(D_RPCTRACE, "obdo: o_seq = "LPD64"\n", oa->o_seq);
- if (valid & OBD_MD_FLFID)
- CDEBUG(D_RPCTRACE, "obdo: o_parent_seq = "LPX64"\n",
- oa->o_parent_seq);
+ CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid);
+ if (valid & OBD_MD_FLID)
+ CDEBUG(D_RPCTRACE, "obdo: id = "DOSTID"\n", POSTID(&oa->o_oi));
+ if (valid & OBD_MD_FLFID)
+ CDEBUG(D_RPCTRACE, "obdo: o_parent_seq = "LPX64"\n",
+ oa->o_parent_seq);
if (valid & OBD_MD_FLSIZE)
CDEBUG(D_RPCTRACE, "obdo: o_size = "LPD64"\n", oa->o_size);
if (valid & OBD_MD_FLMTIME)
/* Checks for struct ost_id */
LASSERTF((int)sizeof(struct ost_id) == 16, "found %lld\n",
(long long)(int)sizeof(struct ost_id));
- LASSERTF((int)offsetof(struct ost_id, oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct ost_id, oi_id));
- LASSERTF((int)sizeof(((struct ost_id *)0)->oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct ost_id *)0)->oi_id));
- LASSERTF((int)offsetof(struct ost_id, oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct ost_id, oi_seq));
- LASSERTF((int)sizeof(((struct ost_id *)0)->oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct ost_id *)0)->oi_seq));
+ LASSERTF((int)offsetof(struct ost_id, oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_id, oi));
+ LASSERTF((int)sizeof(((struct ost_id *)0)->oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_id *)0)->oi));
LASSERTF(LUSTRE_FID_INIT_OID == 1, "found %lld\n",
(long long)LUSTRE_FID_INIT_OID);
LASSERTF(FID_SEQ_OST_MDT0 == 0, "found %lld\n",
(long long)FID_SEQ_QUOTA);
LASSERTF(FID_SEQ_QUOTA_GLB == 0x0000000200000006ULL, "found 0x%.16llxULL\n",
(long long)FID_SEQ_QUOTA_GLB);
+ LASSERTF(FID_SEQ_ROOT == 0x0000000200000007ULL, "found 0x%.16llxULL\n",
+ (long long)FID_SEQ_ROOT);
LASSERTF(FID_SEQ_NORMAL == 0x0000000200000400ULL, "found 0x%.16llxULL\n",
(long long)FID_SEQ_NORMAL);
LASSERTF(FID_SEQ_LOV_DEFAULT == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
(long long)(int)offsetof(struct obdo, o_valid));
LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_valid));
- LASSERTF((int)offsetof(struct obdo, o_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_oi.oi_id));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_oi.oi_id));
- LASSERTF((int)offsetof(struct obdo, o_oi.oi_seq) == 16, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_oi.oi_seq));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_oi.oi_seq));
+ LASSERTF((int)offsetof(struct obdo, o_oi) == 8, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_oi));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_oi));
LASSERTF((int)offsetof(struct obdo, o_parent_seq) == 24, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_parent_seq));
LASSERTF((int)sizeof(((struct obdo *)0)->o_parent_seq) == 8, "found %lld\n",
/* Checks for struct lov_ost_data_v1 */
LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n",
(long long)(int)sizeof(struct lov_ost_data_v1));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_id));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_id));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_seq));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_seq));
+ LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi));
+ LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi));
LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, "found %lld\n",
(long long)(int)offsetof(struct lov_ost_data_v1, l_ost_gen));
LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, "found %lld\n",
/* Checks for struct obd_ioobj */
LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
(long long)(int)sizeof(struct obd_ioobj));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid.oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_oid.oi_id));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_id));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid.oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_oid.oi_seq));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_seq));
+ LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct obd_ioobj, ioo_oid));
+ LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid));
LASSERTF((int)offsetof(struct obd_ioobj, ioo_max_brw) == 16, "found %lld\n",
(long long)(int)offsetof(struct obd_ioobj, ioo_max_brw));
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_max_brw) == 4, "found %lld\n",
/* Checks for struct llog_logid */
LASSERTF((int)sizeof(struct llog_logid) == 20, "found %lld\n",
(long long)(int)sizeof(struct llog_logid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oid) == 0, "found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oid));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oseq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oseq));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oseq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oseq));
+ LASSERTF((int)offsetof(struct llog_logid, lgl_oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct llog_logid, lgl_oi));
+ LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oi));
LASSERTF((int)offsetof(struct llog_logid, lgl_ogen) == 16, "found %lld\n",
(long long)(int)offsetof(struct llog_logid, lgl_ogen));
LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
(long long)(int)offsetof(struct llog_setattr64_rec, lsr_hdr));
LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr) == 16, "found %lld\n",
(long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr));
- LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oid) == 16, "found %lld\n",
- (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oid));
- LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid));
- LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oseq) == 24, "found %lld\n",
- (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oseq));
- LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oseq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oseq));
+ LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oi) == 16, "found %lld\n",
+ (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oi));
+ LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi));
LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_uid) == 32, "found %lld\n",
(long long)(int)offsetof(struct llog_setattr64_rec, lsr_uid));
LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid) == 4, "found %lld\n",
ostnum=$(index_from_ostuuid ${ostname}_UUID)
node=$(facet_active_host ost$((ostnum+1)))
param="obdfilter.$ostname.last_id"
- ost_last=$(do_node $node lctl get_param -n $param | head -n 1)
+ ost_last=$(do_node $node lctl get_param -n $param | head -n 1 |
+ awk -F':' '{print $2}')
echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
if [ $ost_last != $mds_last ]; then
error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
int rc;
if (is_dir && ostid_seq(&lum->lmm_oi) == FID_SEQ_LOV_DEFAULT) {
- lum->lmm_oi.oi_seq = FID_SEQ_OST_MDT0;
+ ostid_set_seq_mdt0(&lum->lmm_oi);
if (verbose & VERBOSE_DETAIL)
llapi_printf(LLAPI_MSG_NORMAL, "(Default) ");
}
for (i = 0; i < lum->lmm_stripe_count; i++) {
int idx = objects[i].l_ost_idx;
- long long oid = objects[i].l_object_id;
- long long gr = objects[i].l_object_seq;
+ long long oid = ostid_id(&objects[i].l_ost_oi);
+ long long gr = ostid_seq(&objects[i].l_ost_oi);
if ((obdindex == OBD_NOT_FOUND) || (obdindex == idx)) {
char fmt[48];
sprintf(fmt, "%s%s%s\n",
struct lov_user_md *lmm = ¶m->lmd->lmd_lmm;
lmm->lmm_magic = LOV_MAGIC_V1;
if (!param->raw)
- lmm->lmm_oi.oi_seq = FID_SEQ_LOV_DEFAULT;
+ ostid_set_seq(&lmm->lmm_oi,
+ FID_SEQ_LOV_DEFAULT);
lmm->lmm_stripe_count = 0;
lmm->lmm_stripe_size = 0;
lmm->lmm_stripe_offset = -1;
/* See jt_obd_create */
static int obj_create(struct kid_t *kid)
{
- struct obd_ioctl_data data;
- int rc;
-
- memset(&data, 0, sizeof(data));
- data.ioc_dev = kid->k_dev;
- data.ioc_obdo1.o_mode = 0100644;
- data.ioc_obdo1.o_id = 0;
- data.ioc_obdo1.o_seq = FID_SEQ_ECHO;
- data.ioc_obdo1.o_uid = 0;
- data.ioc_obdo1.o_gid = 0;
- data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
+ struct obd_ioctl_data data;
+ int rc;
+
+ memset(&data, 0, sizeof(data));
+ data.ioc_dev = kid->k_dev;
+ data.ioc_obdo1.o_mode = 0100644;
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, 1);
+ data.ioc_obdo1.o_uid = 0;
+ data.ioc_obdo1.o_gid = 0;
+ data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
rc = obj_ioctl(OBD_IOC_CREATE, &data, 1);
if (rc) {
return rc;
}
- kid->k_objid = data.ioc_obdo1.o_id;
+ kid->k_objid = ostid_id(&data.ioc_obdo1.o_oi);
if (o_verbose > 4)
printf("%d: cr "LPX64"\n", kid->k_id, kid->k_objid);
memset(&data, 0, sizeof(data));
data.ioc_dev = kid->k_dev;
- data.ioc_obdo1.o_id = kid->k_objid;
+ ostid_set_id(&data.ioc_obdo1.o_oi, kid->k_objid);
data.ioc_obdo1.o_mode = S_IFREG | 0644;
data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
data.ioc_pbuf1 = (void *)1;
data.ioc_plen1 = 1;
- data.ioc_obdo1.o_id = kid->k_objid;
- data.ioc_obdo1.o_mode = S_IFREG;
- data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLFLAGS;
- data.ioc_obdo1.o_flags = OBD_FL_DEBUG_CHECK;
- data.ioc_count = len;
- data.ioc_offset = 0;
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, kid->k_objid);
+ data.ioc_obdo1.o_mode = S_IFREG;
+ data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
+ data.ioc_obdo1.o_flags = OBD_FL_DEBUG_CHECK;
+ data.ioc_count = len;
+ data.ioc_offset = 0;
gettimeofday(&start, NULL);
char *obdo_print(struct obdo *obd)
{
- char buf[1024];
+ char buf[1024];
- sprintf(buf, "id: "LPX64"\ngrp: "LPX64"\natime: "LPU64"\nmtime: "LPU64
- "\nctime: "LPU64"\nsize: "LPU64"\nblocks: "LPU64
- "\nblksize: %u\nmode: %o\nuid: %d\ngid: %d\nflags: %x\n"
- "misc: %x\nnlink: %d,\nvalid "LPX64"\n",
- obd->o_id, obd->o_seq, obd->o_atime, obd->o_mtime, obd->o_ctime,
- obd->o_size, obd->o_blocks, obd->o_blksize, obd->o_mode,
- obd->o_uid, obd->o_gid, obd->o_flags, obd->o_misc,
- obd->o_nlink, obd->o_valid);
- return strdup(buf);
+ sprintf(buf, "id: "LPX64"\ngrp: "LPX64"\natime: "LPU64"\nmtime: "LPU64
+ "\nctime: "LPU64"\nsize: "LPU64"\nblocks: "LPU64
+ "\nblksize: %u\nmode: %o\nuid: %d\ngid: %d\nflags: %x\n"
+ "misc: %x\nnlink: %d,\nvalid "LPX64"\n",
+ ostid_id(&obd->o_oi), ostid_seq(&obd->o_oi), obd->o_atime,
+ obd->o_mtime, obd->o_ctime,
+ obd->o_size, obd->o_blocks, obd->o_blksize, obd->o_mode,
+ obd->o_uid, obd->o_gid, obd->o_flags, obd->o_misc,
+ obd->o_nlink, obd->o_valid);
+ return strdup(buf);
}
reset_lsmb (lsmb);
- lsm->lsm_oi.oi_id = strtoull(string, &end, 0);
+ ostid_set_id(&lsm->lsm_oi, strtoull(string, &end, 0));
if (end == string)
return -1;
string = end;
if (*string == 0) /* don't have to specify obj ids */
return (0);
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (*string != '@')
- return (-1);
- string++;
- lsm->lsm_oinfo[i]->loi_ost_idx = strtoul(string, &end, 0);
- if (*end != ':')
- return (-1);
- string = end + 1;
- lsm->lsm_oinfo[i]->loi_id = strtoull(string, &end, 0);
- string = end;
- }
+ for (i = 0; i < lsm->lsm_stripe_count; i++) {
+ if (*string != '@')
+ return (-1);
+ string++;
+ lsm->lsm_oinfo[i]->loi_ost_idx = strtoul(string, &end, 0);
+ if (*end != ':')
+ return (-1);
+ string = end + 1;
+ ostid_set_id(&lsm->lsm_oinfo[i]->loi_oi,
+ strtoull(string, &end, 0));
+ string = end;
+ }
if (*string != 0)
return (-1);
gettimeofday(&start, NULL);
while (shmem_running()) {
- struct lu_fid fid;
+ struct lu_fid fid = { 0 };
- data.ioc_obdo2.o_id = child_base_id;
+ ostid_set_id(&data.ioc_obdo2.o_oi, child_base_id);
data.ioc_obdo2.o_mode = mode | create_mode;
data.ioc_obdo2.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE |
OBD_MD_FLMODE | OBD_MD_FLFLAGS |
fprintf(stderr, "Allocate fids error %d.\n",rc);
return rc;
}
- data.ioc_obdo1.o_seq = fid.f_seq;
- data.ioc_obdo1.o_id = fid.f_oid;
+ fid_to_ostid(&fid, &data.ioc_obdo1.o_oi);
}
child_base_id += data.ioc_count;
char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
struct obd_ioctl_data data;
struct timeval next_time;
- __u64 count = 1, next_count, base_id = 0;
+ __u64 count = 1, next_count, base_id = 1;
int verbose = 1, mode = 0100644, rc = 0, i, valid_lsm = 0;
char *end;
next_time.tv_sec -= verbose;
for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
- data.ioc_obdo1.o_mode = mode;
- data.ioc_obdo1.o_id = base_id;
- data.ioc_obdo1.o_uid = 0;
- data.ioc_obdo1.o_gid = 0;
- data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
-
- if (valid_lsm) {
- data.ioc_plen1 = sizeof lsm_buffer;
- data.ioc_pbuf1 = (char *)&lsm_buffer;
- }
+ data.ioc_obdo1.o_mode = mode;
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, base_id);
+ data.ioc_obdo1.o_uid = 0;
+ data.ioc_obdo1.o_gid = 0;
+ data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLID | OBD_MD_FLUID |
+ OBD_MD_FLGID | OBD_MD_FLGROUP;
+ if (valid_lsm) {
+ data.ioc_plen1 = sizeof lsm_buffer;
+ data.ioc_pbuf1 = (char *)&lsm_buffer;
+ }
memset(buf, 0, sizeof(rawbuf));
rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
break;
}
- if (be_verbose(verbose, &next_time, i, &next_count, count))
- printf("%s: #%d is object id "LPX64"\n",
- jt_cmdname(argv[0]), i, data.ioc_obdo1.o_id);
+ if (be_verbose(verbose, &next_time, i, &next_count, count))
+ printf("%s: #%d is object id "LPX64"\n",
+ jt_cmdname(argv[0]), i,
+ ostid_id(&data.ioc_obdo1.o_oi));
}
return rc;
}
if (argc != 2)
return CMD_HELP;
- data.ioc_obdo1.o_id = strtoull(argv[1], &end, 0);
+ ostid_set_id(&data.ioc_obdo1.o_oi, strtoull(argv[1], &end, 0));
if (*end) {
fprintf(stderr, "error: %s: invalid objid '%s'\n",
jt_cmdname(argv[0]), argv[1]);
jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec));
for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
- data.ioc_obdo1.o_id = objid;
+ ostid_set_id(&data.ioc_obdo1.o_oi, objid);
data.ioc_obdo1.o_mode = S_IFREG;
data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
memset(buf, 0, sizeof(rawbuf));
next_time.tv_sec -= verbose;
for (i = 1, next_count = verbose; i <= count && shmem_running(); i++, id++) {
- data.ioc_obdo1.o_id = id;
- data.ioc_obdo1.o_mode = S_IFREG | 0644;
- data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
+ ostid_set_id(&data.ioc_obdo1.o_oi, id);
+ data.ioc_obdo1.o_mode = S_IFREG | 0644;
+ data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
memset(buf, 0, sizeof(rawbuf));
rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (argc != 2)
return CMD_HELP;
- memset(&data, 0, sizeof(data));
- data.ioc_dev = cur_device;
- data.ioc_obdo1.o_id = strtoull(argv[1], &end, 0);
- if (*end) {
- fprintf(stderr, "error: %s: invalid objid '%s'\n",
- jt_cmdname(argv[0]), argv[1]);
- return CMD_HELP;
- }
- /* to help obd filter */
- data.ioc_obdo1.o_mode = 0100644;
- data.ioc_obdo1.o_valid = 0xffffffff;
- printf("%s: object id "LPX64"\n", jt_cmdname(argv[0]),data.ioc_obdo1.o_id);
+ memset(&data, 0, sizeof(data));
+ data.ioc_dev = cur_device;
+ ostid_set_id(&data.ioc_obdo1.o_oi, strtoull(argv[1], &end, 0));
+ if (*end) {
+ fprintf(stderr, "error: %s: invalid objid '%s'\n",
+ jt_cmdname(argv[0]), argv[1]);
+ return CMD_HELP;
+ }
+ /* to help obd filter */
+ data.ioc_obdo1.o_mode = 0100644;
+ data.ioc_obdo1.o_valid = 0xffffffff;
+ printf("%s: object id "LPX64"\n", jt_cmdname(argv[0]),
+ ostid_id(&data.ioc_obdo1.o_oi));
memset(buf, 0, sizeof(rawbuf));
rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
strerror(rc = errno));
} else {
- printf("%s: object id "LPX64", mode %o\n", jt_cmdname(argv[0]),
- data.ioc_obdo1.o_id, data.ioc_obdo1.o_mode);
+ printf("%s: object id "LPU64", mode %o\n", jt_cmdname(argv[0]),
+ ostid_id(&data.ioc_obdo1.o_oi), data.ioc_obdo1.o_mode);
}
return rc;
}
jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec));
for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
- data.ioc_obdo1.o_id = objid;
- data.ioc_obdo1.o_mode = S_IFREG;
- data.ioc_obdo1.o_valid = 0xffffffff;
- memset(buf, 0, sizeof(rawbuf));
- rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
- if (rc) {
- fprintf(stderr, "error: %s: invalid ioctl\n",
- jt_cmdname(argv[0]));
- return rc;
- }
+ ostid_set_id(&data.ioc_obdo1.o_oi, objid);
+ data.ioc_obdo1.o_mode = S_IFREG;
+ data.ioc_obdo1.o_valid = 0xffffffff;
+ memset(buf, 0, sizeof(rawbuf));
+ rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
+ if (rc) {
+ fprintf(stderr, "error: %s: invalid ioctl\n",
+ jt_cmdname(argv[0]));
+ return rc;
+ }
rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_GETATTR, &data);
shmem_bump(1);
if (rc < 0) {
}
#endif
- data.ioc_obdo1.o_id = objid;
- data.ioc_obdo1.o_mode = S_IFREG;
- data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLFLAGS;
- data.ioc_obdo1.o_flags = (verify ? OBD_FL_DEBUG_CHECK : 0);
- data.ioc_count = len;
- data.ioc_offset = (repeat_offset ? 0 : thr_offset);
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, objid);
+ data.ioc_obdo1.o_mode = S_IFREG;
+ data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
+ data.ioc_obdo1.o_flags = (verify ? OBD_FL_DEBUG_CHECK : 0);
+ data.ioc_count = len;
+ data.ioc_offset = (repeat_offset ? 0 : thr_offset);
gettimeofday(&start, NULL);
next_time.tv_sec = start.tv_sec - verbose;
write ? "write" : "read");
break;
} else if (be_verbose(verbose, &next_time,i, &next_count,count)) {
- shmem_lock ();
- printf("%s: %s number %d @ "LPD64":"LPU64" for %d\n",
- jt_cmdname(argv[0]), write ? "write" : "read", i,
- data.ioc_obdo1.o_id, data.ioc_offset,
- (int)(pages * getpagesize()));
- shmem_unlock ();
+ shmem_lock ();
+ printf("%s: %s number %d @ "LPD64":"LPU64" for %d\n",
+ jt_cmdname(argv[0]), write ? "write" : "read", i,
+ ostid_id(&data.ioc_obdo1.o_oi), data.ioc_offset,
+ (int)(pages * getpagesize()));
+ shmem_unlock ();
}
if (!repeat_offset) {
{
obdio_iocinit (conn);
- conn->oc_data.ioc_obdo1.o_id = oid;
- conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
- conn->oc_data.ioc_obdo1.o_valid =
- OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
+ ostid_set_id(&conn->oc_data.ioc_obdo1.o_oi, oid);
+ conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
+ conn->oc_data.ioc_obdo1.o_valid =
+ OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
conn->oc_data.ioc_pbuf2 = buffer;
conn->oc_data.ioc_plen2 = count;
{
obdio_iocinit (conn);
- conn->oc_data.ioc_obdo1.o_id = oid;
- conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
- conn->oc_data.ioc_obdo1.o_valid =
- OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
+ ostid_set_id(&conn->oc_data.ioc_obdo1.o_oi, oid);
+ conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
+ conn->oc_data.ioc_obdo1.o_valid =
+ OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
conn->oc_data.ioc_pbuf1 = (void*)1;
conn->oc_data.ioc_plen1 = 1;
obdio_iocinit (conn);
- conn->oc_data.ioc_obdo1.o_id = oid;
- conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
- conn->oc_data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
+ ostid_set_id(&conn->oc_data.ioc_obdo1.o_oi, oid);
+ conn->oc_data.ioc_obdo1.o_mode = S_IFREG;
+ conn->oc_data.ioc_obdo1.o_valid =
+ OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
conn->oc_data.ioc_conn1 = mode;
conn->oc_data.ioc_count = count;
{
BLANK_LINE();
CHECK_STRUCT(ost_id);
- CHECK_MEMBER(ost_id, oi_id);
- CHECK_MEMBER(ost_id, oi_seq);
+ CHECK_MEMBER(ost_id, oi);
CHECK_VALUE(LUSTRE_FID_INIT_OID);
CHECK_VALUE_64X(FID_SEQ_SPECIAL);
CHECK_VALUE_64X(FID_SEQ_QUOTA);
CHECK_VALUE_64X(FID_SEQ_QUOTA_GLB);
+ CHECK_VALUE_64X(FID_SEQ_ROOT);
CHECK_VALUE_64X(FID_SEQ_NORMAL);
CHECK_VALUE_64X(FID_SEQ_LOV_DEFAULT);
BLANK_LINE();
CHECK_STRUCT(obdo);
CHECK_MEMBER(obdo, o_valid);
- CHECK_MEMBER(obdo, o_id);
- CHECK_MEMBER(obdo, o_seq);
+ CHECK_MEMBER(obdo, o_oi);
CHECK_MEMBER(obdo, o_parent_seq);
CHECK_MEMBER(obdo, o_size);
CHECK_MEMBER(obdo, o_mtime);
{
BLANK_LINE();
CHECK_STRUCT(lov_ost_data_v1);
- CHECK_MEMBER(lov_ost_data_v1, l_object_id);
- CHECK_MEMBER(lov_ost_data_v1, l_object_seq);
+ CHECK_MEMBER(lov_ost_data_v1, l_ost_oi);
CHECK_MEMBER(lov_ost_data_v1, l_ost_gen);
CHECK_MEMBER(lov_ost_data_v1, l_ost_idx);
}
{
BLANK_LINE();
CHECK_STRUCT(obd_ioobj);
- CHECK_MEMBER(obd_ioobj, ioo_id);
- CHECK_MEMBER(obd_ioobj, ioo_seq);
+ CHECK_MEMBER(obd_ioobj, ioo_oid);
CHECK_MEMBER(obd_ioobj, ioo_max_brw);
CHECK_MEMBER(obd_ioobj, ioo_bufcnt);
}
{
BLANK_LINE();
CHECK_STRUCT(llog_logid);
- CHECK_MEMBER(llog_logid, lgl_oid);
- CHECK_MEMBER(llog_logid, lgl_oseq);
+ CHECK_MEMBER(llog_logid, lgl_oi);
CHECK_MEMBER(llog_logid, lgl_ogen);
CHECK_CVALUE(OST_SZ_REC);
BLANK_LINE();
CHECK_STRUCT(llog_setattr64_rec);
CHECK_MEMBER(llog_setattr64_rec, lsr_hdr);
- CHECK_MEMBER(llog_setattr64_rec, lsr_oid);
- CHECK_MEMBER(llog_setattr64_rec, lsr_oseq);
+ CHECK_MEMBER(llog_setattr64_rec, lsr_oi);
CHECK_MEMBER(llog_setattr64_rec, lsr_uid);
CHECK_MEMBER(llog_setattr64_rec, lsr_uid_h);
CHECK_MEMBER(llog_setattr64_rec, lsr_gid);
/* Checks for struct ost_id */
LASSERTF((int)sizeof(struct ost_id) == 16, "found %lld\n",
(long long)(int)sizeof(struct ost_id));
- LASSERTF((int)offsetof(struct ost_id, oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct ost_id, oi_id));
- LASSERTF((int)sizeof(((struct ost_id *)0)->oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct ost_id *)0)->oi_id));
- LASSERTF((int)offsetof(struct ost_id, oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct ost_id, oi_seq));
- LASSERTF((int)sizeof(((struct ost_id *)0)->oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct ost_id *)0)->oi_seq));
+ LASSERTF((int)offsetof(struct ost_id, oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_id, oi));
+ LASSERTF((int)sizeof(((struct ost_id *)0)->oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_id *)0)->oi));
LASSERTF(LUSTRE_FID_INIT_OID == 1, "found %lld\n",
(long long)LUSTRE_FID_INIT_OID);
LASSERTF(FID_SEQ_OST_MDT0 == 0, "found %lld\n",
(long long)FID_SEQ_QUOTA);
LASSERTF(FID_SEQ_QUOTA_GLB == 0x0000000200000006ULL, "found 0x%.16llxULL\n",
(long long)FID_SEQ_QUOTA_GLB);
+ LASSERTF(FID_SEQ_ROOT == 0x0000000200000007ULL, "found 0x%.16llxULL\n",
+ (long long)FID_SEQ_ROOT);
LASSERTF(FID_SEQ_NORMAL == 0x0000000200000400ULL, "found 0x%.16llxULL\n",
(long long)FID_SEQ_NORMAL);
LASSERTF(FID_SEQ_LOV_DEFAULT == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
(long long)(int)offsetof(struct obdo, o_valid));
LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_valid));
- LASSERTF((int)offsetof(struct obdo, o_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_oi.oi_id));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_oi.oi_id));
- LASSERTF((int)offsetof(struct obdo, o_oi.oi_seq) == 16, "found %lld\n",
- (long long)(int)offsetof(struct obdo, o_oi.oi_seq));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_oi.oi_seq));
+ LASSERTF((int)offsetof(struct obdo, o_oi) == 8, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_oi));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_oi));
LASSERTF((int)offsetof(struct obdo, o_parent_seq) == 24, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_parent_seq));
LASSERTF((int)sizeof(((struct obdo *)0)->o_parent_seq) == 8, "found %lld\n",
/* Checks for struct lov_ost_data_v1 */
LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n",
(long long)(int)sizeof(struct lov_ost_data_v1));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_id));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_id));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi.oi_seq));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi.oi_seq));
+ LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_oi));
+ LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_oi));
LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, "found %lld\n",
(long long)(int)offsetof(struct lov_ost_data_v1, l_ost_gen));
LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, "found %lld\n",
/* Checks for struct obd_ioobj */
LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
(long long)(int)sizeof(struct obd_ioobj));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid.oi_id) == 0, "found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_oid.oi_id));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_id) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_id));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid.oi_seq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_oid.oi_seq));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_seq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid.oi_seq));
+ LASSERTF((int)offsetof(struct obd_ioobj, ioo_oid) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct obd_ioobj, ioo_oid));
+ LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_oid) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_oid));
LASSERTF((int)offsetof(struct obd_ioobj, ioo_max_brw) == 16, "found %lld\n",
(long long)(int)offsetof(struct obd_ioobj, ioo_max_brw));
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_max_brw) == 4, "found %lld\n",
/* Checks for struct llog_logid */
LASSERTF((int)sizeof(struct llog_logid) == 20, "found %lld\n",
(long long)(int)sizeof(struct llog_logid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oid) == 0, "found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oid));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oseq) == 8, "found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oseq));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oseq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oseq));
+ LASSERTF((int)offsetof(struct llog_logid, lgl_oi) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct llog_logid, lgl_oi));
+ LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oi));
LASSERTF((int)offsetof(struct llog_logid, lgl_ogen) == 16, "found %lld\n",
(long long)(int)offsetof(struct llog_logid, lgl_ogen));
LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
(long long)(int)offsetof(struct llog_setattr64_rec, lsr_hdr));
LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr) == 16, "found %lld\n",
(long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr));
- LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oid) == 16, "found %lld\n",
- (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oid));
- LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid));
- LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oseq) == 24, "found %lld\n",
- (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oseq));
- LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oseq) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oseq));
+ LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oi) == 16, "found %lld\n",
+ (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oi));
+ LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi) == 16, "found %lld\n",
+ (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi));
LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_uid) == 32, "found %lld\n",
(long long)(int)offsetof(struct llog_setattr64_rec, lsr_uid));
LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid) == 4, "found %lld\n",