const struct dt_it_ops *iops;
__u32 stripes;
__u32 magic = le32_to_cpu(lmv1->lmv_magic);
- int size;
+ size_t lmv1_size;
int rc;
ENTRY;
if (stripes < 1)
RETURN(0);
- size = lmv_mds_md_size(stripes, magic);
- if (buf->lb_len < size) {
+ rc = lmv_mds_md_size(stripes, magic);
+ if (rc < 0)
+ RETURN(rc);
+ lmv1_size = rc;
+ if (buf->lb_len < lmv1_size) {
struct lu_buf tbuf;
if (!resize)
tbuf = *buf;
buf->lb_buf = NULL;
buf->lb_len = 0;
- lu_buf_alloc(buf, size);
+ lu_buf_alloc(buf, lmv1_size);
lmv1 = buf->lb_buf;
if (lmv1 == NULL)
RETURN(-ENOMEM);
*/
LASSERT(lo->ldo_stripe);
for (i = 0; i < lo->ldo_stripenr; i++) {
- if (likely(lo->ldo_stripe[i] != NULL)) {
- if (dt_object_exists(lo->ldo_stripe[i]) == 0)
- continue;
-
- rc = dt_attr_set(env, lo->ldo_stripe[i], attr,
- handle, capa);
- if (rc != 0) {
- CERROR("failed declaration: %d\n", rc);
- break;
- }
+ if (unlikely(lo->ldo_stripe[i] == NULL))
+ continue;
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr) &&
+ (dt_object_exists(lo->ldo_stripe[i]) == 0))
+ continue;
+
+ rc = dt_attr_set(env, lo->ldo_stripe[i], attr, handle, capa);
+ if (rc != 0) {
+ CERROR("failed declaration: %d\n", rc);
+ break;
}
}
struct lmv_mds_md_v1 *lmv1;
int rc1 = 0;
- if (rc > sizeof(*lmv1))
+ if (rc > (typeof(rc))sizeof(*lmv1))
RETURN(rc);
- if (rc < sizeof(*lmv1))
+ if (rc < (typeof(rc))sizeof(*lmv1))
RETURN(rc = rc > 0 ? -EINVAL : rc);
if (buf->lb_buf == NULL || buf->lb_len == 0) {
union lmv_mds_md *lmm = buf->lb_buf;
struct lmv_mds_md_v1 *lmv1 = &lmm->lmv_md_v1;
struct lu_fid *fid = &info->lti_fid;
- int i;
+ unsigned int i;
int rc = 0;
ENTRY;
struct lmv_mds_md_v1 *lmm;
struct lmv_mds_md_v1 *slave_lmm = NULL;
struct dt_insert_rec *rec = &info->lti_dt_rec;
- int stripe_count;
+ __u32 stripe_count;
int *idx_array;
int rc = 0;
- int i;
- int j;
+ __u32 i;
+ __u32 j;
ENTRY;
/* The lum has been verifed in lod_verify_md_striping */
for (j = 0; j < lod->lod_remote_mdt_count;
j++, idx = (idx + 1) % (lod->lod_remote_mdt_count + 1)) {
bool already_allocated = false;
- int k;
+ __u32 k;
- CDEBUG(D_INFO, "try idx %d, mdt cnt %d,"
- " allocated %d, last allocated %d\n", idx,
+ CDEBUG(D_INFO, "try idx %d, mdt cnt %u,"
+ " allocated %u, last allocated %d\n", idx,
lod->lod_remote_mdt_count, i, idx_array[i - 1]);
/* Find next available target */
/* Can not allocate more stripes */
if (j == lod->lod_remote_mdt_count) {
- CDEBUG(D_INFO, "%s: require stripes %d only get %d\n",
+ CDEBUG(D_INFO, "%s: require stripes %u only get %d\n",
lod2obd(lod)->obd_name, stripe_count, i - 1);
break;
}
- CDEBUG(D_INFO, "idx %d, mdt cnt %d,"
- " allocated %d, last allocated %d\n", idx,
+ CDEBUG(D_INFO, "idx %d, mdt cnt %u,"
+ " allocated %u, last allocated %d\n", idx,
lod->lod_remote_mdt_count, i, idx_array[i - 1]);
next:
if (rc != 0)
GOTO(out_put, rc);
- snprintf(stripe_name, sizeof(info->lti_key), DFID":%d",
+ snprintf(stripe_name, sizeof(info->lti_key), DFID":%u",
PFID(lu_object_fid(&dto->do_lu)), i);
sname = lod_name_get(env, stripe_name, strlen(stripe_name));
if (rc < 0)
GOTO(unlock, rc);
- if (rc < sizeof(struct lov_user_md)) {
+ if (rc < (typeof(rc))sizeof(struct lov_user_md)) {
/* don't lookup for non-existing or invalid striping */
lp->ldo_def_striping_set = 0;
lp->ldo_striping_cached = 1;
if (rc < 0)
GOTO(unlock, rc);
- if (rc < sizeof(struct lmv_user_md)) {
+ if (rc < (typeof(rc))sizeof(struct lmv_user_md)) {
/* don't lookup for non-existing or invalid striping */
lp->ldo_dir_def_striping_set = 0;
lp->ldo_dir_striping_cached = 1;
struct lod_object *lo = lod_dt_obj(dt);
struct lod_thread_info *info = lod_env_info(env);
char *stripe_name = info->lti_key;
- int rc, i;
+ unsigned int i;
+ int rc;
ENTRY;
/* destroy sub-stripe of master object */
struct lu_object *cobj;
struct lod_tgt_descs *ltd = NULL;
struct lod_tgt_desc *tgt;
- mdsno_t idx = 0;
+ u32 idx = 0;
int type = LU_SEQ_RANGE_ANY;
int rc;
ENTRY;