+static void osd_take_care_of_agent(const struct lu_env *env,
+ struct osd_device *osd,
+ struct osd_thandle *oh,
+ struct ldiskfs_dir_entry_2 *de)
+{
+ struct lu_fid *fid = &osd_oti_get(env)->oti_fid;
+ struct osd_idmap_cache *idc;
+ int rc, schedule = 0;
+
+ LASSERT(de != NULL);
+
+ rc = osd_get_fid_from_dentry(de, (struct dt_rec *)fid);
+ if (likely(rc == 0)) {
+ idc = osd_idc_find_or_init(env, osd, fid);
+ if (IS_ERR(idc) || idc->oic_remote)
+ schedule = 1;
+ } else if (rc == -ENODATA) {
+ /* can't get FID, postpone to the end of the
+ * transaction when iget() is safe */
+ schedule = 1;
+ } else {
+ CERROR("%s: can't get FID: rc = %d\n", osd_name(osd), rc);
+ }
+ if (schedule)
+ osd_schedule_agent_inode_removal(env, oh,
+ le32_to_cpu(de->inode));
+}
+