From fe0adb8fcad1a6aef97d6d4e2d6a2c418ae282e3 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 22 Apr 2005 17:39:58 +0000 Subject: [PATCH] Branch: b1_4 Improved error messages for debugging of recent problems. Use a constant for the minimum acceptable LOV stripe size. Return limit of stripe_size * num_stripes for default_striped files on 32-bit. --- lustre/lov/lov_merge.c | 11 +++++++---- lustre/lov/lov_obd.c | 28 +++++++++++++++++----------- lustre/lov/lov_pack.c | 11 ++++++----- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/lustre/lov/lov_merge.c b/lustre/lov/lov_merge.c index 082dae3..30092ae 100644 --- a/lustre/lov/lov_merge.c +++ b/lustre/lov/lov_merge.c @@ -99,11 +99,14 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, if (shrink) { struct lov_oinfo *loi; - int i = 0; - for (loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; - i++, loi++) { - kms = lov_size_to_stripe(lsm, size, i); + for (loi = lsm->lsm_oinfo; stripe < lsm->lsm_stripe_count; + stripe++, loi++) { + kms = lov_size_to_stripe(lsm, size, stripe); loi->loi_kms = loi->loi_rss = kms; + CDEBUG(D_INODE, + "stripe %d KMS %sing "LPU64"->"LPU64"\n", + stripe, kms > loi->loi_kms ? "increas":"shrink", + loi->loi_kms, kms); } RETURN(0); } diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 3f212f3..da25941 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -392,19 +392,25 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf) CWARN("Please update config and run --write-conf on MDS\n"); desc->ld_default_stripe_size = PTLRPC_MAX_BRW_SIZE; + } else if (desc->ld_default_stripe_size & (LOV_MIN_STRIPE_SIZE - 1)) { + CWARN("default_stripe_size "LPU64" isn't a multiple of %lu\n", + desc->ld_default_stripe_size, LOV_MIN_STRIPE_SIZE); + CWARN("Please update config and run --write-conf on MDS\n"); + + desc->ld_default_stripe_size &= ~(LOV_MIN_STRIPE_SIZE - 1); } /* Because of 64-bit divide/mod operations only work with a 32-bit * divisor in a 32-bit kernel, we cannot support a stripe width - * of 4GB or larger on 32-bit CPUs. - */ + * of 4GB or larger on 32-bit CPUs. */ count = desc->ld_default_stripe_count; - if (count && (count * desc->ld_default_stripe_size) > ~0UL) { + if ((count ? count : desc->ld_tgt_count) * + desc->ld_default_stripe_size > ~0UL) { CERROR("LOV: stripe width "LPU64"x%u > %lu on 32-bit system\n", desc->ld_default_stripe_size, count, ~0UL); RETURN(-EINVAL); } - + /* Allocate space for target list */ if (desc->ld_tgt_count) count = desc->ld_tgt_count; @@ -790,11 +796,11 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, RETURN(rc); } -#define ASSERT_LSM_MAGIC(lsmp) \ -do { \ - LASSERT((lsmp) != NULL); \ - LASSERTF((lsmp)->lsm_magic == LOV_MAGIC, "%p, %x", \ - (lsmp), (lsmp)->lsm_magic); \ +#define ASSERT_LSM_MAGIC(lsmp) \ +do { \ + LASSERT((lsmp) != NULL); \ + LASSERTF((lsmp)->lsm_magic == LOV_MAGIC, "%p->lsm_magic=%x\n", \ + (lsmp), (lsmp)->lsm_magic); \ } while (0) static int lov_destroy(struct obd_export *exp, struct obdo *oa, @@ -1010,12 +1016,12 @@ static int lov_setattr_async(struct obd_export *exp, struct obdo *src_oa, obd_id objid = src_oa->o_id; int i; ENTRY; - + ASSERT_LSM_MAGIC(lsm); LASSERT(oti); if (src_oa->o_valid & OBD_MD_FLCOOKIE) LASSERT(oti->oti_logcookies); - + if (!exp || !exp->exp_obd) RETURN(-ENODEV); diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 342ad47..4fcbfbc 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -124,7 +124,8 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, for (i = 0, loi = lsm->lsm_oinfo; i < stripe_count; i++, loi++) { /* XXX LOV STACKING call down to osc_packmd() to do packing */ - LASSERT(loi->loi_id); + LASSERTF(loi->loi_id, "lmm_oid "LPU64" stripe %u/%u idx %u\n", + lmm->lmm_object_id, i, stripe_count, loi->loi_ost_idx); lmm->lmm_objects[i].l_object_id = cpu_to_le64(loi->loi_id); lmm->lmm_objects[i].l_object_gr = cpu_to_le64(loi->loi_gr); lmm->lmm_objects[i].l_ost_gen = cpu_to_le32(loi->loi_ost_gen); @@ -366,10 +367,10 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, /* 64kB is the largest common page size we see (ia64), and matches the * check in lfs */ - if (lum.lmm_stripe_size & (65536 - 1)) { - CDEBUG(D_IOCTL, "stripe size %u not multiple of 64kB\n", - lum.lmm_stripe_size); - RETURN(-EINVAL); + if (lum.lmm_stripe_size & (LOV_MIN_STRIPE_SIZE - 1)) { + CDEBUG(D_IOCTL, "stripe size %u not multiple of %lu, fixing\n", + lum.lmm_stripe_size, LOV_MIN_STRIPE_SIZE); + lum.lmm_stripe_size = LOV_MIN_STRIPE_SIZE; } if ((lum.lmm_stripe_offset >= lov->desc.ld_active_tgt_count) && -- 1.8.3.1