Hello community,

here is the log from the commit of package btrfsprogs for openSUSE:Factory 
checked in at 2014-11-29 08:39:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/btrfsprogs (Old)
 and      /work/SRC/openSUSE:Factory/.btrfsprogs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "btrfsprogs"

Changes:
--------
--- /work/SRC/openSUSE:Factory/btrfsprogs/btrfsprogs.changes    2014-11-11 
09:59:19.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.btrfsprogs.new/btrfsprogs.changes       
2014-11-29 08:39:48.000000000 +0100
@@ -1,0 +2,37 @@
+Wed Nov 19 00:00:01 CET 2014 - [email protected]
+
+- version 3.17.2
+  - check improvements
+    - add ability to replace missing dir item/dir indexes
+    - fix missing inode items
+    - create missing root dirid
+  - corrupt block: enhancements for testing fsck
+  - zero-log: able to reset a fs with bogus log tree pointer (bko#72151)
+
+-------------------------------------------------------------------
+Wed Nov 19 00:00:00 CET 2014 - [email protected]
+
+- package mkinitrd scripts conditionally (bsc#893577)
+- spec: minor updates
+
+-------------------------------------------------------------------
+Fri Nov  7 00:00:00 CET 2014 - [email protected]
+
+- version 3.17.1
+  - fi df: argument handling
+  - fix linking with libbtrfs
+  - replace: better error reporting
+  - fi show: fixed stall if run concurrently with balance
+  - check: fixed argument parsing for --subvol-extents
+  - fi df: SI prefixes corrected
+- Added patches:
+  * fix-doc-build-on-SLE11SP3.diff
+- Removed patches:
+  * 0042-btrfs-progs-fix-linking-with-libbtrfs.patch
+  * 0043-btrfs-progs-libbtrfs-make-exported-headers-compatibl.patch
+- Modified patches:
+  * 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch
+  * 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch
+  * 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch
+
+-------------------------------------------------------------------

Old:
----
  0042-btrfs-progs-fix-linking-with-libbtrfs.patch
  0043-btrfs-progs-libbtrfs-make-exported-headers-compatibl.patch
  btrfs-progs-v3.17.tar.gz

New:
----
  btrfs-progs-v3.17.2.tar.gz
  fix-doc-build-on-SLE11SP3.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ btrfsprogs.spec ++++++
--- /var/tmp/diff_new_pack.NWl2TV/_old  2014-11-29 08:39:49.000000000 +0100
+++ /var/tmp/diff_new_pack.NWl2TV/_new  2014-11-29 08:39:49.000000000 +0100
@@ -16,9 +16,8 @@
 #
 
 
-%define tar_version v3.17
 Name:           btrfsprogs
-Version:        3.17
+Version:        3.17.2
 Release:        0
 Summary:        Utilities for the Btrfs filesystem
 License:        GPL-2.0
@@ -26,7 +25,8 @@
 Url:            http://btrfs.wiki.kernel.org/index.php/Main_Page
 #Git-Web:      
http://git.kernel.org/cgit/linux/kernel/git/kdave/btrfs-progs.git
 #Git-Clone:    git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs
-Source:         
https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-%{tar_version}.tar.gz
+Source:         
https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v%{version}.tar.gz
+# support for mkinitrd in < 13.1
 Source1:        boot-btrfs.sh
 Source4:        setup-btrfs.sh
 
@@ -50,8 +50,6 @@
 Patch29:        0029-btrfs-progs-replace-df_pretty_sizes-with-pretty_size.patch
 Patch30:        0030-btrfs-progs-clean-up-return-codes-and-paths.patch
 Patch31:        0031-btrfs-progs-move-global-reserve-to-overall-summary.patch
-Patch42:        0042-btrfs-progs-fix-linking-with-libbtrfs.patch
-Patch43:        0043-btrfs-progs-libbtrfs-make-exported-headers-compatibl.patch
 
 Patch163:       0163-btrfs-progs-fsck-fix-segfault.patch
 Patch167:       0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
@@ -59,6 +57,7 @@
 Patch169:       0169-btrfs-progs-Check-metadata-mirrors-in-find-root.patch
 
 Patch1000:      local-version-override.patch
+Patch1001:      fix-doc-build-on-SLE11SP3.diff
 
 BuildRequires:  asciidoc
 BuildRequires:  libacl-devel
@@ -67,6 +66,9 @@
 BuildRequires:  libext2fs-devel
 BuildRequires:  libuuid-devel
 BuildRequires:  lzo-devel
+%if 0%{?suse_version} >= 1310
+BuildRequires:  suse-module-tools
+%endif
 BuildRequires:  udev
 BuildRequires:  xmlto
 BuildRequires:  zlib-devel
@@ -95,7 +97,7 @@
 build applications to interface with btrfs.
 
 %prep
-%setup -q -n btrfs-progs-%{tar_version}
+%setup -q -n btrfs-progs-v%{version}
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
@@ -116,13 +118,12 @@
 %patch30 -p1
 %patch31 -p1
 %patch28 -p1
-%patch42 -p1
-%patch43 -p1
 %patch163 -p1
 %patch167 -p1
 %patch168 -p1
 %patch169 -p1
 %patch1000 -p1
+%patch1001 -p1
 
 %build
 make %{?_smp_mflags} CFLAGS="%{optflags}" all btrfs-convert \
@@ -153,9 +154,11 @@
 ln -s %{_sbindir}/btrfs-show-super %{buildroot}/sbin
 ln -s %{_sbindir}/mkfs.btrfs %{buildroot}/sbin
 ln -s %{_sbindir}/fsck.btrfs %{buildroot}/sbin
+%if 0%{?suse_version} < 1310
 install -d -m0755 %{buildroot}/lib/mkinitrd/scripts/
 install -m 0755 %{SOURCE1} %{buildroot}/lib/mkinitrd/scripts/
 install -m 0755 %{SOURCE4} %{buildroot}/lib/mkinitrd/scripts/
+%endif
 find %{buildroot} -type f -name "*.la" -delete -print
 # don't install .a for now
 rm -f %{buildroot}/%{_libdir}/*.a
@@ -175,6 +178,11 @@
 
 %postun -n libbtrfs0 -p /sbin/ldconfig
 
+%if 0%{?suse_version} >= 1310
+%posttrans
+%{?regenerate_initrd_posttrans}
+%endif
+
 %files
 %defattr(-, root, root)
 /sbin/fsck.btrfs
@@ -198,10 +206,12 @@
 %{_sbindir}/mkfs.btrfs
 %{_sbindir}/btrfs-debug-tree
 %{_sbindir}/btrfs-show-super
+%if 0%{?suse_version} < 1310
 %dir /lib/mkinitrd
 %dir /lib/mkinitrd/scripts
 /lib/mkinitrd/scripts/boot-btrfs.sh
 /lib/mkinitrd/scripts/setup-btrfs.sh
+%endif
 %{_bindir}/btrfs-map-logical
 %{_mandir}/man8/btrfs-image.8.gz
 %{_mandir}/man8/btrfsck.8.gz

++++++ 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch ++++++
--- /var/tmp/diff_new_pack.NWl2TV/_old  2014-11-29 08:39:49.000000000 +0100
+++ /var/tmp/diff_new_pack.NWl2TV/_new  2014-11-29 08:39:49.000000000 +0100
@@ -22,24 +22,23 @@
  create mode 100644 cmds-fi-disk_usage.c
  create mode 100644 cmds-fi-disk_usage.h
 
-diff --git a/Makefile b/Makefile
-index 9c69adae9050..a6c1ccede7c4 100644
---- a/Makefile
-+++ b/Makefile
-@@ -15,7 +15,7 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o 
cmds-device.o cmds-scrub.o \
+Index: btrfs-progs-v3.17.1/Makefile
+===================================================================
+--- btrfs-progs-v3.17.1.orig/Makefile
++++ btrfs-progs-v3.17.1/Makefile
+@@ -15,7 +15,7 @@ cmds_objects = cmds-subvolume.o cmds-fil
               cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
               cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
               cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
 -             cmds-property.o
 +             cmds-property.o cmds-fi-disk_usage.o
  libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
-                  uuid-tree.o utils-lib.o
+                  uuid-tree.o utils-lib.o rbtree-utils.o
  libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
-diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
-new file mode 100644
-index 000000000000..7f4415666bd8
+Index: btrfs-progs-v3.17.1/cmds-fi-disk_usage.c
+===================================================================
 --- /dev/null
-+++ b/cmds-fi-disk_usage.c
++++ btrfs-progs-v3.17.1/cmds-fi-disk_usage.c
 @@ -0,0 +1,516 @@
 +/*
 + * This program is free software; you can redistribute it and/or
@@ -557,11 +556,10 @@
 +      return 0;
 +}
 +
-diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
-new file mode 100644
-index 000000000000..9f68bb342d52
+Index: btrfs-progs-v3.17.1/cmds-fi-disk_usage.h
+===================================================================
 --- /dev/null
-+++ b/cmds-fi-disk_usage.h
++++ btrfs-progs-v3.17.1/cmds-fi-disk_usage.h
 @@ -0,0 +1,25 @@
 +/*
 + * Copyright (C) 2007 Oracle.  All rights reserved.
@@ -588,10 +586,10 @@
 +int cmd_filesystem_df(int argc, char **argv);
 +
 +#endif
-diff --git a/cmds-filesystem.c b/cmds-filesystem.c
-index ffa939c5b89a..91e4e2e5a881 100644
---- a/cmds-filesystem.c
-+++ b/cmds-filesystem.c
+Index: btrfs-progs-v3.17.1/cmds-filesystem.c
+===================================================================
+--- btrfs-progs-v3.17.1.orig/cmds-filesystem.c
++++ btrfs-progs-v3.17.1/cmds-filesystem.c
 @@ -36,6 +36,7 @@
  #include "volumes.h"
  #include "version.h"
@@ -600,7 +598,7 @@
  #include "list_sort.h"
  #include "disk-io.h"
  
-@@ -112,6 +113,7 @@ static const char * const filesystem_cmd_group_usage[] = {
+@@ -121,6 +122,7 @@ static const char * const filesystem_cmd
        NULL
  };
  
@@ -608,15 +606,15 @@
  static const char * const cmd_df_usage[] = {
         "btrfs filesystem df [options] <path>",
         "Show space usage information for a mount point",
-@@ -126,6 +128,7 @@ static const char * const cmd_df_usage[] = {
-       "-t|--tbytes        show sizes in TiB, or tB with --si",
+@@ -135,6 +137,7 @@ static const char * const cmd_df_usage[]
+       "-t|--tbytes        show sizes in TiB, or TB with --si",
         NULL
  };
 +#endif
  
  static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
  {
-@@ -175,6 +178,7 @@ static int get_df(int fd, struct btrfs_ioctl_space_args 
**sargs_ret)
+@@ -184,6 +187,7 @@ static int get_df(int fd, struct btrfs_i
        return 0;
  }
  
@@ -624,7 +622,7 @@
  static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
  {
        u64 i;
-@@ -269,6 +273,7 @@ static int cmd_df(int argc, char **argv)
+@@ -277,6 +281,7 @@ static int cmd_df(int argc, char **argv)
        close_file_or_dir(fd, dirstream);
        return !!ret;
  }
@@ -632,7 +630,7 @@
  
  static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label,
                                        char *search)
-@@ -1263,7 +1268,7 @@ static int cmd_label(int argc, char **argv)
+@@ -1275,7 +1280,7 @@ static int cmd_label(int argc, char **ar
  
  const struct cmd_group filesystem_cmd_group = {
        filesystem_cmd_group_usage, NULL, {
@@ -641,10 +639,10 @@
                { "show", cmd_show, cmd_show_usage, NULL, 0 },
                { "sync", cmd_sync, cmd_sync_usage, NULL, 0 },
                { "defragment", cmd_defrag, cmd_defrag_usage, NULL, 0 },
-diff --git a/ctree.h b/ctree.h
-index 89036defc396..5a60bd268871 100644
---- a/ctree.h
-+++ b/ctree.h
+Index: btrfs-progs-v3.17.1/ctree.h
+===================================================================
+--- btrfs-progs-v3.17.1.orig/ctree.h
++++ btrfs-progs-v3.17.1/ctree.h
 @@ -842,9 +842,10 @@ struct btrfs_csum_item {
  #define BTRFS_BLOCK_GROUP_RAID1               (1ULL << 4)
  #define BTRFS_BLOCK_GROUP_DUP         (1ULL << 5)
@@ -658,10 +656,10 @@
  
  #define BTRFS_BLOCK_GROUP_TYPE_MASK   (BTRFS_BLOCK_GROUP_DATA |    \
                                         BTRFS_BLOCK_GROUP_SYSTEM |  \
-diff --git a/utils.c b/utils.c
-index 43b693c94039..cf0559d9c9dd 100644
---- a/utils.c
-+++ b/utils.c
+Index: btrfs-progs-v3.17.1/utils.c
+===================================================================
+--- btrfs-progs-v3.17.1.orig/utils.c
++++ btrfs-progs-v3.17.1/utils.c
 @@ -38,6 +38,8 @@
  #include <linux/kdev_t.h>
  #include <limits.h>
@@ -671,7 +669,7 @@
  #include "kerncompat.h"
  #include "radix-tree.h"
  #include "ctree.h"
-@@ -2475,3 +2477,12 @@ char* btrfs_group_profile_str(u64 flag)
+@@ -2493,3 +2495,12 @@ char* btrfs_group_profile_str(u64 flag)
        }
  }
  
@@ -684,11 +682,11 @@
 +      else
 +              return sfs.f_bsize * sfs.f_blocks;
 +}
-diff --git a/utils.h b/utils.h
-index 0d202f6344c4..2976e11d7a93 100644
---- a/utils.h
-+++ b/utils.h
-@@ -133,6 +133,7 @@ int find_mount_root(const char *path, char **mount_root);
+Index: btrfs-progs-v3.17.1/utils.h
+===================================================================
+--- btrfs-progs-v3.17.1.orig/utils.h
++++ btrfs-progs-v3.17.1/utils.h
+@@ -134,6 +134,7 @@ int find_mount_root(const char *path, ch
  int get_device_info(int fd, u64 devid,
                struct btrfs_ioctl_dev_info_args *di_args);
  int test_uuid_unique(char *fs_uuid);
@@ -696,6 +694,3 @@
  
  int test_minimum_size(const char *file, u32 leafsize);
  int test_issubvolname(const char *name);
--- 
-2.1.1
-

++++++ 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch ++++++
--- /var/tmp/diff_new_pack.NWl2TV/_old  2014-11-29 08:39:49.000000000 +0100
+++ /var/tmp/diff_new_pack.NWl2TV/_new  2014-11-29 08:39:49.000000000 +0100
@@ -39,24 +39,23 @@
  create mode 100644 string-table.c
  create mode 100644 string-table.h
 
-diff --git a/Makefile b/Makefile
-index a6c1ccede7c4..7f76447e3c55 100644
---- a/Makefile
-+++ b/Makefile
-@@ -10,7 +10,7 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o 
print-tree.o \
+Index: btrfs-progs-v3.17.1/Makefile
+===================================================================
+--- btrfs-progs-v3.17.1.orig/Makefile
++++ btrfs-progs-v3.17.1/Makefile
+@@ -10,7 +10,7 @@ objects = ctree.o disk-io.o radix-tree.o
          root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
          extent-cache.o extent_io.o volumes.o utils.o repair.o \
          qgroup.o raid6.o free-space-cache.o list_sort.o props.o \
--        ulist.o qgroup-verify.o backref.o rbtree-utils.o
-+        ulist.o qgroup-verify.o backref.o rbtree-utils.o string-table.o
+-        ulist.o qgroup-verify.o backref.o
++        ulist.o qgroup-verify.o backref.o string-table.o
  cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
               cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
               cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
-diff --git a/string-table.c b/string-table.c
-new file mode 100644
-index 000000000000..701f2147a3cc
+Index: btrfs-progs-v3.17.1/string-table.c
+===================================================================
 --- /dev/null
-+++ b/string-table.c
++++ btrfs-progs-v3.17.1/string-table.c
 @@ -0,0 +1,156 @@
 +/*
 + * This program is free software; you can redistribute it and/or
@@ -214,11 +213,10 @@
 +      free(tab);
 +
 +}
-diff --git a/string-table.h b/string-table.h
-new file mode 100644
-index 000000000000..83c4425d5f76
+Index: btrfs-progs-v3.17.1/string-table.h
+===================================================================
 --- /dev/null
-+++ b/string-table.h
++++ btrfs-progs-v3.17.1/string-table.h
 @@ -0,0 +1,36 @@
 +/*
 + * This program is free software; you can redistribute it and/or
@@ -256,6 +254,3 @@
 +void table_free(struct string_table *);
 +
 +#endif
--- 
-2.1.1
-

++++++ 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch ++++++
--- /var/tmp/diff_new_pack.NWl2TV/_old  2014-11-29 08:39:49.000000000 +0100
+++ /var/tmp/diff_new_pack.NWl2TV/_new  2014-11-29 08:39:49.000000000 +0100
@@ -16,11 +16,11 @@
  cmds-filesystem.c    | 16 ++++------
  3 files changed, 24 insertions(+), 84 deletions(-)
 
-diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
-index 9fd59bc1b5ae..683d6fb36de4 100644
---- a/cmds-fi-disk_usage.c
-+++ b/cmds-fi-disk_usage.c
-@@ -328,6 +328,8 @@ static struct btrfs_ioctl_space_args *load_space_info(int 
fd, char *path)
+Index: btrfs-progs-v3.17.1/cmds-fi-disk_usage.c
+===================================================================
+--- btrfs-progs-v3.17.1.orig/cmds-fi-disk_usage.c
++++ btrfs-progs-v3.17.1/cmds-fi-disk_usage.c
+@@ -328,6 +328,8 @@ static struct btrfs_ioctl_space_args *lo
        return sargs;
  }
  
@@ -93,7 +93,7 @@
  
  /*
   *  Helper to sort the disk_info structure
-@@ -612,10 +559,10 @@ static u64 calc_chunk_size(struct chunk_info *ci)
+@@ -612,10 +559,10 @@ static u64 calc_chunk_size(struct chunk_
  }
  
  /*
@@ -106,7 +106,7 @@
                                        struct btrfs_ioctl_space_args *sargs,
                                        struct chunk_info *chunks_info_ptr,
                                        int chunks_info_count,
-@@ -795,10 +742,10 @@ static void print_chunk_disks(u64 chunk_type,
+@@ -795,10 +742,10 @@ static void print_chunk_disks(u64 chunk_
  }
  
  /*
@@ -119,7 +119,7 @@
                                        struct btrfs_ioctl_space_args *sargs,
                                        struct chunk_info *info_ptr,
                                        int info_count,
-@@ -839,7 +786,7 @@ static void _cmd_filesystem_disk_usage_linear(int mode,
+@@ -839,7 +786,7 @@ static void _cmd_filesystem_disk_usage_l
  
  }
  
@@ -128,7 +128,7 @@
  {
        struct btrfs_ioctl_space_args *sargs = 0;
        int info_count = 0;
-@@ -860,11 +807,11 @@ static int _cmd_filesystem_disk_usage(int fd, char 
*path, int mode, int tabular)
+@@ -860,11 +807,11 @@ static int _cmd_filesystem_disk_usage(in
        }
  
        if (tabular)
@@ -153,7 +153,7 @@
        "Show in which disk the chunks are allocated.",
        "",
        "-b\tSet byte as unit",
-@@ -889,7 +836,7 @@ const char * const cmd_filesystem_disk_usage_usage[] = {
+@@ -889,7 +836,7 @@ const char * const cmd_filesystem_disk_u
        NULL
  };
  
@@ -162,7 +162,7 @@
  {
  
        int     flags = DF_HUMAN_UNIT;
-@@ -909,12 +856,12 @@ int cmd_filesystem_disk_usage(int argc, char **argv)
+@@ -909,12 +856,12 @@ int cmd_filesystem_disk_usage(int argc,
                        tabular = 1;
                        break;
                default:
@@ -177,7 +177,7 @@
  
        for (i = optind; i < argc ; i++) {
                int r, fd;
-@@ -928,7 +875,7 @@ int cmd_filesystem_disk_usage(int argc, char **argv)
+@@ -928,7 +875,7 @@ int cmd_filesystem_disk_usage(int argc,
                                argv[1]);
                        return 12;
                }
@@ -186,10 +186,10 @@
                close_file_or_dir(fd, dirstream);
  
                if (r)
-diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
-index c315004cd806..95cf4aabefb4 100644
---- a/cmds-fi-disk_usage.h
-+++ b/cmds-fi-disk_usage.h
+Index: btrfs-progs-v3.17.1/cmds-fi-disk_usage.h
+===================================================================
+--- btrfs-progs-v3.17.1.orig/cmds-fi-disk_usage.h
++++ btrfs-progs-v3.17.1/cmds-fi-disk_usage.h
 @@ -19,11 +19,8 @@
  #ifndef __CMDS_FI_DISK_USAGE__
  #define __CMDS_FI_DISK_USAGE__
@@ -204,11 +204,11 @@
  
  extern const char * const cmd_device_disk_usage_usage[];
  int cmd_device_disk_usage(int argc, char **argv);
-diff --git a/cmds-filesystem.c b/cmds-filesystem.c
-index 43d5c31dcbb0..6626c7c9eaa2 100644
---- a/cmds-filesystem.c
-+++ b/cmds-filesystem.c
-@@ -113,8 +113,7 @@ static const char * const filesystem_cmd_group_usage[] = {
+Index: btrfs-progs-v3.17.1/cmds-filesystem.c
+===================================================================
+--- btrfs-progs-v3.17.1.orig/cmds-filesystem.c
++++ btrfs-progs-v3.17.1/cmds-filesystem.c
+@@ -122,8 +122,7 @@ static const char * const filesystem_cmd
        NULL
  };
  
@@ -218,15 +218,15 @@
         "btrfs filesystem df [options] <path>",
         "Show space usage information for a mount point",
        "-b|--raw           raw numbers in bytes",
-@@ -128,7 +127,6 @@ static const char * const cmd_df_usage[] = {
-       "-t|--tbytes        show sizes in TiB, or tB with --si",
+@@ -137,7 +136,6 @@ static const char * const cmd_df_usage[]
+       "-t|--tbytes        show sizes in TiB, or TB with --si",
         NULL
  };
 -#endif
  
  static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
  {
-@@ -178,7 +176,6 @@ static int get_df(int fd, struct btrfs_ioctl_space_args 
**sargs_ret)
+@@ -187,7 +185,6 @@ static int get_df(int fd, struct btrfs_i
        return 0;
  }
  
@@ -234,7 +234,7 @@
  static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
  {
        u64 i;
-@@ -193,7 +190,7 @@ static void print_df(struct btrfs_ioctl_space_args *sargs, 
unsigned unit_mode)
+@@ -202,7 +199,7 @@ static void print_df(struct btrfs_ioctl_
        }
  }
  
@@ -243,7 +243,7 @@
  {
        struct btrfs_ioctl_space_args *sargs = NULL;
        int ret;
-@@ -247,12 +244,12 @@ static int cmd_df(int argc, char **argv)
+@@ -255,12 +252,12 @@ static int cmd_df(int argc, char **argv)
                        units_set_mode(&unit_mode, UNITS_BINARY);
                        break;
                default:
@@ -252,13 +252,13 @@
                }
        }
  
-       if (check_argc_max(argc, optind + 1))
+       if (check_argc_exact(argc, optind + 1))
 -              usage(cmd_df_usage);
 +              usage(cmd_filesystem_df_usage);
  
        path = argv[optind];
  
-@@ -273,7 +270,6 @@ static int cmd_df(int argc, char **argv)
+@@ -281,7 +278,6 @@ static int cmd_df(int argc, char **argv)
        close_file_or_dir(fd, dirstream);
        return !!ret;
  }
@@ -266,7 +266,7 @@
  
  static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label,
                                        char *search)
-@@ -1275,8 +1271,8 @@ const struct cmd_group filesystem_cmd_group = {
+@@ -1287,8 +1283,8 @@ const struct cmd_group filesystem_cmd_gr
                { "balance", cmd_balance, NULL, &balance_cmd_group, 1 },
                { "resize", cmd_resize, cmd_resize_usage, NULL, 0 },
                { "label", cmd_label, cmd_label_usage, NULL, 0 },
@@ -277,6 +277,3 @@
  
                NULL_CMD_STRUCT
        }
--- 
-2.1.1
-

++++++ btrfs-progs-v3.17.tar.gz -> btrfs-progs-v3.17.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/.gitignore 
new/btrfs-progs-v3.17.2/.gitignore
--- old/btrfs-progs-v3.17/.gitignore    2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/.gitignore  2014-11-19 17:44:56.000000000 +0100
@@ -1,6 +1,7 @@
 *.o
 *.static.o
 *.o.d
+tags
 .cc-defines.h
 version.h
 version
@@ -30,8 +31,11 @@
 btrfs-zero-log
 btrfs-corrupt-block
 btrfs-select-super
+btrfs-calc-size
 btrfstune
 libbtrfs.a
 libbtrfs.so
 libbtrfs.so.0
 libbtrfs.so.0.1
+library-test
+library-test-static
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/Documentation/btrfs-check.txt 
new/btrfs-progs-v3.17.2/Documentation/btrfs-check.txt
--- old/btrfs-progs-v3.17/Documentation/btrfs-check.txt 2014-10-17 
18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/Documentation/btrfs-check.txt       2014-11-19 
17:44:56.000000000 +0100
@@ -32,6 +32,8 @@
 create a new extent tree.
 --check-data-csum::
 verify checkums of data blocks.
+--subvol-extents <subvolid>::
+show extent state for a subvolume.
 
 EXIT STATUS
 -----------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/Documentation/btrfs-filesystem.txt 
new/btrfs-progs-v3.17.2/Documentation/btrfs-filesystem.txt
--- old/btrfs-progs-v3.17/Documentation/btrfs-filesystem.txt    2014-10-17 
18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/Documentation/btrfs-filesystem.txt  2014-11-19 
17:44:56.000000000 +0100
@@ -35,11 +35,11 @@
 -k|--kbytes::::
 show sizes in KiB, or kB with --si
 -m|--mbytes::::
-show sizes in MiB, or mB with --si
+show sizes in MiB, or MB with --si
 -g|--gbytes::::
-show sizes in GiB, or gB with --si
+show sizes in GiB, or GB with --si
 -t|--tbytes::::
-show sizes in TiB, or tB with --si
+show sizes in TiB, or TB with --si
 
 If conflicting options are passed, the last one takes precedence.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/Makefile 
new/btrfs-progs-v3.17.2/Makefile
--- old/btrfs-progs-v3.17/Makefile      2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/Makefile    2014-11-19 17:44:56.000000000 +0100
@@ -10,14 +10,14 @@
          root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
          extent-cache.o extent_io.o volumes.o utils.o repair.o \
          qgroup.o raid6.o free-space-cache.o list_sort.o props.o \
-         ulist.o qgroup-verify.o backref.o rbtree-utils.o
+         ulist.o qgroup-verify.o backref.o
 cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
               cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
               cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
               cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
               cmds-property.o
 libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
-                  uuid-tree.o utils-lib.o
+                  uuid-tree.o utils-lib.o rbtree-utils.o
 libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
               crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
               extent_io.h ioctl.h ctree.h btrfsck.h version.h
@@ -50,6 +50,9 @@
        btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
        btrfs-find-root btrfstune btrfs-show-super
 
+progs_extra = btrfs-corrupt-block btrfs-fragments btrfs-calc-size \
+             btrfs-select-super
+
 progs_static = $(foreach p,$(progs),$(p).static)
 
 # external libs required by various binaries; for btrfs-foo,
@@ -240,6 +243,22 @@
        @echo "    [LD]     $@"
        $(Q)$(CC) $(CFLAGS) -o send-test $(objects) send-test.o $(LDFLAGS) 
$(LIBS) -lpthread
 
+library-test: $(libs_shared) library-test.o
+       @echo "    [LD]     $@"
+       $(Q)$(CC) $(CFLAGS) -o library-test library-test.o $(LDFLAGS) -lbtrfs
+
+library-test.static: $(libs_static) library-test.o
+       @echo "    [LD]     $@"
+       $(Q)$(CC) $(CFLAGS) -o library-test-static library-test.o $(LDFLAGS) 
$(libs_static)
+
+test-build:
+       $(MAKE) clean-all
+       $(MAKE) library-test
+       -$(MAKE) library-test.static
+       $(MAKE) -j 8 all
+       -$(MAKE) -j 8 static
+       $(MAKE) -j 8 $(progs_extra)
+
 manpages:
        $(Q)$(MAKE) $(MAKEOPTS) -C Documentation
 
@@ -247,11 +266,12 @@
 
 clean: $(CLEANDIRS)
        @echo "Cleaning"
-       $(Q)rm -f $(progs) cscope.out *.o *.o.d btrfs-convert btrfs-image 
btrfs-select-super \
-             btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test 
btrfsck \
-             btrfs.static mkfs.btrfs.static btrfs-calc-size \
+       $(Q)rm -f $(progs) cscope.out *.o *.o.d \
+             dir-test ioctl-test quick-test send-test library-test 
library-test-static \
+             btrfs.static mkfs.btrfs.static \
              version.h $(check_defs) \
-             $(libs) $(lib_links)
+             $(libs) $(lib_links) \
+             $(progs_static) $(progs_extra)
 
 clean-doc:
        @echo "Cleaning Documentation"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/btrfs-corrupt-block.c 
new/btrfs-progs-v3.17.2/btrfs-corrupt-block.c
--- old/btrfs-progs-v3.17/btrfs-corrupt-block.c 2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/btrfs-corrupt-block.c       2014-11-19 
17:44:56.000000000 +0100
@@ -111,6 +111,7 @@
        fprintf(stderr, "\t-I An item to corrupt (must also specify the field "
                "to corrupt and a root+key for the item)\n");
        fprintf(stderr, "\t-D Corrupt a dir item, must specify key and 
field\n");
+       fprintf(stderr, "\t-d Delete this item (must specify -K)\n");
        exit(1);
 }
 
@@ -811,6 +812,39 @@
        return ret;
 }
 
+static int delete_item(struct btrfs_root *root, struct btrfs_key *key)
+{
+       struct btrfs_trans_handle *trans;
+       struct btrfs_path *path;
+       int ret;
+
+       path = btrfs_alloc_path();
+       if (!path)
+               return -ENOMEM;
+
+       trans = btrfs_start_transaction(root, 1);
+       if (IS_ERR(trans)) {
+               btrfs_free_path(path);
+               fprintf(stderr, "Couldn't start transaction %ld\n",
+                       PTR_ERR(trans));
+               return PTR_ERR(trans);
+       }
+
+       ret = btrfs_search_slot(trans, root, key, path, -1, 1);
+       if (ret) {
+               if (ret > 0)
+                       ret = -ENOENT;
+               fprintf(stderr, "Error searching to node %d\n", ret);
+               goto out;
+       }
+       ret = btrfs_del_item(trans, root, path);
+       btrfs_mark_buffer_dirty(path->nodes[0]);
+out:
+       btrfs_commit_transaction(trans, root);
+       btrfs_free_path(path);
+       return ret;
+}
+
 static struct option long_options[] = {
        /* { "byte-count", 1, NULL, 'b' }, */
        { "logical", 1, NULL, 'l' },
@@ -828,6 +862,7 @@
        { "key", 1, NULL, 'K'},
        { "item", 0, NULL, 'I'},
        { "dir-item", 0, NULL, 'D'},
+       { "delete", 0, NULL, 'd'},
        { 0, 0, 0, 0}
 };
 
@@ -993,6 +1028,7 @@
        int chunk_tree = 0;
        int corrupt_item = 0;
        int corrupt_di = 0;
+       int delete = 0;
        u64 metadata_block = 0;
        u64 inode = 0;
        u64 file_extent = (u64)-1;
@@ -1004,7 +1040,7 @@
 
        while(1) {
                int c;
-               c = getopt_long(ac, av, "l:c:b:eEkuUi:f:x:m:K:ID", long_options,
+               c = getopt_long(ac, av, "l:c:b:eEkuUi:f:x:m:K:IDd", 
long_options,
                                &option_index);
                if (c < 0)
                        break;
@@ -1060,6 +1096,8 @@
                                break;
                        case 'I':
                                corrupt_item = 1;
+                       case 'd':
+                               delete = 1;
                                break;
                        default:
                                print_usage();
@@ -1167,6 +1205,11 @@
                if (!key.objectid)
                        print_usage();
                ret = corrupt_btrfs_item(root, &key, field);
+       }
+       if (delete) {
+               if (!key.objectid)
+                       print_usage();
+               ret = delete_item(root, &key);
                goto out_close;
        }
        if (key.objectid || key.offset || key.type) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/btrfs-map-logical.c 
new/btrfs-progs-v3.17.2/btrfs-map-logical.c
--- old/btrfs-progs-v3.17/btrfs-map-logical.c   2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/btrfs-map-logical.c 2014-11-19 17:44:56.000000000 
+0100
@@ -76,8 +76,18 @@
                        (unsigned long long)eb->dev_bytenr, device->name);
                kfree(multi);
 
-               if (!copy || mirror_num == copy)
+               if (!copy || mirror_num == copy) {
                        ret = read_extent_from_disk(eb, 0, eb->len);
+                       if (ret) {
+                               fprintf(info_file,
+                                       "Error: failed to read extent: mirror 
%d logical %llu: %s\n",
+                                       mirror_num, (unsigned long 
long)eb->start,
+                                       strerror(-ret));
+                               free_extent_buffer(eb);
+                               eb = NULL;
+                               break;
+                       }
+               }
 
                num_copies = btrfs_num_copies(&root->fs_info->mapping_tree,
                                              eb->start, eb->len);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/btrfs-zero-log.c 
new/btrfs-progs-v3.17.2/btrfs-zero-log.c
--- old/btrfs-progs-v3.17/btrfs-zero-log.c      2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/btrfs-zero-log.c    2014-11-19 17:44:56.000000000 
+0100
@@ -61,7 +61,7 @@
                goto out;
        }
 
-       root = open_ctree(av[1], 0, OPEN_CTREE_WRITES);
+       root = open_ctree(av[1], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
 
        if (root == NULL)
                return 1;
@@ -71,6 +71,7 @@
        btrfs_set_super_log_root_level(root->fs_info->super_copy, 0);
        btrfs_commit_transaction(trans, root);
        close_ctree(root);
+       printf("Log root zero'ed\n");
 out:
        return !!ret;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-check.c 
new/btrfs-progs-v3.17.2/cmds-check.c
--- old/btrfs-progs-v3.17/cmds-check.c  2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/cmds-check.c        2014-11-19 17:44:56.000000000 
+0100
@@ -1727,6 +1727,61 @@
        return ret;
 }
 
+static int create_inode_item(struct btrfs_root *root,
+                            struct inode_record *rec,
+                            struct inode_backref *backref, int root_dir)
+{
+       struct btrfs_trans_handle *trans;
+       struct btrfs_inode_item inode_item;
+       time_t now = time(NULL);
+       int ret;
+
+       trans = btrfs_start_transaction(root, 1);
+       if (IS_ERR(trans)) {
+               ret = PTR_ERR(trans);
+               return ret;
+       }
+
+       fprintf(stderr, "root %llu inode %llu recreating inode item, this may "
+               "be incomplete, please check permissions and content after "
+               "the fsck completes.\n", (unsigned long long)root->objectid,
+               (unsigned long long)rec->ino);
+
+       memset(&inode_item, 0, sizeof(inode_item));
+       btrfs_set_stack_inode_generation(&inode_item, trans->transid);
+       if (root_dir)
+               btrfs_set_stack_inode_nlink(&inode_item, 1);
+       else
+               btrfs_set_stack_inode_nlink(&inode_item, rec->found_link);
+       btrfs_set_stack_inode_nbytes(&inode_item, rec->found_size);
+       if (rec->found_dir_item) {
+               if (rec->found_file_extent)
+                       fprintf(stderr, "root %llu inode %llu has both a dir "
+                               "item and extents, unsure if it is a dir or a "
+                               "regular file so setting it as a directory\n",
+                               (unsigned long long)root->objectid,
+                               (unsigned long long)rec->ino);
+               btrfs_set_stack_inode_mode(&inode_item, S_IFDIR | 0755);
+               btrfs_set_stack_inode_size(&inode_item, rec->found_size);
+       } else if (!rec->found_dir_item) {
+               btrfs_set_stack_inode_size(&inode_item, rec->extent_end);
+               btrfs_set_stack_inode_mode(&inode_item, S_IFREG | 0755);
+       }
+       btrfs_set_stack_timespec_sec(&inode_item.atime, now);
+       btrfs_set_stack_timespec_nsec(&inode_item.atime, 0);
+       btrfs_set_stack_timespec_sec(&inode_item.ctime, now);
+       btrfs_set_stack_timespec_nsec(&inode_item.ctime, 0);
+       btrfs_set_stack_timespec_sec(&inode_item.mtime, now);
+       btrfs_set_stack_timespec_nsec(&inode_item.mtime, 0);
+       btrfs_set_stack_timespec_sec(&inode_item.otime, 0);
+       btrfs_set_stack_timespec_nsec(&inode_item.otime, 0);
+
+       ret = btrfs_insert_inode(trans, root, rec->ino, &inode_item);
+       BUG_ON(ret);
+       btrfs_commit_transaction(trans, root);
+       return 0;
+}
+
 static int repair_inode_backrefs(struct btrfs_root *root,
                                 struct inode_record *rec,
                                 struct cache_tree *inode_cache,
@@ -1738,6 +1793,15 @@
        int repaired = 0;
 
        list_for_each_entry_safe(backref, tmp, &rec->backrefs, list) {
+               if (!delete && rec->ino == root_dirid) {
+                       if (!rec->found_inode_item) {
+                               ret = create_inode_item(root, rec, backref, 1);
+                               if (ret)
+                                       break;
+                               repaired++;
+                       }
+               }
+
                /* Index 0 for root dir's are special, don't mess with it */
                if (rec->ino == root_dirid && backref->index == 0)
                        continue;
@@ -1772,6 +1836,45 @@
                        }
                }
 
+               if (!delete && (!backref->found_dir_index &&
+                               !backref->found_dir_item &&
+                               backref->found_inode_ref)) {
+                       struct btrfs_trans_handle *trans;
+                       struct btrfs_key location;
+
+                       location.objectid = rec->ino;
+                       location.type = BTRFS_INODE_ITEM_KEY;
+                       location.offset = 0;
+
+                       trans = btrfs_start_transaction(root, 1);
+                       if (IS_ERR(trans)) {
+                               ret = PTR_ERR(trans);
+                               break;
+                       }
+                       fprintf(stderr, "adding missing dir index/item pair "
+                               "for inode %llu\n",
+                               (unsigned long long)rec->ino);
+                       ret = btrfs_insert_dir_item(trans, root, backref->name,
+                                                   backref->namelen,
+                                                   backref->dir, &location,
+                                                   imode_to_type(rec->imode),
+                                                   backref->index);
+                       BUG_ON(ret);
+                       btrfs_commit_transaction(trans, root);
+                       repaired++;
+               }
+
+               if (!delete && (backref->found_inode_ref &&
+                               backref->found_dir_index &&
+                               backref->found_dir_item &&
+                               !(backref->errors & REF_ERR_INDEX_UNMATCH) &&
+                               !rec->found_inode_item)) {
+                       ret = create_inode_item(root, rec, backref, 0);
+                       if (ret)
+                               break;
+                       repaired++;
+               }
+
        }
        return ret ? ret : repaired;
 }
@@ -1884,6 +1987,26 @@
                        error++;
                }
        } else {
+               if (repair) {
+                       struct btrfs_trans_handle *trans;
+
+                       trans = btrfs_start_transaction(root, 1);
+                       if (IS_ERR(trans)) {
+                               err = PTR_ERR(trans);
+                               return err;
+                       }
+
+                       fprintf(stderr,
+                               "root %llu missing its root dir, recreating\n",
+                               (unsigned long long)root->objectid);
+
+                       ret = btrfs_make_root_dir(trans, root, root_dirid);
+                       BUG_ON(ret);
+
+                       btrfs_commit_transaction(trans, root);
+                       return -EAGAIN;
+               }
+
                fprintf(stderr, "root %llu root dir %llu not found\n",
                        (unsigned long long)root->root_key.objectid,
                        (unsigned long long)root_dirid);
@@ -7544,7 +7667,7 @@
        { "init-extent-tree", 0, NULL, 0 },
        { "check-data-csum", 0, NULL, 0 },
        { "backup", 0, NULL, 0 },
-       { "subvol-extents", no_argument, NULL, 'E' },
+       { "subvol-extents", 1, NULL, 'E' },
        { "qgroup-report", 0, NULL, 'Q' },
        { NULL, 0, NULL, 0}
 };
@@ -7560,7 +7683,7 @@
        "--init-extent-tree          create a new extent tree",
        "--check-data-csum           verify checkums of data blocks",
        "--qgroup-report             print a report on qgroup consistency",
-       "--subvol-extents            print subvolume extents and sharing state",
+       "--subvol-extents <subvolid> print subvolume extents and sharing state",
        NULL
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-device.c 
new/btrfs-progs-v3.17.2/cmds-device.c
--- old/btrfs-progs-v3.17/cmds-device.c 2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/cmds-device.c       2014-11-19 17:44:56.000000000 
+0100
@@ -205,7 +205,7 @@
 
 static int cmd_scan_dev(int argc, char **argv)
 {
-       int i, fd, e;
+       int i;
        int devstart = 1;
        int all = 0;
        int ret = 0;
@@ -235,28 +235,23 @@
 
        if (all || argc == 1) {
                printf("Scanning for Btrfs filesystems\n");
-               ret = btrfs_scan_lblkid(BTRFS_UPDATE_KERNEL);
+               ret = btrfs_scan_lblkid();
                if (ret)
                        fprintf(stderr, "ERROR: error %d while scanning\n", 
ret);
-               goto out;
-       }
-
-       fd = open("/dev/btrfs-control", O_RDWR);
-       if (fd < 0) {
-               perror("failed to open /dev/btrfs-control");
-               ret = 1;
+               ret = btrfs_register_all_devices();
+               if (ret)
+                       fprintf(stderr, "ERROR: error %d while registering\n", 
ret);
                goto out;
        }
 
        for( i = devstart ; i < argc ; i++ ){
-               struct btrfs_ioctl_vol_args args;
                char *path;
 
                if (!is_block_device(argv[i])) {
                        fprintf(stderr,
                                "ERROR: %s is not a block device\n", argv[i]);
                        ret = 1;
-                       goto close_out;
+                       goto out;
                }
                path = canonicalize_path(argv[i]);
                if (!path) {
@@ -264,30 +259,17 @@
                                "ERROR: Could not canonicalize path '%s': %s\n",
                                argv[i], strerror(errno));
                        ret = 1;
-                       goto close_out;
+                       goto out;
                }
                printf("Scanning for Btrfs filesystems in '%s'\n", path);
-
-               strncpy_null(args.name, path);
-               /*
-                * FIXME: which are the error code returned by this ioctl ?
-                * it seems that is impossible to understand if there no is
-                * a btrfs filesystem from an I/O error !!!
-                */
-               ret = ioctl(fd, BTRFS_IOC_SCAN_DEV, &args);
-               e = errno;
-
-               if( ret < 0 ){
-                       fprintf(stderr, "ERROR: unable to scan the device '%s' 
- %s\n",
-                               path, strerror(e));
+               if (btrfs_register_one_device(path) != 0) {
+                       ret = 1;
                        free(path);
-                       goto close_out;
+                       goto out;
                }
                free(path);
        }
 
-close_out:
-       close(fd);
 out:
        return !!ret;
 }
@@ -426,31 +408,37 @@
                                path, strerror(errno));
                        err = 1;
                } else {
+                       char *canonical_path;
+
+                       canonical_path = canonicalize_path((char *)path);
+
                        if (args.nr_items >= BTRFS_DEV_STAT_WRITE_ERRS + 1)
                                printf("[%s].write_io_errs   %llu\n",
-                                      path,
+                                      canonical_path,
                                       (unsigned long long) args.values[
                                        BTRFS_DEV_STAT_WRITE_ERRS]);
                        if (args.nr_items >= BTRFS_DEV_STAT_READ_ERRS + 1)
                                printf("[%s].read_io_errs    %llu\n",
-                                      path,
+                                      canonical_path,
                                       (unsigned long long) args.values[
                                        BTRFS_DEV_STAT_READ_ERRS]);
                        if (args.nr_items >= BTRFS_DEV_STAT_FLUSH_ERRS + 1)
                                printf("[%s].flush_io_errs   %llu\n",
-                                      path,
+                                      canonical_path,
                                       (unsigned long long) args.values[
                                        BTRFS_DEV_STAT_FLUSH_ERRS]);
                        if (args.nr_items >= BTRFS_DEV_STAT_CORRUPTION_ERRS + 1)
                                printf("[%s].corruption_errs %llu\n",
-                                      path,
+                                      canonical_path,
                                       (unsigned long long) args.values[
                                        BTRFS_DEV_STAT_CORRUPTION_ERRS]);
                        if (args.nr_items >= BTRFS_DEV_STAT_GENERATION_ERRS + 1)
                                printf("[%s].generation_errs %llu\n",
-                                      path,
+                                      canonical_path,
                                       (unsigned long long) args.values[
                                        BTRFS_DEV_STAT_GENERATION_ERRS]);
+
+                       free(canonical_path);
                }
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-filesystem.c 
new/btrfs-progs-v3.17.2/cmds-filesystem.c
--- old/btrfs-progs-v3.17/cmds-filesystem.c     2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/cmds-filesystem.c   2014-11-19 17:44:56.000000000 
+0100
@@ -53,6 +53,15 @@
 
 static struct seen_fsid *seen_fsid_hash[SEEN_FSID_HASH_SIZE] = {NULL,};
 
+static int is_seen_fsid(u8 *fsid)
+{
+       u8 hash = fsid[0];
+       int slot = hash % SEEN_FSID_HASH_SIZE;
+       struct seen_fsid *seen = seen_fsid_hash[slot];
+
+       return seen ? 1 : 0;
+}
+
 static int add_seen_fsid(u8 *fsid)
 {
        u8 hash = fsid[0];
@@ -119,11 +128,11 @@
        "-h                 human friendly numbers, base 1024 (default)",
        "-H                 human friendly numbers, base 1000",
        "--iec              use 1024 as a base (KiB, MiB, GiB, TiB)",
-       "--si               use 1000 as a base (kB, mB, gB, tB)",
+       "--si               use 1000 as a base (kB, MB, GB, TB)",
        "-k|--kbytes        show sizes in KiB, or kB with --si",
-       "-m|--mbytes        show sizes in MiB, or mB with --si",
-       "-g|--gbytes        show sizes in GiB, or gB with --si",
-       "-t|--tbytes        show sizes in TiB, or tB with --si",
+       "-m|--mbytes        show sizes in MiB, or MB with --si",
+       "-g|--gbytes        show sizes in GiB, or GB with --si",
+       "-t|--tbytes        show sizes in TiB, or TB with --si",
        NULL
 };
 
@@ -241,7 +250,6 @@
        DIR *dirstream = NULL;
        unsigned unit_mode = UNITS_DEFAULT;
 
-       optind = 1;
        while (1) {
                int long_index;
                static const struct option long_options[] = {
@@ -290,7 +298,7 @@
                }
        }
 
-       if (check_argc_max(argc, optind + 1))
+       if (check_argc_exact(argc, optind + 1))
                usage(cmd_df_usage);
 
        path = argv[optind];
@@ -502,7 +510,10 @@
                        pretty_size(calc_used_bytes(space_info)));
 
        for (i = 0; i < fs_info->num_devices; i++) {
+               char *canonical_path;
+
                tmp_dev_info = (struct btrfs_ioctl_dev_info_args *)&dev_info[i];
+               canonical_path = canonicalize_path((char *)tmp_dev_info->path);
 
                /* Add check for missing devices even mounted */
                fd = open((char *)tmp_dev_info->path, O_RDONLY);
@@ -515,7 +526,9 @@
                        tmp_dev_info->devid,
                        pretty_size(tmp_dev_info->total_bytes),
                        pretty_size(tmp_dev_info->bytes_used),
-                       tmp_dev_info->path);
+                       canonical_path);
+
+               free(canonical_path);
        }
 
        if (missing)
@@ -767,6 +780,10 @@
                        *found = 1;
                }
 
+               /* skip all fs already shown as mounted fs */
+               if (is_seen_fsid(cur_fs->fsid))
+                       continue;
+
                fs_copy = malloc(sizeof(*fs_copy));
                if (!fs_copy) {
                        ret = -ENOMEM;
@@ -936,7 +953,7 @@
                goto out;
 
 devs_only:
-       ret = btrfs_scan_lblkid(!BTRFS_UPDATE_KERNEL);
+       ret = btrfs_scan_lblkid();
 
        if (ret) {
                fprintf(stderr, "ERROR: %d while scanning\n", ret);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-replace.c 
new/btrfs-progs-v3.17.2/cmds-replace.c
--- old/btrfs-progs-v3.17/cmds-replace.c        2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/cmds-replace.c      2014-11-19 17:44:56.000000000 
+0100
@@ -184,12 +184,17 @@
 
        /* check for possible errors before backgrounding */
        status_args.cmd = BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS;
+       status_args.result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT;
        ret = ioctl(fdmnt, BTRFS_IOC_DEV_REPLACE, &status_args);
        if (ret) {
                fprintf(stderr,
-                       "ERROR: ioctl(DEV_REPLACE_STATUS) failed on \"%s\": %s, 
%s\n",
-                       path, strerror(errno),
-                       replace_dev_result2string(status_args.result));
+                       "ERROR: ioctl(DEV_REPLACE_STATUS) failed on \"%s\": %s",
+                       path, strerror(errno));
+               if (status_args.result != 
BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT)
+                       fprintf(stderr, ", %s\n",
+                               replace_dev_result2string(status_args.result));
+               else
+                       fprintf(stderr, "\n");
                goto leave_with_error;
        }
 
@@ -302,13 +307,18 @@
        }
 
        start_args.cmd = BTRFS_IOCTL_DEV_REPLACE_CMD_START;
+       start_args.result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT;
        ret = ioctl(fdmnt, BTRFS_IOC_DEV_REPLACE, &start_args);
        if (do_not_background) {
                if (ret) {
                        fprintf(stderr,
-                               "ERROR: ioctl(DEV_REPLACE_START) failed on 
\"%s\": %s, %s\n",
-                               path, strerror(errno),
-                               replace_dev_result2string(start_args.result));
+                               "ERROR: ioctl(DEV_REPLACE_START) failed on 
\"%s\": %s",
+                               path, strerror(errno));
+                       if (start_args.result != 
BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT)
+                               fprintf(stderr, ", %s\n",
+                                       
replace_dev_result2string(start_args.result));
+                       else
+                               fprintf(stderr, "\n");
 
                        if (errno == EOPNOTSUPP)
                                fprintf(stderr,
@@ -403,11 +413,16 @@
 
        for (;;) {
                args.cmd = BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS;
+               args.result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT;
                ret = ioctl(fd, BTRFS_IOC_DEV_REPLACE, &args);
                if (ret) {
-                       fprintf(stderr, "ERROR: ioctl(DEV_REPLACE_STATUS) 
failed on \"%s\": %s, %s\n",
-                               path, strerror(errno),
-                               replace_dev_result2string(args.result));
+                       fprintf(stderr, "ERROR: ioctl(DEV_REPLACE_STATUS) 
failed on \"%s\": %s",
+                               path, strerror(errno));
+                       if (args.result != 
BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT)
+                               fprintf(stderr, ", %s\n",
+                                       replace_dev_result2string(args.result));
+                       else
+                               fprintf(stderr, "\n");
                        return ret;
                }
 
@@ -551,13 +566,18 @@
        }
 
        args.cmd = BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL;
+       args.result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT;
        ret = ioctl(fd, BTRFS_IOC_DEV_REPLACE, &args);
        e = errno;
        close_file_or_dir(fd, dirstream);
        if (ret) {
-               fprintf(stderr, "ERROR: ioctl(DEV_REPLACE_CANCEL) failed on 
\"%s\": %s, %s\n",
-                       path, strerror(e),
-                       replace_dev_result2string(args.result));
+               fprintf(stderr, "ERROR: ioctl(DEV_REPLACE_CANCEL) failed on 
\"%s\": %s",
+                       path, strerror(e));
+               if (args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT)
+                       fprintf(stderr, ", %s\n",
+                               replace_dev_result2string(args.result));
+               else
+                       fprintf(stderr, "\n");
                return 1;
        }
        if (args.result == BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-restore.c 
new/btrfs-progs-v3.17.2/cmds-restore.c
--- old/btrfs-progs-v3.17/cmds-restore.c        2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/cmds-restore.c      2014-11-19 17:44:56.000000000 
+0100
@@ -176,7 +176,7 @@
                        break;
        }
 
-       if (level == BTRFS_MAX_LEVEL)
+       if (level >= BTRFS_MAX_LEVEL)
                return 1;
 
        slot = path->slots[level] + 1;
@@ -840,6 +840,8 @@
                        ret = copy_file(root, fd, &location, path_name);
                        close(fd);
                        if (ret) {
+                               fprintf(stderr, "Error copying data for %s\n",
+                                       path_name);
                                if (ignore_errors)
                                        goto next;
                                btrfs_free_path(path);
@@ -917,6 +919,8 @@
                                         output_rootdir, dir, mreg);
                        free(dir);
                        if (ret) {
+                               fprintf(stderr, "Error searching %s\n",
+                                       path_name);
                                if (ignore_errors)
                                        goto next;
                                btrfs_free_path(path);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/cmds-send.c 
new/btrfs-progs-v3.17.2/cmds-send.c
--- old/btrfs-progs-v3.17/cmds-send.c   2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/cmds-send.c 2014-11-19 17:44:56.000000000 +0100
@@ -427,7 +427,7 @@
        u32 i;
        char *mount_root = NULL;
        char *snapshot_parent = NULL;
-       u64 root_id;
+       u64 root_id = 0;
        u64 parent_root_id = 0;
        int full_send = 1;
        int new_end_cmd_semantic = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/disk-io.c 
new/btrfs-progs-v3.17.2/disk-io.c
--- old/btrfs-progs-v3.17/disk-io.c     2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/disk-io.c   2014-11-19 17:44:56.000000000 +0100
@@ -834,6 +834,35 @@
        return best_index;
 }
 
+static int setup_root_or_create_block(struct btrfs_fs_info *fs_info,
+                                     enum btrfs_open_ctree_flags flags,
+                                     struct btrfs_root *info_root,
+                                     u64 objectid, char *str)
+{
+       struct btrfs_super_block *sb = fs_info->super_copy;
+       struct btrfs_root *root = fs_info->tree_root;
+       u32 leafsize = btrfs_super_leafsize(sb);
+       int ret;
+
+       ret = find_and_setup_root(root, fs_info, objectid, info_root);
+       if (ret) {
+               printk("Couldn't setup %s tree\n", str);
+               if (!(flags & OPEN_CTREE_PARTIAL))
+                       return -EIO;
+               /*
+                * Need a blank node here just so we don't screw up in the
+                * million of places that assume a root has a valid ->node
+                */
+               info_root->node =
+                       btrfs_find_create_tree_block(info_root, 0, leafsize);
+               if (!info_root->node)
+                       return -ENOMEM;
+               clear_extent_buffer_uptodate(NULL, info_root->node);
+       }
+
+       return 0;
+}
+
 int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
                          enum btrfs_open_ctree_flags flags)
 {
@@ -880,22 +909,10 @@
                return -EIO;
        }
 
-       ret = find_and_setup_root(root, fs_info, BTRFS_EXTENT_TREE_OBJECTID,
-                                 fs_info->extent_root);
-       if (ret) {
-               printk("Couldn't setup extent tree\n");
-               if (!(flags & OPEN_CTREE_PARTIAL))
-                       return -EIO;
-               /* Need a blank node here just so we don't screw up in the
-                * million of places that assume a root has a valid ->node
-                */
-               fs_info->extent_root->node =
-                       btrfs_find_create_tree_block(fs_info->extent_root, 0,
-                                                    leafsize);
-               if (!fs_info->extent_root->node)
-                       return -ENOMEM;
-               clear_extent_buffer_uptodate(NULL, fs_info->extent_root->node);
-       }
+       ret = setup_root_or_create_block(fs_info, flags, fs_info->extent_root,
+                                        BTRFS_EXTENT_TREE_OBJECTID, "extent");
+       if (ret)
+               return ret;
        fs_info->extent_root->track_dirty = 1;
 
        ret = find_and_setup_root(root, fs_info, BTRFS_DEV_TREE_OBJECTID,
@@ -906,20 +923,10 @@
        }
        fs_info->dev_root->track_dirty = 1;
 
-       ret = find_and_setup_root(root, fs_info, BTRFS_CSUM_TREE_OBJECTID,
-                                 fs_info->csum_root);
-       if (ret) {
-               printk("Couldn't setup csum tree\n");
-               if (!(flags & OPEN_CTREE_PARTIAL))
-                       return -EIO;
-               /* do the same thing as extent tree rebuilding */
-               fs_info->csum_root->node =
-                       btrfs_find_create_tree_block(fs_info->extent_root, 0,
-                                                    leafsize);
-               if (!fs_info->csum_root->node)
-                       return -ENOMEM;
-               clear_extent_buffer_uptodate(NULL, fs_info->csum_root->node);
-       }
+       ret = setup_root_or_create_block(fs_info, flags, fs_info->csum_root,
+                                        BTRFS_CSUM_TREE_OBJECTID, "csum");
+       if (ret)
+               return ret;
        fs_info->csum_root->track_dirty = 1;
 
        ret = find_and_setup_root(root, fs_info, BTRFS_QUOTA_TREE_OBJECTID,
@@ -930,7 +937,8 @@
        ret = find_and_setup_log_root(root, fs_info, sb);
        if (ret) {
                printk("Couldn't setup log root tree\n");
-               return -EIO;
+               if (!(flags & OPEN_CTREE_PARTIAL))
+                       return -EIO;
        }
 
        fs_info->generation = generation;
@@ -1000,10 +1008,20 @@
                          u64 sb_bytenr, int super_recover)
 {
        u64 total_devs;
+       u64 dev_size;
        int ret;
        if (!sb_bytenr)
                sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
 
+       dev_size = lseek(fd, 0, SEEK_END);
+       if (dev_size < 0)
+               return (int)(dev_size);
+       lseek(fd, 0, SEEK_SET);
+       if (sb_bytenr > dev_size) {
+               fprintf(stderr, "Superblock bytenr is larger than device 
size\n");
+               return -EINVAL;
+       }
+
        ret = btrfs_scan_one_device(fd, path, fs_devices,
                                    &total_devs, sb_bytenr, super_recover);
        if (ret) {
@@ -1012,7 +1030,7 @@
        }
 
        if (total_devs != 1) {
-               ret = btrfs_scan_lblkid(!BTRFS_UPDATE_KERNEL);
+               ret = btrfs_scan_lblkid();
                if (ret)
                        return ret;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/extent_io.c 
new/btrfs-progs-v3.17.2/extent_io.c
--- old/btrfs-progs-v3.17/extent_io.c   2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/extent_io.c 2014-11-19 17:44:56.000000000 +0100
@@ -666,8 +666,10 @@
 {
        int ret;
        ret = pread(eb->fd, eb->data + offset, len, eb->dev_bytenr);
-       if (ret < 0)
+       if (ret < 0) {
+               ret = -errno;
                goto out;
+       }
        if (ret != len) {
                ret = -EIO;
                goto out;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/ioctl.h 
new/btrfs-progs-v3.17.2/ioctl.h
--- old/btrfs-progs-v3.17/ioctl.h       2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/ioctl.h     2014-11-19 17:44:56.000000000 +0100
@@ -141,6 +141,7 @@
 #define BTRFS_IOCTL_DEV_REPLACE_CMD_START                      0
 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS                     1
 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL                     2
+#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT               -1
 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR                        0
 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED             1
 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED         2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/library-test.c 
new/btrfs-progs-v3.17.2/library-test.c
--- old/btrfs-progs-v3.17/library-test.c        1970-01-01 01:00:00.000000000 
+0100
+++ new/btrfs-progs-v3.17.2/library-test.c      2014-11-19 17:44:56.000000000 
+0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 SUSE.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include "kerncompat.h"
+#include "version.h"
+#include "send-stream.h"
+
+/*
+ * Reduced code snippet from snapper.git/snapper/Btrfs.cc
+ */
+struct btrfs_send_ops send_ops = {
+       .subvol = NULL,
+       .snapshot = NULL,
+       .mkfile = NULL,
+       .mkdir = NULL,
+       .mknod = NULL,
+       .mkfifo = NULL,
+       .mksock = NULL,
+       .symlink = NULL,
+       .rename = NULL,
+       .link = NULL,
+       .unlink = NULL,
+       .rmdir = NULL,
+       .write = NULL,
+       .clone = NULL,
+       .set_xattr = NULL,
+       .remove_xattr = NULL,
+       .truncate = NULL,
+       .chmod = NULL,
+       .chown = NULL,
+       .utimes = NULL,
+       .update_extent = NULL,
+};
+
+/*
+ * Link test only, not intended to be executed.
+ */
+static int test_send_stream_api() {
+       int ret;
+       int fd = -1;
+
+#if BTRFS_LIB_VERSION < 101
+       ret = btrfs_read_and_process_send_stream(fd, &send_ops, NULL, 0);
+#else
+       ret = btrfs_read_and_process_send_stream(fd, &send_ops, NULL, 0, 1);
+#endif
+       return ret;
+}
+
+int main() {
+       test_send_stream_api();
+
+       return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/props.c 
new/btrfs-progs-v3.17.2/props.c
--- old/btrfs-progs-v3.17/props.c       2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/props.c     2014-11-19 17:44:56.000000000 +0100
@@ -17,7 +17,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
 #include <fcntl.h>
 #include <unistd.h>
 
@@ -29,6 +29,12 @@
 #define XATTR_BTRFS_PREFIX     "btrfs."
 #define XATTR_BTRFS_PREFIX_LEN (sizeof(XATTR_BTRFS_PREFIX) - 1)
 
+/*
+ * Defined as synonyms in attr/xattr.h
+ */
+#ifndef ENOATTR
+#define ENOATTR ENODATA
+#endif
 
 static int prop_read_only(enum prop_object_type type,
                          const char *object,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/rbtree-utils.h 
new/btrfs-progs-v3.17.2/rbtree-utils.h
--- old/btrfs-progs-v3.17/rbtree-utils.h        2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/rbtree-utils.h      2014-11-19 17:44:56.000000000 
+0100
@@ -21,6 +21,10 @@
 
 #include "rbtree.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The common insert/search/free functions */
 typedef int (*rb_compare_nodes)(struct rb_node *node1, struct rb_node *node2);
 typedef int (*rb_compare_keys)(struct rb_node *node, void *key);
@@ -42,4 +46,8 @@
        rb_free_nodes(root, free_func);                 \
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/rbtree.h 
new/btrfs-progs-v3.17.2/rbtree.h
--- old/btrfs-progs-v3.17/rbtree.h      2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/rbtree.h    2014-11-19 17:44:56.000000000 +0100
@@ -34,6 +34,10 @@
 #include <btrfs/kerncompat.h>
 #endif /* BTRFS_FLAT_INCLUDES */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct rb_node {
        unsigned long  __rb_parent_color;
        struct rb_node *rb_right;
@@ -75,7 +79,7 @@
 extern struct rb_node *rb_next_postorder(const struct rb_node *);
 
 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new_node,
                            struct rb_root *root);
 
 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
@@ -107,4 +111,8 @@
                        typeof(*pos), field); 1; }); \
             pos = n)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _LINUX_RBTREE_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/rbtree_augmented.h 
new/btrfs-progs-v3.17.2/rbtree_augmented.h
--- old/btrfs-progs-v3.17/rbtree_augmented.h    2014-10-17 18:43:33.000000000 
+0200
+++ new/btrfs-progs-v3.17.2/rbtree_augmented.h  2014-11-19 17:44:56.000000000 
+0100
@@ -26,6 +26,10 @@
 
 #include "rbtree.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Please note - only struct rb_augment_callbacks and the prototypes for
  * rb_insert_augmented() and rb_erase_augmented() are intended to be public.
@@ -228,4 +232,8 @@
                __rb_erase_color(rebalance, root, augment->rotate);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _LINUX_RBTREE_AUGMENTED_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/send-stream.c 
new/btrfs-progs-v3.17.2/send-stream.c
--- old/btrfs-progs-v3.17/send-stream.c 2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/send-stream.c       2014-11-19 17:44:56.000000000 
+0100
@@ -216,7 +216,7 @@
 {
        int ret;
        void *data;
-       int len;
+       int len = 0;
 
        TLV_GET(s, attr, &data, &len);
 
Files old/btrfs-progs-v3.17/tests/fsck-tests/010-no-dir-item-or-index.img and 
new/btrfs-progs-v3.17.2/tests/fsck-tests/010-no-dir-item-or-index.img differ
Files old/btrfs-progs-v3.17/tests/fsck-tests/011-no-rootdir-inode-item.img and 
new/btrfs-progs-v3.17.2/tests/fsck-tests/011-no-rootdir-inode-item.img differ
Files old/btrfs-progs-v3.17/tests/fsck-tests/012-no-inode-item.img and 
new/btrfs-progs-v3.17.2/tests/fsck-tests/012-no-inode-item.img differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/utils.c 
new/btrfs-progs-v3.17.2/utils.c
--- old/btrfs-progs-v3.17/utils.c       2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/utils.c     2014-11-19 17:44:56.000000000 +0100
@@ -52,6 +52,8 @@
 #define BLKDISCARD     _IO(0x12,119)
 #endif
 
+static int btrfs_scan_done = 0;
+
 static char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";
 
 void fixup_argv0(char **argv, const char *token)
@@ -64,7 +66,8 @@
 
 void set_argv0(char **argv)
 {
-       sprintf(argv0_buf, "%s", argv[0]);
+       strncpy(argv0_buf, argv[0], sizeof(argv0_buf));
+       argv0_buf[sizeof(argv0_buf) - 1] = 0;
 }
 
 int check_argc_exact(int nargs, int expected)
@@ -1186,7 +1189,7 @@
 
        /* scan other devices */
        if (is_btrfs && total_devs > 1) {
-               ret = btrfs_scan_lblkid(!BTRFS_UPDATE_KERNEL);
+               ret = btrfs_scan_lblkid();
                if (ret)
                        return ret;
        }
@@ -1239,7 +1242,7 @@
        char name[PATH_MAX];
 };
 
-void btrfs_register_one_device(char *fname)
+int btrfs_register_one_device(const char *fname)
 {
        struct btrfs_ioctl_vol_args args;
        int fd;
@@ -1251,17 +1254,46 @@
                fprintf(stderr, "failed to open /dev/btrfs-control "
                        "skipping device registration: %s\n",
                        strerror(errno));
-               return;
+               return -errno;
        }
        strncpy(args.name, fname, BTRFS_PATH_NAME_MAX);
        args.name[BTRFS_PATH_NAME_MAX-1] = 0;
        ret = ioctl(fd, BTRFS_IOC_SCAN_DEV, &args);
        e = errno;
-       if(ret<0){
+       if (ret < 0) {
                fprintf(stderr, "ERROR: device scan failed '%s' - %s\n",
                        fname, strerror(e));
+               ret = -e;
        }
        close(fd);
+       return ret;
+}
+
+/*
+ * Register all devices in the fs_uuid list created in the user
+ * space. Ensure btrfs_scan_lblkid() is called before this func.
+ */
+int btrfs_register_all_devices(void)
+{
+       int err;
+       struct btrfs_fs_devices *fs_devices;
+       struct btrfs_device *device;
+       struct list_head *all_uuids;
+
+       all_uuids = btrfs_scanned_uuids();
+
+       list_for_each_entry(fs_devices, all_uuids, list) {
+               list_for_each_entry(device, &fs_devices->devices, dev_list) {
+                       if (strlen(device->name) != 0) {
+                               err = btrfs_register_one_device(device->name);
+                               if (err < 0)
+                                       return err;
+                               if (err > 0)
+                                       return -err;
+                       }
+               }
+       }
+       return 0;
 }
 
 int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
@@ -1297,7 +1329,7 @@
 static const char* unit_suffix_binary[] =
        { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
 static const char* unit_suffix_decimal[] =
-       { "B", "kB", "mB", "gB", "tB", "pB", "eB"};
+       { "B", "kB", "MB", "GB", "TB", "PB", "EB"};
 
 int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned 
unit_mode)
 {
@@ -1865,29 +1897,12 @@
        if (!fi_args->num_devices)
                goto out;
 
-       /*
-        * with kernel patch
-        * btrfs: ioctl BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO miss-matched 
with slots
-        * the kernel now returns total_devices which does not include
-        * replacing device if running.
-        * As we need to get dev info of the replace device if it is running,
-        * so just add one to fi_args->num_devices.
-        */
-
-       di_args = *di_ret = malloc((fi_args->num_devices + 1) * 
sizeof(*di_args));
+       di_args = *di_ret = malloc((fi_args->num_devices) * sizeof(*di_args));
        if (!di_args) {
                ret = -errno;
                goto out;
        }
 
-       /* get the replace target device if it is there */
-       ret = get_device_info(fd, i, &di_args[ndevs]);
-       if (!ret) {
-               ndevs++;
-               fi_args->num_devices++;
-       }
-       i++;
-
        for (; i <= fi_args->max_id; ++i) {
                BUG_ON(ndevs >= fi_args->num_devices);
                ret = get_device_info(fd, i, &di_args[ndevs]);
@@ -2167,7 +2182,7 @@
        return 0;
 }
 
-int btrfs_scan_lblkid(int update_kernel)
+int btrfs_scan_lblkid()
 {
        int fd = -1;
        int ret;
@@ -2178,6 +2193,9 @@
        blkid_cache cache = NULL;
        char path[PATH_MAX];
 
+       if (btrfs_scan_done)
+               return 0;
+
        if (blkid_get_cache(&cache, 0) < 0) {
                printf("ERROR: lblkid cache get failed\n");
                return 1;
@@ -2206,11 +2224,12 @@
                }
 
                close(fd);
-               if (update_kernel)
-                       btrfs_register_one_device(path);
        }
        blkid_dev_iterate_end(iter);
        blkid_put_cache(cache);
+
+       btrfs_scan_done = 1;
+
        return 0;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/utils.h 
new/btrfs-progs-v3.17.2/utils.h
--- old/btrfs-progs-v3.17/utils.h       2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/utils.h     2014-11-19 17:44:56.000000000 +0100
@@ -38,7 +38,7 @@
 
 #define BTRFS_UUID_UNPARSED_SIZE       37
 
-#define ARGV0_BUF_SIZE 64
+#define ARGV0_BUF_SIZE PATH_MAX
 
 int check_argc_exact(int nargs, int expected);
 int check_argc_min(int nargs, int expected);
@@ -81,7 +81,8 @@
                      u64 block_count, u32 io_width, u32 io_align,
                      u32 sectorsize);
 int btrfs_scan_for_fsid(int run_ioctls);
-void btrfs_register_one_device(char *fname);
+int btrfs_register_one_device(const char *fname);
+int btrfs_register_all_devices(void);
 char *canonicalize_dm_name(const char *ptname);
 char *canonicalize_path(const char *path);
 int check_mounted(const char *devicename);
@@ -127,7 +128,7 @@
                           int verify);
 int ask_user(char *question);
 int lookup_ino_rootid(int fd, u64 *rootid);
-int btrfs_scan_lblkid(int update_kernel);
+int btrfs_scan_lblkid(void);
 int get_btrfs_mount(const char *dev, char *mp, size_t mp_size);
 int find_mount_root(const char *path, char **mount_root);
 int get_device_info(int fd, u64 devid,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/btrfs-progs-v3.17/version.sh 
new/btrfs-progs-v3.17.2/version.sh
--- old/btrfs-progs-v3.17/version.sh    2014-10-17 18:43:33.000000000 +0200
+++ new/btrfs-progs-v3.17.2/version.sh  2014-11-19 17:44:56.000000000 +0100
@@ -6,7 +6,7 @@
 # Copyright 2008, Oracle
 # Released under the GNU GPLv2
  
-v="v3.17"
+v="v3.17.2"
 
 lib_major=0
 lib_minor=1

++++++ fix-doc-build-on-SLE11SP3.diff ++++++
Build on SLE11SP3 complains:

ERROR: btrfs-mount.xml.tmp1: line 9: second section must be named SYNOPSIS


Index: btrfs-progs-v3.17.1/Documentation/btrfs-mount.txt
===================================================================
--- btrfs-progs-v3.17.1.orig/Documentation/btrfs-mount.txt
+++ btrfs-progs-v3.17.1/Documentation/btrfs-mount.txt
@@ -5,6 +5,10 @@ NAME
 ----
 btrfs-mount - mount options and supported file attributes for the btrfs 
filesystem
 
+SYNOPSIS
+--------
+*man btrfs*
+
 DESCRIPTION
 -----------
 This document describes mount options specific to the btrfs filesystem.
++++++ local-version-override.patch ++++++
--- /var/tmp/diff_new_pack.NWl2TV/_old  2014-11-29 08:39:49.000000000 +0100
+++ /var/tmp/diff_new_pack.NWl2TV/_new  2014-11-29 08:39:49.000000000 +0100
@@ -6,8 +6,8 @@
  # Copyright 2008, Oracle
  # Released under the GNU GPLv2
   
--v="v3.17"
-+v="v3.17+20141103"
+-v="v3.17.2"
++v="v3.17.2+20141119"
  
  lib_major=0
  lib_minor=1

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to