diff --git a/Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch b/Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch index ef8528d..fe04876 100644 --- a/Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch +++ b/Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch @@ -1,27 +1,7 @@ -From f507119002c6bb972df09a47edfa8998c0fc8172 Mon Sep 17 00:00:00 2001 -From: Josef Bacik -Date: Fri, 20 Jul 2012 11:09:43 -0400 -Subject: [PATCH 2/3] Btrfs-progs: detect if the disk we are formatting is a - ssd - -SSD's do not gain anything by having metadata DUP turned on. The underlying -file system that is a part of all SSD's could easily map duplicate metadat -blocks into the same erase block which effectively eliminates the benefit of -duplicating the metadata on disk. So detect if we are formatting a single -SSD drive and if we are do not use DUP. Thanks, - -Signed-off-by: Josef Bacik ---- - Makefile | 2 +- - man/mkfs.btrfs.8.in | 5 +++- - mkfs.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 60 insertions(+), 5 deletions(-) - -diff --git a/Makefile b/Makefile -index c0aaa3d..1afef49 100644 ---- a/Makefile -+++ b/Makefile -@@ -66,7 +66,7 @@ btrfsck: $(objects) btrfsck.o +diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/Makefile.patch4 btrfs-progs-0.20.rc1.20121017git91d9eec/Makefile +--- btrfs-progs-0.20.rc1.20121017git91d9eec/Makefile.patch4 2012-10-04 20:35:31.000000000 -0400 ++++ btrfs-progs-0.20.rc1.20121017git91d9eec/Makefile 2012-10-17 13:48:02.331453645 -0400 +@@ -67,7 +67,7 @@ btrfsck: $(objects) btrfsck.o $(CC) $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS) mkfs.btrfs: $(objects) mkfs.o @@ -30,11 +10,10 @@ index c0aaa3d..1afef49 100644 btrfs-debug-tree: $(objects) debug-tree.o $(CC) $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS) -diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in -index fc2e1d2..dfa7996 100644 ---- a/man/mkfs.btrfs.8.in -+++ b/man/mkfs.btrfs.8.in -@@ -46,7 +46,10 @@ Specify a label for the filesystem. +diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/man/mkfs.btrfs.8.in.patch4 btrfs-progs-0.20.rc1.20121017git91d9eec/man/mkfs.btrfs.8.in +--- btrfs-progs-0.20.rc1.20121017git91d9eec/man/mkfs.btrfs.8.in.patch4 2012-10-04 20:35:31.000000000 -0400 ++++ btrfs-progs-0.20.rc1.20121017git91d9eec/man/mkfs.btrfs.8.in 2012-10-17 13:48:02.331453645 -0400 +@@ -47,7 +47,10 @@ Specify a label for the filesystem. .TP \fB\-m\fR, \fB\-\-metadata \fIprofile\fR Specify how metadata must be spanned across the devices specified. Valid @@ -46,10 +25,9 @@ index fc2e1d2..dfa7996 100644 .TP \fB\-M\fR, \fB\-\-mixed\fR Mix data and metadata chunks together for more efficient space -diff --git a/mkfs.c b/mkfs.c -index dff5eb8..8816db8 100644 ---- a/mkfs.c -+++ b/mkfs.c +diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch4 btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c +--- btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch4 2012-10-17 13:48:02.329453660 -0400 ++++ btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c 2012-10-17 13:53:36.954806793 -0400 @@ -37,6 +37,7 @@ #include #include @@ -58,7 +36,7 @@ index dff5eb8..8816db8 100644 #include "kerncompat.h" #include "ctree.h" #include "disk-io.h" -@@ -234,7 +235,7 @@ static int create_one_raid_group(struct btrfs_trans_handle *trans, +@@ -234,7 +235,7 @@ static int create_one_raid_group(struct static int create_raid_groups(struct btrfs_trans_handle *trans, struct btrfs_root *root, u64 data_profile, int data_profile_opt, u64 metadata_profile, @@ -67,7 +45,7 @@ index dff5eb8..8816db8 100644 { u64 num_devices = btrfs_super_num_devices(&root->fs_info->super_copy); u64 allowed; -@@ -245,8 +246,12 @@ static int create_raid_groups(struct btrfs_trans_handle *trans, +@@ -245,8 +246,12 @@ static int create_raid_groups(struct btr * For mixed groups defaults are single/single. */ if (!metadata_profile_opt && !mixed) { @@ -81,8 +59,8 @@ index dff5eb8..8816db8 100644 } if (!data_profile_opt && !mixed) { data_profile = (num_devices > 1) ? -@@ -1201,6 +1206,49 @@ static int zero_output_file(int out_fd, u64 size, u32 sectorsize) - return ret; +@@ -1215,6 +1220,49 @@ static int check_leaf_or_node_size(u32 s + return 0; } +static int is_ssd(const char *file) @@ -131,7 +109,7 @@ index dff5eb8..8816db8 100644 int main(int ac, char **av) { char *file; -@@ -1227,6 +1275,7 @@ int main(int ac, char **av) +@@ -1241,6 +1289,7 @@ int main(int ac, char **av) int data_profile_opt = 0; int metadata_profile_opt = 0; int nodiscard = 0; @@ -139,7 +117,7 @@ index dff5eb8..8816db8 100644 char *source_dir = NULL; int source_dir_set = 0; -@@ -1352,6 +1401,9 @@ int main(int ac, char **av) +@@ -1360,6 +1409,9 @@ int main(int ac, char **av) exit(1); } } @@ -149,7 +127,7 @@ index dff5eb8..8816db8 100644 if (mixed) { if (metadata_profile != data_profile) { fprintf(stderr, "With mixed block groups data and metadata " -@@ -1438,7 +1490,7 @@ raid_groups: +@@ -1445,7 +1497,7 @@ raid_groups: if (!source_dir_set) { ret = create_raid_groups(trans, root, data_profile, data_profile_opt, metadata_profile, @@ -158,6 +136,3 @@ index dff5eb8..8816db8 100644 BUG_ON(ret); } --- -1.7.7.6 - diff --git a/Btrfs-progs-only-enforce-a-maximum-size-if-we-specif.patch b/Btrfs-progs-only-enforce-a-maximum-size-if-we-specif.patch deleted file mode 100644 index 93aa5e0..0000000 --- a/Btrfs-progs-only-enforce-a-maximum-size-if-we-specif.patch +++ /dev/null @@ -1,143 +0,0 @@ -From cbe7ca77431c40bab80135c7b8ee6a5dece56e03 Mon Sep 17 00:00:00 2001 -From: Josef Bacik -Date: Fri, 27 Jul 2012 08:24:37 -0400 -Subject: [PATCH 3/3] Btrfs-progs: only enforce a maximum size if we specify - one - -My patch - -04609add88ef8428d725de6ef60f46a3ff0dbc8e - -introduced a regression where if you mkfs'ed a group of disks with different -sizes it limited the disks to the size of the first one that is specified. -This was not the intent of my patch, I only want it to limit the size based -on the -b option, so I've reworked the code to pass in a max block count and -that fixes the issue. Thanks, - -Signed-off-by: Josef Bacik ---- - btrfs-vol.c | 3 ++- - cmds-device.c | 3 ++- - mkfs.c | 15 ++++++--------- - utils.c | 12 +++--------- - utils.h | 6 ++---- - 5 files changed, 15 insertions(+), 24 deletions(-) - -diff --git a/btrfs-vol.c b/btrfs-vol.c -index 0efdbc1..ad824bd 100644 ---- a/btrfs-vol.c -+++ b/btrfs-vol.c -@@ -150,7 +150,8 @@ int main(int ac, char **av) - if (cmd == BTRFS_IOC_ADD_DEV) { - int mixed = 0; - -- ret = btrfs_prepare_device(devfd, device, 1, &dev_block_count, &mixed); -+ ret = btrfs_prepare_device(devfd, device, 1, &dev_block_count, -+ 0, &mixed, 0); - if (ret) { - fprintf(stderr, "Unable to init %s\n", device); - exit(1); -diff --git a/cmds-device.c b/cmds-device.c -index b24e2a3..75ee293 100644 ---- a/cmds-device.c -+++ b/cmds-device.c -@@ -107,7 +107,8 @@ static int cmd_add_dev(int argc, char **argv) - continue; - } - -- res = btrfs_prepare_device(devfd, argv[i], 1, &dev_block_count, &mixed); -+ res = btrfs_prepare_device(devfd, argv[i], 1, &dev_block_count, -+ 0, &mixed, 0); - if (res) { - fprintf(stderr, "ERROR: Unable to init '%s'\n", argv[i]); - close(devfd); -diff --git a/mkfs.c b/mkfs.c -index 8816db8..93cd83c 100644 ---- a/mkfs.c -+++ b/mkfs.c -@@ -1373,11 +1373,9 @@ int main(int ac, char **av) - exit(1); - } - first_file = file; -- ret = __btrfs_prepare_device(fd, file, zero_end, -- &dev_block_count, &mixed, nodiscard); -- if (block_count == 0) -- block_count = dev_block_count; -- else if (block_count > dev_block_count) { -+ ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count, -+ block_count, &mixed, nodiscard); -+ if (block_count && block_count > dev_block_count) { - fprintf(stderr, "%s is smaller than requested size\n", file); - exit(1); - } -@@ -1418,7 +1416,7 @@ int main(int ac, char **av) - leafsize * i; - } - -- ret = make_btrfs(fd, file, label, blocks, block_count, -+ ret = make_btrfs(fd, file, label, blocks, dev_block_count, - nodesize, leafsize, - sectorsize, stripesize); - if (ret) { -@@ -1474,9 +1472,8 @@ int main(int ac, char **av) - close(fd); - continue; - } -- dev_block_count = block_count; -- ret = __btrfs_prepare_device(fd, file, zero_end, -- &dev_block_count, &mixed, nodiscard); -+ ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count, -+ block_count, &mixed, nodiscard); - mixed = old_mixed; - BUG_ON(ret); - -diff --git a/utils.c b/utils.c -index aade9e2..a5ffb62 100644 ---- a/utils.c -+++ b/utils.c -@@ -537,13 +537,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, - } - - int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, -- int *mixed) --{ -- /* discard by default when called from 'device add' */ -- return __btrfs_prepare_device(fd, file, zero_end, block_count_ret, mixed, 0); --} --int __btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, -- int *mixed, int nodiscard) -+ u64 max_block_count, int *mixed, int nodiscard) - { - u64 block_count; - u64 bytenr; -@@ -561,8 +555,8 @@ int __btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_re - fprintf(stderr, "unable to find %s size\n", file); - exit(1); - } -- if (*block_count_ret) -- block_count = min(block_count, *block_count_ret); -+ if (max_block_count) -+ block_count = min(block_count, max_block_count); - zero_end = 1; - - if (block_count < 1024 * 1024 * 1024 && !(*mixed)) { -diff --git a/utils.h b/utils.h -index c147c12..3a0368b 100644 ---- a/utils.h -+++ b/utils.h -@@ -26,10 +26,8 @@ int make_btrfs(int fd, const char *device, const char *label, - u32 leafsize, u32 sectorsize, u32 stripesize); - int btrfs_make_root_dir(struct btrfs_trans_handle *trans, - struct btrfs_root *root, u64 objectid); --int btrfs_prepare_device(int fd, char *file, int zero_end, -- u64 *block_count_ret, int *mixed); --int __btrfs_prepare_device(int fd, char *file, int zero_end, -- u64 *block_count_ret, int *mixed, int nodiscard); -+int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, -+ u64 max_block_count, int *mixed, int nodiscard); - int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, - struct btrfs_root *root, int fd, char *path, - u64 block_count, u32 io_width, u32 io_align, --- -1.7.7.6 - diff --git a/btrfs-progs-build-fixes.patch b/btrfs-progs-build-fixes.patch index 136ac62..4771e53 100644 --- a/btrfs-progs-build-fixes.patch +++ b/btrfs-progs-build-fixes.patch @@ -1,6 +1,6 @@ -diff -up btrfs-progs-0.19/btrfsck.c.orig btrfs-progs-0.19/btrfsck.c ---- btrfs-progs-0.19/btrfsck.c.orig 2012-04-11 10:44:44.000000000 -0400 -+++ btrfs-progs-0.19/btrfsck.c 2012-04-11 10:45:35.769767880 -0400 +diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c.patch2 btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c +--- btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c.patch2 2012-10-04 20:35:31.000000000 -0400 ++++ btrfs-progs-0.20.rc1.20121017git91d9eec/btrfsck.c 2012-10-17 13:45:30.172638798 -0400 @@ -22,7 +22,9 @@ #include #include @@ -11,10 +11,10 @@ diff -up btrfs-progs-0.19/btrfsck.c.orig btrfs-progs-0.19/btrfsck.c #include #include "kerncompat.h" #include "ctree.h" -diff -up btrfs-progs-0.19/mkfs.c.orig btrfs-progs-0.19/mkfs.c ---- btrfs-progs-0.19/mkfs.c.orig 2012-04-11 10:44:44.652047854 -0400 -+++ btrfs-progs-0.19/mkfs.c 2012-04-11 10:46:03.727553072 -0400 -@@ -1198,7 +1198,7 @@ int main(int ac, char **av) +diff -up btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch2 btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c +--- btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c.patch2 2012-10-17 13:45:30.167638835 -0400 ++++ btrfs-progs-0.20.rc1.20121017git91d9eec/mkfs.c 2012-10-17 13:46:41.444084426 -0400 +@@ -1228,7 +1228,7 @@ int main(int ac, char **av) u64 alloc_start = 0; u64 metadata_profile = 0; u64 data_profile = 0; @@ -23,12 +23,12 @@ diff -up btrfs-progs-0.19/mkfs.c.orig btrfs-progs-0.19/mkfs.c u32 sectorsize = 4096; u32 nodesize = leafsize; u32 stripesize = 4096; -@@ -1270,7 +1270,7 @@ int main(int ac, char **av) +@@ -1304,7 +1304,7 @@ int main(int ac, char **av) print_usage(); } } - sectorsize = max(sectorsize, (u32)getpagesize()); + sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE)); - if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) { - fprintf(stderr, "Illegal leafsize %u\n", leafsize); + if (check_leaf_or_node_size(leafsize, sectorsize)) exit(1); + if (check_leaf_or_node_size(nodesize, sectorsize)) diff --git a/btrfs-progs.spec b/btrfs-progs.spec index 936ac20..1c45615 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -1,5 +1,5 @@ Name: btrfs-progs -Version: 0.19.20120817git043a639 +Version: 0.20.rc1.20121017git91d9eec Release: 1%{?dist} Summary: Userspace programs for btrfs @@ -12,8 +12,7 @@ Patch1: btrfs-progs-valgrind.patch Patch2: btrfs-progs-build-fixes.patch Patch3: Btrfs-progs-add-btrfs-device-ready-command.patch Patch4: Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch -Patch5: Btrfs-progs-only-enforce-a-maximum-size-if-we-specif.patch -Patch6: btrfs-init-dev-list.patch +Patch5: btrfs-init-dev-list.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -33,7 +32,6 @@ check, modify and correct any inconsistencies in the btrfs filesystem. %patch3 -p1 %patch4 -p1 %patch5 -p1 -%patch6 -p1 %build make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} @@ -70,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/btrfs.8.gz %changelog +* Wed Oct 17 2012 Josef Bacik 0.20.rc1.20121017git91d9eec-1 +- update to latest btrfs-progs + * Fri Aug 17 2012 Josef Bacik 0.19.20120817git043a639-1 - update to latest btrfs-progs