Whamcloud - gitweb
LU-5807 qos: enable QOS_DEBUG()
[fs/lustre-release.git] / lustre / lod / lod_lov.c
index 08fbeda..6b352e8 100644 (file)
@@ -791,9 +791,11 @@ int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt,
        v3->lmm_stripe_count = cpu_to_le16(lo->ldo_def_stripenr);
        v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset);
        v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size);
-       if (lo->ldo_pool != NULL)
+       if (lo->ldo_pool != NULL) {
                strlcpy(v3->lmm_pool_name, lo->ldo_pool,
                        sizeof(v3->lmm_pool_name));
+               v3->lmm_pool_name[sizeof(v3->lmm_pool_name) - 1] = '\0';
+       }
        info->lti_buf.lb_buf = v3;
        info->lti_buf.lb_len = sizeof(*v3);
        rc = dt_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV, 0, th,
@@ -1158,9 +1160,8 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
                GOTO(out, rc = -EINVAL);
        }
 
-       /* an offset of -1 is treated as a "special" valid offset */
        stripe_offset = le16_to_cpu(lum->lmm_stripe_offset);
-       if (stripe_offset != (typeof(stripe_offset))-1) {
+       if (stripe_offset != LOV_OFFSET_DEFAULT) {
                /* if offset is not within valid range [0, osts_size) */
                if (stripe_offset >= d->lod_osts_size) {
                        CDEBUG(D_IOCTL, "stripe offset %u >= bitmap size %u\n",
@@ -1210,7 +1211,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
        if (pool == NULL)
                goto out;
 
-       if (stripe_offset != (typeof(stripe_offset))-1) {
+       if (stripe_offset != LOV_OFFSET_DEFAULT) {
                rc = lod_check_index_in_pool(stripe_offset, pool);
                if (rc < 0)
                        GOTO(out, rc = -EINVAL);