From de3ec2b0223460c4623b99546f78cb6ca079da10 Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 2 Mar 2005 23:12:23 +0000 Subject: [PATCH] r=adilger HP submitted a patch to dynamically calculate the page size in lfs, but we decided that it made more sense to hard code it to at least 64kB. That's the largest page size that we could commonly come into contact with (ia64) --- lustre/lov/lov_pack.c | 8 +++++--- lustre/utils/lfs.c | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 0df50a1..968de87 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -359,9 +359,11 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, RETURN(-EINVAL); } - if (lum.lmm_stripe_size & (PAGE_SIZE - 1)) { - CDEBUG(D_IOCTL, "stripe size %u not multiple of %lu\n", - lum.lmm_stripe_size, PAGE_SIZE); + /* 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); } diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 09bd187..54d94d9 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -87,7 +87,7 @@ static int lfs_setstripe(int argc, char **argv) long st_size; int st_offset, st_count; char *end; - int page_size; + int page_size; if (argc != 5) return CMD_HELP; @@ -99,10 +99,19 @@ static int lfs_setstripe(int argc, char **argv) argv[0], argv[2]); return CMD_HELP; } - page_size = getpagesize(); - if (st_size % page_size) - fprintf(stderr, "WARNING: stripe size %ld is not " - "an increment of page size %d\n", st_size, page_size); + /* 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; + if (getpagesize() > page_size) { + fprintf(stderr, "WARNING: your page size (%d) is larger than " + "expected.\n"); + page_size = getpagesize(); + } + if (st_size % page_size) { + fprintf(stderr, "FATAL: stripe_size must be an even multiple " + "of %d bytes.\n", page_size); + return CMD_HELP; + } // get the stripe offset st_offset = strtoul(argv[3], &end, 0); -- 1.8.3.1