From 27f77f5de6fe27611c9f819f8cdaba89d70f15d9 Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 20 Dec 2013 09:33:40 -0800 Subject: [PATCH] LU-2682 fid: cleanup direct _id and _seq access Access/copying the individual _id and _seq fields should be replaced with the _oi field, and compatibility macros for accessing the individual fields should be removed. Signed-off-by: Wang Di Change-Id: Iedce5cfb308c1b6de6aa24872b8c71e7b616b67c Reviewed-on: http://review.whamcloud.com/5601 Reviewed-by: Lai Siyao Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/include/lustre/lustre_idl.h | 50 +++--- lustre/include/lustre/lustre_user.h | 26 ++- lustre/include/obd.h | 6 +- lustre/include/obd_ost.h | 2 - lustre/liblustre/file.c | 21 ++- lustre/liblustre/super.c | 3 +- lustre/liblustre/tests/sanity.c | 30 ++-- lustre/llite/file.c | 13 +- lustre/llite/llite_lib.c | 3 +- lustre/llite/namei.c | 23 ++- lustre/lod/lod_lov.c | 12 +- lustre/lod/lod_object.c | 6 +- lustre/lov/lov_ea.c | 47 +++--- lustre/lov/lov_log.c | 23 +-- lustre/lov/lov_merge.c | 63 +++---- lustre/lov/lov_obd.c | 321 ++++++++++++++++++------------------ lustre/lov/lov_pack.c | 69 ++++---- lustre/lov/lov_request.c | 107 ++++++------ lustre/mdd/mdd_object.c | 9 +- lustre/mdt/mdt_lib.c | 20 ++- lustre/obdclass/debug.c | 8 +- lustre/obdecho/echo_client.c | 69 ++++---- lustre/ofd/ofd_obd.c | 7 +- lustre/ofd/ofd_objects.c | 5 +- lustre/osc/osc_request.c | 65 ++++---- lustre/ost/ost_handler.c | 6 +- lustre/ptlrpc/pack_generic.c | 26 ++- lustre/ptlrpc/wiretest.c | 42 ++--- lustre/utils/liblustreapi.c | 55 +++--- lustre/utils/obd.c | 32 ++-- lustre/utils/wirecheck.c | 6 +- lustre/utils/wiretest.c | 43 ++--- 32 files changed, 591 insertions(+), 627 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index f830dc3..b5bd261 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -357,11 +357,6 @@ struct hsm_attrs { }; extern void lustre_hsm_swab(struct hsm_attrs *attrs); -struct ost_id { - obd_id oi_id; - obd_seq oi_seq; -}; - static inline void ostid_cpu_to_le(struct ost_id *src_oi, struct ost_id *dst_oi) { @@ -1490,23 +1485,21 @@ enum obdo_flags { #define lov_ost_data lov_ost_data_v1 struct lov_ost_data_v1 { /* per-stripe data structure (little-endian)*/ - __u64 l_object_id; /* OST object ID */ - __u64 l_object_seq; /* OST object seq number */ - __u32 l_ost_gen; /* generation of this l_ost_idx */ - __u32 l_ost_idx; /* OST index in LOV (lov_tgt_desc->tgts) */ + struct ost_id l_ost_oi; /* OST object ID */ + __u32 l_ost_gen; /* generation of this l_ost_idx */ + __u32 l_ost_idx; /* OST index in LOV (lov_tgt_desc->tgts) */ }; #define lov_mds_md lov_mds_md_v1 struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */ - __u32 lmm_magic; /* magic number = LOV_MAGIC_V1 */ - __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ - __u64 lmm_object_id; /* LOV object ID */ - __u64 lmm_object_seq; /* LOV object seq number */ - __u32 lmm_stripe_size; /* size of stripe in bytes */ - /* lmm_stripe_count used to be __u32 */ - __u16 lmm_stripe_count; /* num stripes in use for this object */ - __u16 lmm_layout_gen; /* layout generation number */ - struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ + __u32 lmm_magic; /* magic number = LOV_MAGIC_V1 */ + __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ + struct ost_id lmm_oi; /* LOV object ID */ + __u32 lmm_stripe_size; /* size of stripe in bytes */ + /* lmm_stripe_count used to be __u32 */ + __u16 lmm_stripe_count; /* num stripes in use for this object */ + __u16 lmm_layout_gen; /* layout generation number */ + struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ }; /* extern void lustre_swab_lov_mds_md(struct lov_mds_md *llm); */ @@ -1531,21 +1524,18 @@ struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */ #define XATTR_NAME_HSM "trusted.hsm" #define XATTR_NAME_LFSCK_NAMESPACE "trusted.lfsck_namespace" - struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ - __u32 lmm_magic; /* magic number = LOV_MAGIC_V3 */ - __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ - __u64 lmm_object_id; /* LOV object ID */ - __u64 lmm_object_seq; /* LOV object seq number */ - __u32 lmm_stripe_size; /* size of stripe in bytes */ - /* lmm_stripe_count used to be __u32 */ - __u16 lmm_stripe_count; /* num stripes in use for this object */ - __u16 lmm_layout_gen; /* layout generation number */ - char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */ - struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ + __u32 lmm_magic; /* magic number = LOV_MAGIC_V3 */ + __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ + struct ost_id lmm_oi; /* LOV object ID */ + __u32 lmm_stripe_size; /* size of stripe in bytes */ + /* lmm_stripe_count used to be __u32 */ + __u16 lmm_stripe_count; /* num stripes in use for this object */ + __u16 lmm_layout_gen; /* layout generation number */ + char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */ + struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ }; - #define OBD_MD_FLID (0x00000001ULL) /* object ID */ #define OBD_MD_FLATIME (0x00000002ULL) /* access time */ #define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */ diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index ef02f90..24b899d 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -110,6 +110,17 @@ struct obd_statfs { }; /** + * 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). @@ -272,18 +283,18 @@ typedef struct lu_fid lustre_fid; #define lov_user_ost_data lov_user_ost_data_v1 struct lov_user_ost_data_v1 { /* per-stripe data structure */ - __u64 l_object_id; /* OST object ID */ - __u64 l_object_seq; /* OST object seq number */ - __u32 l_ost_gen; /* generation of this OST index */ - __u32 l_ost_idx; /* OST index in LOV */ + struct ost_id l_ost_oi; /* OST object ID */ + __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) */ __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V1 */ __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ - __u64 lmm_object_id; /* LOV object ID */ - __u64 lmm_object_seq; /* LOV object seq */ + struct ost_id lmm_oi; /* LOV object ID */ __u32 lmm_stripe_size; /* size of stripe in bytes */ __u16 lmm_stripe_count; /* num stripes in use for this object */ union { @@ -298,8 +309,7 @@ struct lov_user_md_v1 { /* LOV EA user data (host-endian) */ struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V3 */ __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ - __u64 lmm_object_id; /* LOV object ID */ - __u64 lmm_object_seq; /* LOV object seq */ + struct ost_id lmm_oi; /* LOV object ID */ __u32 lmm_stripe_size; /* size of stripe in bytes */ __u16 lmm_stripe_count; /* num stripes in use for this object */ union { diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 70b0555..81ac1b8 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -110,7 +110,7 @@ struct lov_stripe_md { __u64 lsm_maxbytes; struct { /* Public members. */ - struct ost_id lw_object_oid; /* lov object id/seq */ + struct ost_id lw_object_oi; /* lov object id/seq */ /* LOV-private members start here -- only for use in lov/. */ __u32 lw_magic; @@ -124,9 +124,7 @@ struct lov_stripe_md { struct lov_oinfo *lsm_oinfo[0]; }; -#define lsm_object_oid lsm_wire.lw_object_oid -#define lsm_object_id lsm_wire.lw_object_oid.oi_id -#define lsm_object_seq lsm_wire.lw_object_oid.oi_seq +#define lsm_oi lsm_wire.lw_object_oi #define lsm_magic lsm_wire.lw_magic #define lsm_layout_gen lsm_wire.lw_layout_gen #define lsm_stripe_size lsm_wire.lw_stripe_size diff --git a/lustre/include/obd_ost.h b/lustre/include/obd_ost.h index 5a9961d..3cf60cf 100644 --- a/lustre/include/obd_ost.h +++ b/lustre/include/obd_ost.h @@ -93,6 +93,4 @@ int osc_extent_blocking_cb(struct ldlm_lock *lock, int flag); #endif -#define POSTID LPU64":"LPX64 - #endif diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index 7c60ff6..88aa135 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -282,8 +282,7 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir) if (oa == NULL) GOTO(out_free_memmd, rc = -ENOMEM); - oa->o_id = lsm->lsm_object_id; - oa->o_seq = lsm->lsm_object_seq; + oa->o_oi = lsm->lsm_oi; oa->o_mode = body->mode & S_IFMT; oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP; obdo_set_parent_fid(oa, &llu_i2info(dir)->lli_fid); @@ -300,15 +299,15 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir) } } - rc = obd_destroy(NULL, llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); - OBDO_FREE(oa); - if (rc) - CERROR("obd destroy objid 0x"LPX64" error %d\n", - lsm->lsm_object_id, rc); - out_free_memmd: - obd_free_memmd(llu_i2obdexp(dir), &lsm); - out: - return rc; + rc = obd_destroy(NULL, llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); + OBDO_FREE(oa); + if (rc) + CERROR("obd destroy objid "DOSTID" error %d\n", + POSTID(&lsm->lsm_oi), rc); +out_free_memmd: + obd_free_memmd(llu_i2obdexp(dir), &lsm); +out: + return rc; } /** Cliens updates SOM attributes on MDS: obd_getattr and md_setattr. */ diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 2db5719..6c54406 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -274,8 +274,7 @@ int llu_inode_getattr(struct inode *inode, struct obdo *obdo, oinfo.oi_md = lsm; oinfo.oi_oa = obdo; - oinfo.oi_oa->o_id = lsm->lsm_object_id; - oinfo.oi_oa->o_seq = lsm->lsm_object_seq; + oinfo.oi_oa->o_oi = lsm->lsm_oi; oinfo.oi_oa->o_mode = S_IFREG; oinfo.oi_oa->o_ioepoch = ioepoch; oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c index 78e19d5..141ebdf 100644 --- a/lustre/liblustre/tests/sanity.c +++ b/lustre/liblustre/tests/sanity.c @@ -1255,12 +1255,14 @@ int t55(char *name) close(fd); if (opt_verbose) { - printf("lmm_magic: 0x%08X\n", lum->lmm_magic); - printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id); - printf("lmm_object_seq: "LPX64"\n", lum->lmm_object_seq); - printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); - printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size); - printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern); + printf("lmm_magic: 0x%08X\n", lum->lmm_magic); + printf("lmm_object_id: "LPX64"\n", + ostid_id(&lum->lmm_oi)); + printf("lmm_object_seq: "LPX64"\n", + ostid_seq(&lum->lmm_oi)); + printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); + 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; @@ -1320,13 +1322,15 @@ int t55(char *name) } close(fd); - if (opt_verbose) { - printf("lmm_magic: 0x%08X\n", lum->lmm_magic); - printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id); - printf("lmm_object_seq: "LPX64"\n", lum->lmm_object_seq); - printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); - printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size); - printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern); + if (opt_verbose) { + printf("lmm_magic: 0x%08X\n", lum->lmm_magic); + printf("lmm_object_id: "LPX64"\n", + ostid_id(&lum->lmm_oi)); + printf("lmm_object_seq: "LPX64"\n", + ostid_seq(&lum->lmm_oi)); + printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); + 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; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 36e3cf6..f5301af 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -705,8 +705,7 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, oinfo.oi_md = lsm; oinfo.oi_oa = obdo; - oinfo.oi_oa->o_id = lsm->lsm_object_id; - oinfo.oi_oa->o_seq = lsm->lsm_object_seq; + oinfo.oi_oa->o_oi = lsm->lsm_oi; oinfo.oi_oa->o_mode = S_IFREG; oinfo.oi_oa->o_ioepoch = ioepoch; oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | @@ -756,10 +755,11 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo, capa, obdo, ioepoch, sync); capa_put(capa); if (rc == 0) { + struct ost_id *oi = lsm ? &lsm->lsm_oi : &obdo->o_oi; + obdo_refresh_inode(inode, obdo, obdo->o_valid); - CDEBUG(D_INODE, - "objid "LPX64" size %llu, blocks %llu, blksize %lu\n", - lsm ? lsm->lsm_object_id : 0, i_size_read(inode), + CDEBUG(D_INODE, "objid "DOSTID" size %llu, blocks %llu," + " blksize %lu\n", POSTID(oi), i_size_read(inode), (unsigned long long)inode->i_blocks, (unsigned long)ll_inode_blksize(inode)); } @@ -1691,8 +1691,7 @@ int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap, !(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) GOTO(out, rc = -EOPNOTSUPP); - fm_key.oa.o_id = lsm->lsm_object_id; - fm_key.oa.o_seq = lsm->lsm_object_seq; + fm_key.oa.o_oi = lsm->lsm_oi; fm_key.oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; obdo_from_inode(&fm_key.oa, inode, OBD_MD_FLSIZE); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f8d5326..a96f878 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1993,8 +1993,7 @@ int ll_iocontrol(struct inode *inode, struct file *file, RETURN(-ENOMEM); } oinfo.oi_md = lsm; - oinfo.oi_oa->o_id = lsm->lsm_object_id; - oinfo.oi_oa->o_seq = lsm->lsm_object_seq; + oinfo.oi_oa->o_oi = lsm->lsm_oi; oinfo.oi_oa->o_flags = flags; oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP; diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 00965bf..878aa6f 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1212,8 +1212,7 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) if (oa == NULL) GOTO(out_free_memmd, rc = -ENOMEM); - oa->o_id = lsm->lsm_object_id; - oa->o_seq = lsm->lsm_object_seq; + oa->o_oi = lsm->lsm_oi; oa->o_mode = body->mode & S_IFMT; oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP; @@ -1236,17 +1235,17 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) GOTO(out_free_memmd, rc); } - rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti, - ll_i2mdexp(dir), oc); - capa_put(oc); - if (rc) - CERROR("obd destroy objid "LPX64" error %d\n", - lsm->lsm_object_id, rc); - out_free_memmd: - obd_free_memmd(ll_i2dtexp(dir), &lsm); + rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti, + ll_i2mdexp(dir), oc); + capa_put(oc); + if (rc) + CERROR("obd destroy objid "DOSTID" error %d\n", + POSTID(&lsm->lsm_oi), rc); +out_free_memmd: + obd_free_memmd(ll_i2dtexp(dir), &lsm); OBDO_FREE(oa); - out: - return rc; +out: + return rc; } /* ll_unlink_generic() doesn't update the inode with the new link count. diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 65326fa..37a5809 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -519,8 +519,8 @@ int lod_generate_and_set_lovea(const struct lu_env *env, lmm->lmm_magic = cpu_to_le32(magic); lmm->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0); - lmm->lmm_object_id = cpu_to_le64(fid_ver_oid(fid)); - lmm->lmm_object_seq = cpu_to_le64(fid_seq(fid)); + fid_ostid_pack(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); lmm->lmm_layout_gen = 0; @@ -547,8 +547,7 @@ int lod_generate_and_set_lovea(const struct lu_env *env, rc = fid_ostid_pack(fid, &info->lti_ostid); LASSERT(rc == 0); - objs[i].l_object_id = cpu_to_le64(info->lti_ostid.oi_id); - objs[i].l_object_seq = cpu_to_le64(info->lti_ostid.oi_seq); + ostid_cpu_to_le(&info->lti_ostid, &objs[i].l_ost_oi); objs[i].l_ost_gen = cpu_to_le32(0); rc = lod_fld_lookup(env, lod, fid, &index, LU_SEQ_RANGE_OST); if (rc < 0) { @@ -642,8 +641,6 @@ int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt, v3->lmm_magic = cpu_to_le32(LOV_MAGIC_V3); v3->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0); - v3->lmm_object_id = 0; - v3->lmm_object_seq = 0; v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size); v3->lmm_stripe_count = cpu_to_le16(lo->ldo_def_stripenr); v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset); @@ -693,8 +690,7 @@ int lod_initialize_objects(const struct lu_env *env, struct lod_object *lo, RETURN(-ENOMEM); for (i = 0; i < lo->ldo_stripenr; i++) { - info->lti_ostid.oi_id = le64_to_cpu(objs[i].l_object_id); - info->lti_ostid.oi_seq = le64_to_cpu(objs[i].l_object_seq); + 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); LASSERTF(fid_is_sane(&info->lti_fid), ""DFID" insane!\n", diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 4bd2aa2..dbed5eb 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -380,7 +380,7 @@ static int lod_xattr_get(const struct lu_env *env, struct dt_object *dt, 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_object_seq = FID_SEQ_LOV_DEFAULT; + lum->lmm_oi.oi_seq = 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; @@ -914,8 +914,8 @@ static int lod_declare_object_create(const struct lu_env *env, v3->lmm_magic = cpu_to_le32(LOV_MAGIC_V3); v3->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0); - v3->lmm_object_id = fid_oid(lu_object_fid(&dt->do_lu)); - v3->lmm_object_seq = fid_seq(lu_object_fid(&dt->do_lu)); + fid_ostid_pack(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); v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset); diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 51a9118..9f7a423 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -68,11 +68,11 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, return -EINVAL; } - if (lmm->lmm_object_id == 0) { - CERROR("zero object id\n"); - lov_dump_lmm(D_WARNING, lmm); - return -EINVAL; - } + if (ostid_id(&lmm->lmm_oi) == 0) { + CERROR("zero object id\n"); + lov_dump_lmm(D_WARNING, lmm); + return -EINVAL; + } if (lmm->lmm_pattern != cpu_to_le32(LOV_PATTERN_RAID0)) { CERROR("bad striping pattern\n"); @@ -136,16 +136,15 @@ void lsm_free_plain(struct lov_stripe_md *lsm) static void lsm_unpackmd_common(struct lov_stripe_md *lsm, struct lov_mds_md *lmm) { - /* - * This supposes lov_mds_md_v1/v3 first fields are - * are the same - */ - lsm->lsm_object_id = le64_to_cpu(lmm->lmm_object_id); - lsm->lsm_object_seq = le64_to_cpu(lmm->lmm_object_seq); - lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); - lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern); - lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); - lsm->lsm_pool_name[0] = '\0'; + /* + * This supposes lov_mds_md_v1/v3 first fields are + * are the same + */ + ostid_le_to_cpu(&lmm->lmm_oi, &lsm->lsm_oi); + lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); + lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern); + lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); + lsm->lsm_pool_name[0] = '\0'; } static void @@ -223,14 +222,13 @@ int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, lsm_unpackmd_common(lsm, lmm); - for (i = 0; i < lsm->lsm_stripe_count; i++) { - /* XXX LOV STACKING call down to osc_unpackmd() */ - loi = lsm->lsm_oinfo[i]; - loi->loi_id = le64_to_cpu(lmm->lmm_objects[i].l_object_id); - loi->loi_seq = le64_to_cpu(lmm->lmm_objects[i].l_object_seq); - loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); - loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); - if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { + for (i = 0; i < lsm->lsm_stripe_count; i++) { + /* XXX LOV STACKING call down to osc_unpackmd() */ + loi = lsm->lsm_oinfo[i]; + ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); + loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); + loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); lov_dump_lmm_v1(D_WARNING, lmm); @@ -306,8 +304,7 @@ int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, for (i = 0; i < lsm->lsm_stripe_count; i++) { /* XXX LOV STACKING call down to osc_unpackmd() */ loi = lsm->lsm_oinfo[i]; - loi->loi_id = le64_to_cpu(lmm->lmm_objects[i].l_object_id); - loi->loi_seq = le64_to_cpu(lmm->lmm_objects[i].l_object_seq); + ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { diff --git a/lustre/lov/lov_log.c b/lustre/lov/lov_log.c index ad9bc3e..666ab4a 100644 --- a/lustre/lov/lov_log.c +++ b/lustre/lov/lov_log.c @@ -188,17 +188,18 @@ static int lov_llog_repl_cancel(const struct lu_env *env, int err; err = llog_cancel(env, cctxt, NULL, 1, cookies, flags); - llog_ctxt_put(cctxt); - if (err && lov->lov_tgts[loi->loi_ost_idx]->ltd_active) { - CERROR("error: objid "LPX64" subobj "LPX64 - " on OST idx %d: rc = %d\n", lsm->lsm_object_id, - loi->loi_id, loi->loi_ost_idx, err); - if (!rc) - rc = err; - } - } - obd_putref(obd); - RETURN(rc); + llog_ctxt_put(cctxt); + if (err && lov->lov_tgts[loi->loi_ost_idx]->ltd_active) { + CERROR("%s: objid "DOSTID" subobj "DOSTID + " on OST idx %d: rc = %d\n", + obd->obd_name, POSTID(&lsm->lsm_oi), + POSTID(&loi->loi_oi), loi->loi_ost_idx, err); + if (!rc) + rc = err; + } + } + obd_putref(obd); + RETURN(rc); } static struct llog_operations lov_mds_ost_orig_logops = { diff --git a/lustre/lov/lov_merge.c b/lustre/lov/lov_merge.c index 4b9b1a5..42617c0 100644 --- a/lustre/lov/lov_merge.c +++ b/lustre/lov/lov_merge.c @@ -55,26 +55,26 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, struct ost_lvb *lvb, __u64 *kms_place) { - __u64 size = 0; - __u64 kms = 0; - __u64 blocks = 0; - obd_time current_mtime = lvb->lvb_mtime; - obd_time current_atime = lvb->lvb_atime; - obd_time current_ctime = lvb->lvb_ctime; - int i; - int rc = 0; - - LASSERT_SPIN_LOCKED(&lsm->lsm_lock); + __u64 size = 0; + __u64 kms = 0; + __u64 blocks = 0; + obd_time current_mtime = lvb->lvb_mtime; + obd_time current_atime = lvb->lvb_atime; + obd_time current_ctime = lvb->lvb_ctime; + int i; + int rc = 0; + struct lu_fid fid; + + LASSERT_SPIN_LOCKED(&lsm->lsm_lock); #ifdef __KERNEL__ - LASSERT(lsm->lsm_lock_owner == cfs_curproc_pid()); + LASSERT(lsm->lsm_lock_owner == cfs_curproc_pid()); #endif + ostid_fid_unpack(&lsm->lsm_oi, &fid); CDEBUG(D_INODE, "MDT FID "DFID" initial value: s="LPU64" m="LPU64 - " a="LPU64" c="LPU64" b="LPU64"\n", - lsm->lsm_object_seq, (__u32)lsm->lsm_object_id, - (__u32)(lsm->lsm_object_id >> 32), lvb->lvb_size, + " a="LPU64" c="LPU64" b="LPU64"\n", PFID(&fid), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); - for (i = 0; i < lsm->lsm_stripe_count; i++) { + for (i = 0; i < lsm->lsm_stripe_count; i++) { struct lov_oinfo *loi = lsm->lsm_oinfo[i]; obd_size lov_size, tmpsize; @@ -102,13 +102,12 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, current_atime = loi->loi_lvb.lvb_atime; if (loi->loi_lvb.lvb_ctime > current_ctime) current_ctime = loi->loi_lvb.lvb_ctime; + CDEBUG(D_INODE, "MDT FID "DFID" on OST[%u]: s="LPU64" m="LPU64 - " a="LPU64" c="LPU64" b="LPU64"\n", - lsm->lsm_object_seq, (__u32)lsm->lsm_object_id, - (__u32)(lsm->lsm_object_id >> 32), loi->loi_ost_idx, - loi->loi_lvb.lvb_size, loi->loi_lvb.lvb_mtime, - loi->loi_lvb.lvb_atime, loi->loi_lvb.lvb_ctime, - loi->loi_lvb.lvb_blocks); + " a="LPU64" c="LPU64" b="LPU64"\n", PFID(&fid), + loi->loi_ost_idx, loi->loi_lvb.lvb_size, + loi->loi_lvb.lvb_mtime, loi->loi_lvb.lvb_atime, + loi->loi_lvb.lvb_ctime, loi->loi_lvb.lvb_blocks); } *kms_place = kms; @@ -132,6 +131,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm, struct ost_lvb *lvb, int kms_only) { + struct lu_fid fid; int rc; __u64 kms; @@ -141,11 +141,11 @@ int lov_merge_lvb(struct obd_export *exp, lov_stripe_unlock(lsm); if (kms_only) lvb->lvb_size = kms; + + ostid_fid_unpack(&lsm->lsm_oi, &fid); CDEBUG(D_INODE, "merged for FID "DFID" s="LPU64" m="LPU64" a="LPU64 - " c="LPU64" b="LPU64"\n", - lsm->lsm_object_seq, (__u32)lsm->lsm_object_id, - (__u32)(lsm->lsm_object_id >> 32), lvb->lvb_size, lvb->lvb_mtime, - lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); + " c="LPU64" b="LPU64"\n", PFID(&fid), lvb->lvb_size, + lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); RETURN(rc); } @@ -213,12 +213,13 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid, tgt->o_mtime = src->o_mtime; if (valid & OBD_MD_FLDATAVERSION) tgt->o_data_version += src->o_data_version; - } else { - memcpy(tgt, src, sizeof(*tgt)); - tgt->o_id = lsm->lsm_object_id; - if (valid & OBD_MD_FLSIZE) - tgt->o_size = lov_stripe_size(lsm,src->o_size,stripeno); - } + } else { + memcpy(tgt, src, sizeof(*tgt)); + tgt->o_oi = lsm->lsm_oi; + if (valid & OBD_MD_FLSIZE) + tgt->o_size = lov_stripe_size(lsm, src->o_size, + stripeno); + } /* data_version needs to be valid on all stripes to be correct! */ if (!(valid & OBD_MD_FLDATAVERSION)) diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 39c6844..29df465 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1126,17 +1126,18 @@ static int lov_destroy(const struct lu_env *env, struct obd_export *exp, if (oa->o_valid & OBD_MD_FLCOOKIE) oti->oti_logcookies = set->set_cookies + req->rq_stripe; - err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp, - req->rq_oi.oi_oa, NULL, oti, NULL, capa); - err = lov_update_common_set(set, req, err); - if (err) { - CERROR("error: destroying objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - oa->o_id, req->rq_oi.oi_oa->o_id, - req->rq_idx, err); - if (!rc) - rc = err; - } + err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp, + req->rq_oi.oi_oa, NULL, oti, NULL, capa); + err = lov_update_common_set(set, req, err); + if (err) { + CERROR("%s: destroying objid "DOSTID" subobj " + DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, POSTID(&oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), + req->rq_idx, err); + if (!rc) + rc = err; + } } if (rc == 0) { @@ -1174,20 +1175,22 @@ static int lov_getattr(const struct lu_env *env, struct obd_export *exp, cfs_list_for_each (pos, &set->set_list) { req = cfs_list_entry(pos, struct lov_request, rq_link); - CDEBUG(D_INFO, "objid "LPX64"[%d] has subobj "LPX64" at idx " - "%u\n", oinfo->oi_oa->o_id, req->rq_stripe, - req->rq_oi.oi_oa->o_id, req->rq_idx); + CDEBUG(D_INFO, "objid "DOSTID"[%d] has subobj "DOSTID" at idx" + " %u\n", POSTID(&oinfo->oi_oa->o_oi), req->rq_stripe, + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx); rc = obd_getattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp, &req->rq_oi); - err = lov_update_common_set(set, req, rc); - if (err) { - CERROR("error: getattr objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - oinfo->oi_oa->o_id, req->rq_oi.oi_oa->o_id, - req->rq_idx, err); - break; - } + err = lov_update_common_set(set, req, rc); + if (err) { + CERROR("%s: getattr objid "DOSTID" subobj " + DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, + POSTID(&oinfo->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), + req->rq_idx, err); + break; + } } rc = lov_fini_getattr_set(set); @@ -1232,26 +1235,28 @@ static int lov_getattr_async(struct obd_export *exp, struct obd_info *oinfo, if (rc) RETURN(rc); - CDEBUG(D_INFO, "objid "LPX64": %ux%u byte stripes\n", - oinfo->oi_md->lsm_object_id, oinfo->oi_md->lsm_stripe_count, - oinfo->oi_md->lsm_stripe_size); - - cfs_list_for_each (pos, &lovset->set_list) { - req = cfs_list_entry(pos, struct lov_request, rq_link); - - CDEBUG(D_INFO, "objid "LPX64"[%d] has subobj "LPX64" at idx " - "%u\n", oinfo->oi_oa->o_id, req->rq_stripe, - req->rq_oi.oi_oa->o_id, req->rq_idx); - rc = obd_getattr_async(lov->lov_tgts[req->rq_idx]->ltd_exp, - &req->rq_oi, rqset); - if (rc) { - CERROR("error: getattr objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - oinfo->oi_oa->o_id, req->rq_oi.oi_oa->o_id, - req->rq_idx, rc); - GOTO(out, rc); - } - } + CDEBUG(D_INFO, "objid "DOSTID": %ux%u byte stripes\n", + POSTID(&oinfo->oi_md->lsm_oi), oinfo->oi_md->lsm_stripe_count, + oinfo->oi_md->lsm_stripe_size); + + cfs_list_for_each(pos, &lovset->set_list) { + req = cfs_list_entry(pos, struct lov_request, rq_link); + + CDEBUG(D_INFO, "objid "DOSTID"[%d] has subobj "DOSTID" at idx" + "%u\n", POSTID(&oinfo->oi_oa->o_oi), req->rq_stripe, + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx); + rc = obd_getattr_async(lov->lov_tgts[req->rq_idx]->ltd_exp, + &req->rq_oi, rqset); + if (rc) { + CERROR("%s: getattr objid "DOSTID" subobj" + DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, + POSTID(&oinfo->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), + req->rq_idx, rc); + GOTO(out, rc); + } + } if (!cfs_list_empty(&rqset->set_requests)) { LASSERT(rc == 0); @@ -1299,17 +1304,19 @@ static int lov_setattr(const struct lu_env *env, struct obd_export *exp, cfs_list_for_each (pos, &set->set_list) { req = cfs_list_entry(pos, struct lov_request, rq_link); - rc = obd_setattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp, - &req->rq_oi, NULL); - err = lov_update_setattr_set(set, req, rc); - if (err) { - CERROR("error: setattr objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - set->set_oi->oi_oa->o_id, - req->rq_oi.oi_oa->o_id, req->rq_idx, err); - if (!rc) - rc = err; - } + rc = obd_setattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp, + &req->rq_oi, NULL); + err = lov_update_setattr_set(set, req, rc); + if (err) { + CERROR("%s: setattr objid "DOSTID" subobj " + DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, + POSTID(&set->set_oi->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx, + err); + if (!rc) + rc = err; + } } err = lov_fini_setattr_set(set); if (!rc) @@ -1358,31 +1365,32 @@ static int lov_setattr_async(struct obd_export *exp, struct obd_info *oinfo, if (rc) RETURN(rc); - CDEBUG(D_INFO, "objid "LPX64": %ux%u byte stripes\n", - oinfo->oi_md->lsm_object_id, oinfo->oi_md->lsm_stripe_count, - oinfo->oi_md->lsm_stripe_size); - - cfs_list_for_each (pos, &set->set_list) { - req = cfs_list_entry(pos, struct lov_request, rq_link); - - if (oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE) - oti->oti_logcookies = set->set_cookies + req->rq_stripe; - - CDEBUG(D_INFO, "objid "LPX64"[%d] has subobj "LPX64" at idx " - "%u\n", oinfo->oi_oa->o_id, req->rq_stripe, - req->rq_oi.oi_oa->o_id, req->rq_idx); - - rc = obd_setattr_async(lov->lov_tgts[req->rq_idx]->ltd_exp, - &req->rq_oi, oti, rqset); - if (rc) { - CERROR("error: setattr objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - set->set_oi->oi_oa->o_id, - req->rq_oi.oi_oa->o_id, - req->rq_idx, rc); - break; - } - } + CDEBUG(D_INFO, "objid "DOSTID": %ux%u byte stripes\n", + POSTID(&oinfo->oi_md->lsm_oi), + oinfo->oi_md->lsm_stripe_count, + oinfo->oi_md->lsm_stripe_size); + + cfs_list_for_each(pos, &set->set_list) { + req = cfs_list_entry(pos, struct lov_request, rq_link); + + if (oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE) + oti->oti_logcookies = set->set_cookies + req->rq_stripe; + + CDEBUG(D_INFO, "objid "DOSTID"[%d] has subobj "DOSTID" at idx" + "%u\n", POSTID(&oinfo->oi_oa->o_oi), req->rq_stripe, + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx); + + rc = obd_setattr_async(lov->lov_tgts[req->rq_idx]->ltd_exp, + &req->rq_oi, oti, rqset); + if (rc) { + CERROR("error: setattr objid "DOSTID" subobj" + DOSTID" on OST idx %d: rc = %d\n", + POSTID(&set->set_oi->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), + req->rq_idx, rc); + break; + } + } /* If we are not waiting for responses on async requests, return. */ if (rc || !rqset || cfs_list_empty(&rqset->set_requests)) { @@ -1441,15 +1449,16 @@ static int lov_punch(const struct lu_env *env, struct obd_export *exp, cfs_list_for_each (pos, &set->set_list) { req = cfs_list_entry(pos, struct lov_request, rq_link); - rc = obd_punch(env, lov->lov_tgts[req->rq_idx]->ltd_exp, - &req->rq_oi, NULL, rqset); - if (rc) { - CERROR("error: punch objid "LPX64" subobj "LPX64 - " on OST idx %d: rc = %d\n", - set->set_oi->oi_oa->o_id, - req->rq_oi.oi_oa->o_id, req->rq_idx, rc); - break; - } + rc = obd_punch(env, lov->lov_tgts[req->rq_idx]->ltd_exp, + &req->rq_oi, NULL, rqset); + if (rc) { + CERROR("%s: punch objid "DOSTID" subobj "DOSTID + " on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, + POSTID(&set->set_oi->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx, rc); + break; + } } if (rc || cfs_list_empty(&rqset->set_requests)) { @@ -1500,8 +1509,8 @@ static int lov_sync(const struct lu_env *env, struct obd_export *exp, if (rc) RETURN(rc); - CDEBUG(D_INFO, "fsync objid "LPX64" ["LPX64", "LPX64"]\n", - set->set_oi->oi_oa->o_id, start, end); + CDEBUG(D_INFO, "fsync objid "DOSTID" ["LPX64", "LPX64"]\n", + POSTID(&set->set_oi->oi_oa->o_oi), start, end); cfs_list_for_each (pos, &set->set_list) { req = cfs_list_entry(pos, struct lov_request, rq_link); @@ -1509,13 +1518,15 @@ static int lov_sync(const struct lu_env *env, struct obd_export *exp, rc = obd_sync(env, lov->lov_tgts[req->rq_idx]->ltd_exp, &req->rq_oi, req->rq_oi.oi_policy.l_extent.start, req->rq_oi.oi_policy.l_extent.end, rqset); - if (rc) { - CERROR("error: fsync objid "LPX64" subobj "LPX64 - " on OST idx %d: rc = %d\n", - set->set_oi->oi_oa->o_id, - req->rq_oi.oi_oa->o_id, req->rq_idx, rc); - break; - } + if (rc) { + CERROR("%s: fsync objid "DOSTID" subobj "DOSTID + " on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, + POSTID(&set->set_oi->oi_oa->o_oi), + POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx, + rc); + break; + } } /* If we are not waiting for responses on async requests, return. */ @@ -1687,13 +1698,12 @@ static int lov_change_cbdata(struct obd_export *exp, continue; } - submd.lsm_object_id = loi->loi_id; - submd.lsm_object_seq = loi->loi_seq; - submd.lsm_stripe_count = 0; - rc = obd_change_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, - &submd, it, data); - } - RETURN(rc); + submd.lsm_oi = loi->loi_oi; + submd.lsm_stripe_count = 0; + rc = obd_change_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, + &submd, it, data); + } + RETURN(rc); } /* find any ldlm lock of the inode in lov @@ -1722,16 +1732,14 @@ static int lov_find_cbdata(struct obd_export *exp, CDEBUG(D_HA, "lov idx %d NULL \n", loi->loi_ost_idx); continue; } - - submd.lsm_object_id = loi->loi_id; - submd.lsm_object_seq = loi->loi_seq; - submd.lsm_stripe_count = 0; - rc = obd_find_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, - &submd, it, data); - if (rc != 0) - RETURN(rc); - } - RETURN(rc); + submd.lsm_oi = loi->loi_oi; + submd.lsm_stripe_count = 0; + rc = obd_find_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, + &submd, it, data); + if (rc != 0) + RETURN(rc); + } + RETURN(rc); } static int lov_cancel(struct obd_export *exp, struct lov_stripe_md *lsm, @@ -1757,25 +1765,25 @@ static int lov_cancel(struct obd_export *exp, struct lov_stripe_md *lsm, if (rc) RETURN(rc); - cfs_list_for_each (pos, &set->set_list) { - req = cfs_list_entry(pos, struct lov_request, rq_link); - lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe; - - rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp, - req->rq_oi.oi_md, mode, lov_lockhp); - rc = lov_update_common_set(set, req, rc); - if (rc) { - CERROR("error: cancel objid "LPX64" subobj " - LPX64" on OST idx %d: rc = %d\n", - lsm->lsm_object_id, - req->rq_oi.oi_md->lsm_object_id, - req->rq_idx, rc); - err = rc; - } + cfs_list_for_each(pos, &set->set_list) { + req = cfs_list_entry(pos, struct lov_request, rq_link); + lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe; + + rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp, + req->rq_oi.oi_md, mode, lov_lockhp); + rc = lov_update_common_set(set, req, rc); + if (rc) { + CERROR("%s: cancel objid "DOSTID" subobj " + DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, POSTID(&lsm->lsm_oi), + POSTID(&req->rq_oi.oi_md->lsm_oi), + req->rq_idx, rc); + err = rc; + } - } - lov_fini_cancel_set(set); - RETURN(err); + } + lov_fini_cancel_set(set); + RETURN(err); } static int lov_cancel_unused(struct obd_export *exp, @@ -1806,33 +1814,34 @@ static int lov_cancel_unused(struct obd_export *exp, ASSERT_LSM_MAGIC(lsm); - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_stripe_md submd; - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; - int err; + for (i = 0; i < lsm->lsm_stripe_count; i++) { + struct lov_stripe_md submd; + struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + int idx = loi->loi_ost_idx; + int err; - if (!lov->lov_tgts[loi->loi_ost_idx]) { - CDEBUG(D_HA, "lov idx %d NULL\n", loi->loi_ost_idx); - continue; - } + if (!lov->lov_tgts[idx]) { + CDEBUG(D_HA, "lov idx %d NULL\n", idx); + continue; + } - if (!lov->lov_tgts[loi->loi_ost_idx]->ltd_active) - CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); - - submd.lsm_object_id = loi->loi_id; - submd.lsm_object_seq = loi->loi_seq; - submd.lsm_stripe_count = 0; - err = obd_cancel_unused(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp, - &submd, flags, opaque); - if (err && lov->lov_tgts[loi->loi_ost_idx]->ltd_active) { - CERROR("error: cancel unused objid "LPX64" subobj "LPX64 - " on OST idx %d: rc = %d\n", lsm->lsm_object_id, - loi->loi_id, loi->loi_ost_idx, err); - if (!rc) - rc = err; - } - } - RETURN(rc); + if (!lov->lov_tgts[idx]->ltd_active) + CDEBUG(D_HA, "lov idx %d inactive\n", idx); + + submd.lsm_oi = loi->loi_oi; + submd.lsm_stripe_count = 0; + err = obd_cancel_unused(lov->lov_tgts[idx]->ltd_exp, + &submd, flags, opaque); + if (err && lov->lov_tgts[idx]->ltd_active) { + CERROR("%s: cancel unused objid "DOSTID + " subobj "DOSTID" on OST idx %d: rc = %d\n", + exp->exp_obd->obd_name, POSTID(&lsm->lsm_oi), + POSTID(&loi->loi_oi), idx, err); + if (!rc) + rc = err; + } + } + RETURN(rc); } int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 420acb4..93bf376 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -56,34 +56,36 @@ static void lov_dump_lmm_common(int level, void *lmmp) { - struct lov_mds_md *lmm = lmmp; - - CDEBUG(level, "objid "LPX64", magic 0x%08x, pattern %#x\n", - (__u64)le64_to_cpu(lmm->lmm_object_id), - le32_to_cpu(lmm->lmm_magic), - le32_to_cpu(lmm->lmm_pattern)); - CDEBUG(level,"stripe_size %u, stripe_count %u, layout_gen %u\n", - le32_to_cpu(lmm->lmm_stripe_size), - le16_to_cpu(lmm->lmm_stripe_count), - le16_to_cpu(lmm->lmm_layout_gen)); + struct lov_mds_md *lmm = lmmp; + struct ost_id oi; + + ostid_le_to_cpu(&lmm->lmm_oi, &oi); + CDEBUG(level, "objid "DOSTID", magic 0x%08x, pattern %#x\n", + POSTID(&oi), le32_to_cpu(lmm->lmm_magic), + le32_to_cpu(lmm->lmm_pattern)); + CDEBUG(level, "stripe_size %u, stripe_count %u, layout_gen %u\n", + le32_to_cpu(lmm->lmm_stripe_size), + le16_to_cpu(lmm->lmm_stripe_count), + le16_to_cpu(lmm->lmm_layout_gen)); } static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod, int stripe_count) { - int i; + int i; - if (stripe_count > LOV_V1_INSANE_STRIPE_COUNT) { - CDEBUG(level, "bad stripe_count %u > max_stripe_count %u\n", - stripe_count, LOV_V1_INSANE_STRIPE_COUNT); - } + if (stripe_count > LOV_V1_INSANE_STRIPE_COUNT) { + CDEBUG(level, "bad stripe_count %u > max_stripe_count %u\n", + stripe_count, LOV_V1_INSANE_STRIPE_COUNT); + } - for (i = 0; i < stripe_count; ++i, ++lod) { - CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n", i, - le32_to_cpu(lod->l_ost_idx), - (__u64)le64_to_cpu(lod->l_object_seq), - (__u64)le64_to_cpu(lod->l_object_id)); - } + for (i = 0; i < stripe_count; ++i, ++lod) { + struct ost_id oi; + + ostid_le_to_cpu(&lod->l_ost_oi, &oi); + CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", i, + le32_to_cpu(lod->l_ost_idx), POSTID(&oi)); + } } void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) @@ -220,8 +222,7 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, /* lmmv1 and lmmv3 point to the same struct and have the * same first fields */ - lmmv1->lmm_object_id = cpu_to_le64(lsm->lsm_object_id); - lmmv1->lmm_object_seq = cpu_to_le64(lsm->lsm_object_seq); + ostid_cpu_to_le(&lsm->lsm_oi, &lmmv1->lmm_oi); lmmv1->lmm_stripe_size = cpu_to_le32(lsm->lsm_stripe_size); lmmv1->lmm_stripe_count = cpu_to_le16(stripe_count); lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_pattern); @@ -236,18 +237,18 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, lmm_objects = lmmv1->lmm_objects; } - 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, "lmm_oid "LPU64" stripe %u/%u idx %u\n", - lmmv1->lmm_object_id, i, stripe_count, loi->loi_ost_idx); - lmm_objects[i].l_object_id = cpu_to_le64(loi->loi_id); - lmm_objects[i].l_object_seq = cpu_to_le64(loi->loi_seq); - 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); - } + 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); + 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); + } - RETURN(lmm_size); + RETURN(lmm_size); } /* Find the max stripecount we should use */ diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index d2dc26a..b85a2b1a 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -151,25 +151,27 @@ extern void osc_update_enqueue(struct lustre_handle *lov_lockhp, struct ost_lvb *lvb, __u32 mode, int rc); static int lov_update_enqueue_lov(struct obd_export *exp, - struct lustre_handle *lov_lockhp, - struct lov_oinfo *loi, int flags, int idx, - __u64 oid, int rc) + struct lustre_handle *lov_lockhp, + struct lov_oinfo *loi, int flags, int idx, + struct ost_id *oi, int rc) { - struct lov_obd *lov = &exp->exp_obd->u.lov; - - if (rc != ELDLM_OK && - !(rc == ELDLM_LOCK_ABORTED && (flags & LDLM_FL_HAS_INTENT))) { - memset(lov_lockhp, 0, sizeof(*lov_lockhp)); - if (lov->lov_tgts[idx] && lov->lov_tgts[idx]->ltd_active) { - /* -EUSERS used by OST to report file contention */ - if (rc != -EINTR && rc != -EUSERS) - CERROR("enqueue objid "LPX64" subobj " - LPX64" on OST idx %d: rc %d\n", - oid, loi->loi_id, loi->loi_ost_idx, rc); - } else - rc = ELDLM_OK; - } - return rc; + struct lov_obd *lov = &exp->exp_obd->u.lov; + + if (rc != ELDLM_OK && + !(rc == ELDLM_LOCK_ABORTED && (flags & LDLM_FL_HAS_INTENT))) { + memset(lov_lockhp, 0, sizeof(*lov_lockhp)); + if (lov->lov_tgts[idx] && lov->lov_tgts[idx]->ltd_active) { + /* -EUSERS used by OST to report file contention */ + if (rc != -EINTR && rc != -EUSERS) + CERROR("%s: enqueue objid "DOSTID" subobj" + DOSTID" on OST idx %d: rc %d\n", + exp->exp_obd->obd_name, + POSTID(oi), POSTID(&loi->loi_oi), + loi->loi_ost_idx, rc); + } else + rc = ELDLM_OK; + } + return rc; } int lov_update_enqueue_set(struct lov_request *req, __u32 mode, int rc) @@ -196,11 +198,11 @@ int lov_update_enqueue_set(struct lov_request *req, __u32 mode, int rc) &req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb, mode, rc); if (rc == ELDLM_LOCK_ABORTED && (oi->oi_flags & LDLM_FL_HAS_INTENT)) memset(lov_lockhp, 0, sizeof *lov_lockhp); - rc = lov_update_enqueue_lov(set->set_exp, lov_lockhp, loi, oi->oi_flags, - req->rq_idx, oi->oi_md->lsm_object_id, rc); - lov_stripe_unlock(oi->oi_md); - lov_update_set(set, req, rc); - RETURN(rc); + rc = lov_update_enqueue_lov(set->set_exp, lov_lockhp, loi, oi->oi_flags, + req->rq_idx, &oi->oi_md->lsm_oi, rc); + lov_stripe_unlock(oi->oi_md); + lov_update_set(set, req, rc); + RETURN(rc); } /* The callback for osc_enqueue that updates lov info for every OSC request. */ @@ -239,15 +241,16 @@ static int enqueue_done(struct lov_request_set *set, __u32 mode) if (!lustre_handle_is_used(lov_lockhp)) continue; - rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp, - req->rq_oi.oi_md, mode, lov_lockhp); - if (rc && lov->lov_tgts[req->rq_idx] && - lov->lov_tgts[req->rq_idx]->ltd_active) - CERROR("cancelling obdjid "LPX64" on OST " - "idx %d error: rc = %d\n", - req->rq_oi.oi_md->lsm_object_id, - req->rq_idx, rc); - } + rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp, + req->rq_oi.oi_md, mode, lov_lockhp); + if (rc && lov->lov_tgts[req->rq_idx] && + lov->lov_tgts[req->rq_idx]->ltd_active) + CERROR("%s: cancelling obdjid "DOSTID" on OST" + "idx %d error: rc = %d\n", + set->set_exp->exp_obd->obd_name, + POSTID(&req->rq_oi.oi_md->lsm_oi), + req->rq_idx, rc); + } if (set->set_lockh) lov_llh_put(set->set_lockh); RETURN(rc); @@ -378,14 +381,13 @@ int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_idx = loi->loi_ost_idx; req->rq_stripe = i; - /* XXX LOV STACKING: submd should be from the subobj */ - req->rq_oi.oi_md->lsm_object_id = loi->loi_id; - req->rq_oi.oi_md->lsm_object_seq = loi->loi_seq; - req->rq_oi.oi_md->lsm_stripe_count = 0; - req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms_valid = - loi->loi_kms_valid; - req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms = loi->loi_kms; - req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb = loi->loi_lvb; + /* XXX LOV STACKING: submd should be from the subobj */ + req->rq_oi.oi_md->lsm_oi = loi->loi_oi; + req->rq_oi.oi_md->lsm_stripe_count = 0; + req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms_valid = + loi->loi_kms_valid; + req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms = loi->loi_kms; + req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb = loi->loi_lvb; lov_set_add_req(req, set); } @@ -474,10 +476,9 @@ int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_idx = loi->loi_ost_idx; req->rq_stripe = i; - /* XXX LOV STACKING: submd should be from the subobj */ - req->rq_oi.oi_md->lsm_object_id = loi->loi_id; - req->rq_oi.oi_md->lsm_object_seq = loi->loi_seq; - req->rq_oi.oi_md->lsm_stripe_count = 0; + /* XXX LOV STACKING: submd should be from the subobj */ + req->rq_oi.oi_md->lsm_oi = loi->loi_oi; + req->rq_oi.oi_md->lsm_stripe_count = 0; lov_set_add_req(req, set); } @@ -557,10 +558,9 @@ int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_idx = loi->loi_ost_idx; req->rq_stripe = i; - /* XXX LOV STACKING: submd should be from the subobj */ - req->rq_oi.oi_md->lsm_object_id = loi->loi_id; - req->rq_oi.oi_md->lsm_object_seq = loi->loi_seq; - req->rq_oi.oi_md->lsm_stripe_count = 0; + /* XXX LOV STACKING: submd should be from the subobj */ + req->rq_oi.oi_md->lsm_oi = loi->loi_oi; + req->rq_oi.oi_md->lsm_stripe_count = 0; lov_set_add_req(req, set); } @@ -747,12 +747,11 @@ int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_idx = loi->loi_ost_idx; req->rq_stripe = i; - /* XXX LOV STACKING */ - req->rq_oi.oi_md->lsm_object_id = loi->loi_id; - req->rq_oi.oi_md->lsm_object_seq = loi->loi_seq; - req->rq_oabufs = info[i].count; - req->rq_pgaidx = shift; - shift += req->rq_oabufs; + /* XXX LOV STACKING */ + req->rq_oi.oi_md->lsm_oi = loi->loi_oi; + req->rq_oabufs = info[i].count; + req->rq_pgaidx = shift; + shift += req->rq_oabufs; /* remember the index for sort brw_page array */ info[i].index = req->rq_pgaidx; diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 8ab38ac..311254d 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1361,14 +1361,12 @@ static int mdd_swap_layouts(const struct lu_env *env, struct md_object *obj1, /* set the file specific informations in lmm */ if (fst_lmm) { fst_lmm->lmm_layout_gen = cpu_to_le16(snd_gen); - fst_lmm->lmm_object_seq = snd_lmm->lmm_object_seq; - fst_lmm->lmm_object_id = snd_lmm->lmm_object_id; + fst_lmm->lmm_oi = snd_lmm->lmm_oi; } if (snd_lmm) { snd_lmm->lmm_layout_gen = cpu_to_le16(fst_gen); - snd_lmm->lmm_object_seq = old_fst_lmm->lmm_object_seq; - snd_lmm->lmm_object_id = old_fst_lmm->lmm_object_id; + snd_lmm->lmm_oi = old_fst_lmm->lmm_oi; } /* prepare transaction */ @@ -1403,8 +1401,7 @@ static int mdd_swap_layouts(const struct lu_env *env, struct md_object *obj1, /* restore object_id, object_seq and generation number * on first file */ if (fst_lmm) { - fst_lmm->lmm_object_id = old_fst_lmm->lmm_object_id; - fst_lmm->lmm_object_seq = old_fst_lmm->lmm_object_seq; + fst_lmm->lmm_oi = old_fst_lmm->lmm_oi; fst_lmm->lmm_layout_gen = old_fst_lmm->lmm_layout_gen; } diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index 42b894a..cfd2759 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -537,19 +537,21 @@ void mdt_dump_lmm(int level, const struct lov_mds_md *lmm) count = le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count); - CDEBUG(level, "objid "LPX64", magic 0x%08X, pattern %#X\n", - le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic), - le32_to_cpu(lmm->lmm_pattern)); + CDEBUG(level, "objid "DOSTID", magic 0x%08X, pattern %#X\n", + POSTID(&lmm->lmm_oi), le32_to_cpu(lmm->lmm_magic), + le32_to_cpu(lmm->lmm_pattern)); CDEBUG(level,"stripe_size=0x%x, stripe_count=0x%x\n", le32_to_cpu(lmm->lmm_stripe_size), count); if (count == LOV_ALL_STRIPES) return; - LASSERT(count <= LOV_MAX_STRIPE_COUNT); - for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++) - CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n", - i, le32_to_cpu(lod->l_ost_idx), - le64_to_cpu(lod->l_object_seq), - le64_to_cpu(lod->l_object_id)); + + LASSERT(count <= LOV_MAX_STRIPE_COUNT); + for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++) { + struct ost_id oi; + ostid_le_to_cpu((struct ost_id *)&lod->l_ost_oi, &oi); + CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", + i, le32_to_cpu(lod->l_ost_idx), POSTID(&oi)); + } } /* Shrink and/or grow reply buffers */ diff --git a/lustre/obdclass/debug.c b/lustre/obdclass/debug.c index 22d510a..c1e4ac1 100644 --- a/lustre/obdclass/debug.c +++ b/lustre/obdclass/debug.c @@ -61,10 +61,10 @@ EXPORT_SYMBOL(dump_lniobuf); void dump_lsm(int level, struct lov_stripe_md *lsm) { - CDEBUG(level, "lsm %p, objid "LPX64", maxbytes "LPX64", magic 0x%08X, " - "stripe_size %u, stripe_count %u, refc: %d, " - "layout_gen %u, pool ["LOV_POOLNAMEF"]\n", lsm, - lsm->lsm_object_id, lsm->lsm_maxbytes, lsm->lsm_magic, + CDEBUG(level, "lsm %p, objid "DOSTID", maxbytes "LPX64", magic 0x%08X," + " stripe_size %u, stripe_count %u, refc: %d," + " layout_gen %u, pool ["LOV_POOLNAMEF"]\n", lsm, + POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, lsm->lsm_stripe_size, lsm->lsm_stripe_count, cfs_atomic_read(&lsm->lsm_refc), lsm->lsm_layout_gen, lsm->lsm_pool_name); diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 5137315..e4b9118 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -174,14 +174,6 @@ struct echo_object_conf *cl2echo_conf(const struct cl_object_conf *c) return container_of(c, struct echo_object_conf, eoc_cl); } -static inline void lsm2fid(struct lov_stripe_md *lsm, struct lu_fid *fid) -{ - fid_zero(fid); - fid->f_seq = FID_SEQ_ECHO; - /* truncated to 32 bits by assignment */ - fid->f_oid = lsm->lsm_object_id; - fid->f_ver = lsm->lsm_object_id >> 32; -} /** @} echo_helpers */ static struct echo_object *cl_echo_object_find(struct echo_device *d, @@ -543,6 +535,7 @@ static int echo_alloc_memmd(struct echo_device *ed, loi_init((*lsmp)->lsm_oinfo[0]); (*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES; + (*lsmp)->lsm_oi.oi_seq = FID_SEQ_ECHO; RETURN(lsm_size); } @@ -1088,10 +1081,11 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, int refcheck; ENTRY; - LASSERT(lsmp); - lsm = *lsmp; - LASSERT(lsm); - LASSERT(lsm->lsm_object_id); + LASSERT(lsmp); + lsm = *lsmp; + LASSERT(lsm); + LASSERT(ostid_id(&lsm->lsm_oi) != 0); + LASSERT(ostid_seq(&lsm->lsm_oi) == FID_SEQ_ECHO); /* Never return an object if the obd is to be freed. */ if (echo_dev2cl(d)->cd_lu_dev.ld_obd->obd_stopping) @@ -1107,8 +1101,7 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, if (!d->ed_next_islov) { struct lov_oinfo *oinfo = lsm->lsm_oinfo[0]; LASSERT(oinfo != NULL); - oinfo->loi_id = lsm->lsm_object_id; - oinfo->loi_seq = lsm->lsm_object_seq; + oinfo->loi_oi = lsm->lsm_oi; conf->eoc_cl.u.coc_oinfo = oinfo; } else { struct lustre_md *md; @@ -1121,7 +1114,7 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, conf->eoc_md = lsmp; fid = &info->eti_fid; - lsm2fid(lsm, fid); + ostid_fid_unpack(&lsm->lsm_oi, fid); /* In the function below, .hs_keycmp resolves to * lu_obj_hop_keycmp() */ @@ -2279,22 +2272,22 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, idx = cfs_rand(); - /* setup stripes: indices + default ids if required */ - for (i = 0; i < lsm->lsm_stripe_count; i++) { - if (lsm->lsm_oinfo[i]->loi_id == 0) - lsm->lsm_oinfo[i]->loi_id = lsm->lsm_object_id; + /* setup stripes: indices + default ids if required */ + for (i = 0; i < lsm->lsm_stripe_count; i++) { + if (lsm->lsm_oinfo[i]->loi_id == 0) + lsm->lsm_oinfo[i]->loi_oi = lsm->lsm_oi; - lsm->lsm_oinfo[i]->loi_ost_idx = - (idx + i) % ec->ec_nstripes; - } + lsm->lsm_oinfo[i]->loi_ost_idx = + (idx + i) % ec->ec_nstripes; + } } - /* setup object ID here for !on_target and LOV hint */ - if (oa->o_valid & OBD_MD_FLID) - lsm->lsm_object_id = oa->o_id; + /* 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 (lsm->lsm_object_id == 0) - lsm->lsm_object_id = ++last_object_id; + if (ostid_id(&lsm->lsm_oi) == 0) + lsm->lsm_oi.oi_id = ++last_object_id; rc = 0; if (on_target) { @@ -2310,7 +2303,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, } /* See what object ID we were given */ - oa->o_id = lsm->lsm_object_id; + oa->o_oi = lsm->lsm_oi; oa->o_valid |= OBD_MD_FLID; eco = cl_echo_object_find(ed, &lsm); @@ -2350,11 +2343,9 @@ static int echo_get_object(struct echo_object **ecop, struct echo_device *ed, if (rc < 0) RETURN(rc); - lsm->lsm_object_id = oa->o_id; - if (oa->o_valid & OBD_MD_FLGROUP) - lsm->lsm_object_seq = oa->o_seq; - else - lsm->lsm_object_seq = FID_SEQ_ECHO; + lsm->lsm_oi = oa->o_oi; + if (!(oa->o_valid & OBD_MD_FLGROUP)) + lsm->lsm_oi.oi_seq = FID_SEQ_ECHO; rc = 0; eco = cl_echo_object_find(ed, &lsm); @@ -2491,9 +2482,9 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, gfp_mask = ((oa->o_id & 2) == 0) ? CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER; - LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ); - LASSERT(lsm != NULL); - LASSERT(lsm->lsm_object_id == oa->o_id); + LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ); + LASSERT(lsm != NULL); + LASSERT(ostid_id(&lsm->lsm_oi) == ostid_id(&oa->o_oi)); if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0) @@ -2579,9 +2570,9 @@ static int echo_client_prep_commit(const struct lu_env *env, ENTRY; - if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0 || - (lsm != NULL && lsm->lsm_object_id != oa->o_id)) - RETURN(-EINVAL); + if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0 || + (lsm != NULL && ostid_id(&lsm->lsm_oi) != ostid_id(&oa->o_oi))) + RETURN(-EINVAL); npages = batch >> CFS_PAGE_SHIFT; tot_pages = count >> CFS_PAGE_SHIFT; diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index dbb7fc9..7fec077 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -42,6 +42,7 @@ #define DEBUG_SUBSYSTEM S_FILTER +#include #include "ofd_internal.h" #include #include @@ -638,14 +639,12 @@ static int ofd_get_info(const struct lu_env *env, struct obd_export *exp, ofd_info_init(&env, exp); ostid_le_to_cpu(oid, oid); - CDEBUG(D_HA, "Get LAST FID for seq "LPX64"\n", oid->oi_seq); oseq = ofd_seq_load(&env, ofd, oid->oi_seq); if (IS_ERR(oseq)) GOTO(out_fini, rc = PTR_ERR(oseq)); - CDEBUG(D_HA, "LAST FID is "POSTID"\n", oseq->os_last_oid, - oseq->os_seq); + CDEBUG(D_HA, "LAST FID is "DOSTID"\n", POSTID(&oseq->os_oi)); *oid = oseq->os_oi; *vallen = sizeof(*oid); @@ -1322,7 +1321,7 @@ out_nolock: if (rc == 0 && ea != NULL) { struct lov_stripe_md *lsm = *ea; - lsm->lsm_object_id = oa->o_id; + lsm->lsm_oi = oa->o_oi; } ofd_seq_put(env, oseq); RETURN(rc); diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index 9ee20c4..32ca902 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -42,6 +42,7 @@ #define DEBUG_SUBSYSTEM S_FILTER #include +#include #include "ofd_internal.h" @@ -163,12 +164,12 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, /* 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)) { - CERROR("%s:"POSTID" hit the IDIF_MAX_OID (1<<48)!\n", + CERROR("%s:"DOSTID" hit the IDIF_MAX_OID (1<<48)!\n", ofd_name(ofd), id, oseq->os_seq); RETURN(rc = -ENOSPC); } else if (unlikely(!fid_seq_is_mdt0(oseq->os_seq) && (id + nr) >= OBIF_MAX_OID)) { - CERROR("%s:"POSTID" hit the OBIF_MAX_OID (1<<32)!\n", + CERROR("%s:"DOSTID" hit the OBIF_MAX_OID (1<<32)!\n", ofd_name(ofd), id, oseq->os_seq); RETURN(rc = -ENOSPC); } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 64d5e3c..ad912ec 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -82,7 +82,7 @@ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, OBD_FREE(*lmmp, lmm_size); *lmmp = NULL; RETURN(0); - } else if (unlikely(lsm != NULL && lsm->lsm_object_id == 0)) { + } else if (unlikely(lsm != NULL && ostid_id(&lsm->lsm_oi) == 0)) { RETURN(-EBADF); } @@ -92,10 +92,8 @@ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, RETURN(-ENOMEM); } - if (lsm != NULL) { - (*lmmp)->lmm_object_id = cpu_to_le64(lsm->lsm_object_id); - (*lmmp)->lmm_object_seq = cpu_to_le64(lsm->lsm_object_seq); - } + if (lsm) + ostid_cpu_to_le(&lsm->lsm_oi, &(*lmmp)->lmm_oi); RETURN(lmm_size); } @@ -117,9 +115,9 @@ static int osc_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, } /* XXX LOV_MAGIC etc check? */ - if (unlikely(lmm->lmm_object_id == 0)) { - CERROR("%s: zero lmm_object_id\n", - exp->exp_obd->obd_name); + if (unlikely(ostid_id(&lmm->lmm_oi) == 0)) { + CERROR("%s: zero lmm_object_id: rc = %d\n", + exp->exp_obd->obd_name, -EINVAL); RETURN(-EINVAL); } } @@ -145,15 +143,13 @@ static int osc_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, RETURN(-ENOMEM); } loi_init((*lsmp)->lsm_oinfo[0]); - } else if (unlikely((*lsmp)->lsm_object_id == 0)) { + } else if (unlikely(ostid_id(&(*lsmp)->lsm_oi) == 0)) { RETURN(-EBADF); } - if (lmm != NULL) { + if (lmm != NULL) /* XXX zero *lsmp? */ - (*lsmp)->lsm_object_id = le64_to_cpu(lmm->lmm_object_id); - (*lsmp)->lsm_object_seq = le64_to_cpu(lmm->lmm_object_seq); - } + ostid_le_to_cpu(&lmm->lmm_oi, &(*lsmp)->lsm_oi); if (imp != NULL && (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_MAXBYTES)) @@ -482,13 +478,12 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa, oa->o_blksize = cli_brw_size(exp->exp_obd); oa->o_valid |= OBD_MD_FLBLKSZ; - /* XXX LOV STACKING: the lsm that is passed to us from LOV does not - * have valid lsm_oinfo data structs, so don't go touching that. - * This needs to be fixed in a big way. - */ - lsm->lsm_object_id = oa->o_id; - lsm->lsm_object_seq = oa->o_seq; - *ea = lsm; + /* XXX LOV STACKING: the lsm that is passed to us from LOV does not + * have valid lsm_oinfo data structs, so don't go touching that. + * This needs to be fixed in a big way. + */ + lsm->lsm_oi = oa->o_oi; + *ea = lsm; if (oti != NULL) { oti->oti_transno = lustre_msg_get_transno(req->rq_repmsg); @@ -2304,7 +2299,7 @@ static int osc_change_cbdata(struct obd_export *exp, struct lov_stripe_md *lsm, struct ldlm_res_id res_id; struct obd_device *obd = class_exp2obd(exp); - ostid_build_res_name(&lsm->lsm_object_oid, &res_id); + ostid_build_res_name(&lsm->lsm_oi, &res_id); ldlm_resource_iterate(obd->obd_namespace, &res_id, replace, data); return 0; } @@ -2320,7 +2315,7 @@ static int osc_find_cbdata(struct obd_export *exp, struct lov_stripe_md *lsm, struct obd_device *obd = class_exp2obd(exp); int rc = 0; - ostid_build_res_name(&lsm->lsm_object_oid, &res_id); + ostid_build_res_name(&lsm->lsm_oi, &res_id); rc = ldlm_resource_iterate(obd->obd_namespace, &res_id, replace, data); if (rc == LDLM_ITER_STOP) return(1); @@ -2630,7 +2625,7 @@ static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo, int rc; ENTRY; - ostid_build_res_name(&oinfo->oi_md->lsm_object_oid, &res_id); + ostid_build_res_name(&oinfo->oi_md->lsm_oi, &res_id); rc = osc_enqueue_base(exp, &res_id, &oinfo->oi_flags, &oinfo->oi_policy, &oinfo->oi_md->lsm_oinfo[0]->loi_lvb, oinfo->oi_md->lsm_oinfo[0]->loi_kms_valid, @@ -2711,7 +2706,7 @@ static int osc_cancel_unused(struct obd_export *exp, struct ldlm_res_id res_id, *resp = NULL; if (lsm != NULL) { - ostid_build_res_name(&lsm->lsm_object_oid, &res_id); + ostid_build_res_name(&lsm->lsm_oi, &res_id); resp = &res_id; } @@ -2899,18 +2894,18 @@ static int osc_getstripe(struct lov_stripe_md *lsm, struct lov_user_md *lump) if (!lumk) RETURN(-ENOMEM); - if (lum.lmm_magic == LOV_USER_MAGIC_V1) - lmm_objects = &(((struct lov_user_md_v1 *)lumk)->lmm_objects[0]); - else - lmm_objects = &(lumk->lmm_objects[0]); - lmm_objects->l_object_id = lsm->lsm_object_id; - } else { - lum_size = lov_mds_md_size(0, lum.lmm_magic); - lumk = &lum; - } + if (lum.lmm_magic == LOV_USER_MAGIC_V1) + lmm_objects = + &(((struct lov_user_md_v1 *)lumk)->lmm_objects[0]); + else + lmm_objects = &(lumk->lmm_objects[0]); + lmm_objects->l_ost_oi = lsm->lsm_oi; + } else { + lum_size = lov_mds_md_size(0, lum.lmm_magic); + lumk = &lum; + } - lumk->lmm_object_id = lsm->lsm_object_id; - lumk->lmm_object_seq = lsm->lsm_object_seq; + lumk->lmm_oi = lsm->lsm_oi; lumk->lmm_stripe_count = 1; if (cfs_copy_to_user(lump, lumk, lum_size)) diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 873c23e..b8a3aa8 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -116,7 +116,7 @@ static int ost_validate_obdo(struct obd_export *exp, struct obdo *oa, } 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)))) { - CERROR("%s: client %s sent bad object "POSTID": rc = -EPROTO\n", + 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); return -EPROTO; @@ -127,10 +127,10 @@ static int ost_validate_obdo(struct obd_export *exp, struct obdo *oa, unsigned max_brw = ioobj_max_brw_get(ioobj); if (unlikely((max_brw & (max_brw - 1)) != 0)) { - CERROR("%s: client %s sent bad ioobj max %u for "POSTID + CERROR("%s: client %s sent bad ioobj max %u for "DOSTID ": rc = -EPROTO\n", exp->exp_obd->obd_name, obd_export_nid2str(exp), max_brw, - oa->o_id, oa->o_seq); + POSTID(&oa->o_oi)); return -EPROTO; } ioobj_from_obdo(ioobj, oa); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index b24185a..8269d5a 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -2158,8 +2158,8 @@ static void print_lum (struct lov_user_md *lum) CDEBUG(D_OTHER, "lov_user_md %p:\n", lum); CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lum->lmm_magic); CDEBUG(D_OTHER, "\tlmm_pattern: %#x\n", lum->lmm_pattern); - CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", lum->lmm_object_id); - CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lum->lmm_object_seq); + CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", ostid_id(&lum->lmm_oi)); + CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", ostid_seq(&lum->lmm_oi)); CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lum->lmm_stripe_size); CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lum->lmm_stripe_count); CDEBUG(D_OTHER, "\tlmm_stripe_offset/lmm_layout_gen: %#x\n", @@ -2171,8 +2171,7 @@ static void lustre_swab_lov_user_md_common(struct lov_user_md_v1 *lum) ENTRY; __swab32s(&lum->lmm_magic); __swab32s(&lum->lmm_pattern); - __swab64s(&lum->lmm_object_id); - __swab64s(&lum->lmm_object_seq); + lustre_swab_ost_id(&lum->lmm_oi); __swab32s(&lum->lmm_stripe_size); __swab16s(&lum->lmm_stripe_count); __swab16s(&lum->lmm_stripe_offset); @@ -2201,16 +2200,15 @@ EXPORT_SYMBOL(lustre_swab_lov_user_md_v3); void lustre_swab_lov_mds_md(struct lov_mds_md *lmm) { - ENTRY; - CDEBUG(D_IOCTL, "swabbing lov_mds_md\n"); - __swab32s(&lmm->lmm_magic); - __swab32s(&lmm->lmm_pattern); - __swab64s(&lmm->lmm_object_id); - __swab64s(&lmm->lmm_object_seq); - __swab32s(&lmm->lmm_stripe_size); - __swab16s(&lmm->lmm_stripe_count); - __swab16s(&lmm->lmm_layout_gen); - EXIT; + ENTRY; + CDEBUG(D_IOCTL, "swabbing lov_mds_md\n"); + __swab32s(&lmm->lmm_magic); + __swab32s(&lmm->lmm_pattern); + lustre_swab_ost_id(&lmm->lmm_oi); + __swab32s(&lmm->lmm_stripe_size); + __swab16s(&lmm->lmm_stripe_count); + __swab16s(&lmm->lmm_layout_gen); + EXIT; } EXPORT_SYMBOL(lustre_swab_lov_mds_md); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index e5f9e70..e65b094 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -54,7 +54,7 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux mercury 2.6.32-279.5.1.el6_lustre.x86_64 #1 SMP Tue Aug 21 00:00:41 PDT 2 + * running on Linux testnode 2.6.32-279.5.1.el6_lustre.g53f705f.x86_64 #1 SMP Mon Oct 8 05:12 * with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) */ @@ -1405,14 +1405,14 @@ void lustre_assert_wire_constants(void) /* 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_object_id) == 0, "found %lld\n", - (long long)(int)offsetof(struct lov_ost_data_v1, l_object_id)); - LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id)); - LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_seq) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_ost_data_v1, l_object_seq)); - LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_seq)); + 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_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", @@ -1433,14 +1433,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v1, lmm_pattern)); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern)); - LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_id)); - LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id)); - LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_seq) == 16, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_seq)); - LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_seq)); + LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_oi) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_mds_md_v1, lmm_oi)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_oi) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_oi)); LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_size)); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, "found %lld\n", @@ -1470,14 +1466,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pattern)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pattern) == 4, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pattern)); - LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_object_id) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v3, lmm_object_id)); - LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_id)); - LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_object_seq) == 16, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v3, lmm_object_seq)); - LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_seq)); + LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_oi) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_mds_md_v3, lmm_oi)); + LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_oi) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_oi)); LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_stripe_size) == 24, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v3, lmm_stripe_size)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_size) == 4, "found %lld\n", diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index fb1e69f..b2842c8 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2021,23 +2021,23 @@ static void lov_dump_user_lmm_header(struct lov_user_md *lum, char *path, char nl = is_dir ? ' ' : '\n'; int rc; - if (is_dir && lum->lmm_object_seq == FID_SEQ_LOV_DEFAULT) { - lum->lmm_object_seq = FID_SEQ_OST_MDT0; - if (verbose & VERBOSE_DETAIL) - llapi_printf(LLAPI_MSG_NORMAL, "(Default) "); - } + if (is_dir && ostid_seq(&lum->lmm_oi) == FID_SEQ_LOV_DEFAULT) { + lum->lmm_oi.oi_seq = FID_SEQ_OST_MDT0; + if (verbose & VERBOSE_DETAIL) + llapi_printf(LLAPI_MSG_NORMAL, "(Default) "); + } if (depth && path && ((verbose != VERBOSE_OBJID) || !is_dir)) llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); - if ((verbose & VERBOSE_DETAIL) && !is_dir) { - llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic: 0x%08X\n", - lum->lmm_magic); - llapi_printf(LLAPI_MSG_NORMAL, "lmm_seq: "LPX64"\n", - lum->lmm_object_seq); - llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id: "LPX64"\n", - lum->lmm_object_id); - } + if ((verbose & VERBOSE_DETAIL) && !is_dir) { + llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic: 0x%08X\n", + lum->lmm_magic); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_seq: "LPX64"\n", + ostid_seq(&lum->lmm_oi)); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id: "LPX64"\n", + ostid_id(&lum->lmm_oi)); + } if (verbose & VERBOSE_COUNT) { if (verbose & ~VERBOSE_COUNT) @@ -2993,21 +2993,20 @@ static int cb_getstripe(char *path, DIR *parent, DIR *d, void *data, if (ret) { if (errno == ENODATA && d != NULL) { - /* We need to "fake" the "use the default" values - * since the lmm struct is zeroed out at this point. - * The magic needs to be set in order to satisfy - * a check later on in the code path. - * The object_seq needs to be set for the "(Default)" - * prefix to be displayed. */ - struct lov_user_md *lmm = ¶m->lmd->lmd_lmm; - lmm->lmm_magic = LOV_MAGIC_V1; - if (!param->raw) - lmm->lmm_object_seq = FID_SEQ_LOV_DEFAULT; - lmm->lmm_stripe_count = 0; - lmm->lmm_stripe_size = 0; - lmm->lmm_stripe_offset = -1; - goto dump; - + /* We need to "fake" the "use the default" values + * since the lmm struct is zeroed out at this point. + * The magic needs to be set in order to satisfy + * a check later on in the code path. + * The object_seq needs to be set for the "(Default)" + * prefix to be displayed. */ + 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; + lmm->lmm_stripe_count = 0; + lmm->lmm_stripe_size = 0; + lmm->lmm_stripe_offset = -1; + goto dump; } else if (errno == ENODATA && parent != NULL) { if (!param->obduuid && !param->mdtuuid) llapi_printf(LLAPI_MSG_NORMAL, diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 53f2fc5..e675d23 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -300,10 +300,10 @@ parse_lsm (struct lsm_buffer *lsmb, char *string) reset_lsmb (lsmb); - lsm->lsm_object_id = strtoull (string, &end, 0); - if (end == string) - return (-1); - string = end; + lsm->lsm_oi.oi_id = strtoull(string, &end, 0); + if (end == string) + return -1; + string = end; if (*string == 0) return (0); @@ -1567,18 +1567,18 @@ int jt_obd_create(int argc, char **argv) return CMD_HELP; } - if (argc < 5) { - reset_lsmb (&lsm_buffer); /* will set default */ - } else { - rc = parse_lsm (&lsm_buffer, argv[4]); - if (rc != 0) { - fprintf(stderr, "error: %s: invalid lsm '%s'\n", - jt_cmdname(argv[0]), argv[4]); - return CMD_HELP; - } - base_id = lsm_buffer.lsm.lsm_object_id; - valid_lsm = 1; - } + if (argc < 5) { + reset_lsmb(&lsm_buffer); /* will set default */ + } else { + rc = parse_lsm(&lsm_buffer, argv[4]); + if (rc != 0) { + fprintf(stderr, "error: %s: invalid lsm '%s'\n", + jt_cmdname(argv[0]), argv[4]); + return CMD_HELP; + } + base_id = ostid_id(&lsm_buffer.lsm.lsm_oi); + valid_lsm = 1; + } printf("%s: "LPD64" objects\n", jt_cmdname(argv[0]), count); gettimeofday(&next_time, NULL); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 842e374..14451fa 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -651,8 +651,7 @@ check_lov_mds_md_v1(void) CHECK_STRUCT(lov_mds_md_v1); CHECK_MEMBER(lov_mds_md_v1, lmm_magic); CHECK_MEMBER(lov_mds_md_v1, lmm_pattern); - CHECK_MEMBER(lov_mds_md_v1, lmm_object_id); - CHECK_MEMBER(lov_mds_md_v1, lmm_object_seq); + CHECK_MEMBER(lov_mds_md_v1, lmm_oi); CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_size); CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_count); CHECK_MEMBER(lov_mds_md_v1, lmm_layout_gen); @@ -668,8 +667,7 @@ check_lov_mds_md_v3(void) CHECK_STRUCT(lov_mds_md_v3); CHECK_MEMBER(lov_mds_md_v3, lmm_magic); CHECK_MEMBER(lov_mds_md_v3, lmm_pattern); - CHECK_MEMBER(lov_mds_md_v3, lmm_object_id); - CHECK_MEMBER(lov_mds_md_v3, lmm_object_seq); + CHECK_MEMBER(lov_mds_md_v3, lmm_oi); CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_size); CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_count); CHECK_MEMBER(lov_mds_md_v3, lmm_layout_gen); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index d426a82..27049c3 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -58,11 +58,12 @@ int main() return ret; } + void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux mercury 2.6.32-279.5.1.el6_lustre.x86_64 #1 SMP Tue Aug 21 00:00:41 PDT 2 + * running on Linux testnode 2.6.32-279.5.1.el6_lustre.g53f705f.x86_64 #1 SMP Mon Oct 8 05:12 * with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) */ @@ -1413,14 +1414,14 @@ void lustre_assert_wire_constants(void) /* 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_object_id) == 0, "found %lld\n", - (long long)(int)offsetof(struct lov_ost_data_v1, l_object_id)); - LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id)); - LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_seq) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_ost_data_v1, l_object_seq)); - LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_seq)); + 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_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", @@ -1441,14 +1442,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v1, lmm_pattern)); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern)); - LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_id)); - LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id)); - LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_seq) == 16, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_seq)); - LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_seq)); + LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_oi) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_mds_md_v1, lmm_oi)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_oi) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_oi)); LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_size)); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, "found %lld\n", @@ -1478,14 +1475,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pattern)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pattern) == 4, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pattern)); - LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_object_id) == 8, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v3, lmm_object_id)); - LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_id)); - LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_object_seq) == 16, "found %lld\n", - (long long)(int)offsetof(struct lov_mds_md_v3, lmm_object_seq)); - LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_seq) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_object_seq)); + LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_oi) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_mds_md_v3, lmm_oi)); + LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_oi) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_oi)); LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_stripe_size) == 24, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v3, lmm_stripe_size)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_size) == 4, "found %lld\n", -- 1.8.3.1