/* We don't actually have direct access to the zap_hashbits() function
* so just pretend like we do for now. If this ever breaks we can look at
- * it at that time. */
+ * it at that time.
+ */
#define zap_hashbits(zc) 48
/*
* ZFS hash format:
uint64_t dirhash)
{
struct osd_device *d = osd_obj2dev(o);
+
osd_zap_cursor_init_serialized(zc, d->od_os,
o->oo_dn->dn_object, dirhash);
}
uint64_t dirhash)
{
struct osd_device *d = osd_obj2dev(o);
+
return osd_zap_cursor_init(zc, d->od_os, o->oo_dn->dn_object, dirhash);
}
struct osd_object *obj = osd_dt_obj(dt);
struct lu_object *lo = &dt->do_lu;
int rc;
- ENTRY;
+ ENTRY;
if (obj->oo_destroyed)
RETURN(ERR_PTR(-ENOENT));
{
struct osd_zap_it *it = (struct osd_zap_it *)di;
struct osd_object *obj;
- ENTRY;
+ ENTRY;
LASSERT(it);
LASSERT(it->ozi_obj);
static void osd_index_it_put(const struct lu_env *env, struct dt_it *di)
{
/* PBS: do nothing : ref are incremented at retrive and decreamented
- * next/finish. */
+ * next/finish.
+ */
}
static inline void osd_it_append_attrs(struct lu_dirent *ent, __u32 attr,
int len, __u16 type)
{
- const unsigned align = sizeof(struct luda_type) - 1;
+ const unsigned int align = sizeof(struct luda_type) - 1;
struct luda_type *lt;
/* check if file type is required */
uint64_t xattr = ZFS_NO_OBJECT;
int size = 0;
int rc;
- ENTRY;
+ ENTRY;
rc = __osd_xattr_load_by_oid(osd, oid, &sa_xattr);
if (rc == -ENOENT)
goto regular;
lustre_lma_swab(lma);
if (unlikely((lma->lma_incompat & ~LMA_INCOMPAT_SUPP) ||
CFS_FAIL_CHECK(OBD_FAIL_OSD_LMA_INCOMPAT))) {
- CWARN("%s: unsupported incompat LMA feature(s) %#x for "
- "oid = %#llx\n", osd->od_svname,
- lma->lma_incompat & ~LMA_INCOMPAT_SUPP, oid);
- GOTO(out, rc = -EOPNOTSUPP);
+ rc = -EOPNOTSUPP;
+ CWARN("%s: unsupported incompat LMA feature(s) %#x for oid = %#llx: rc = %d\n",
+ osd->od_svname, lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
+ oid, rc);
+ GOTO(out, rc);
} else {
*fid = lma->lma_self_fid;
GOTO(out, rc = 0);
struct osd_device *osd = osd_obj2dev(obj);
uint64_t dnode = ZFS_NO_OBJECT;
int rc;
- ENTRY;
+ ENTRY;
/* first of all, get parent dnode from own attributes */
rc = osd_sa_handle_get(obj);
if (rc != 0)
struct link_ea_entry *lee;
struct lu_buf buf;
int rc;
- ENTRY;
+ ENTRY;
buf.lb_buf = osd_oti_get(env)->oti_buf;
buf.lb_len = sizeof(osd_oti_get(env)->oti_buf);
#if 0
/* this block can be enabled for additional verification
- * it's trying to match FID from LinkEA vs. FID from LMA */
+ * it's trying to match FID from LinkEA vs. FID from LMA
+ */
if (rc == 0) {
struct lu_fid fid2;
+
int rc2;
+
rc2 = osd_find_parent_by_dnode(env, o, &fid2, oid);
if (rc2 == 0)
if (lu_fid_eq(fid, &fid2) == 0)
struct lmv_mds_md_v1 *lmv = NULL;
int size;
int rc;
- ENTRY;
+ ENTRY;
rc = __osd_xattr_load_by_oid(osd, oid, &nvbuf);
if (rc == -ENOENT || rc == -EEXIST || rc == -ENODATA)
RETURN(0);
GOTO(out_zc, rc = 0);
if (rc) {
- CERROR("%s: fail to locate next for check LMV "
- DFID"(%llu): rc = %d\n",
+ CERROR("%s: fail to locate next for check LMV "DFID"(%llu): rc = %d\n",
osd_name(osd), PFID(fid), oid, rc);
GOTO(out_zc, rc);
}
sizeof(*zde) / za->za_integer_length,
(void *)zde);
if (rc) {
- CERROR("%s: fail to lookup for check LMV "
- DFID"(%llu): rc = %d\n",
+ CERROR("%s: fail to lookup for check LMV "DFID"(%llu): rc = %d\n",
osd_name(osd), PFID(fid), oid, rc);
GOTO(out_zc, rc);
}
/* There is race condition between osd_oi_lookup and OI scrub.
* The OI scrub finished just after osd_oi_lookup() failure.
* Under such case, it is unnecessary to trigger OI scrub again,
- * but try to call osd_oi_lookup() again. */
+ * but try to call osd_oi_lookup() again.
+ */
if (unlikely(rc == -EAGAIN))
goto again;
char *name = (char *)key;
uint64_t oid = ZFS_NO_OBJECT;
int rc;
- ENTRY;
+ ENTRY;
if (name[0] == '.') {
if (name[1] == 0) {
const struct lu_fid *f = lu_object_fid(&dt->do_lu);
+
memcpy(rec, f, sizeof(*f));
RETURN(1);
} else if (name[1] == '.' && name[2] == 0) {
dnode_t *dn = NULL;
sa_handle_t *hdl;
int rc = 0;
- ENTRY;
+ ENTRY;
if (CFS_FAIL_CHECK(OBD_FAIL_LFSCK_NO_AGENTOBJ))
RETURN(0);
GOTO(out, rc);
la->la_valid = LA_TYPE | LA_MODE;
- la->la_mode = (DTTOIF(zde->lzd_reg.zde_type) & S_IFMT) |
- S_IRUGO | S_IWUSR | S_IXUGO;
+ la->la_mode = (DTTOIF(zde->lzd_reg.zde_type) & S_IFMT) | 0755;
if (S_ISDIR(la->la_mode))
rc = __osd_zap_create(env, osd, &dn, tx, la,
};
int size = 0;
int rc;
- ENTRY;
+ ENTRY;
if (CFS_FAIL_CHECK(OBD_FAIL_LFSCK_NO_AGENTENT))
RETURN(0);
rc = osd_xattr_get_internal(env, obj, &buf, XATTR_NAME_LMA, &size);
if (rc) {
- CWARN("%s: fail to load LMA for adding "
- DFID" to remote parent: rc = %d\n",
+ CWARN("%s: fail to load LMA for adding "DFID" to remote parent: rc = %d\n",
osd_name(osd), PFID(fid), rc);
RETURN(rc);
}
rc = osd_xattr_set_internal(env, obj, &buf, XATTR_NAME_LMA,
LU_XATTR_REPLACE, oh);
if (rc) {
- CWARN("%s: fail to update LMA for adding "
- DFID" to remote parent: rc = %d\n",
+ CWARN("%s: fail to update LMA for adding "DFID" to remote parent: rc = %d\n",
osd_name(osd), PFID(fid), rc);
RETURN(rc);
}
};
int size = 0;
int rc;
- ENTRY;
+ ENTRY;
osd_fid2str(name, fid, sizeof(info->oti_str));
rc = osd_zap_remove(osd, osd->od_remote_parent_dir, NULL,
name, oh->ot_tx);
if (unlikely(rc == -ENOENT))
rc = 0;
if (rc)
- CERROR("%s: fail to remove entry under remote "
- "parent for "DFID": rc = %d\n",
+ CERROR("%s: fail to remove entry under remote parent for "DFID": rc = %d\n",
osd_name(osd), PFID(fid), rc);
if (destroy || rc)
rc = osd_xattr_get_internal(env, obj, &buf, XATTR_NAME_LMA, &size);
if (rc) {
- CERROR("%s: fail to load LMA for removing "
- DFID" from remote parent: rc = %d\n",
+ CERROR("%s: fail to load LMA for removing "DFID" from remote parent: rc = %d\n",
osd_name(osd), PFID(fid), rc);
RETURN(rc);
}
rc = osd_xattr_set_internal(env, obj, &buf, XATTR_NAME_LMA,
LU_XATTR_REPLACE, oh);
if (rc)
- CERROR("%s: fail to update LMA for removing "
- DFID" from remote parent: rc = %d\n",
+ CERROR("%s: fail to update LMA for removing "DFID" from remote parent: rc = %d\n",
osd_name(osd), PFID(fid), rc);
else
lu_object_clear_agent_entry(&obj->oo_dt.do_lu);
struct osd_thandle *oh;
uint64_t object;
struct osd_idmap_cache *idc;
- ENTRY;
+ ENTRY;
rec1 = (struct dt_insert_rec *)rec;
fid = rec1->rec_fid;
LASSERT(fid != NULL);
if (name[0] != '.' || name[1] != '.' || name[2] != 0) {
/* Prepare agent object for remote entry that will
* be used for operations via ZPL, such as MDT side
- * file-level backup and restore. */
+ * file-level backup and restore.
+ */
dmu_tx_hold_sa_create(oh->ot_tx,
osd_find_dnsize(osd, OSD_BASE_EA_IN_BONUS));
if (S_ISDIR(rec1->rec_type))
/* do not specify the key as then DMU is trying to look it up
* which is very expensive. usually the layers above lookup
- * before insertion */
+ * before insertion
+ */
osd_tx_hold_zap(oh->ot_tx, object, obj->oo_dn, TRUE, NULL);
RETURN(0);
struct lu_seq_range *range = &osd_oti_get(env)->oti_seq_range;
struct seq_server_site *ss = osd_seq_site(osd);
int rc;
- ENTRY;
+ ENTRY;
LASSERT(ss != NULL);
LASSERT(ss->ss_server_fld != NULL);
rc = osd_fld_lookup(env, osd, seq, range);
if (rc != 0) {
if (rc != -ENOENT)
- CERROR("%s: Can not lookup fld for %#llx\n",
- osd_name(osd), seq);
+ CERROR("%s: Can not lookup fld for %#llx: rc = %d\n",
+ osd_name(osd), seq, rc);
RETURN(0);
}
const struct lu_fid *fid)
{
struct seq_server_site *ss = osd_seq_site(osd);
- ENTRY;
+ ENTRY;
/* FID seqs not in FLDB, must be local seq */
if (unlikely(!fid_seq_in_fldb(fid_seq(fid))))
RETURN(0);
/* If FLD is not being initialized yet, it only happens during the
* initialization, likely during mgs initialization, and we assume
- * this is local FID. */
+ * this is local FID.
+ */
if (ss == NULL || ss->ss_server_fld == NULL)
RETURN(0);
struct luz_direntry *zde = &oti->oti_zde;
int num = sizeof(*zde) / 8;
int rc;
- ENTRY;
+ ENTRY;
LASSERT(parent->oo_dn);
LASSERT(dt_object_exists(dt));
* FID is missing in OI cache. we better do not
* lookup FID in FLDB/OI and don't risk to deadlock,
* but in some special cases (lfsck testing, etc)
- * it's much simpler than fixing a caller */
+ * it's much simpler than fixing a caller
+ */
idc = osd_idc_find_or_init(env, osd, fid);
if (IS_ERR(idc)) {
CERROR("%s: "DFID" wasn't declared for insert\n",
if (idc->oic_remote) {
if (name[0] != '.' || name[1] != '.' || name[2] != 0) {
/* Create agent inode for remote object that will
- * be used for MDT file-level backup and restore. */
+ * be used for MDT file-level backup and restore.
+ */
rc = osd_create_agent_object(env, osd, zde,
parent->oo_dn->dn_object, oh->ot_tx);
if (rc) {
- CWARN("%s: Fail to create agent object for "
- DFID": rc = %d\n",
+ CWARN("%s: Fail to create agent object for "DFID": rc = %d\n",
osd_name(osd), PFID(fid), rc);
/* Ignore the failure since the system can go
* ahead if we do not care about the MDT side
- * file-level backup and restore. */
+ * file-level backup and restore.
+ */
rc = 0;
}
}
if (name[0] == '.') {
if (name[1] == 0) {
/* do not store ".", instead generate it
- * during iteration */
+ * during iteration
+ */
GOTO(out, rc = 0);
} else if (name[1] == '.' && name[2] == 0) {
uint64_t dnode = idc->oic_dnode;
+
if (CFS_FAIL_CHECK(OBD_FAIL_LFSCK_BAD_PARENT))
dnode--;
/* update parent dnode in the child.
- * later it will be used to generate ".." */
+ * later it will be used to generate ".."
+ */
rc = osd_object_sa_update(parent,
SA_ZPL_PARENT(osd),
&dnode, 8, oh);
zde->lzd_fid.f_ver = ~0;
/* The logic is not related with IGIF, just re-use the fail_loc value
- * to be consistent with ldiskfs case, then share the same test logic */
+ * to be consistent with ldiskfs case, then share the same test logic
+ */
if (CFS_FAIL_CHECK(OBD_FAIL_FID_IGIF))
num = 1;
dnode_t *zap_dn = obj->oo_dn;
struct osd_thandle *oh;
const char *name = (const char *)key;
- ENTRY;
+ ENTRY;
LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
LASSERT(zap_dn != NULL);
/* do not specify the key as then DMU is trying to look it up
* which is very expensive. usually the layers above lookup
- * before deletion */
+ * before deletion
+ */
osd_tx_hold_zap(oh->ot_tx, zap_dn->dn_object, zap_dn, FALSE, NULL);
/* For destroying agent object if have. */
dnode_t *zap_dn = obj->oo_dn;
char *name = (char *)key;
int rc;
- ENTRY;
+ ENTRY;
LASSERT(zap_dn);
LASSERT(th != NULL);
* request as now). we preserve them for backward compatibility
*/
if (name[0] == '.') {
- if (name[1] == 0) {
+ if (name[1] == 0)
RETURN(0);
- } else if (name[1] == '.' && name[2] == 0) {
+ else if (name[1] == '.' && name[2] == 0)
RETURN(0);
- }
}
/* XXX: We have to say that lookup during delete_declare will affect
* the lookup conditionally.
* 2) Enhance the ZFS logic to recognize the OSD lookup result
* and delete the given entry directly without lookup again
- * internally. LU-10190 */
+ * internally. LU-10190
+ */
memset(&zde->lzd_fid, 0, sizeof(zde->lzd_fid));
rc = osd_zap_lookup(osd, zap_dn->dn_object, zap_dn, name, 8, 3, zde);
if (unlikely(rc)) {
rc = -dmu_object_free(osd->od_os, zde->lzd_reg.zde_dnode,
oh->ot_tx);
if (rc)
- CERROR("%s: failed to destroy agent object (%llu) "
- "for the entry %s: rc = %d\n", osd->od_svname,
- (__u64)zde->lzd_reg.zde_dnode, name, rc);
+ CERROR("%s: failed to destroy agent object (%llu) for the entry %s: rc = %d\n",
+ osd->od_svname, (__u64)zde->lzd_reg.zde_dnode,
+ name, rc);
}
/* Remove key from the ZAP */
struct osd_object *obj = it->ozi_obj;
char *name = (char *)key;
int rc;
- ENTRY;
+ ENTRY;
LASSERT(it);
LASSERT(it->ozi_zc);
/* neither . nor .. - some real record */
it->ozi_pos = OZI_POS_REAL;
- rc = +1;
+ rc = 1;
out:
RETURN(rc);
static void osd_dir_it_put(const struct lu_env *env, struct dt_it *di)
{
/* PBS: do nothing : ref are incremented at retrive and decreamented
- * next/finish. */
+ * next/finish.
+ */
}
/*
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
- ENTRY;
+ ENTRY;
/* temp. storage should be enough for any key supported by ZFS */
BUILD_BUG_ON(sizeof(za->za_name) > sizeof(it->ozi_name));
it->ozi_pos++;
if (it->ozi_pos <= OZI_POS_DOTDOT)
RETURN(0);
-
} else {
zap_cursor_advance(it->ozi_zc);
}
struct osd_zap_it *it = (struct osd_zap_it *)di;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc = 0;
- ENTRY;
+ ENTRY;
if (it->ozi_pos <= OZI_POS_DOT) {
it->ozi_pos = OZI_POS_DOT;
RETURN((struct dt_key *)".");
RETURN((struct dt_key *)"..");
}
- if ((rc = -zap_cursor_retrieve(it->ozi_zc, za)))
+ rc = -zap_cursor_retrieve(it->ozi_zc, za);
+ if (rc)
RETURN(ERR_PTR(rc));
strcpy(it->ozi_name, za->za_name);
struct osd_zap_it *it = (struct osd_zap_it *)di;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
- ENTRY;
+ ENTRY;
if (it->ozi_pos <= OZI_POS_DOT) {
it->ozi_pos = OZI_POS_DOT;
RETURN(2);
RETURN(3);
}
- if ((rc = -zap_cursor_retrieve(it->ozi_zc, za)) == 0)
+ rc = -zap_cursor_retrieve(it->ozi_zc, za);
+ if (rc == 0)
rc = strlen(za->za_name);
RETURN(rc);
{
dmu_tx_t *tx;
int rc;
- ENTRY;
+ ENTRY;
tx = dmu_tx_create(dev->od_os);
if (!tx)
RETURN(-ENOMEM);
{
dmu_tx_t *tx = NULL;
int rc = 0;
- ENTRY;
+ ENTRY;
if (attr & LUDA_VERIFY_DRYRUN)
GOTO(out, rc = 0);
struct lu_fid *fid = &info->oti_fid;
struct osd_device *osd = osd_obj2dev(it->ozi_obj);
int rc, namelen;
- ENTRY;
+ ENTRY;
lde->lde_attrs = 0;
if (it->ozi_pos <= OZI_POS_DOT) {
/* notice hash=0 here, this is needed to avoid
* case when some real entry (after ./..) may
* have hash=0. in this case the client would
- * be confused having records out of hash order. */
+ * be confused having records out of hash order.
+ */
lde->lde_hash = cpu_to_le64(0);
strcpy(lde->lde_name, ".");
lde->lde_namelen = cpu_to_le16(1);
osd_remote_fid(env, osd, &zde->lzd_fid) > 0 &&
attr & LUDA_VERIFY)) {
/* It is mainly used for handling the MDT
- * upgraded from old ZFS based backend. */
+ * upgraded from old ZFS based backend.
+ */
rc = osd_update_entry_for_agent(env, osd,
it->ozi_obj->oo_dn->dn_object,
za->za_name, zde, attr);
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
size_t namelen = 0;
int rc;
- ENTRY;
+ ENTRY;
if (it->ozi_pos <= OZI_POS_DOT)
namelen = 1;
else if (it->ozi_pos == OZI_POS_DOTDOT)
{
struct osd_zap_it *it = (struct osd_zap_it *)di;
__u64 pos;
- ENTRY;
+ ENTRY;
if (it->ozi_pos <= OZI_POS_DOTDOT)
pos = 0;
else
struct osd_object *obj = it->ozi_obj;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
- ENTRY;
+ ENTRY;
/* reset the cursor */
zap_cursor_fini(it->ozi_zc);
osd_obj_cursor_init_serialized(it->ozi_zc, obj, hash);
if (hash == 0) {
it->ozi_pos = OZI_POS_INIT;
- rc = +1; /* there will be ./.. at least */
+ rc = 1; /* there will be ./.. at least */
} else {
it->ozi_pos = OZI_POS_REAL;
/* to return whether the end has been reached */
rc = osd_index_retrieve_skip_dots(it, za);
if (rc == 0)
- rc = +1;
+ rc = 1;
else if (rc == -ENOENT)
rc = 0;
}
struct osd_device *osd = osd_obj2dev(obj);
__u64 *k = osd_oti_get(env)->oti_key64;
int rc;
- ENTRY;
+ ENTRY;
rc = osd_prepare_key_uint64(obj, k, key);
rc = -zap_lookup_uint64(osd->od_os, obj->oo_dn->dn_object,
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
- ENTRY;
+ ENTRY;
LASSERT(th != NULL);
oh = container_of(th, struct osd_thandle, ot_super);
/* do not specify the key as then DMU is trying to look it up
* which is very expensive. usually the layers above lookup
- * before insertion */
+ * before insertion
+ */
osd_tx_hold_zap(oh->ot_tx, obj->oo_dn->dn_object, obj->oo_dn,
TRUE, NULL);
struct osd_thandle *oh;
__u64 *k = osd_oti_get(env)->oti_key64;
int rc;
- ENTRY;
+ ENTRY;
LASSERT(obj->oo_dn);
LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
- ENTRY;
+ ENTRY;
LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
LASSERT(th != NULL);
/* do not specify the key as then DMU is trying to look it up
* which is very expensive. usually the layers above lookup
- * before deletion */
+ * before deletion
+ */
osd_tx_hold_zap(oh->ot_tx, obj->oo_dn->dn_object, obj->oo_dn,
FALSE, NULL);
struct osd_thandle *oh;
__u64 *k = osd_oti_get(env)->oti_key64;
int rc;
- ENTRY;
+ ENTRY;
LASSERT(obj->oo_dn);
LASSERT(th != NULL);
oh = container_of(th, struct osd_thandle, ot_super);
struct osd_zap_it *it = (struct osd_zap_it *)di;
struct osd_object *obj = it->ozi_obj;
struct osd_device *osd = osd_obj2dev(obj);
- ENTRY;
+ ENTRY;
LASSERT(it);
LASSERT(it->ozi_zc);
- /*
- * XXX: we need a binary version of zap_cursor_move_to_key()
- * to implement this API */
+ /* XXX: we need a binary version of zap_cursor_move_to_key()
+ * to implement this API
+ */
if (*((const __u64 *)key) != 0)
- CERROR("NOT IMPLEMETED YET (move to %#llx)\n",
- *((__u64 *)key));
+ CERROR("NOT IMPLEMETED YET (move to %#llx)\n", *((__u64 *)key));
zap_cursor_fini(it->ozi_zc);
zap_cursor_init(it->ozi_zc, osd->od_os, obj->oo_dn->dn_object);
struct osd_zap_it *it = (struct osd_zap_it *)di;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
- ENTRY;
+ ENTRY;
if (it->ozi_reset == 0)
zap_cursor_advance(it->ozi_zc);
it->ozi_reset = 0;
struct osd_object *obj = it->ozi_obj;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc = 0;
- ENTRY;
+ ENTRY;
it->ozi_reset = 0;
rc = -zap_cursor_retrieve(it->ozi_zc, za);
if (rc)
{
struct osd_zap_it *it = (struct osd_zap_it *)di;
struct osd_object *obj = it->ozi_obj;
+
RETURN(obj->oo_keysize);
}
struct osd_device *osd = osd_obj2dev(obj);
__u64 *k = osd_oti_get(env)->oti_key64;
int rc;
- ENTRY;
+ ENTRY;
it->ozi_reset = 0;
rc = -zap_cursor_retrieve(it->ozi_zc, za);
if (rc)
struct osd_device *osd = osd_obj2dev(obj);
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
- ENTRY;
+ ENTRY;
/* reset the cursor */
zap_cursor_fini(it->ozi_zc);
zap_cursor_init_serialized(it->ozi_zc, osd->od_os,
struct osd_device *osd = osd_obj2dev(obj);
const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
int rc = 0;
- ENTRY;
+ ENTRY;
down_read(&obj->oo_guard);
/*
dt->do_index_ops = &osd_acct_index_ops;
} else if (dt->do_index_ops == NULL) {
/* For index file, we don't support variable key & record sizes
- * and the key has to be unique */
+ * and the key has to be unique
+ */
if ((feat->dif_flags & ~DT_IND_UPDATE) != 0)
GOTO(out, rc = -EINVAL);