dnode_t *dn = NULL;
uint64_t zapid;
int rc;
- ENTRY;
+ ENTRY;
if (dev->od_scrub.os_file.sf_param & SP_DRYRUN && !force)
GOTO(log, rc = 0);
rc = osd_zap_remove(dev, zapid, dn, buf, tx);
if (rc == -ENOENT) {
/* It is normal that the unlink thread has removed the
- * OI mapping already. */
+ * OI mapping already.
+ */
rc = 1;
}
break;
uint64_t oid2;
int ops = DTO_INDEX_UPDATE;
int rc;
- ENTRY;
+ ENTRY;
down_write(&scrub->os_rwsem);
scrub->os_new_checked++;
if (val < 0)
lustre_lma_swab(lma);
if (unlikely(lu_fid_eq(&lma->lma_self_fid, fid))) {
- CDEBUG(D_LFSCK, "%s: the FID "DFID" is used by "
- "two objects: %llu and %llu (in OI)\n",
- osd_name(dev), PFID(fid), oid, oid2);
+ rc = -EEXIST;
+ CDEBUG(D_LFSCK,
+ "%s: the FID "DFID" is used by two objects: %llu and %llu (in OI): rc = %d\n",
+ osd_name(dev), PFID(fid), oid, oid2, rc);
- GOTO(out, rc = -EEXIST);
+ GOTO(out, rc);
}
update:
}
/* There may be conflict unlink during the OI scrub,
- * if happend, then remove the new added OI mapping. */
+ * if happend, then remove the new added OI mapping.
+ */
if (ops == DTO_INDEX_INSERT && dn && dn->dn_free_txg)
osd_scrub_refresh_mapping(env, dev, fid, oid,
DTO_INDEX_DELETE, false, NULL);
nvlist_t *nvbuf = NULL;
int size = 0;
int rc = 0;
- ENTRY;
+ ENTRY;
if (CFS_FAIL_CHECK(OBD_FAIL_OSD_SCRUB_DELAY) && cfs_fail_val > 0) {
wait_var_event_timeout(
scrub,
rc = scrub_checkpoint(env, scrub);
if (rc) {
- CDEBUG(D_LFSCK, "%s: fail to checkpoint, pos = %llu: "
- "rc = %d\n", scrub->os_name, scrub->os_pos_current, rc);
+ CDEBUG(D_LFSCK, "%s: fail to checkpoint, pos = %llu: rc = %d\n",
+ scrub->os_name, scrub->os_pos_current, rc);
/* Continue, as long as the scrub itself can go ahead. */
}
struct lu_fid *fid;
uint64_t oid;
int rc = 0, ret;
- ENTRY;
+ ENTRY;
rc = lu_env_init(&env, LCT_LOCAL | LCT_DT_THREAD);
if (rc) {
CDEBUG(D_LFSCK, "%s: OI scrub fail to init env: rc = %d\n",
/* OSP update logs update_log{_dir} use f_seq = FID_SEQ_UPDATE_LOG{_DIR}
* and f_oid = index for their log files. See lu_update_log{_dir}_fid()
- * for more details. */
+ * for more details.
+ */
/* update_log */
{
handle_dirent_t handle_dirent)
{
struct osd_ios_item *item;
+ int rc = 0;
OBD_ALLOC_PTR(item);
if (!item) {
- CWARN("%s: initial OI scrub failed to add item for %llu\n",
- osd_name(dev), parent);
- return -ENOMEM;
+ rc = -ENOMEM;
+ CWARN("%s: initial OI scrub failed to add item for %llu: rc = %d\n",
+ osd_name(dev), parent, rc);
+ return rc;
}
INIT_LIST_HEAD(&item->oii_list);
item->oii_handle_dirent = handle_dirent;
list_add_tail(&item->oii_list, &dev->od_ios_list);
- return 0;
+ return rc;
}
static bool osd_index_need_recreate(const struct lu_env *env,
zap_attribute_t *za = &info->oti_za2;
zap_cursor_t *zc = &info->oti_zc2;
int rc;
- ENTRY;
+ ENTRY;
zap_cursor_init_serialized(zc, dev->od_os, oid, 0);
rc = -zap_cursor_retrieve(zc, za);
zap_cursor_fini(zc);
__u32 keysize = 0;
__u32 recsize = 0;
int rc;
- ENTRY;
+ ENTRY;
rc = __osd_obj2dnode(osd->od_os, oid, &dn);
if (rc == -EEXIST || rc == -ENOENT)
RETURN_EXIT;
struct lu_fid *tgt_fid = &liru->liru_cfid;
struct lu_fid bak_fid;
int rc;
- ENTRY;
+ ENTRY;
lustre_fid2lbx(buf, tgt_fid, bufsize);
rc = -zap_lookup(dev->od_os, dev->od_index_backup_id, buf, 8,
sizeof(*zde) / 8, (void *)zde);
GOTO(log, rc);
/* The OI mapping for index may be invalid, since it will be
- * re-created, not update the OI mapping, just cache it in RAM. */
+ * re-created, not update the OI mapping, just cache it in RAM.
+ */
rc = osd_idc_find_and_init_with_oid(env, dev, tgt_fid,
liru->liru_clid);
if (!rc)
{
struct lustre_scrub *scrub = &dev->od_scrub;
struct scrub_file *sf = &scrub->os_file;
- struct lustre_mdt_attrs *lma = NULL;
+ struct lustre_mdt_attrs *lma = NULL;
nvlist_t *nvbuf = NULL;
struct lu_fid tfid;
uint64_t oid2 = 0;
int size = 0;
int op = 0;
int rc;
- ENTRY;
+ ENTRY;
rc = __osd_xattr_load_by_oid(dev, oid, &nvbuf);
if (unlikely(rc == -ENOENT || rc == -EEXIST))
RETURN(0);
if (rc && rc != -ENODATA) {
- CWARN("%s: initial OI scrub failed to get lma for %llu: "
- "rc = %d\n", osd_name(dev), oid, rc);
+ CWARN("%s: initial OI scrub failed to get lma for %llu: rc = %d\n",
+ osd_name(dev), oid, rc);
RETURN(rc);
}
rc = osd_fid_lookup(env, dev, &tfid, &oid2);
if (rc) {
if (rc != -ENOENT) {
- CWARN("%s: initial OI scrub failed to lookup fid for "
- DFID"=>%llu: rc = %d\n",
+ CWARN("%s: initial OI scrub failed to lookup fid for "DFID"=>%llu: rc = %d\n",
osd_name(dev), PFID(&tfid), oid, rc);
-
RETURN(rc);
}
enum osd_lf_flags flags, bool is_dir)
{
int rc;
- ENTRY;
+ ENTRY;
rc = osd_ios_scan_one(env, dev, NULL, parent, oid, name, 0);
if (!rc && is_dir)
rc = osd_ios_new_item(dev, oid, flags, osd_ios_general_sd,
{
struct lu_fid tfid;
int rc;
- ENTRY;
+ ENTRY;
/* skip any non-DFID format name */
if (name[0] != '[')
RETURN(0);
zap_attribute_t *za = &info->oti_za;
zap_cursor_t *zc = &info->oti_zc;
int rc;
- ENTRY;
+ ENTRY;
zap_cursor_init_serialized(zc, dev->od_os, parent, 0);
rc = -zap_cursor_retrieve(zc, za);
if (rc == -ENOENT)
sizeof(*zde) / za->za_integer_length,
(void *)zde);
if (rc) {
- CWARN("%s: initial OI scrub failed to lookup "
- "%s under %llu: rc = %d\n",
+ CWARN("%s: initial OI scrub failed to lookup %s under %llu: rc = %d\n",
osd_name(dev), za->za_name, parent, rc);
continue;
}
zde->lzd_reg.zde_dnode, flags,
S_ISDIR(DTTOIF(zde->lzd_reg.zde_type)) ?
true : false);
- CDEBUG(D_LFSCK, "%s: initial OI scrub handled %s under "
- "%llu: rc = %d\n",
+ CDEBUG(D_LFSCK,
+ "%s: initial OI scrub handled %s under %llu: rc = %d\n",
osd_name(dev), za->za_name, parent, rc);
}
log:
if (rc)
- CWARN("%s: initial OI scrub failed to scan the directory %llu: "
- "rc = %d\n", osd_name(dev), parent, rc);
+ CWARN("%s: initial OI scrub failed to scan the directory %llu: rc = %d\n",
+ osd_name(dev), parent, rc);
zap_cursor_fini(zc);
return rc;
uint64_t oid;
int rc;
int rc1 = 0;
- ENTRY;
+ ENTRY;
rc = osd_zap_lookup(dev, parent, NULL, dot_lustre_name, 8,
sizeof(*zde) / 8, (void *)zde);
if (rc == -ENOENT) {
/* The .lustre directory is lost. That is not fatal. It can
- * be re-created in the subsequent MDT start processing. */
+ * be re-created in the subsequent MDT start processing.
+ */
RETURN(0);
}
if (rc) {
- CWARN("%s: initial OI scrub failed to find .lustre: "
- "rc = %d\n", osd_name(dev), rc);
+ CWARN("%s: initial OI scrub failed to find .lustre: rc = %d\n",
+ osd_name(dev), rc);
RETURN(rc);
}
struct luz_direntry *zde = &osd_oti_get(env)->oti_zde;
const struct osd_lf_map *map;
int rc;
- ENTRY;
+ ENTRY;
for (map = osd_lf_maps; map->olm_name; map++) {
rc = osd_zap_lookup(dev, dev->od_root, NULL, map->olm_name, 8,
sizeof(*zde) / 8, (void *)zde);
if (rc) {
if (rc != -ENOENT)
- CWARN("%s: initial OI scrub failed "
- "to find the entry %s: rc = %d\n",
+ CWARN("%s: initial OI scrub failed to find the entry %s: rc = %d\n",
osd_name(dev), map->olm_name, rc);
else if (!fid_is_zero(&map->olm_fid))
/* Try to remove the stale OI mapping. */
OBD_ALLOC_LARGE(buf, INDEX_BACKUP_BUFSIZE);
if (!buf)
- CERROR("%s: not enough RAM for rebuild index\n",
- osd_name(dev));
+ CERROR("%s: not enough RAM for rebuild index: rc = %d\n",
+ osd_name(dev), -ENOMEM);
while (!list_empty(&dev->od_index_restore_list)) {
struct lustre_index_restore_unit *liru;
__u32 flags)
{
int rc;
- ENTRY;
+ ENTRY;
if (dev->od_dt_dev.dd_rdonly)
RETURN(-EROFS);
void osd_scrub_stop(struct osd_device *dev)
{
struct lustre_scrub *scrub = &dev->od_scrub;
- ENTRY;
+ ENTRY;
/* od_otable_sem: prevent concurrent start/stop */
down(&dev->od_otable_sem);
spin_lock(&scrub->os_lock);
uint64_t oid;
int rc = 0;
bool dirty = false;
- ENTRY;
+ ENTRY;
memcpy(dev->od_uuid.b,
&dsl_dataset_phys(dev->od_os->os_dsl_dataset)->ds_guid,
sizeof(dsl_dataset_phys(dev->od_os->os_dsl_dataset)->ds_guid));
scrub->os_auto_scrub_interval = interval;
/* 'What the @fid is' is not imporatant, because the object
- * has no OI mapping, and only is visible inside the OSD.*/
+ * has no OI mapping, and only is visible inside the OSD.
+ */
fid->f_seq = FID_SEQ_IGIF_MAX;
if (dev->od_is_ost)
fid->f_oid = ((1 << 31) | dev->od_index) + 1;
struct osd_otable_it *it;
__u32 start = 0;
int rc;
- ENTRY;
+ ENTRY;
if (dev->od_dt_dev.dd_rdonly)
RETURN(ERR_PTR(-EROFS));
/* XXX: dmu_object_next() does NOT find dnodes allocated
* in the current non-committed txg, so we force txg
- * commit to find all existing dnodes ... */
+ * commit to find all existing dnodes ...
+ */
txg_wait_synced(dmu_objset_pool(dev->od_os), 0ULL);
dev->od_otable_it = it;
int rc;
/* can go negative on the very first access to the iterator
- * or if some non-Lustre objects were found */
+ * or if some non-Lustre objects were found
+ */
if (unlikely(it->ooi_prefetched < 0))
it->ooi_prefetched = 0;
nvlist_t *nvbuf = NULL;
int rc, size = 0;
bool locked;
- ENTRY;
+ ENTRY;
LASSERT(it->ooi_user_ready);
fid_zero(&it->ooi_fid);
(uchar_t **)&lma, &size);
if (rc || size == 0)
/* It is either non-Lustre object or OSD internal object,
- * ignore it, go ahead */
+ * ignore it, go ahead
+ */
goto again;
LASSERTF(lma != NULL, "corrupted LMA, size %d\n", size);
struct osd_device *dev = it->ooi_dev;
struct lustre_scrub *scrub = &dev->od_scrub;
int rc;
- ENTRY;
+ ENTRY;
/* Forbid to set iteration position after iteration started. */
if (it->ooi_user_ready)
RETURN(-EPERM);
if (hash > OSD_OTABLE_MAX_HASH)
hash = OSD_OTABLE_MAX_HASH;
- /* The hash is the last checkpoint position,
- * we will start from the next one. */
+ /* The hash is the last checkpoint position, start from the next one. */
it->ooi_pos = hash + 1;
it->ooi_prefetched = 0;
it->ooi_prefetched_dnode = 0;
struct lustre_scrub *scrub = &dev->od_scrub;
struct osd_inconsistent_item *oii;
bool wakeup = false;
- ENTRY;
+ ENTRY;
osd_idc_find_and_init_with_oid(env, dev, fid, oid);
OBD_ALLOC_PTR(oii);
if (unlikely(!oii))
struct lustre_scrub *scrub = &dev->od_scrub;
struct osd_inconsistent_item *oii;
int ret = -ENOENT;
- ENTRY;
+ ENTRY;
spin_lock(&scrub->os_lock);
list_for_each_entry(oii, &scrub->os_inconsistent_items, oii_list) {
if (lu_fid_eq(fid, &oii->oii_cache.oic_fid)) {
GOTO(out, rc);
if (nlink <= 1) {
- CERROR("%s: multi-link file O/%s/%s/%s has nlink %llu\n",
+ rc = 0;
+ CERROR("%s: multi-link file O/%s/%s/%s has nlink %llu: rc = %d\n",
osd_name(dev), info->oti_seq_name, info->oti_dir_name,
- name, nlink);
- GOTO(out, rc = 0);
+ name, nlink, rc);
+ GOTO(out, rc);
}
tx = dmu_tx_create(dev->od_os);
if (!tx) {
- CERROR("%s: fail to create tx to remove multi-link file!\n",
- osd_name(dev));
- GOTO(out, rc = -ENOMEM);
+ rc = -ENOMEM;
+ CERROR("%s: fail to create tx to remove multi-link file!: rc = %d\n",
+ osd_name(dev), rc);
+ GOTO(out, rc);
}
dmu_tx_hold_zap(tx, dir, FALSE, NULL);