From 4810679219f28bf89903be6851d466963db64fd1 Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 5 May 2005 18:51:17 +0000 Subject: [PATCH] Branch: b1_4 Limit the number of stripes in a file to the maximum that will fit into a 4kB EA. This is needed until we can store larger EAs in ext3 (bug 4424). b=6093 --- lustre/ChangeLog | 1 + lustre/include/linux/lustre_idl.h | 3 ++- lustre/lov/lov_obd.c | 2 +- lustre/lov/lov_pack.c | 7 ++++++- lustre/utils/liblustreapi.c | 12 ++++++------ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index bb2dc4a..0c1bcba 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -53,6 +53,7 @@ tbd Cluster File Systems, Inc. - Vanilla 2.4.29 support - increase maximum number of obd devices to 520 (6242) - remove the tcp-zero-copy patch from the suse-2.4 series (5902) + - limit stripes per file to 160 (the maximum EA size) (6093) 2005-03-22 Cluster File Systems, Inc. * version 1.4.1 diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index e64b57b..1c0f97f 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -734,7 +734,8 @@ extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn); * LOV data structures */ -#define LOV_MIN_STRIPE_SIZE 65536UL /* maximum PAGE_SIZE (ia64), power of 2 */ +#define LOV_MIN_STRIPE_SIZE 65536 /* maximum PAGE_SIZE (ia64), power of 2 */ +#define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */ #define LOV_MAX_UUID_BUFFER_SIZE 8192 /* The size of the buffer the lov/mdc reserves for the diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index d6e228d..269c4c6 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -393,7 +393,7 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf) 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", + CWARN("default_stripe_size "LPU64" isn't a multiple of %u\n", desc->ld_default_stripe_size, LOV_MIN_STRIPE_SIZE); CWARN("Please update config and run --write-conf on MDS\n"); diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 4fcbfbc..8038a37 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -141,6 +141,11 @@ int lov_get_stripecnt(struct lov_obd *lov, int stripe_count) stripe_count = lov->desc.ld_default_stripe_count; if (!stripe_count || stripe_count > lov->desc.ld_active_tgt_count) stripe_count = lov->desc.ld_active_tgt_count; + /* for now, we limit the stripe count directly, when bug 4424 is + * fixed this needs to be somewhat dynamic based on whether ext3 + * can handle larger EA sizes. */ + if (stripe_count > LOV_MAX_STRIPE_COUNT) + stripe_count = LOV_MAX_STRIPE_COUNT; return stripe_count; } @@ -368,7 +373,7 @@ 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 & (LOV_MIN_STRIPE_SIZE - 1)) { - CDEBUG(D_IOCTL, "stripe size %u not multiple of %lu, fixing\n", + CDEBUG(D_IOCTL, "stripe size %u not multiple of %u, fixing\n", lum.lmm_stripe_size, LOV_MIN_STRIPE_SIZE); lum.lmm_stripe_size = LOV_MIN_STRIPE_SIZE; } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 6e10b56..96d5d67 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -84,25 +84,25 @@ int llapi_file_create(char *name, long stripe_size, int stripe_offset, /* 64 KB is the largest common page size I'm aware of (on ia64), but * check the local page size just in case. */ - page_size = 65536; + page_size = LOV_MIN_STRIPE_SIZE; if (getpagesize() > page_size) { page_size = getpagesize(); - fprintf(stderr, "WARNING: your page size (%d) is larger than " - "expected.\n", page_size); + fprintf(stderr, "WARNING: your page size (%u) is larger than " + "expected (%u).\n", page_size, LOV_MIN_STRIPE_SIZE); } - if ((stripe_size < 0 || stripe_size % 65536) && + if ((stripe_size < 0 || (stripe_size & (LOV_MIN_STRIPE_SIZE - 1))) && !(isdir && stripe_size == -1)) { rc = -EINVAL; err_msg("error: stripe_size must be an even " "multiple of %d bytes.\n", page_size); goto out; } - if (stripe_offset < -1 || stripe_offset > 65534) { + if (stripe_offset < -1 || stripe_offset > LOV_MAX_STRIPE_COUNT) { errno = rc = -EINVAL; err_msg("error: bad stripe offset %d\n", stripe_offset); goto out; } - if (stripe_count < -1 || stripe_count > 65534) { + if (stripe_count < -1 || stripe_count > LOV_MAX_STRIPE_COUNT) { errno = rc = -EINVAL; err_msg("error: bad stripe count %d\n", stripe_count); goto out; -- 1.8.3.1