* unexpected reason, we should be able to detect it later by calling
* do_create->osd_oi_insert()
*/
- if (conf != NULL && (conf->loc_flags & LOC_F_NEW) != 0)
+ if (conf != NULL && conf->loc_flags & LOC_F_NEW)
GOTO(out, result = 0);
/* Search order: 3. OI files. */
result = osd_oi_lookup(info, dev, fid, id, true);
if (result == -ENOENT) {
- if (!fid_is_norm(fid) ||
+ if (!fid_is_norm(fid) || fid_is_on_ost(info, dev, fid) ||
!ldiskfs_test_bit(osd_oi_fid2idx(dev,fid),
sf->sf_oi_bitmap))
GOTO(out, result = 0);
osd_trans_exec_op(env, handle, OSD_OT_ATTR_SET);
+ if (OBD_FAIL_CHECK(OBD_FAIL_OSD_FID_MAPPING)) {
+ struct osd_thread_info *oti = osd_oti_get(env);
+ const struct lu_fid *fid0 = lu_object_fid(&dt->do_lu);
+ struct lu_fid *fid1 = &oti->oti_fid;
+ struct osd_inode_id *id = &oti->oti_id;
+ struct iam_path_descr *ipd;
+ struct iam_container *bag;
+ struct osd_thandle *oh;
+ int rc;
+
+ fid_cpu_to_be(fid1, fid0);
+ memset(id, 1, sizeof(*id));
+ bag = &osd_fid2oi(osd_dev(dt->do_lu.lo_dev),
+ fid0)->oi_dir.od_container;
+ ipd = osd_idx_ipd_get(env, bag);
+ if (unlikely(ipd == NULL))
+ RETURN(-ENOMEM);
+
+ oh = container_of0(handle, struct osd_thandle, ot_super);
+ rc = iam_update(oh->ot_handle, bag, (const struct iam_key *)fid1,
+ (const struct iam_rec *)id, ipd);
+ osd_ipd_put(env, bag, ipd);
+ return(rc > 0 ? 0 : rc);
+ }
+
inode = obj->oo_inode;
ll_vfs_dq_init(inode);
osd_trans_declare_op(env, oh, OSD_OT_CREATE,
osd_dto_credits_noquota[DTO_OBJECT_CREATE]);
- /* XXX: So far, only normal fid needs be inserted into the oi,
- * things could be changed later. Revise following code then. */
- if (fid_is_norm(lu_object_fid(&dt->do_lu)) &&
- !fid_is_on_ost(osd_oti_get(env), osd_dt_dev(handle->th_dev),
- lu_object_fid(&dt->do_lu))) {
+ if (!fid_is_on_ost(osd_oti_get(env), osd_dt_dev(handle->th_dev),
+ lu_object_fid(&dt->do_lu)))
/* Reuse idle OI block may cause additional one OI block
* to be changed. */
osd_trans_declare_op(env, oh, OSD_OT_INSERT,
osd_dto_credits_noquota[DTO_INDEX_INSERT] + 1);
- }
+
/* If this is directory, then we expect . and .. to be inserted as
* well. The one directory block always needs to be created for the
* directory, so we could use DTO_WRITE_BASE here (GDT, block bitmap,
osd_trans_declare_op(env, oh, OSD_OT_DELETE,
osd_dto_credits_noquota[DTO_OBJECT_DELETE]);
- /* XXX: So far, only normal fid needs to be inserted into the OI,
- * so only normal fid needs to be removed from the OI also.
- * Recycle idle OI leaf may cause additional three OI blocks
+ /* Recycle idle OI leaf may cause additional three OI blocks
* to be changed. */
osd_trans_declare_op(env, oh, OSD_OT_DESTROY,
- fid_is_norm(lu_object_fid(&dt->do_lu)) ?
- osd_dto_credits_noquota[DTO_INDEX_DELETE] + 3 : 0);
+ osd_dto_credits_noquota[DTO_INDEX_DELETE] + 3);
/* one less inode */
rc = osd_declare_inode_qid(env, inode->i_uid, inode->i_gid, -1, oh,
void osd_get_ldiskfs_dirent_param(struct ldiskfs_dentry_param *param,
const struct dt_rec *fid)
{
- /* XXX: replace the check with "!fid_is_client_mdt_visible()"
- * when FID in OI file introduced for local object. */
- if (!fid_is_norm((const struct lu_fid *)fid) &&
- !fid_is_igif((const struct lu_fid *)fid)) {
+ if (!fid_is_client_mdt_visible((const struct lu_fid *)fid)) {
param->edp_magic = 0;
return;
}
}
/**
- * Try to read the fid from inode ea into dt_rec, if return value
- * i.e. rc is +ve, then we got fid, otherwise we will have to form igif
+ * Try to read the fid from inode ea into dt_rec.
*
* \param fid object fid.
*
osd_trans_declare_rb(env, th, OSD_OT_REF_ADD);
result = __osd_object_create(info, obj, attr, hint, dof, th);
- /* objects under osd root shld have igif fid, so dont add fid EA */
- /* For ost object, the fid will be stored during first write */
- if (result == 0 && fid_seq(fid) >= FID_SEQ_NORMAL &&
- !fid_is_on_ost(info, osd_dt_dev(th->th_dev), fid))
+ if ((result == 0) &&
+ (fid_is_last_id(fid) ||
+ !fid_is_on_ost(info, osd_dt_dev(th->th_dev), fid)))
result = osd_ea_fid_set(info, obj->oo_inode, fid);
if (result == 0)
oic->oic_lid = *id;
oic->oic_fid = *fid;
if ((scrub->os_pos_current <= ino) &&
- (sf->sf_flags & SF_INCONSISTENT ||
+ ((sf->sf_flags & SF_INCONSISTENT) ||
+ (sf->sf_flags & SF_UPGRADE && fid_is_igif(fid)) ||
ldiskfs_test_bit(osd_oi_fid2idx(dev, fid),
sf->sf_oi_bitmap)))
osd_consistency_check(oti, dev, oic);
oic->oic_lid = *id;
oic->oic_fid = *fid;
if ((scrub->os_pos_current <= ino) &&
- (sf->sf_flags & SF_INCONSISTENT ||
+ ((sf->sf_flags & SF_INCONSISTENT) ||
+ (sf->sf_flags & SF_UPGRADE && fid_is_igif(fid)) ||
ldiskfs_test_bit(osd_oi_fid2idx(dev, fid), sf->sf_oi_bitmap)))
osd_consistency_check(oti, dev, oic);