X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Flov%2Flov_ea.c;h=462f39bbef518389e75708c2c9b88191ddece791;hp=e5ae020168bd989c6371f8c69fb32d20a82a47e5;hb=c394068ee148595711c661651368b91373bcc78a;hpb=7da33dc0ba361bedd274480890755a8d2691e65b diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index e5ae020..462f39b 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -41,14 +41,13 @@ #define DEBUG_SUBSYSTEM S_LOV #ifdef __KERNEL__ -#include +#include #include #else #include #endif #include -#include #include #include "lov_internal.h" @@ -86,33 +85,33 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size) { - struct lov_stripe_md *lsm; - struct lov_oinfo *loi; - int i, oinfo_ptrs_size; + struct lov_stripe_md *lsm; + struct lov_oinfo *loi; + int i, oinfo_ptrs_size; - LASSERT(stripe_count <= LOV_MAX_STRIPE_COUNT); + LASSERT(stripe_count <= LOV_MAX_STRIPE_COUNT); - oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count; - *size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size; + oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count; + *size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size; - OBD_ALLOC_LARGE(lsm, *size); - if (!lsm) - return NULL;; + OBD_ALLOC_LARGE(lsm, *size); + if (!lsm) + return NULL; - for (i = 0; i < stripe_count; i++) { - OBD_SLAB_ALLOC_PTR_GFP(loi, lov_oinfo_slab, __GFP_IO); - if (loi == NULL) - goto err; - lsm->lsm_oinfo[i] = loi; - } - lsm->lsm_stripe_count = stripe_count; - return lsm; + for (i = 0; i < stripe_count; i++) { + OBD_SLAB_ALLOC_PTR_GFP(loi, lov_oinfo_slab, GFP_NOFS); + if (loi == NULL) + goto err; + lsm->lsm_oinfo[i] = loi; + } + lsm->lsm_stripe_count = stripe_count; + return lsm; err: - while (--i >= 0) - OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi)); - OBD_FREE_LARGE(lsm, *size); - return NULL; + while (--i >= 0) + OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi)); + OBD_FREE_LARGE(lsm, *size); + return NULL; } void lsm_free_plain(struct lov_stripe_md *lsm) @@ -227,6 +226,9 @@ int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); @@ -309,11 +311,14 @@ int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, return -E2BIG; for (i = 0; i < stripe_count; i++) { - /* XXX LOV STACKING call down to osc_unpackmd() */ - loi = lsm->lsm_oinfo[i]; + /* XXX LOV STACKING call down to osc_unpackmd() */ + loi = lsm->lsm_oinfo[i]; ostid_le_to_cpu(&lmm->lmm_objects[i].l_ost_oi, &loi->loi_oi); - loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); - loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + loi->loi_ost_idx = le32_to_cpu(lmm->lmm_objects[i].l_ost_idx); + loi->loi_ost_gen = le32_to_cpu(lmm->lmm_objects[i].l_ost_gen); + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ost_idx >= lov->desc.ld_tgt_count) { CERROR("OST index %d more than OST count %d\n", loi->loi_ost_idx, lov->desc.ld_tgt_count); @@ -346,3 +351,13 @@ const struct lsm_operations lsm_v3_ops = { .lsm_unpackmd = lsm_unpackmd_v3, }; +void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) +{ + CDEBUG(level, "lsm %p, objid "DOSTID", maxbytes "LPX64", magic 0x%08X," + " stripe_size %u, stripe_count %u, refc: %d," + " layout_gen %u, pool ["LOV_POOLNAMEF"]\n", lsm, + POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, + lsm->lsm_stripe_size, lsm->lsm_stripe_count, + atomic_read(&lsm->lsm_refc), lsm->lsm_layout_gen, + lsm->lsm_pool_name); +}