Whamcloud - gitweb
r=adilger
authorphil <phil>
Wed, 2 Mar 2005 23:12:23 +0000 (23:12 +0000)
committerphil <phil>
Wed, 2 Mar 2005 23:12:23 +0000 (23:12 +0000)
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
lustre/utils/lfs.c

index 0df50a1..968de87 100644 (file)
@@ -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);
         }
 
index 09bd187..54d94d9 100644 (file)
@@ -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);