sf->sf_items_updated = 0;
sf->sf_items_failed = 0;
sf->sf_items_updated_prior = 0;
+ sf->sf_items_noscrub = 0;
+ sf->sf_items_igif = 0;
}
static int osd_scrub_file_load(struct osd_scrub *scrub)
osd_scrub_file_to_le(&scrub->os_file_disk, &scrub->os_file);
rc = osd_ldiskfs_write_record(scrub->os_inode, &scrub->os_file_disk,
- len, &pos, jh);
+ len, 0, &pos, jh);
ldiskfs_journal_stop(jh);
if (rc != 0)
CERROR("%.16s: fail to store scrub file, expected = %d, "
#define SCRUB_NEXT_WAIT 4 /* wait for free cache slot */
#define SCRUB_NEXT_CRASH 5 /* simulate system crash during OI scrub */
#define SCRUB_NEXT_FATAL 6 /* simulate failure during OI scrub */
+#define SCRUB_NEXT_NOSCRUB 7 /* new created object, no scrub on it */
+#define SCRUB_NEXT_IGIF 8 /* IGIF object */
struct osd_iit_param {
struct super_block *sb;
if (rc != 0)
return rc;
- if (!fid_is_norm(fid) || inode->i_state & I_LUSTRE_NOSCRUB)
- rc = SCRUB_NEXT_CONTINUE;
+ if (inode->i_state & I_LUSTRE_NOSCRUB) {
+ /* Only skip it for the first OI scrub accessing. */
+ inode->i_state &= ~I_LUSTRE_NOSCRUB;
+ rc = SCRUB_NEXT_NOSCRUB;
+ } else if (!fid_is_norm(fid)) {
+ rc = SCRUB_NEXT_IGIF;
+ }
+
iput(inode);
return rc;
}
{
struct l_wait_info lwi = { 0 };
struct osd_scrub *scrub = &dev->od_scrub;
+ struct scrub_file *sf = &scrub->os_file;
+ __u64 *items = NULL;
struct ptlrpc_thread *thread = &scrub->os_thread;
struct osd_otable_it *it = dev->od_otable_it;
struct osd_otable_cache *ooc = it ? &it->ooi_cache : NULL;
goto next;
case SCRUB_NEXT_WAIT:
goto wait;
+ case SCRUB_NEXT_NOSCRUB:
+ items = &sf->sf_items_noscrub;
+ break;
+ case SCRUB_NEXT_IGIF:
+ items = &sf->sf_items_igif;
+ break;
+ }
+
+ if (items != NULL) {
+ cfs_down_write(&scrub->os_rwsem);
+ scrub->os_new_checked++;
+ (*items)++;
+ cfs_up_write(&scrub->os_rwsem);
+ goto next;
}
LASSERTF(rc <= 0, "unexpected rc = %d\n", rc);
}
cfs_spin_unlock(&scrub->os_lock);
+ if (scrub->os_file.sf_status == SS_COMPLETED)
+ flags |= SS_RESET;
+
scrub->os_start_flags = flags;
thread_set_flags(thread, 0);
rc = cfs_create_thread(osd_scrub_main, dev, 0);
int osd_scrub_start(struct osd_device *dev)
{
- __u32 flags = SS_AUTO;
- int rc;
+ int rc;
ENTRY;
- if (dev->od_scrub.os_file.sf_status == SS_COMPLETED)
- flags |= SS_RESET;
-
/* od_otable_mutex: prevent curcurrent start/stop */
cfs_mutex_lock(&dev->od_otable_mutex);
- rc = do_osd_scrub_start(dev, flags);
+ rc = do_osd_scrub_start(dev, SS_AUTO);
cfs_mutex_unlock(&dev->od_otable_mutex);
RETURN(rc == -EALREADY ? 0 : rc);
cfs_init_rwsem(&scrub->os_rwsem);
cfs_spin_lock_init(&scrub->os_lock);
CFS_INIT_LIST_HEAD(&scrub->os_inconsistent_items);
- if (get_mount_flags(dev->od_mount->lmi_sb) & LMD_FLG_NOSCRUB)
- scrub->os_no_scrub = 1;
push_ctxt(&saved, ctxt, NULL);
filp = filp_open(osd_scrub_name, O_RDWR | O_CREAT, 0644);
}
}
- if (rc == 0 && !scrub->os_no_scrub &&
+ if (rc == 0 && !dev->od_noscrub &&
((sf->sf_status == SS_PAUSED) ||
(sf->sf_status == SS_CRASHED &&
sf->sf_flags & (SF_RECREATED | SF_INCONSISTENT | SF_AUTO)) ||
"updated: "LPU64"\n"
"failed: "LPU64"\n"
"prior_updated: "LPU64"\n"
+ "noscrub: "LPU64"\n"
+ "igif: "LPU64"\n"
"success_count: %u\n",
checked, sf->sf_items_updated, sf->sf_items_failed,
- sf->sf_items_updated_prior, sf->sf_success_count);
+ sf->sf_items_updated_prior, sf->sf_items_noscrub,
+ sf->sf_items_igif, sf->sf_success_count);
if (rc <= 0)
goto out;