.load = osd_otable_it_load,
}
};
+
+int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
+ int insert)
+{
+ struct osd_inconsistent_item *oii;
+ struct osd_scrub *scrub = &dev->od_scrub;
+ struct ptlrpc_thread *thread = &scrub->os_thread;
+ int wakeup = 0;
+ ENTRY;
+
+ OBD_ALLOC_PTR(oii);
+ if (unlikely(oii == NULL))
+ RETURN(-ENOMEM);
+
+ CFS_INIT_LIST_HEAD(&oii->oii_list);
+ oii->oii_cache = *oic;
+ oii->oii_insert = insert;
+
+ cfs_spin_lock(&scrub->os_lock);
+ if (unlikely(!thread_is_running(thread))) {
+ cfs_spin_unlock(&scrub->os_lock);
+ OBD_FREE_PTR(oii);
+ RETURN(-EAGAIN);
+ }
+
+ if (cfs_list_empty(&scrub->os_inconsistent_items))
+ wakeup = 1;
+ cfs_list_add_tail(&oii->oii_list, &scrub->os_inconsistent_items);
+ cfs_spin_unlock(&scrub->os_lock);
+
+ if (wakeup != 0)
+ cfs_waitq_broadcast(&thread->t_ctl_waitq);
+
+ RETURN(0);
+}
+
+int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
+ struct osd_inode_id *id)
+{
+ struct osd_scrub *scrub = &dev->od_scrub;
+ struct osd_inconsistent_item *oii;
+ ENTRY;
+
+ cfs_spin_lock(&scrub->os_lock);
+ cfs_list_for_each_entry(oii, &scrub->os_inconsistent_items, oii_list) {
+ if (lu_fid_eq(fid, &oii->oii_cache.oic_fid)) {
+ *id = oii->oii_cache.oic_lid;
+ cfs_spin_unlock(&scrub->os_lock);
+ RETURN(0);
+ }
+ }
+ cfs_spin_unlock(&scrub->os_lock);
+
+ RETURN(-ENOENT);
+}