From fbfd488a2f87ea43332ae16341887f68c0ffbde5 Mon Sep 17 00:00:00 2001 From: pravins Date: Mon, 27 Jul 2009 05:00:18 +0000 Subject: [PATCH] b=19902 i=rahul i=alex removed fid_packed structure. --- lustre/include/lustre/lustre_idl.h | 20 ++------- lustre/include/lustre_fid.h | 3 +- lustre/mdd/mdd_dir.c | 30 ++++++------- lustre/mdd/mdd_internal.h | 10 ----- lustre/mdd/mdd_orphans.c | 4 +- lustre/obdclass/dt_object.c | 8 +--- lustre/obdclass/lu_object.c | 88 -------------------------------------- lustre/osd/osd_handler.c | 69 +++++++++++++++++++++--------- lustre/osd/osd_internal.h | 14 +++++- lustre/osd/osd_oi.c | 66 +++++++++------------------- lustre/osd/osd_oi.h | 5 +-- lustre/ptlrpc/wiretest.c | 27 +++--------- lustre/utils/wiretest.c | 26 +++-------- 13 files changed, 117 insertions(+), 253 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 7cc39e1..89fa719 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -422,20 +422,6 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src) LASSERTF(fid_is_igif(dst) || fid_ver(dst) == 0, DFID"\n", PFID(dst)); } -/** - * Storage representation for fids. - * - * Variable size, first byte contains the length of the whole record. - */ -struct lu_fid_pack { - char fp_len; - char fp_area[sizeof(struct lu_fid)]; -}; - -void fid_pack(struct lu_fid_pack *pack, const struct lu_fid *fid, - struct lu_fid *befider); -int fid_unpack(const struct lu_fid_pack *pack, struct lu_fid *fid); - static inline int fid_is_sane(const struct lu_fid *fid) { return @@ -2776,12 +2762,12 @@ struct link_ea_header { * Stored in this crazy struct for maximum packing and endian-neutrality */ struct link_ea_entry { + struct lu_fid lee_parent_fid; /** __u16 stored big-endian, unaligned */ char lee_reclen[2]; - struct lu_fid_pack lee_parent_fid; /**< variable length */ - /** logically after lee_parent_fid; don't use directly */ + __u16 lee_padding; char lee_name[0]; -}; +}__attribute__((packed)); /** fid2path request/reply structure */ struct getinfo_fid2path { diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 921b423..ac91579 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -90,8 +90,7 @@ enum { /** special OID for local objects */ enum { /** \see osd_oi_index_create */ - OSD_OI_FID_SMALL_OID = 1UL, - OSD_OI_FID_OTHER_OID = 2UL, + OSD_OI_FID_16_OID = 2UL, /** \see fld_mod_init */ FLD_INDEX_OID = 3UL, /** \see fid_mod_init */ diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 3d5a7f9..067910e 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -550,7 +550,7 @@ static int __mdd_index_insert_only(const struct lu_env *env, struct md_ucred *uc = md_ucred(env); rc = next->do_index_ops->dio_insert(env, next, - __mdd_fid_rec(env, lf), + (struct dt_rec*)lf, (const struct dt_key *)name, handle, capa, uc->mu_cap & CFS_CAP_SYS_RESOURCE_MASK); @@ -1398,7 +1398,6 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj, struct mdd_object *mdd_obj = md2mdd_obj(pobj); struct mdd_device *m = mdo2mdd(pobj); struct dt_object *dir = mdd_object_child(mdd_obj); - struct lu_fid_pack *pack = &mdd_env_info(env)->mti_pack; int rc; ENTRY; @@ -1427,10 +1426,10 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj, dt_try_as_dir(env, dir))) { rc = dir->do_index_ops->dio_lookup(env, dir, - (struct dt_rec *)pack, key, + (struct dt_rec *)fid, key, mdd_object_capa(env, mdd_obj)); if (rc > 0) - rc = fid_unpack(pack, fid); + rc = 0; else if (rc == 0) rc = -ENOENT; } else @@ -2302,20 +2301,17 @@ struct lu_buf *mdd_links_get(const struct lu_env *env, /** Pack a link_ea_entry. * All elements are stored as chars to avoid alignment issues. * Numbers are always big-endian - * \param packbuf is a temp fid buffer * \retval record length */ static int mdd_lee_pack(struct link_ea_entry *lee, const struct lu_name *lname, - const struct lu_fid *pfid, struct lu_fid* packbuf) + const struct lu_fid *pfid) { - char *ptr; int reclen; - fid_pack(&lee->lee_parent_fid, pfid, packbuf); - ptr = (char *)&lee->lee_parent_fid + lee->lee_parent_fid.fp_len; - strncpy(ptr, lname->ln_name, lname->ln_namelen); - reclen = lee->lee_parent_fid.fp_len + lname->ln_namelen + - sizeof(lee->lee_reclen); + fid_cpu_to_be(&lee->lee_parent_fid, pfid); + strncpy(lee->lee_name, lname->ln_name, lname->ln_namelen); + reclen = sizeof(struct link_ea_entry) + lname->ln_namelen; + lee->lee_reclen[0] = (reclen >> 8) & 0xff; lee->lee_reclen[1] = reclen & 0xff; return reclen; @@ -2325,11 +2321,9 @@ void mdd_lee_unpack(const struct link_ea_entry *lee, int *reclen, struct lu_name *lname, struct lu_fid *pfid) { *reclen = (lee->lee_reclen[0] << 8) | lee->lee_reclen[1]; - fid_unpack(&lee->lee_parent_fid, pfid); - lname->ln_name = (char *)&lee->lee_parent_fid + - lee->lee_parent_fid.fp_len; - lname->ln_namelen = *reclen - lee->lee_parent_fid.fp_len - - sizeof(lee->lee_reclen); + fid_be_to_cpu(pfid, &lee->lee_parent_fid); + lname->ln_name = lee->lee_name; + lname->ln_namelen = *reclen - sizeof(struct link_ea_entry); } /** Add a record to the end of link ea buf */ @@ -2354,7 +2348,7 @@ static int __mdd_links_add(const struct lu_env *env, struct lu_buf *buf, leh = buf->lb_buf; lee = buf->lb_buf + leh->leh_len; - reclen = mdd_lee_pack(lee, lname, pfid, &mdd_env_info(env)->mti_fid2); + reclen = mdd_lee_pack(lee, lname, pfid); leh->leh_len += reclen; leh->leh_reccount++; return 0; diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 2b2b23e..51ca3e4 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -184,7 +184,6 @@ struct mdd_thread_info { struct lu_name mti_name; struct obdo mti_oa; char mti_xattr_buf[LUSTRE_POSIX_ACL_MAX_SIZE]; - struct lu_fid_pack mti_pack; struct dt_allocation_hint mti_hint; struct lov_mds_md *mti_max_lmm; int mti_max_lmm_size; @@ -546,15 +545,6 @@ static inline const struct lu_fid *mdo2fid(const struct mdd_object *obj) return lu_object_fid(&obj->mod_obj.mo_lu); } -static inline const struct dt_rec *__mdd_fid_rec(const struct lu_env *env, - const struct lu_fid *fid) -{ - struct lu_fid_pack *pack = &mdd_env_info(env)->mti_pack; - - fid_pack(pack, fid, &mdd_env_info(env)->mti_fid2); - return (const struct dt_rec *)pack; -} - static inline umode_t mdd_object_type(const struct mdd_object *obj) { return lu_object_attr(&obj->mod_obj.mo_lu); diff --git a/lustre/mdd/mdd_orphans.c b/lustre/mdd/mdd_orphans.c index 64294cf..de02595 100644 --- a/lustre/mdd/mdd_orphans.c +++ b/lustre/mdd/mdd_orphans.c @@ -143,7 +143,7 @@ static inline int mdd_orphan_insert_obj(const struct lu_env *env, ENTRY; return dor->do_index_ops->dio_insert(env, dor, - __mdd_fid_rec(env, lf), + (struct dt_rec *)lf, key, th, BYPASS_CAPA, 1); } @@ -215,7 +215,7 @@ static int orph_index_insert(const struct lu_env *env, dotdot, th, BYPASS_CAPA); next->do_index_ops->dio_insert(env, next, - __mdd_fid_rec(env, lf_dor), + (struct dt_rec *) lf_dor, dotdot, th, BYPASS_CAPA, 1); out: diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index e5d3c4d..23fa33ac 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -60,7 +60,6 @@ struct dt_find_hint { struct dt_thread_info { char dti_buf[DT_MAX_PATH]; - struct lu_fid_pack dti_pack; struct dt_find_hint dti_dfh; }; @@ -217,10 +216,7 @@ EXPORT_SYMBOL(dt_mode_to_dft); static int dt_lookup(const struct lu_env *env, struct dt_object *dir, const char *name, struct lu_fid *fid) { - struct dt_thread_info *info = lu_context_key_get(&env->le_ctx, - &dt_key); - struct lu_fid_pack *pack = &info->dti_pack; - struct dt_rec *rec = (struct dt_rec *)pack; + struct dt_rec *rec = (struct dt_rec *)fid; const struct dt_key *key = (const struct dt_key *)name; int result; @@ -228,7 +224,7 @@ static int dt_lookup(const struct lu_env *env, struct dt_object *dir, result = dir->do_index_ops->dio_lookup(env, dir, rec, key, BYPASS_CAPA); if (result > 0) - result = fid_unpack(pack, fid); + result = 0; else if (result == 0) result = -ENOENT; } else diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 0c07d53..f7bdbcc 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -1651,94 +1651,6 @@ int lu_site_stats_print(const struct lu_site *s, char *page, int count) } EXPORT_SYMBOL(lu_site_stats_print); -#ifdef __KERNEL__ -/* - * XXX: Functions below logically belong to the fid module, but they are used - * by dt_store_open(). Put them here until better place is found. - */ - -void fid_pack(struct lu_fid_pack *pack, const struct lu_fid *fid, - struct lu_fid *befider) -{ - int recsize; - __u64 seq; - __u32 oid; - - seq = fid_seq(fid); - oid = fid_oid(fid); - - /* - * Two cases: compact 6 bytes representation for a common case, and - * full 17 byte representation for "unusual" fid. - */ - - /* - * Check that usual case is really usual. - */ - CLASSERT(LUSTRE_SEQ_MAX_WIDTH < 0xffffull); - - /* fid can be packed in six bytes (first byte as length of packed fid, - * three bytes of seq and two bytes of oid). - * this reduces IO overhead specially for OSD Object Index. */ - - if (seq < FID_SEQ_START || - seq > (0xffffffull + FID_SEQ_START) || - oid > 0xffff || fid_ver(fid) != 0) { - fid_cpu_to_be(befider, fid); - recsize = sizeof *befider; - } else { - unsigned char *small_befider; - - /* as lower 24 bits of FID_SEQ_START are zero, no need to - * subtract its value from seq */ - - CLASSERT((FID_SEQ_START & 0xffffff) == 0); - - small_befider = (unsigned char *)befider; - - small_befider[0] = seq >> 16; - small_befider[1] = seq >> 8; - small_befider[2] = seq; - - small_befider[3] = oid >> 8; - small_befider[4] = oid; - - recsize = 5; - } - memcpy(pack->fp_area, befider, recsize); - pack->fp_len = recsize + 1; -} -EXPORT_SYMBOL(fid_pack); - -int fid_unpack(const struct lu_fid_pack *pack, struct lu_fid *fid) -{ - int result; - - result = 0; - switch (pack->fp_len) { - case sizeof *fid + 1: - memcpy(fid, pack->fp_area, sizeof *fid); - fid_be_to_cpu(fid, fid); - break; - case 6: { - const unsigned char *area; - - area = (unsigned char *)pack->fp_area; - fid->f_seq = (area[0] << 16) | (area[1] << 8) | area[2]; - fid->f_seq += FID_SEQ_START; - fid->f_oid = (area[3] << 8) | area[4]; - fid->f_ver = 0; - break; - } - default: - CERROR("Unexpected packed fid size: %d\n", pack->fp_len); - result = -EIO; - } - return result; -} -EXPORT_SYMBOL(fid_unpack); -#endif /* #ifdef __KERNEL__ */ - const char *lu_time_names[LU_TIME_NR] = { [LU_TIME_FIND_LOOKUP] = "find_lookup", [LU_TIME_FIND_ALLOC] = "find_alloc", diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 2c639c7..6be19ed 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -1453,7 +1453,7 @@ static int osd_mkdir(struct osd_thread_info *info, struct osd_object *obj, */ result = iam_lvar_create(obj->oo_inode, OSD_NAME_LEN, 4, - sizeof (struct lu_fid_pack), + sizeof (struct osd_fid_pack), oth->ot_handle); } return result; @@ -1732,10 +1732,29 @@ static inline void osd_igif_get(const struct lu_env *env, struct inode *inode, /** * Helper function to pack the fid */ -static inline void osd_fid_pack(const struct lu_env *env, const struct lu_fid *fid, - struct dt_rec *pack) +void osd_fid_pack(struct osd_fid_pack *pack, const struct dt_rec *fid, + struct lu_fid *befider) { - fid_pack((struct lu_fid_pack *)pack, fid, &osd_oti_get(env)->oti_fid); + fid_cpu_to_be(befider, (struct lu_fid *)fid); + memcpy(pack->fp_area, befider, sizeof(*befider)); + pack->fp_len = sizeof(*befider) + 1; +} + +int osd_fid_unpack(struct lu_fid *fid, const struct osd_fid_pack *pack) +{ + int result; + + result = 0; + switch (pack->fp_len) { + case sizeof *fid + 1: + memcpy(fid, pack->fp_area, sizeof *fid); + fid_be_to_cpu(fid, fid); + break; + default: + CERROR("Unexpected packed fid size: %d\n", pack->fp_len); + result = -EIO; + } + return result; } /** @@ -2148,7 +2167,7 @@ static int osd_iam_index_probe(const struct lu_env *env, struct osd_object *o, descr = o->oo_dir->od_container.ic_descr; if (feat == &dt_directory_features) { - if (descr->id_rec_size == sizeof(struct lu_fid_pack)) + if (descr->id_rec_size == sizeof(struct osd_fid_pack)) return 1; else return 0; @@ -2507,6 +2526,7 @@ static int osd_index_iam_lookup(const struct lu_env *env, struct dt_object *dt, struct iam_container *bag = &obj->oo_dir->od_container; struct osd_thread_info *oti = osd_oti_get(env); struct iam_iterator *it = &oti->oti_idx_it; + struct iam_rec *iam_rec; int rc; ENTRY; @@ -2525,9 +2545,17 @@ static int osd_index_iam_lookup(const struct lu_env *env, struct dt_object *dt, iam_it_init(it, bag, 0, ipd); rc = iam_it_get(it, (struct iam_key *)key); - if (rc >= 0) - iam_reccpy(&it->ii_path.ip_leaf, (struct iam_rec *)rec); + if (rc >= 0) { + if (S_ISDIR(obj->oo_inode->i_mode)) + iam_rec = (struct iam_rec *)oti->oti_fid_packed; + else + iam_rec = (struct iam_rec *) rec; + iam_reccpy(&it->ii_path.ip_leaf, (struct iam_rec *)iam_rec); + if (S_ISDIR(obj->oo_inode->i_mode)) + osd_fid_unpack((struct lu_fid *) rec, + (struct osd_fid_pack *)iam_rec); + } iam_it_put(it); iam_it_fini(it); osd_ipd_put(env, bag, ipd); @@ -2560,6 +2588,8 @@ static int osd_index_iam_insert(const struct lu_env *env, struct dt_object *dt, #ifdef HAVE_QUOTA_SUPPORT cfs_cap_t save = current->cap_effective; #endif + struct osd_thread_info *oti = osd_oti_get(env); + struct iam_rec *iam_rec = (struct iam_rec *)oti->oti_fid_packed; int rc; ENTRY; @@ -2585,8 +2615,12 @@ static int osd_index_iam_insert(const struct lu_env *env, struct dt_object *dt, else current->cap_effective &= ~CFS_CAP_SYS_RESOURCE_MASK; #endif + if (S_ISDIR(obj->oo_inode->i_mode)) + osd_fid_pack((struct osd_fid_pack *)iam_rec, rec, &oti->oti_fid); + else + iam_rec = (struct iam_rec *) rec; rc = iam_insert(oh->ot_handle, bag, (const struct iam_key *)key, - (struct iam_rec *)rec, ipd); + iam_rec, ipd); #ifdef HAVE_QUOTA_SUPPORT current->cap_effective = save; #endif @@ -2707,11 +2741,10 @@ static int osd_ea_lookup_rec(const struct lu_env *env, struct osd_object *obj, struct dt_rec *rec, const struct dt_key *key) { struct inode *dir = obj->oo_inode; - struct osd_thread_info *info = osd_oti_get(env); struct dentry *dentry; struct ldiskfs_dir_entry_2 *de; struct buffer_head *bh; - struct lu_fid *fid = &info->oti_fid; + struct lu_fid *fid = (struct lu_fid *) rec; int ino; int rc; @@ -2726,8 +2759,6 @@ static int osd_ea_lookup_rec(const struct lu_env *env, struct osd_object *obj, ino = le32_to_cpu(de->inode); brelse(bh); rc = osd_ea_fid_get(env, obj, ino, fid); - if (rc == 0) - osd_fid_pack(env, fid, rec); } else rc = -ENOENT; @@ -2808,8 +2839,7 @@ static int osd_index_ea_insert(const struct lu_env *env, struct dt_object *dt, struct lustre_capa *capa, int ignore_quota) { struct osd_object *obj = osd_dt_obj(dt); - struct lu_fid *fid = &osd_oti_get(env)->oti_fid; - const struct lu_fid_pack *pack = (const struct lu_fid_pack *)rec; + struct lu_fid *fid = (struct lu_fid *) rec; const char *name = (const char *)key; struct osd_object *child; #ifdef HAVE_QUOTA_SUPPORT @@ -2826,9 +2856,6 @@ static int osd_index_ea_insert(const struct lu_env *env, struct dt_object *dt, if (osd_object_auth(env, dt, capa, CAPA_OPC_INDEX_INSERT)) RETURN(-EACCES); - rc = fid_unpack(pack, fid); - if (rc != 0) - RETURN(rc); child = osd_object_find(env, dt, fid); if (!IS_ERR(child)) { struct inode *inode = obj->oo_inode; @@ -3041,7 +3068,7 @@ static int osd_it_iam_rec(const struct lu_env *env, struct osd_it_iam *it = (struct osd_it_iam *)di; struct osd_thread_info *info = osd_oti_get(env); struct lu_fid *fid = &info->oti_fid; - const struct lu_fid_pack *rec; + const struct osd_fid_pack *rec; char *name; int namelen; __u64 hash; @@ -3053,11 +3080,11 @@ static int osd_it_iam_rec(const struct lu_env *env, namelen = iam_it_key_size(&it->oi_it); - rec = (const struct lu_fid_pack *) iam_it_rec_get(&it->oi_it); + rec = (const struct osd_fid_pack *) iam_it_rec_get(&it->oi_it); if (IS_ERR(rec)) RETURN(PTR_ERR(rec)); - rc = fid_unpack(rec, fid); + rc = osd_fid_unpack(fid, rec); if (rc) RETURN(rc); @@ -3150,7 +3177,7 @@ static struct dt_it *osd_it_ea_init(const struct lu_env *env, it->oie_file.f_op = obj->oo_inode->i_fop; it->oie_file.private_data = NULL; lu_object_get(lo); - RETURN((struct dt_it*) it); + RETURN((struct dt_it *) it); } /** diff --git a/lustre/osd/osd_internal.h b/lustre/osd/osd_internal.h index 14910aa..0b1ca69 100644 --- a/lustre/osd/osd_internal.h +++ b/lustre/osd/osd_internal.h @@ -128,6 +128,16 @@ struct osd_device { __u32 od_iop_mode; }; +/** + * Storage representation for fids. + * + * Variable size, first byte contains the length of the whole record. + */ +struct osd_fid_pack { + unsigned char fp_len; + char fp_area[sizeof(struct lu_fid)]; +}; + struct osd_it_ea_dirent { __u64 oied_ino; __u64 oied_off; @@ -194,8 +204,6 @@ struct osd_thread_info { struct lustre_capa_key oti_capa_key; struct lustre_capa oti_capa; - struct lu_fid_pack oti_pack; - /** * following ipd and it structures are used for osd_index_iam_lookup() * these are defined separately as we might do index operation @@ -239,6 +247,8 @@ struct osd_thread_info { struct osd_ctxt oti_ctxt; #endif struct lu_env oti_obj_delete_tx_env; +#define OSD_FID_REC_SZ 32 + char oti_fid_packed[OSD_FID_REC_SZ]; }; #ifdef LPROCFS diff --git a/lustre/osd/osd_oi.c b/lustre/osd/osd_oi.c index 5a43a54..a66a034 100644 --- a/lustre/osd/osd_oi.c +++ b/lustre/osd/osd_oi.c @@ -91,15 +91,10 @@ static struct dt_index_features oi_feat = { }; static const struct oi_descr oi_descr[OSD_OI_FID_NR] = { - [OSD_OI_FID_SMALL] = { - .fid_size = 5, - .name = "oi.5", - .oid = OSD_OI_FID_SMALL_OID - }, - [OSD_OI_FID_OTHER] = { + [OSD_OI_FID_16] = { .fid_size = sizeof(struct lu_fid), .name = "oi.16", - .oid = OSD_OI_FID_OTHER_OID + .oid = OSD_OI_FID_16_OID } }; @@ -143,8 +138,6 @@ int osd_oi_init(struct osd_thread_info *info, int rc; int i; - CLASSERT(ARRAY_SIZE(oi->oi_dir) == ARRAY_SIZE(oi_descr)); - env = info->oti_env; mutex_lock(&oi_init_lock); memset(oi, 0, sizeof *oi); @@ -162,7 +155,7 @@ retry: rc = obj->do_ops->do_index_try(env, obj, &oi_feat); if (rc == 0) { LASSERT(obj->do_index_ops != NULL); - oi->oi_dir[i] = obj; + oi->oi_dir = obj; } else { CERROR("Wrong index \"%s\": %d\n", name, rc); lu_object_put(env, &obj->do_lu); @@ -186,36 +179,10 @@ retry: void osd_oi_fini(struct osd_thread_info *info, struct osd_oi *oi) { - int i; - - for (i = 0; i < ARRAY_SIZE(oi->oi_dir); ++i) { - if (oi->oi_dir[i] != NULL) { - lu_object_put(info->oti_env, &oi->oi_dir[i]->do_lu); - oi->oi_dir[i] = NULL; - } - } -} - -static const struct dt_key *oi_fid_key(struct osd_thread_info *info, - struct osd_oi *oi, - const struct lu_fid *fid, - struct dt_object **idx) -{ - int i; - struct lu_fid_pack *pack; - - pack = &info->oti_pack; - fid_pack(pack, fid, &info->oti_fid); - for (i = 0; i < ARRAY_SIZE(oi->oi_dir); ++i) { - if (pack->fp_len == oi_descr[i].fid_size + sizeof pack->fp_len){ - *idx = oi->oi_dir[i]; - return (const struct dt_key *)&pack->fp_area; - } + if (oi->oi_dir != NULL) { + lu_object_put(info->oti_env, &oi->oi_dir->do_lu); + oi->oi_dir = NULL; } - CERROR("Unsupported packed fid size: %d ("DFID")\n", - pack->fp_len, PFID(fid)); - LBUG(); - return NULL; } static inline int fid_is_oi_fid(const struct lu_fid *fid) @@ -224,13 +191,13 @@ static inline int fid_is_oi_fid(const struct lu_fid *fid) * oi-index create operation. */ return (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE && - (fid_oid(fid) == OSD_OI_FID_SMALL_OID || - fid_oid(fid) == OSD_OI_FID_OTHER_OID))); + fid_oid(fid) == OSD_OI_FID_16_OID)); } int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, struct osd_inode_id *id) { + struct lu_fid *oi_fid = &info->oti_fid; int rc; if (fid_is_igif(fid)) { @@ -243,7 +210,9 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi, if (fid_is_oi_fid(fid)) return -ENOENT; - key = oi_fid_key(info, oi, fid, &idx); + idx = oi->oi_dir; + fid_cpu_to_be(oi_fid, fid); + key = (struct dt_key *) oi_fid; rc = idx->do_index_ops->dio_lookup(info->oti_env, idx, (struct dt_rec *)id, key, BYPASS_CAPA); @@ -261,6 +230,7 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, const struct osd_inode_id *id0, struct thandle *th, int ignore_quota) { + struct lu_fid *oi_fid = &info->oti_fid; struct dt_object *idx; struct osd_inode_id *id; const struct dt_key *key; @@ -271,12 +241,15 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi, if (fid_is_oi_fid(fid)) return 0; - key = oi_fid_key(info, oi, fid, &idx); + idx = oi->oi_dir; + fid_cpu_to_be(oi_fid, fid); + key = (struct dt_key *) oi_fid; + id = &info->oti_id; id->oii_ino = cpu_to_be32(id0->oii_ino); id->oii_gen = cpu_to_be32(id0->oii_gen); return idx->do_index_ops->dio_insert(info->oti_env, idx, - (const struct dt_rec *)id, + (struct dt_rec *)id, key, th, BYPASS_CAPA, ignore_quota); } @@ -285,13 +258,16 @@ int osd_oi_delete(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, struct thandle *th) { + struct lu_fid *oi_fid = &info->oti_fid; struct dt_object *idx; const struct dt_key *key; if (fid_is_igif(fid)) return 0; - key = oi_fid_key(info, oi, fid, &idx); + idx = oi->oi_dir; + fid_cpu_to_be(oi_fid, fid); + key = (struct dt_key *) oi_fid; return idx->do_index_ops->dio_delete(info->oti_env, idx, key, th, BYPASS_CAPA); } diff --git a/lustre/osd/osd_oi.h b/lustre/osd/osd_oi.h index fe87768..77b293c 100644 --- a/lustre/osd/osd_oi.h +++ b/lustre/osd/osd_oi.h @@ -64,8 +64,7 @@ struct thandle; struct dt_device; enum { - OSD_OI_FID_SMALL, - OSD_OI_FID_OTHER, + OSD_OI_FID_16, OSD_OI_FID_NR }; @@ -76,7 +75,7 @@ struct osd_oi { /* * underlying index object, where fid->id mapping in stored. */ - struct dt_object *oi_dir[OSD_OI_FID_NR]; + struct dt_object *oi_dir; }; /* diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 0bc45fe..4bd0158 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1042,18 +1042,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fid *)0)->f_type)); - /* Checks for struct lu_fid_pack */ - LASSERTF((int)sizeof(struct lu_fid_pack) == 17, " found %lld\n", - (long long)(int)sizeof(struct lu_fid_pack)); - LASSERTF((int)offsetof(struct lu_fid_pack, fp_len) == 0, " found %lld\n", - (long long)(int)offsetof(struct lu_fid_pack, fp_len)); - LASSERTF((int)sizeof(((struct lu_fid_pack *)0)->fp_len) == 1, " found %lld\n", - (long long)(int)sizeof(((struct lu_fid_pack *)0)->fp_len)); - LASSERTF((int)offsetof(struct lu_fid_pack, fp_area) == 1, " found %lld\n", - (long long)(int)offsetof(struct lu_fid_pack, fp_area)); - LASSERTF((int)sizeof(((struct lu_fid_pack *)0)->fp_area) == 16, " found %lld\n", - (long long)(int)sizeof(((struct lu_fid_pack *)0)->fp_area)); - /* Checks for struct mds_status_req */ LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n", (long long)(int)sizeof(struct mds_status_req)); @@ -2497,19 +2485,18 @@ void lustre_assert_wire_constants(void) (long long)(int)sizeof(((struct link_ea_header *)0)->padding2)); /* Checks for struct link_ea_entry */ - LASSERTF((int)sizeof(struct link_ea_entry) == 19, " found %lld\n", + LASSERTF((int)sizeof(struct link_ea_entry) == 20, " found %lld\n", (long long)(int)sizeof(struct link_ea_entry)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 0, " found %lld\n", + LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", + (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); + LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); + LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 16, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_reclen)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_reclen) == 2, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_reclen)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 2, " found %lld\n", - (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); - LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 17, " found %lld\n", - (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 19, " found %lld\n", + LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 20, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_name)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_name) == 0, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_name)); } - diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 88c8506..697f917 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1039,18 +1039,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fid *)0)->f_type)); - /* Checks for struct lu_fid_pack */ - LASSERTF((int)sizeof(struct lu_fid_pack) == 17, " found %lld\n", - (long long)(int)sizeof(struct lu_fid_pack)); - LASSERTF((int)offsetof(struct lu_fid_pack, fp_len) == 0, " found %lld\n", - (long long)(int)offsetof(struct lu_fid_pack, fp_len)); - LASSERTF((int)sizeof(((struct lu_fid_pack *)0)->fp_len) == 1, " found %lld\n", - (long long)(int)sizeof(((struct lu_fid_pack *)0)->fp_len)); - LASSERTF((int)offsetof(struct lu_fid_pack, fp_area) == 1, " found %lld\n", - (long long)(int)offsetof(struct lu_fid_pack, fp_area)); - LASSERTF((int)sizeof(((struct lu_fid_pack *)0)->fp_area) == 16, " found %lld\n", - (long long)(int)sizeof(((struct lu_fid_pack *)0)->fp_area)); - /* Checks for struct mds_status_req */ LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n", (long long)(int)sizeof(struct mds_status_req)); @@ -2494,17 +2482,17 @@ void lustre_assert_wire_constants(void) (long long)(int)sizeof(((struct link_ea_header *)0)->padding2)); /* Checks for struct link_ea_entry */ - LASSERTF((int)sizeof(struct link_ea_entry) == 19, " found %lld\n", + LASSERTF((int)sizeof(struct link_ea_entry) == 20, " found %lld\n", (long long)(int)sizeof(struct link_ea_entry)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 0, " found %lld\n", + LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", + (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); + LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); + LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 16, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_reclen)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_reclen) == 2, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_reclen)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 2, " found %lld\n", - (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); - LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 17, " found %lld\n", - (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 19, " found %lld\n", + LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 20, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_name)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_name) == 0, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_name)); -- 1.8.3.1