X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Flod%2Flod_lov.c;h=47eefff982fd18c1a8d43d798b40a7d3265f82cf;hp=a65eec6903907a8d53a1ee73157a956bc6bad342;hb=0030ed640284e4ed5afa9187c5a907141132b083;hpb=2305c36139a7deaf25a0dc737d412eed42ca54e9 diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index a65eec6..47eefff 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -6,13 +6,13 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License version 2 for more details. A copy is * included in the COPYING file that accompanied this code. - + * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.gnu.org/licenses/gpl-2.0.html @@ -278,9 +278,6 @@ int lod_add_device(const struct lu_env *env, struct lod_device *lod, OBD_CONNECT_AT | OBD_CONNECT_FULL20 | OBD_CONNECT_LFSCK; - /* XXX set MDS-MDS flags, remove this when running this - * on client*/ - data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS; spin_lock(&imp->imp_lock); imp->imp_server_timeout = 1; spin_unlock(&imp->imp_lock); @@ -739,72 +736,6 @@ repeat: } /** - * Store default striping. - * - * Store default striping for the files in the given directory. The data - * are stored in the LOD-object representing the directory (ldo_def_* fields). - * If default striping matches virtual fs-wide default striping, then we - * store nothing. This mean that the files in the directory will be created - * with filesystem-wide default striping. The transaction must be started. - * - * \param[in] env execution environment for this thread - * \param[in] dt dt object representing directory in LOD layer - * \param[in] th transaction handle - * - * \retval 0 if stored successfully or no need to store - * \retval negative error number on failure - */ -int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt, - struct thandle *th) -{ - struct lod_thread_info *info = lod_env_info(env); - struct lod_object *lo = lod_dt_obj(dt); - struct dt_object *next = dt_object_child(dt); - struct lov_user_md_v3 *v3; - int rc; - ENTRY; - - if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) - RETURN(-ENOTDIR); - /* - * store striping defaults into new directory - * used to implement defaults inheritance - */ - - /* probably nothing to inherite */ - if (lo->ldo_striping_cached == 0) - RETURN(0); - - if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size, lo->ldo_def_stripenr, - lo->ldo_def_stripe_offset)) - RETURN(0); - - v3 = info->lti_ea_store; - if (info->lti_ea_store_size < sizeof(*v3)) { - rc = lod_ea_store_resize(info, sizeof(*v3)); - if (rc != 0) - RETURN(rc); - v3 = info->lti_ea_store; - } - memset(v3, 0, sizeof(*v3)); - v3->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V3); - 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) { - 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, - BYPASS_CAPA); - - RETURN(rc); -} - -/** * Verify the target index is present in the current configuration. * * \param[in] md LOD device where the target table is stored @@ -1127,7 +1058,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf, LASSERT(sizeof(*lum) < sizeof(*lum3)); if (buf->lb_len < sizeof(*lum)) { - CDEBUG(D_IOCTL, "buf len %zd too small for lov_user_md\n", + CDEBUG(D_IOCTL, "buf len %zu too small for lov_user_md\n", buf->lb_len); GOTO(out, rc = -EINVAL); } @@ -1160,9 +1091,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", @@ -1189,7 +1119,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf, stripe_count = le16_to_cpu(lum->lmm_stripe_count); if (buf->lb_len != lum_size) { - CDEBUG(D_IOCTL, "invalid buf len %zd for lov_user_md with " + CDEBUG(D_IOCTL, "invalid buf len %zu for lov_user_md with " "magic %#x and stripe_count %u\n", buf->lb_len, magic, stripe_count); GOTO(out, rc = -EINVAL); @@ -1200,7 +1130,7 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf, lum3 = buf->lb_buf; if (buf->lb_len < sizeof(*lum3)) { - CDEBUG(D_IOCTL, "buf len %zd too small for lov_user_md_v3\n", + CDEBUG(D_IOCTL, "buf len %zu too small for lov_user_md_v3\n", buf->lb_len); GOTO(out, rc = -EINVAL); } @@ -1212,7 +1142,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);