diff --git a/Btrfs-progs-add-btrfs-device-ready-command.patch b/Btrfs-progs-add-btrfs-device-ready-command.patch
deleted file mode 100644
index b59b9d1..0000000
--- a/Btrfs-progs-add-btrfs-device-ready-command.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 01077c81987011d8a50999824f96032c10b2733b Mon Sep 17 00:00:00 2001
-From: Josef Bacik <jbacik@fusionio.com>
-Date: Thu, 21 Jun 2012 16:02:10 -0400
-Subject: [PATCH 1/3] Btrfs-progs: add btrfs device ready command
-
-This command will be used by things like dracut that wish to know very
-simply if all of the devices have been added to the kernel cache yet for the
-device to be fully mounted.  This keeps initrd's from constantly having to
-try to mount the file system until it succeeds every time a device is added
-to the system.  Thanks,
-
-Signed-off-by: Josef Bacik <jbacik@fusionio.com>
----
- cmds-device.c |   35 +++++++++++++++++++++++++++++++++++
- ioctl.h       |    2 ++
- 2 files changed, 37 insertions(+), 0 deletions(-)
-
-diff --git a/cmds-device.c b/cmds-device.c
-index 771856b..b24e2a3 100644
---- a/cmds-device.c
-+++ b/cmds-device.c
-@@ -249,11 +249,46 @@ static int cmd_scan_dev(int argc, char **argv)
- 	return 0;
- }
- 
-+static const char * const cmd_ready_dev_usage[] = {
-+	"btrfs device ready <device>",
-+	"Check device to see if it has all of it's devices in cache for mounting",
-+	NULL
-+};
-+
-+static int cmd_ready_dev(int argc, char **argv)
-+{
-+	struct	btrfs_ioctl_vol_args args;
-+	int	fd;
-+	int	ret;
-+
-+	if (check_argc_min(argc, 2))
-+		usage(cmd_ready_dev_usage);
-+
-+	fd = open("/dev/btrfs-control", O_RDWR);
-+	if (fd < 0) {
-+		perror("failed to open /dev/btrfs-control");
-+		return 10;
-+	}
-+
-+	strncpy(args.name, argv[argc - 1], BTRFS_PATH_NAME_MAX);
-+	ret = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
-+	if (ret < 0) {
-+		fprintf(stderr, "ERROR: unable to determine if the device '%s'"
-+			" is ready for mounting - %s\n", argv[argc - 1],
-+			strerror(errno));
-+		ret = 1;
-+	}
-+
-+	close(fd);
-+	return ret;
-+}
-+
- const struct cmd_group device_cmd_group = {
- 	device_cmd_group_usage, NULL, {
- 		{ "add", cmd_add_dev, cmd_add_dev_usage, NULL, 0 },
- 		{ "delete", cmd_rm_dev, cmd_rm_dev_usage, NULL, 0 },
- 		{ "scan", cmd_scan_dev, cmd_scan_dev_usage, NULL, 0 },
-+		{ "ready", cmd_ready_dev, cmd_ready_dev_usage, NULL, 0 },
- 		{ 0, 0, 0, 0, 0 }
- 	}
- };
-diff --git a/ioctl.h b/ioctl.h
-index d6f3d07..30220ad 100644
---- a/ioctl.h
-+++ b/ioctl.h
-@@ -365,6 +365,8 @@ struct btrfs_ioctl_clone_range_args {
- 					struct btrfs_ioctl_ino_path_args)
- #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
- 					struct btrfs_ioctl_ino_path_args)
-+#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
-+				     struct btrfs_ioctl_vol_args)
- 
- #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
- 				struct btrfs_ioctl_received_subvol_args)
--- 
-1.7.7.6
-
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
deleted file mode 100644
index e06491c..0000000
--- a/Btrfs-progs-detect-if-the-disk-we-are-formatting-is-.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From fe4e9b20d9ffffbb6aade4083caa71d65f16230a Mon Sep 17 00:00:00 2001
-From: Josef Bacik <jbacik@fusionio.com>
-Date: Fri, 20 Jul 2012 11:09:43 -0400
-Subject: [PATCH] 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 <jbacik@fusionio.com>
----
- Makefile            |    2 +-
- man/mkfs.btrfs.8.in |    5 +++-
- mkfs.c              |   63 ++++++++++++++++++++++++++++++++++++++++++++++++--
- 3 files changed, 65 insertions(+), 5 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 4894903..c7fd97d 100644
---- a/Makefile
-+++ b/Makefile
-@@ -67,7 +67,7 @@ btrfsck: $(objects) btrfsck.o
- 	$(CC) $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS)
- 
- mkfs.btrfs: $(objects) mkfs.o
--	$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
-+	$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS) -lblkid
- 
- 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 72025ed..b7bcc1b 100644
---- a/man/mkfs.btrfs.8.in
-+++ b/man/mkfs.btrfs.8.in
-@@ -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
--values are raid0, raid1, raid10 or single.
-+values are raid0, raid1, raid10, single or dup.  Single device will have dup
-+set by default except in the case of SSDs which will default to single.  This is
-+because SSDs can remap blocks internally so duplicate blocks could end up in the
-+same erase block which negates the benefits of doing metadata duplication.
- .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 47f0c9c..72f10fa 100644
---- a/mkfs.c
-+++ b/mkfs.c
-@@ -37,6 +37,7 @@
- #include <linux/fs.h>
- #include <ctype.h>
- #include <attr/xattr.h>
-+#include <blkid/blkid.h>
- #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,
- static int create_raid_groups(struct btrfs_trans_handle *trans,
- 			      struct btrfs_root *root, u64 data_profile,
- 			      int data_profile_opt, u64 metadata_profile,
--			      int metadata_profile_opt, int mixed)
-+			      int metadata_profile_opt, int mixed, int ssd)
- {
- 	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,
- 	 * For mixed groups defaults are single/single.
- 	 */
- 	if (!metadata_profile_opt && !mixed) {
-+		if (num_devices == 1 && ssd)
-+			printf("Detected a SSD, turning off metadata "
-+			       "duplication.  Mkfs with -m dup if you want to "
-+			       "force metadata duplication.\n");
- 		metadata_profile = (num_devices > 1) ?
--			BTRFS_BLOCK_GROUP_RAID1 : BTRFS_BLOCK_GROUP_DUP;
-+			BTRFS_BLOCK_GROUP_RAID1 : (ssd) ? 0: BTRFS_BLOCK_GROUP_DUP;
- 	}
- 	if (!data_profile_opt && !mixed) {
- 		data_profile = (num_devices > 1) ?
-@@ -1222,6 +1227,54 @@ static int check_leaf_or_node_size(u32 size, u32 sectorsize)
- 	return 0;
- }
- 
-+static int is_ssd(const char *file)
-+{
-+	char *devname;
-+	blkid_probe probe;
-+	char *dev;
-+	char path[PATH_MAX];
-+	dev_t disk;
-+	int fd;
-+	char rotational;
-+
-+	probe = blkid_new_probe_from_filename(file);
-+	if (!probe)
-+		return 0;
-+
-+	/*
-+	 * We want to use blkid_devno_to_wholedisk() but it's broken for some
-+	 * reason on F17 at least so we'll do this trickery
-+	 */
-+	disk = blkid_probe_get_wholedisk_devno(probe);
-+	if (!disk)
-+		return 0;
-+
-+	devname = blkid_devno_to_devname(disk);
-+	if (!devname)
-+		return 0;
-+
-+	dev = strrchr(devname, '/');
-+	dev++;
-+
-+	snprintf(path, PATH_MAX, "/sys/block/%s/queue/rotational", dev);
-+
-+	free(devname);
-+	blkid_free_probe(probe);
-+
-+	fd = open(path, O_RDONLY);
-+	if (fd < 0) {
-+		return 0;
-+	}
-+
-+	if (read(fd, &rotational, sizeof(char)) < sizeof(char)) {
-+		close(fd);
-+		return 0;
-+	}
-+	close(fd);
-+
-+	return !atoi((const char *)&rotational);
-+}
-+
- int main(int ac, char **av)
- {
- 	char *file;
-@@ -1248,6 +1301,7 @@ int main(int ac, char **av)
- 	int data_profile_opt = 0;
- 	int metadata_profile_opt = 0;
- 	int nodiscard = 0;
-+	int ssd = 0;
- 
- 	char *source_dir = NULL;
- 	int source_dir_set = 0;
-@@ -1367,6 +1421,9 @@ int main(int ac, char **av)
- 			exit(1);
- 		}
- 	}
-+
-+	ssd = is_ssd(file);
-+
- 	if (mixed) {
- 		if (metadata_profile != data_profile) {
- 			fprintf(stderr, "With mixed block groups data and metadata "
-@@ -1452,7 +1509,7 @@ raid_groups:
- 	if (!source_dir_set) {
- 		ret = create_raid_groups(trans, root, data_profile,
- 				 data_profile_opt, metadata_profile,
--				 metadata_profile_opt, mixed);
-+				 metadata_profile_opt, mixed, ssd);
- 		BUG_ON(ret);
- 	}
- 
--- 
-1.7.7.6
-
diff --git a/Btrfs-progs-make-btrfs-filesystem-show-uuid-actually.patch b/Btrfs-progs-make-btrfs-filesystem-show-uuid-actually.patch
deleted file mode 100644
index 8e17bad..0000000
--- a/Btrfs-progs-make-btrfs-filesystem-show-uuid-actually.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 33cbabf480ea811ddaef1b5f97603f4c7df7b240 Mon Sep 17 00:00:00 2001
-From: Josef Bacik <josef@redhat.com>
-Date: Wed, 25 Apr 2012 14:25:24 -0400
-Subject: [PATCH] Btrfs-progs: make btrfs filesystem show <uuid> actually work
-
-The btrfs filesystem show command is only actually searching for labels,
-it's not searching for UUID's at all.  This patch fixes that problem.
-Thanks,
-
-Signed-off-by: Josef Bacik <josef@redhat.com>
----
- cmds-filesystem.c |    7 +++++++
- 1 files changed, 7 insertions(+), 0 deletions(-)
-
-diff --git a/cmds-filesystem.c b/cmds-filesystem.c
-index 1f53d1c..ff98a77 100644
---- a/cmds-filesystem.c
-+++ b/cmds-filesystem.c
-@@ -155,8 +155,15 @@ static int cmd_df(int argc, char **argv)
- 
- static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search)
- {
-+	char uuidbuf[37];
- 	struct list_head *cur;
- 	struct btrfs_device *device;
-+	int search_len = strlen(search);
-+
-+	search_len = min(search_len, 37);
-+	uuid_unparse(fs_devices->fsid, uuidbuf);
-+	if (!strncmp(uuidbuf, search, search_len))
-+		return 1;
- 
- 	list_for_each(cur, &fs_devices->devices) {
- 		device = list_entry(cur, struct btrfs_device, dev_list);
--- 
-1.7.7.6
-
diff --git a/btrfs-progs-build-everything.patch b/btrfs-progs-build-everything.patch
deleted file mode 100644
index ed17381..0000000
--- a/btrfs-progs-build-everything.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -up btrfs-progs-0.19/Makefile.build btrfs-progs-0.19/Makefile
---- btrfs-progs-0.19/Makefile.build	2011-08-05 14:06:29.871749619 -0400
-+++ btrfs-progs-0.19/Makefile	2011-08-05 14:06:45.419727708 -0400
-@@ -17,8 +17,7 @@ bindir = $(prefix)/bin
- LIBS=-luuid
- 
- progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
--	btrfs \
--	btrfs-map-logical
-+	btrfs btrfs-map-logical btrfstune btrfs-image btrfs-zero-log
- 
- # make C=1 to enable sparse
- ifdef C
diff --git a/btrfs-progs-build-fixes.patch b/btrfs-progs-build-fixes.patch
deleted file mode 100644
index 4771e53..0000000
--- a/btrfs-progs-build-fixes.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-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 <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
-+#include <sys/types.h>
- #include <sys/stat.h>
-+#include <unistd.h>
- #include <getopt.h>
- #include "kerncompat.h"
- #include "ctree.h"
-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;
--	u32 leafsize = getpagesize();
-+	u32 leafsize = sysconf(_SC_PAGESIZE);
- 	u32 sectorsize = 4096;
- 	u32 nodesize = leafsize;
- 	u32 stripesize = 4096;
-@@ -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 (check_leaf_or_node_size(leafsize, sectorsize))
- 		exit(1);
- 	if (check_leaf_or_node_size(nodesize, sectorsize))
diff --git a/btrfs-progs-correct-uninitialized-fsid-variable.patch b/btrfs-progs-correct-uninitialized-fsid-variable.patch
deleted file mode 100644
index 3e060a0..0000000
--- a/btrfs-progs-correct-uninitialized-fsid-variable.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 6eba9002956ac40db87d42fb653a0524dc568810 Mon Sep 17 00:00:00 2001
-From: Goffredo Baroncelli <kreijack@inwind.it>
-Date: Tue, 4 Sep 2012 19:59:26 +0200
-Subject: [PATCH 1/1] Correct un-initialized fsid variable
-
----
- disk-io.c |   20 ++++++++++++++++----
- 1 files changed, 16 insertions(+), 4 deletions(-)
-
-diff --git a/disk-io.c b/disk-io.c
-index b21a87f..0395205 100644
---- a/disk-io.c
-+++ b/disk-io.c
-@@ -910,6 +910,7 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
- int btrfs_read_dev_super(int fd, struct btrfs_super_block *sb, u64 sb_bytenr)
- {
- 	u8 fsid[BTRFS_FSID_SIZE];
-+	int fsid_is_initialized = 0;
- 	struct btrfs_super_block buf;
- 	int i;
- 	int ret;
-@@ -936,15 +937,26 @@ int btrfs_read_dev_super(int fd, struct btrfs_super_block *sb, u64 sb_bytenr)
- 		if (ret < sizeof(buf))
- 			break;
- 
--		if (btrfs_super_bytenr(&buf) != bytenr ||
--		    strncmp((char *)(&buf.magic), BTRFS_MAGIC,
-+		if (btrfs_super_bytenr(&buf) != bytenr )
-+			continue;
-+		/* if magic is NULL, the device was removed */
-+		if (buf.magic == 0 && i == 0) 
-+			return -1;
-+		if (strncmp((char *)(&buf.magic), BTRFS_MAGIC,
- 			    sizeof(buf.magic)))
- 			continue;
- 
--		if (i == 0)
-+		if (!fsid_is_initialized) {
- 			memcpy(fsid, buf.fsid, sizeof(fsid));
--		else if (memcmp(fsid, buf.fsid, sizeof(fsid)))
-+			fsid_is_initialized = 1;
-+		} else if (memcmp(fsid, buf.fsid, sizeof(fsid))) {
-+			/*
-+			 * the superblocks (the original one and
-+			 * its backups) contain data of different
-+			 * filesystems -> the super cannot be trusted
-+			 */
- 			continue;
-+		}
- 
- 		if (btrfs_super_generation(&buf) > transid) {
- 			memcpy(sb, &buf, sizeof(*sb));
--- 
-1.7.7.6
-
diff --git a/btrfs-progs-fix-labels.patch b/btrfs-progs-fix-labels.patch
deleted file mode 100644
index c9b0c32..0000000
--- a/btrfs-progs-fix-labels.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-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:38:26.825973948 -0400
-+++ btrfs-progs-0.19/mkfs.c	2012-04-11 10:39:46.031360540 -0400
-@@ -372,7 +372,6 @@ static u64 parse_profile(char *s)
- 
- static char *parse_label(char *input)
- {
--	int i;
- 	int len = strlen(input);
- 
- 	if (len >= BTRFS_LABEL_SIZE) {
-@@ -380,12 +379,6 @@ static char *parse_label(char *input)
- 			BTRFS_LABEL_SIZE - 1);
- 		exit(1);
- 	}
--	for (i = 0; i < len; i++) {
--		if (input[i] == '/' || input[i] == '\\') {
--			fprintf(stderr, "invalid label %s\n", input);
--			exit(1);
--		}
--	}
- 	return strdup(input);
- }
- 
diff --git a/btrfs-progs-valgrind.patch b/btrfs-progs-valgrind.patch
index 49f0e4b..0ad3927 100644
--- a/btrfs-progs-valgrind.patch
+++ b/btrfs-progs-valgrind.patch
@@ -1,19 +1,10 @@
+Not-upstream changes from Josef.  Some bits have made it usptream
+and have been removed; the rest needs some reverse-engineering.
+
 diff -up btrfs-progs-0.19/btrfsck.c.orig btrfs-progs-0.19/btrfsck.c
 diff -up btrfs-progs-0.19/disk-io.c.orig btrfs-progs-0.19/disk-io.c
 --- btrfs-progs-0.19/disk-io.c.orig	2012-04-11 10:42:36.213042556 -0400
 +++ btrfs-progs-0.19/disk-io.c	2012-04-11 10:42:58.790867701 -0400
-@@ -458,8 +458,10 @@ static int find_and_setup_log_root(struc
- 	u64 blocknr = btrfs_super_log_root(disk_super);
- 	struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
- 
--	if (blocknr == 0)
-+	if (blocknr == 0) {
-+		free(log_root);
- 		return 0;
-+	}
- 
- 	blocksize = btrfs_level_size(tree_root,
- 			     btrfs_super_log_root_level(disk_super));
 @@ -622,7 +624,7 @@ static struct btrfs_fs_info *__open_ctre
  	struct btrfs_root *chunk_root = malloc(sizeof(struct btrfs_root));
  	struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root));
@@ -150,15 +141,6 @@ diff -up btrfs-progs-0.19/volumes.c.orig btrfs-progs-0.19/volumes.c
  int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len)
  {
  	struct cache_extent *ce;
-@@ -1484,7 +1498,7 @@ int btrfs_read_sys_array(struct btrfs_ro
- 	if (!sb)
- 		return -ENOMEM;
- 	btrfs_set_buffer_uptodate(sb);
--	write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
-+	write_extent_buffer(sb, super_copy, 0, sizeof(*super_copy));
- 	array_size = btrfs_super_sys_array_size(super_copy);
- 
- 	/*
 diff -up btrfs-progs-0.19/volumes.h.orig btrfs-progs-0.19/volumes.h
 --- btrfs-progs-0.19/volumes.h.orig	2012-04-11 10:42:36.228042439 -0400
 +++ btrfs-progs-0.19/volumes.h	2012-04-11 10:43:03.314832666 -0400
diff --git a/btrfs-progs.spec b/btrfs-progs.spec
index 03b6986..283e4ec 100644
--- a/btrfs-progs.spec
+++ b/btrfs-progs.spec
@@ -1,22 +1,17 @@
 Name:           btrfs-progs
-Version:        0.20.rc1.20121017git91d9eec
-Release:        3%{?dist}
+Version:        0.20.rc1.20130308git704a08c
+Release:        1%{?dist}
 Summary:        Userspace programs for btrfs
 
 Group:          System Environment/Base
 License:        GPLv2
 URL:            http://btrfs.wiki.kernel.org/index.php/Main_Page
 Source0:	%{name}-%{version}.tar.bz2
-Patch0: btrfs-progs-fix-labels.patch
-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-init-dev-list.patch
-# Partial fix for RHBZ#863978 (but only in Rawhide).
-# Upstream: https://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs.git;a=commitdiff;h=8fe354744cd7b5c4f7a3314dcdbb5095192a032f
-# See also: http://thread.gmane.org/gmane.comp.file-systems.btrfs/23249
-Patch6: clear-caches-when-opening-and-closing-devices.patch
+
+# Valgrind patch no longer applied, but kept for posterity
+# Still must reverse-engineer fixes in there and get upstream
+Patch0: btrfs-progs-valgrind.patch
+Patch1: btrfs-init-dev-list.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -30,16 +25,10 @@ check, modify and correct any inconsistencies in the btrfs filesystem.
 
 %prep
 %setup -q
-%patch0 -p1
 %patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
 
 %build
-make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
+make CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -63,8 +52,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_sbindir}/btrfs
 %{_sbindir}/btrfs-map-logical
 %{_sbindir}/btrfs-zero-log
-%{_sbindir}/btrfs-restore
 %{_sbindir}/btrfs-find-root
+%{_sbindir}/btrfs-show-super
 %{_mandir}/man8/btrfs-image.8.gz
 %{_mandir}/man8/btrfs-show.8.gz
 %{_mandir}/man8/btrfsck.8.gz
@@ -73,6 +62,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/btrfs.8.gz
 
 %changelog
+* Fri Mar 08 2013 Eric Sandeen <sandeen@redhat.com> 0.20.rc1.20130308git704a08c-1
+- New upstream snapshot
+- btrfs-restore is now a command in the btrfs utility
+
 * Wed Feb 13 2013 Richard W.M. Jones <rjones@redhat.com> 0.20.rc1.20121017git91d9eec-3
 - Include upstream patch to clear caches as a partial fix for RHBZ#863978.
 
@@ -177,7 +170,7 @@ rm -rf $RPM_BUILD_ROOT
 * Sat Jan 10 2009 Marek Mahut <mmahut@fedoraproject.org> 0.16-1
 - Upstream release 0.16
 
-* Mon Jun 25 2008 Josef Bacik <josef@toxicpanda.com> 0.15-4
+* Wed Jun 25 2008 Josef Bacik <josef@toxicpanda.com> 0.15-4
 -use fedoras normal CFLAGS
 
 * Mon Jun 23 2008 Josef Bacik <josef@toxicpanda.com> 0.15-3
diff --git a/clear-caches-when-opening-and-closing-devices.patch b/clear-caches-when-opening-and-closing-devices.patch
deleted file mode 100644
index 37d254d..0000000
--- a/clear-caches-when-opening-and-closing-devices.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-diff -ur btrfs-progs-0.20.rc1.20121017git91d9eec.old/disk-io.c btrfs-progs-0.20.rc1.20121017git91d9eec/disk-io.c
---- btrfs-progs-0.20.rc1.20121017git91d9eec.old/disk-io.c	2013-02-13 11:04:05.361458311 +0000
-+++ btrfs-progs-0.20.rc1.20121017git91d9eec/disk-io.c	2013-02-13 11:04:22.513377018 +0000
-@@ -634,6 +634,9 @@
- 	if (sb_bytenr == 0)
- 		sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
- 
-+	/* try to drop all the caches */
-+	posix_fadvise(fp, 0, 0, POSIX_FADV_DONTNEED);
-+
- 	ret = btrfs_scan_one_device(fp, path, &fs_devices,
- 				    &total_devs, sb_bytenr);
- 
-@@ -1083,6 +1086,10 @@
- 	list = &fs_info->fs_devices->devices;
- 	list_for_each_safe(next, tmp, list) {
- 		device = list_entry(next, struct btrfs_device, dev_list);
-+		if (device->fd) {
-+			fsync(device->fd);
-+			posix_fadvise(device->fd, 0, 0, POSIX_FADV_DONTNEED);
-+		}
- 		close(device->fd);
- 		list_del(&device->dev_list);
- 		free(device->name);
-diff -ur btrfs-progs-0.20.rc1.20121017git91d9eec.old/disk-io.c.orig btrfs-progs-0.20.rc1.20121017git91d9eec/disk-io.c.orig
---- btrfs-progs-0.20.rc1.20121017git91d9eec.old/disk-io.c.orig	2012-10-05 01:35:31.000000000 +0100
-+++ btrfs-progs-0.20.rc1.20121017git91d9eec/disk-io.c.orig	2013-02-13 11:04:05.361458311 +0000
-@@ -458,8 +458,10 @@
- 	u64 blocknr = btrfs_super_log_root(disk_super);
- 	struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
- 
--	if (blocknr == 0)
-+	if (blocknr == 0) {
-+		free(log_root);
- 		return 0;
-+	}
- 
- 	blocksize = btrfs_level_size(tree_root,
- 			     btrfs_super_log_root_level(disk_super));
-@@ -622,7 +624,7 @@
- 	struct btrfs_root *chunk_root = malloc(sizeof(struct btrfs_root));
- 	struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root));
- 	struct btrfs_root *csum_root = malloc(sizeof(struct btrfs_root));
--	struct btrfs_fs_info *fs_info = malloc(sizeof(*fs_info));
-+	struct btrfs_fs_info *fs_info = malloc(sizeof(struct btrfs_fs_info));
- 	int ret;
- 	struct btrfs_super_block *disk_super;
- 	struct btrfs_fs_devices *fs_devices = NULL;
-@@ -646,7 +648,7 @@
- 			goto out;
- 	}
- 
--	memset(fs_info, 0, sizeof(*fs_info));
-+	memset(fs_info, 0, sizeof(struct btrfs_fs_info));
- 	fs_info->tree_root = tree_root;
- 	fs_info->extent_root = extent_root;
- 	fs_info->chunk_root = chunk_root;
-@@ -1075,15 +1077,19 @@
- {
- 	struct list_head *list;
- 	struct list_head *next;
-+	struct list_head *tmp;
- 	struct btrfs_device *device;
- 
--	return 0;
--
- 	list = &fs_info->fs_devices->devices;
--	list_for_each(next, list) {
-+	list_for_each_safe(next, tmp, list) {
- 		device = list_entry(next, struct btrfs_device, dev_list);
- 		close(device->fd);
-+		list_del(&device->dev_list);
-+		free(device->name);
-+		free(device->label);
-+		free(device);
- 	}
-+	free(fs_info->fs_devices);
- 	return 0;
- }
- 
-@@ -1133,12 +1139,14 @@
- 	extent_io_tree_cleanup(&fs_info->pinned_extents);
- 	extent_io_tree_cleanup(&fs_info->pending_del);
- 	extent_io_tree_cleanup(&fs_info->extent_ins);
-+	btrfs_mapping_tree_free(&fs_info->mapping_tree);
- 
- 	free(fs_info->tree_root);
- 	free(fs_info->extent_root);
- 	free(fs_info->chunk_root);
- 	free(fs_info->dev_root);
- 	free(fs_info->csum_root);
-+	free(fs_info->log_root_tree);
- 	free(fs_info);
- 
- 	return 0;
-diff -ur btrfs-progs-0.20.rc1.20121017git91d9eec.old/volumes.c btrfs-progs-0.20.rc1.20121017git91d9eec/volumes.c
---- btrfs-progs-0.20.rc1.20121017git91d9eec.old/volumes.c	2013-02-13 11:04:05.411458074 +0000
-+++ btrfs-progs-0.20.rc1.20121017git91d9eec/volumes.c	2013-02-13 11:04:22.514377013 +0000
-@@ -176,6 +176,8 @@
- 			goto fail;
- 		}
- 
-+		posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
-+
- 		if (device->devid == fs_devices->latest_devid)
- 			fs_devices->latest_bdev = fd;
- 		if (device->devid == fs_devices->lowest_devid)
diff --git a/sources b/sources
index 6c3dfd9..8d0f054 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b44804be936858099ed1fc5b9c247c6e  btrfs-progs-0.20.rc1.20121017git91d9eec.tar.bz2
+be14c7227165ad1134355503a85fcfa8  btrfs-progs-0.20.rc1.20130308git704a08c.tar.bz2