Josef Bacik 8bffa8
diff -up btrfs-progs-0.19/btrfsck.c.orig btrfs-progs-0.19/btrfsck.c
Josef Bacik 8bffa8
--- btrfs-progs-0.19/btrfsck.c.orig	2012-04-11 10:44:44.000000000 -0400
Josef Bacik 8bffa8
+++ btrfs-progs-0.19/btrfsck.c	2012-04-11 10:45:35.769767880 -0400
Josef Bacik a37e25
@@ -22,7 +22,9 @@
Josef Bacik 4ec8d5
 #include <stdlib.h>
Josef Bacik a37e25
 #include <unistd.h>
Josef Bacik 4ec8d5
 #include <fcntl.h>
Josef Bacik 4ec8d5
+#include <sys/types.h>
Josef Bacik a37e25
 #include <sys/stat.h>
Josef Bacik 4ec8d5
+#include <unistd.h>
Josef Bacik 8bffa8
 #include <getopt.h>
Josef Bacik 4ec8d5
 #include "kerncompat.h"
Josef Bacik 4ec8d5
 #include "ctree.h"
Josef Bacik 8bffa8
diff -up btrfs-progs-0.19/mkfs.c.orig btrfs-progs-0.19/mkfs.c
Josef Bacik 8bffa8
--- btrfs-progs-0.19/mkfs.c.orig	2012-04-11 10:44:44.652047854 -0400
Josef Bacik 8bffa8
+++ btrfs-progs-0.19/mkfs.c	2012-04-11 10:46:03.727553072 -0400
Josef Bacik 8bffa8
@@ -1198,7 +1198,7 @@ int main(int ac, char **av)
Josef Bacik 4ec8d5
 	u64 alloc_start = 0;
Josef Bacik 8bffa8
 	u64 metadata_profile = 0;
Josef Bacik 8bffa8
 	u64 data_profile = 0;
Josef Bacik 4ec8d5
-	u32 leafsize = getpagesize();
Josef Bacik 4ec8d5
+	u32 leafsize = sysconf(_SC_PAGESIZE);
Josef Bacik 4ec8d5
 	u32 sectorsize = 4096;
Josef Bacik 4ec8d5
 	u32 nodesize = leafsize;
Josef Bacik 4ec8d5
 	u32 stripesize = 4096;
Josef Bacik 8bffa8
@@ -1270,7 +1270,7 @@ int main(int ac, char **av)
Josef Bacik 4ec8d5
 				print_usage();
Josef Bacik 4ec8d5
 		}
Josef Bacik 4ec8d5
 	}
Josef Bacik 4ec8d5
-	sectorsize = max(sectorsize, (u32)getpagesize());
Josef Bacik 4ec8d5
+	sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
Josef Bacik 4ec8d5
 	if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) {
Josef Bacik 4ec8d5
 		fprintf(stderr, "Illegal leafsize %u\n", leafsize);
Josef Bacik 4ec8d5
 		exit(1);