Hello community,
here is the log from the commit of package btrfsprogs for openSUSE:Factory checked in at 2018-05-06 14:57:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/btrfsprogs (Old)
and /work/SRC/openSUSE:Factory/.btrfsprogs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "btrfsprogs"
Sun May 6 14:57:50 2018 rev:95 rq:604057 version:4.16.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/btrfsprogs/btrfsprogs.changes 2018-04-20 17:24:51.900558509 +0200
+++ /work/SRC/openSUSE:Factory/.btrfsprogs.new/btrfsprogs.changes 2018-05-06 14:57:52.508938275 +0200
@@ -1,0 +2,32 @@
+Fri May 4 00:00:00 CEST 2018 - dsterba@suse.cz
+
+- fix installation of btrfs.5.gz
+
+-------------------------------------------------------------------
+Mon Apr 30 14:39:07 UTC 2018 - jeffm@suse.com
+
+- Fix building on SLE11:
+ * btrfs-progs: convert: fix support for e2fsprogs < 1.42
+ * btrfs-progs: build: detect whether -std=gnu90 is supported
+ * btrfs-progs: build: autoconf 2.63 compatibility
+ * Fixed mismerged addition of libbtrfsutil1 package description
+- Added patches:
+ * 0001-btrfs-progs-convert-fix-support-for-e2fsprogs-1.42.patch
+ * 0002-btrfs-progs-build-autoconf-2.63-compatibility.patch
+ * 0003-btrfs-progs-build-detect-whether-std-gnu90-is-suppor.patch
+
+-------------------------------------------------------------------
+Tue Apr 24 00:00:00 CEST 2018 - dsterba@suse.cz
+
+- update to version 4.16.1
+ * remove obsolete tools: btrfs-debug-tree, btrfs-zero-log, btrfs-show-super,
+ btrfs-calc-size
+ * sb-mod: new debugging tool to edit superblock items
+ * mkfs: detect if thin-provisioned device does not have enough space
+ * check: don't try to verify checksums on metadata dump images
+ * build: fail documentation build if xmlto is not found
+ * build: fix build of btrfs.static
+- Remove patch: 0001-btrfs-progs-build-fix-static-build.patch (upstream)
+- Update initrd script
+
+-------------------------------------------------------------------
Old:
----
0001-btrfs-progs-build-fix-static-build.patch
btrfs-progs-v4.16.tar.gz
New:
----
0001-btrfs-progs-convert-fix-support-for-e2fsprogs-1.42.patch
0002-btrfs-progs-build-autoconf-2.63-compatibility.patch
0003-btrfs-progs-build-detect-whether-std-gnu90-is-suppor.patch
btrfs-progs-v4.16.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ btrfsprogs.spec ++++++
--- /var/tmp/diff_new_pack.1M2JH5/_old 2018-05-06 14:57:53.240911416 +0200
+++ /var/tmp/diff_new_pack.1M2JH5/_new 2018-05-06 14:57:53.244911269 +0200
@@ -31,7 +31,7 @@
%define build_docs 0
Name: btrfsprogs
-Version: 4.16
+Version: 4.16.1
Release: 0
Summary: Utilities for the Btrfs filesystem
License: GPL-2.0-only
@@ -46,7 +46,9 @@
Source5: sles11-defaults.h
Patch1: mkfs-default-features.patch
-Patch2: 0001-btrfs-progs-build-fix-static-build.patch
+Patch2: 0001-btrfs-progs-convert-fix-support-for-e2fsprogs-1.42.patch
+Patch3: 0002-btrfs-progs-build-autoconf-2.63-compatibility.patch
+Patch4: 0003-btrfs-progs-build-detect-whether-std-gnu90-is-suppor.patch
%if %build_docs
BuildRequires: asciidoc
@@ -137,6 +139,15 @@
Conflicts: udev < %{udev_with_btrfs_builtin}
BuildArch: noarch
+%description udev-rules
+This package contains the udev rule file for configuring device mapper
+devices that are components of btrfs file systems. It is meant to be
+used with versions of udev that contain the "built-in" btrfs command
+(v190 and newer). Older versions of udev will call the version of
+"btrfs ready" contained in the btrfsprogs package, which does the right
+thing.
+%endif
+
%package -n libbtrfsutil1
Summary: Utility library for interacting with Btrfs
Group: System/Libraries
@@ -156,19 +167,12 @@
This package contains the libraries and headers files for developers to
build applications to interface with Btrfs using libbtrfsutil.
-%description udev-rules
-This package contains the udev rule file for configuring device mapper
-devices that are components of btrfs file systems. It is meant to be
-used with versions of udev that contain the "built-in" btrfs command
-(v190 and newer). Older versions of udev will call the version of
-"btrfs ready" contained in the btrfsprogs package, which does the right
-thing.
-%endif
-
%prep
%setup -q -n btrfs-progs-v%{version}
%patch1 -p1
%patch2 -p1
+%patch3 -p1
+%patch4 -p1
%build
./autogen.sh
@@ -200,10 +204,12 @@
%if !%build_docs
cd Documentation
-# fool make to avoid rebuilding some of the sources
+# fool make to avoid rebuilding some of the sources, the final btrfs.5.gz is in
+# the tarball and we have to overwrite it in the installation path
touch btrfs-man5.5.gz btrfs-man5.asciidoc
-touch btrfs-ioctl.asciidoc touch btrfs-ioctl.3.gz
+touch btrfs-ioctl.asciidoc btrfs-ioctl.3.gz
make V=1 MV=mv DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir} install
+install -m 0644 btrfs.5.gz %{buildroot}/%{_mandir}/man5
cd ..
%endif
@@ -216,21 +222,18 @@
# move some utilities out of /usr/sbin
mv %{buildroot}/%{_sbindir}/btrfs-map-logical %{buildroot}/%{_bindir}
# initrd rescue utilities
-install -m 0755 btrfs-zero-log %{buildroot}/%{_sbindir}
install -m 0755 btrfs-select-super %{buildroot}/%{_sbindir}
install -m 0755 btrfs-image %{buildroot}/%{_sbindir}
install -m 0755 btrfstune %{buildroot}/%{_sbindir}
install -m 0755 btrfs-find-root %{buildroot}/%{_sbindir}
install -m 0755 -d %{buildroot}/sbin
ln -s %{_sbindir}/btrfs %{buildroot}/sbin
-ln -s %{_sbindir}/btrfs-zero-log %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-convert %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-select-super %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-image %{buildroot}/sbin
ln -s %{_sbindir}/btrfstune %{buildroot}/sbin
ln -s %{_sbindir}/btrfsck %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-find-root %{buildroot}/sbin
-ln -s %{_sbindir}/btrfs-debug-tree %{buildroot}/sbin
ln -s %{_sbindir}/mkfs.btrfs %{buildroot}/sbin
ln -s %{_sbindir}/fsck.btrfs %{buildroot}/sbin
%if 0%{?suse_version} < 1310
@@ -280,22 +283,18 @@
/sbin/fsck.btrfs
# mkinitrd utils
/sbin/btrfs
-/sbin/btrfs-zero-log
/sbin/btrfs-convert
/sbin/btrfs-image
/sbin/btrfstune
/sbin/btrfsck
/sbin/mkfs.btrfs
-/sbin/btrfs-debug-tree
%{_sbindir}/btrfs
-%{_sbindir}/btrfs-zero-log
%{_sbindir}/btrfs-convert
%{_sbindir}/btrfs-image
%{_sbindir}/btrfstune
%{_sbindir}/btrfsck
%{_sbindir}/fsck.btrfs
%{_sbindir}/mkfs.btrfs
-%{_sbindir}/btrfs-debug-tree
%if 0%{?suse_version} < 1310
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
@@ -310,9 +309,7 @@
%{_mandir}/man8/btrfs.8.gz
%{_mandir}/man5/btrfs.5.gz
%{_mandir}/man8/btrfs-convert.8.gz
-%{_mandir}/man8/btrfs-debug-tree.8.gz
%{_mandir}/man8/btrfs-map-logical.8.gz
-%{_mandir}/man8/btrfs-zero-log.8.gz
%{_mandir}/man8/btrfstune.8.gz
%{_mandir}/man8/btrfs-balance.8.gz
%{_mandir}/man8/btrfs-check.8.gz
@@ -330,7 +327,6 @@
%{_mandir}/man8/btrfs-send.8.gz
%{_mandir}/man8/btrfs-subvolume.8.gz
%{_mandir}/man8/btrfs-select-super.8.gz
-%{_mandir}/man8/btrfs-show-super.8.gz
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/btrfs
@@ -347,13 +343,11 @@
%files -n btrfsprogs-static
%defattr(-, root, root)
%{_sbindir}/btrfs.static
-%{_sbindir}/btrfs-zero-log.static
%{_sbindir}/btrfs-convert.static
%{_sbindir}/btrfs-image.static
%{_sbindir}/btrfstune.static
%{_sbindir}/btrfsck.static
%{_sbindir}/mkfs.btrfs.static
-%{_sbindir}/btrfs-debug-tree.static
%{_sbindir}/btrfs-corrupt-block.static
%{_sbindir}/btrfs-find-root.static
%{_sbindir}/btrfs-map-logical.static
@@ -376,7 +370,6 @@
%files -n libbtrfsutil-devel
%defattr(-, root, root)
-%dir %{_includedir}
%{_includedir}/btrfsutil.h
%{_libdir}/libbtrfsutil.so
++++++ 0001-btrfs-progs-convert-fix-support-for-e2fsprogs-1.42.patch ++++++
From 1a9818aa0dcbcd48eadbb122a1433497f758db9a Mon Sep 17 00:00:00 2001
From: Jeff Mahoney
Date: Fri, 27 Apr 2018 13:58:41 -0400
Subject: [PATCH 1/3] btrfs-progs: convert: fix support for e2fsprogs < 1.42
Patch-mainline: Submitted, linux-btrfs 26 Apr 2018
Commit 324d4c1857a (btrfs-progs: convert: Add larger device support)
introduced new dependencies on the 64-bit API provided by e2fsprogs.
That API was introduced in v1.42 (along with bigalloc).
This patch maps the following to their equivalents in e2fsprogs < 1.42.
- ext2fs_get_block_bitmap_range2
- ext2fs_inode_data_blocks2
- ext2fs_read_ext_attr2
Since we need to detect and define EXT2_FLAG_64BITS for compatibilty
anyway, it makes sense to use that to detect the older e2fsprogs instead
of defining a new flag ourselves.
Signed-off-by: Jeff Mahoney
---
configure.ac | 6 +-----
convert/source-ext2.h | 12 +++++++++++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index af13a95..2dea1c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,11 +140,7 @@ BTRFSCONVERT_EXT2=0
BTRFSCONVERT_REISERFS=0
if test "x$enable_convert" = xyes; then
if test "x$with_convert" = "xauto" || echo "$with_convert" | grep -q "ext2"; then
- PKG_CHECK_MODULES(EXT2FS, [ext2fs >= 1.42],,
- [PKG_CHECK_MODULES(EXT2FS, [ext2fs],
- [AC_DEFINE([HAVE_OLD_E2FSPROGS], [1],
- [E2fsprogs does not support BIGALLOC])]
- )])
+ PKG_CHECK_MODULES(EXT2FS, [ext2fs])
PKG_CHECK_MODULES(COM_ERR, [com_err])
convertfs="${convertfs:+$convertfs,}ext2"
BTRFSCONVERT_EXT2=1
diff --git a/convert/source-ext2.h b/convert/source-ext2.h
index 80833b2..c321412 100644
--- a/convert/source-ext2.h
+++ b/convert/source-ext2.h
@@ -33,8 +33,18 @@
* BIGALLOC.
* Unlike normal RO compat flag, BIGALLOC affects how e2fsprogs check used
* space, and btrfs-convert heavily relies on it.
+ *
+ * e2fsprogs 1.42 also introduced the 64-bit API. Any file system
+ * that requires it will have EXT4_FEATURE_INCOMPAT_64BIT set and
+ * will fail to open with earlier releases. We can map it to the
+ * older API without risk of corruption.
*/
-#ifdef HAVE_OLD_E2FSPROGS
+#ifndef EXT2_FLAG_64BITS
+#define EXT2_FLAG_64BITS (0)
+#define ext2fs_get_block_bitmap_range2 ext2fs_get_block_bitmap_range
+#define ext2fs_inode_data_blocks2 ext2fs_inode_data_blocks
+#define ext2fs_read_ext_attr2 ext2fs_read_ext_attr
+#define ext2fs_blocks_count(s) ((s)->s_blocks_count)
#define EXT2FS_CLUSTER_RATIO(fs) (1)
#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_BLOCKS_PER_GROUP(s))
#define EXT2FS_B2C(fs, blk) (blk)
--
1.7.12.4
++++++ 0002-btrfs-progs-build-autoconf-2.63-compatibility.patch ++++++
From ce3c33cd54a4de8a3c49c11806fae195328b4413 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney
Date: Fri, 27 Apr 2018 14:50:08 -0400
Subject: [PATCH 2/3] btrfs-progs: build: autoconf 2.63 compatibility
Patch-mainline: Submitted, linux-btrfs 30 Apr 2018
Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking)
started m4_chomp to strip the newlines from the version file. m4_chomp
was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63.
For purposes of just stripping the newline, m4_flatten is sufficient.
Signed-off-by: Jeff Mahoney
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 2dea1c6..9e5603b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([btrfs-progs],
- m4_chomp(m4_include([VERSION])),
+ m4_flatten(m4_include([VERSION])),
[linux-btrfs@vger.kernel.org],,
[http://btrfs.wiki.kernel.org])
--
1.7.12.4
++++++ 0003-btrfs-progs-build-detect-whether-std-gnu90-is-suppor.patch ++++++
From 7b71ff68c7027a1fa9329ad9167625b81ea3aab2 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney
Date: Fri, 27 Apr 2018 14:47:28 -0400
Subject: [PATCH 3/3 v2] btrfs-progs: build: detect whether -std=gnu90 is
supported
Patch-mainline: Submitted, linux-btrfs 30 Apr 2018
GCC releases prior to 4.5.0 don't support -std=gnu90 so btrfs-progs won't
build at all on older distros. We can detect whether the compiler
supports -std=gnu90 and fall back to -std=gnu89 if it doesn't.
AX_CHECK_COMPILE_FLAG is the right way to do this, but it depends on
autoconf 2.64. AX_GCC_VERSION has been deprecated, so we'll use that
only for earlier autoconf versions so we can drop it when we drop
support for older autoconf releases.
Signed-off-by: Jeff Mahoney
---
Makefile | 1 -
Makefile.inc.in | 1 +
configure.ac | 1 +
m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++++++++++
m4/ax_gcc_version.m4 | 37 +++++++++++++++++++++++
m4/btrfs_detect_cstd.m4 | 20 ++++++++++++
6 files changed, 133 insertions(+), 1 deletion(-)
create mode 100644 m4/ax_check_compile_flag.m4
create mode 100644 m4/ax_gcc_version.m4
create mode 100644 m4/btrfs_detect_cstd.m4
diff --git a/Makefile b/Makefile
index 5ba76d2..c0eb3d6 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,6 @@ ABSTOPDIR = $(shell pwd)
TOPDIR := .
# Common build flags
-CSTD = -std=gnu90
CFLAGS = $(SUBST_CFLAGS) \
$(CSTD) \
-include config.h \
diff --git a/Makefile.inc.in b/Makefile.inc.in
index 52410f6..fb32461 100644
--- a/Makefile.inc.in
+++ b/Makefile.inc.in
@@ -4,6 +4,7 @@
export
CC = @CC@
+CSTD = @BTRFS_CSTD_FLAGS@
LN_S = @LN_S@
AR = @AR@
RM = @RM@
diff --git a/configure.ac b/configure.ac
index 9e5603b..4f63bb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_CONFIG_SRCDIR([btrfs.c])
AC_PREFIX_DEFAULT([/usr/local])
AC_PROG_CC
+BTRFS_DETECT_CSTD
AC_CANONICAL_HOST
AC_C_CONST
AC_C_VOLATILE
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
new file mode 100644
index 0000000..dcabb92
--- /dev/null
+++ b/m4/ax_check_compile_flag.m4
@@ -0,0 +1,74 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# Check whether the given FLAG works with the current language's compiler
+# or gives an error. (Warnings, however, are ignored)
+#
+# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+# success/failure.
+#
+# If EXTRA-FLAGS is defined, it is added to the current language's default
+# flags (e.g. CFLAGS) when the check is done. The check is thus made with
+# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
+# force the compiler to issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim
+# Copyright (c) 2011 Maarten Bosmans
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# 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, see https://www.gnu.org/licenses/.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+ AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/m4/ax_gcc_version.m4 b/m4/ax_gcc_version.m4
new file mode 100644
index 0000000..63914d5
--- /dev/null
+++ b/m4/ax_gcc_version.m4
@@ -0,0 +1,37 @@
+dnl @synopsis AX_GCC_VERSION(MAJOR, MINOR, PATCHLEVEL, [ACTION-SUCCESS], [ACTION-FAILURE])
+dnl @summary check wither gcc is at least version MAJOR.MINOR.PATCHLEVEL
+dnl @category InstalledPackages
+dnl
+dnl Check whether we are using gcc and, if so, whether its version
+dnl is at least MAJOR.MINOR.PATCHLEVEL
+dnl
+dnl ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+dnl success/failure.
+dnl
+dnl @version 2005-05-30
+dnl @license GPLWithACException
+dnl @author Steven G. Johnson and Matteo Frigo.
+AC_DEFUN([AX_GCC_VERSION],
+[
+AC_REQUIRE([AC_PROG_CC])
+AC_CACHE_CHECK(whether we are using gcc $1.$2.$3 or later, ax_cv_gcc_$1_$2_$3,
+[
+ax_cv_gcc_$1_$2_$3=no
+if test "$GCC" = "yes"; then
+dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
+AC_EGREP_CPP(yes, [
+#ifdef __GNUC__
+# if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ > $2) \
+ || (__GNUC__ == $1 && __GNUC_MINOR__ == $2 && __GNUC_PATCHLEVEL__ >= $3)
+ yes;
+# endif
+#endif
+], [ax_cv_gcc_$1_$2_$3=yes])
+fi
+])
+if test "$ax_cv_gcc_$1_$2_$3" = yes; then
+ m4_default([$4], :)
+else
+ m4_default([$5], :)
+fi
+])
diff --git a/m4/btrfs_detect_cstd.m4 b/m4/btrfs_detect_cstd.m4
new file mode 100644
index 0000000..f0c45d9
--- /dev/null
+++ b/m4/btrfs_detect_cstd.m4
@@ -0,0 +1,20 @@
+dnl We prefer -std=gnu90 but gcc versions prior to 4.5.0 don't support
+dnl it. AX_CHECK_COMPILE_FLAG is the right way to determine whether a
+dnl particular version of gcc supports a flag, but it requires autoconf
+dnl 2.64. Since (for now) we still want to support older releases
+dnl that ship with autoconf 2.63, we the also-deprecated AX_GCC_VERSION
+dnl macro there.
+AC_DEFUN([BTRFS_DETECT_CSTD],
+[
+ m4_version_prereq([2.64], [
+ AX_CHECK_COMPILE_FLAG([-std=gnu90],
+ [BTRFS_CSTD_FLAGS=-std=gnu90],
+ [BTRFS_CSTD_FLAGS=-std=gnu89])
+ ], [
+ AX_GCC_VERSION([4], [5], [0],
+ [BTRFS_CSTD_FLAGS=-std=gnu90],
+ [BTRFS_CSTD_FLAGS=-std=gnu89])
+ ])
+ AC_SUBST([BTRFS_CSTD_FLAGS])
+]) dnl BTRFS_DETECT_CSTD
+
--
1.7.12.4
++++++ boot-btrfs.sh ++++++
--- /var/tmp/diff_new_pack.1M2JH5/_old 2018-05-06 14:57:53.308908919 +0200
+++ /var/tmp/diff_new_pack.1M2JH5/_new 2018-05-06 14:57:53.308908919 +0200
@@ -3,12 +3,9 @@
#%depends: dm dmraid lvm2 udev md luks
#%programs: btrfs
#%programs: btrfs-convert
-#%programs: btrfs-debug-tree
-#%programs: btrfs-dump-super
#%programs: btrfs-find-root
#%programs: btrfs-image
#%programs: btrfs-select-super
-#%programs: btrfs-zero-log
#%programs: btrfsck
#%programs: btrfstune
# for fsck(8): listed twice so that a copy really ends up in /sbin
++++++ btrfs-progs-v4.16.tar.gz -> btrfs-progs-v4.16.1.tar.gz ++++++
++++ 1655 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/.gitignore new/btrfs-progs-v4.16.1/.gitignore
--- old/btrfs-progs-v4.16/.gitignore 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/.gitignore 2018-04-24 13:42:06.000000000 +0200
@@ -10,11 +10,9 @@
Documentation/*.html
btrfs
btrfs.static
-btrfs-debug-tree
btrfs-map-logical
btrfs-fragments
btrfsck
-calc-size
ioctl-test
dir-test
send-test
@@ -28,11 +26,8 @@
btrfs-find-root
btrfs-find-root.static
btrfs-image
-btrfs-show-super
-btrfs-zero-log
btrfs-corrupt-block
btrfs-select-super
-btrfs-calc-size
btrfs-crc
btrfstune
mktables
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/CHANGES new/btrfs-progs-v4.16.1/CHANGES
--- old/btrfs-progs-v4.16/CHANGES 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/CHANGES 2018-04-24 13:42:06.000000000 +0200
@@ -1,3 +1,12 @@
+btrfs-progs-4.16.1 (2018-04-24)
+ * remove obsolete tools: btrfs-debug-tree, btrfs-zero-log, btrfs-show-super,
+ btrfs-calc-size
+ * sb-mod: new debugging tool to edit superblock items
+ * mkfs: detect if thin-provisioned device does not have enough space
+ * check: don't try to verify checksums on metadata dump images
+ * build: fail documentation build if xmlto is not found
+ * build: fix build of btrfs.static
+
btrfs-progs-4.16 (2018-04-06)
* libbtrfsutil - new LGPL library to wrap userspace functionality
* several 'btrfs' commands converted to use it:
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-balance.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-balance.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-check.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-check.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-convert.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-convert.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Documentation/btrfs-debug-tree.8.gz new/btrfs-progs-v4.16.1/Documentation/btrfs-debug-tree.8.gz
--- old/btrfs-progs-v4.16/Documentation/btrfs-debug-tree.8.gz 2018-05-06 14:57:53.592898499 +0200
+++ new/btrfs-progs-v4.16.1/Documentation/btrfs-debug-tree.8.gz 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to btrfs-inspect-internal.8.gz
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-device.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-device.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-filesystem.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-filesystem.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-find-root.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-find-root.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-image.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-image.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-inspect-internal.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-inspect-internal.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-map-logical.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-map-logical.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-property.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-property.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-qgroup.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-qgroup.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-quota.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-quota.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-receive.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-receive.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-replace.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-replace.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-rescue.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-rescue.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-restore.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-restore.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-scrub.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-scrub.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-select-super.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-select-super.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Documentation/btrfs-select-super.asciidoc new/btrfs-progs-v4.16.1/Documentation/btrfs-select-super.asciidoc
--- old/btrfs-progs-v4.16/Documentation/btrfs-select-super.asciidoc 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/Documentation/btrfs-select-super.asciidoc 2018-04-24 13:42:06.000000000 +0200
@@ -21,8 +21,7 @@
NOTE: *Prior to overwriting the primary superblock, please make sure that the backup
copies are valid!*
-To dump a superblock use the *btrfs inspect-internal
-dump-super* command, or the obsolete command *btrfs-show-super*.
+To dump a superblock use the *btrfs inspect-internal dump-super* command.
Then run the check (in the non-repair mode) using the command *btrfs check -s*
where '-s' specifies the superblock copy to use.
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-send.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-send.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Documentation/btrfs-show-super.8.gz new/btrfs-progs-v4.16.1/Documentation/btrfs-show-super.8.gz
--- old/btrfs-progs-v4.16/Documentation/btrfs-show-super.8.gz 2018-05-06 14:57:53.604898059 +0200
+++ new/btrfs-progs-v4.16.1/Documentation/btrfs-show-super.8.gz 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to btrfs-inspect-internal.8.gz
Binary files old/btrfs-progs-v4.16/Documentation/btrfs-subvolume.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs-subvolume.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Documentation/btrfs-zero-log.8.gz new/btrfs-progs-v4.16.1/Documentation/btrfs-zero-log.8.gz
--- old/btrfs-progs-v4.16/Documentation/btrfs-zero-log.8.gz 2018-05-06 14:57:53.612897765 +0200
+++ new/btrfs-progs-v4.16.1/Documentation/btrfs-zero-log.8.gz 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to btrfs-rescue.8.gz
Binary files old/btrfs-progs-v4.16/Documentation/btrfs.5.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs.5.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/btrfs.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfs.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Documentation/btrfs.asciidoc new/btrfs-progs-v4.16.1/Documentation/btrfs.asciidoc
--- old/btrfs-progs-v4.16/Documentation/btrfs.asciidoc 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/Documentation/btrfs.asciidoc 2018-04-24 13:42:06.000000000 +0200
@@ -120,9 +120,11 @@
Deprecated and obsolete tools:
-*btrfs-debug-tree*:: moved to *btrfs inspect-internal dump-tree*
-*btrfs-show-super*:: moved to *btrfs inspect-internal dump-super*
-*btrfs-zero-log*:: moved to *btrfs rescue zero-log*
+*btrfs-debug-tree*:: moved to *btrfs inspect-internal dump-tree*. Removed from
+source distribution.
+*btrfs-show-super*:: moved to *btrfs inspect-internal dump-super*, standalone
+removed.
+*btrfs-zero-log*:: moved to *btrfs rescue zero-log*, standalone removed.
EXIT STATUS
-----------
Binary files old/btrfs-progs-v4.16/Documentation/btrfstune.8.gz and new/btrfs-progs-v4.16.1/Documentation/btrfstune.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/fsck.btrfs.8.gz and new/btrfs-progs-v4.16.1/Documentation/fsck.btrfs.8.gz differ
Binary files old/btrfs-progs-v4.16/Documentation/mkfs.btrfs.8.gz and new/btrfs-progs-v4.16.1/Documentation/mkfs.btrfs.8.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/Makefile new/btrfs-progs-v4.16.1/Makefile
--- old/btrfs-progs-v4.16/Makefile 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/Makefile 2018-04-24 13:42:06.000000000 +0200
@@ -210,13 +210,12 @@
progs = $(progs_install) btrfsck btrfs-corrupt-block
# install only selected
-progs_install = btrfs mkfs.btrfs btrfs-debug-tree \
- btrfs-map-logical btrfs-image btrfs-zero-log \
+progs_install = btrfs mkfs.btrfs btrfs-map-logical btrfs-image \
btrfs-find-root btrfstune \
btrfs-select-super
# other tools, not built by default
-progs_extra = btrfs-fragments btrfs-calc-size btrfs-show-super
+progs_extra = btrfs-fragments
progs_static = $(foreach p,$(progs),$(p).static)
@@ -229,9 +228,6 @@
btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS)
btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
-btrfs_debug_tree_objects = cmds-inspect-dump-tree.o
-btrfs_show_super_objects = cmds-inspect-dump-super.o
-btrfs_calc_size_objects = cmds-inspect-tree-stats.o
cmds_restore_cflags = -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
CHECKER_FLAGS += $(btrfs_convert_cflags)
@@ -261,6 +257,7 @@
static_objects = $(patsubst %.o, %.static.o, $(objects))
static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects))
+static_libbtrfsutil_objects = $(patsubst %.o, %.static.o, $(libbtrfsutil_objects))
static_convert_objects = $(patsubst %.o, %.static.o, $(convert_objects))
static_mkfs_objects = $(patsubst %.o, %.static.o, $(mkfs_objects))
static_image_objects = $(patsubst %.o, %.static.o, $(image_objects))
@@ -324,7 +321,7 @@
$(Q)bash tests/fsck-tests.sh
test-misc: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune fssum \
- btrfs-zero-log btrfs-find-root btrfs-select-super btrfs-convert
+ btrfs-find-root btrfs-select-super btrfs-convert
@echo " [TEST] misc-tests.sh"
$(Q)bash tests/misc-tests.sh
@@ -453,7 +450,7 @@
@echo " [LD] $@"
$(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_COMP)
-btrfs.static: btrfs.static.o $(static_objects) $(static_cmds_objects) $(static_libbtrfs_objects)
+btrfs.static: btrfs.static.o $(static_objects) $(static_cmds_objects) $(static_libbtrfs_objects) $(static_libbtrfsutil_objects)
@echo " [LD] $@"
$(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(STATIC_LIBS) $(STATIC_LIBS_COMP)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/VERSION new/btrfs-progs-v4.16.1/VERSION
--- old/btrfs-progs-v4.16/VERSION 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/VERSION 2018-04-24 13:42:06.000000000 +0200
@@ -1 +1 @@
-v4.16
+v4.16.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-calc-size.c new/btrfs-progs-v4.16.1/btrfs-calc-size.c
--- old/btrfs-progs-v4.16/btrfs-calc-size.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-calc-size.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2011 Red Hat. 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 "volumes.h"
-#include "utils.h"
-#include "commands.h"
-#include "help.h"
-
-int main(int argc, char **argv)
-{
- int ret;
-
- warning(
-"\nthe tool has been deprecated, please use 'btrfs inspect-internal tree-stats' instead\n");
-
- if (argc > 1 && !strcmp(argv[1], "--help"))
- usage(cmd_inspect_tree_stats_usage);
-
- ret = cmd_inspect_tree_stats(argc, argv);
-
- btrfs_close_all_devices();
-
- return ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-corrupt-block.c new/btrfs-progs-v4.16.1/btrfs-corrupt-block.c
--- old/btrfs-progs-v4.16/btrfs-corrupt-block.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-corrupt-block.c 2018-04-24 13:42:06.000000000 +0200
@@ -726,7 +726,7 @@
static void shift_items(struct btrfs_root *root, struct extent_buffer *eb)
{
int nritems = btrfs_header_nritems(eb);
- int shift_space = btrfs_leaf_free_space(root, eb) / 2;
+ int shift_space = btrfs_leaf_free_space(root->fs_info, eb) / 2;
int slot = nritems / 2;
int i = 0;
unsigned int data_end = btrfs_item_offset_nr(eb, nritems - 1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-debug-tree.c new/btrfs-progs-v4.16.1/btrfs-debug-tree.c
--- old/btrfs-progs-v4.16/btrfs-debug-tree.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-debug-tree.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2007 Oracle. 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 "disk-io.h"
-#include "volumes.h"
-#include "utils.h"
-#include "commands.h"
-#include "help.h"
-
-int main(int argc, char **argv)
-{
- int ret;
-
- set_argv0(argv);
-
- if (argc > 1 && !strcmp(argv[1], "--help"))
- usage(cmd_inspect_dump_tree_usage);
-
- radix_tree_init();
-
- ret = cmd_inspect_dump_tree(argc, argv);
-
- btrfs_close_all_devices();
-
- return ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-sb-mod.c new/btrfs-progs-v4.16.1/btrfs-sb-mod.c
--- old/btrfs-progs-v4.16/btrfs-sb-mod.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-sb-mod.c 2018-04-24 13:42:06.000000000 +0200
@@ -110,6 +110,7 @@
enum field_type {
TYPE_UNKNOWN,
TYPE_U64,
+ TYPE_U16,
};
struct sb_field {
@@ -123,21 +124,43 @@
{ .name = "chunk_root_generation", .type = TYPE_U64 },
{ .name = "cache_generation", .type = TYPE_U64 },
{ .name = "uuid_tree_generation", .type = TYPE_U64 },
+ { .name = "compat_flags", .type = TYPE_U64 },
+ { .name = "compat_ro_flags", .type = TYPE_U64 },
+ { .name = "incompat_flags", .type = TYPE_U64 },
+ { .name = "csum_type", .type = TYPE_U16 },
};
-#define MOD_FIELD(fname, set, val) \
+#define MOD_FIELD_XX(fname, set, val, bits, f_dec, f_hex, f_type) \
else if (strcmp(name, #fname) == 0) { \
if (set) { \
- printf("SET: %s %llu (0x%llx)\n", #fname, \
- (unsigned long long)*val, (unsigned long long)*val); \
- sb->fname = cpu_to_le64(*val); \
+ printf("SET: "#fname" "f_dec" (0x"f_hex")\n", \
+ (f_type)*val, (f_type)*val); \
+ sb->fname = cpu_to_le##bits(*val); \
} else { \
- *val = le64_to_cpu(sb->fname); \
- printf("GET: %s %llu (0x%llx)\n", #fname, \
- (unsigned long long)*val, (unsigned long long)*val); \
+ *val = le##bits##_to_cpu(sb->fname); \
+ printf("GET: "#fname" "f_dec" (0x"f_hex")\n", \
+ (f_type)*val, (f_type)*val); \
} \
}
+#define MOD_FIELD64(fname, set, val) \
+ MOD_FIELD_XX(fname, set, val, 64, "%llu", "%llx", unsigned long long)
+
+/* Alias for u64 */
+#define MOD_FIELD(fname, set, val) MOD_FIELD64(fname, set, val)
+
+/*
+ * Support only GET and SET properly, ADD and SUB may work
+ */
+#define MOD_FIELD32(fname, set, val) \
+ MOD_FIELD_XX(fname, set, val, 32, "%u", "%x", unsigned int)
+
+#define MOD_FIELD16(fname, set, val) \
+ MOD_FIELD_XX(fname, set, val, 16, "%hu", "%hx", unsigned short int)
+
+#define MOD_FIELD8(fname, set, val) \
+ MOD_FIELD_XX(fname, set, val, 8, "%hhu", "%hhx", unsigned char)
+
static void mod_field_by_name(struct btrfs_super_block *sb, int set, const char *name,
u64 *val)
{
@@ -149,6 +172,10 @@
MOD_FIELD(chunk_root_generation, set, val)
MOD_FIELD(cache_generation, set, val)
MOD_FIELD(uuid_tree_generation, set, val)
+ MOD_FIELD(compat_flags, set, val)
+ MOD_FIELD(compat_ro_flags, set, val)
+ MOD_FIELD(incompat_flags, set, val)
+ MOD_FIELD16(csum_type, set, val)
else {
printf("ERROR: unhandled field: %s\n", name);
exit(1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-show-super.c new/btrfs-progs-v4.16.1/btrfs-show-super.c
--- old/btrfs-progs-v4.16/btrfs-show-super.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-show-super.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 STRATO AG. 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 "utils.h"
-#include "commands.h"
-#include "help.h"
-
-int main(int argc, char **argv)
-{
-
- int ret;
-
- set_argv0(argv);
-
- warning(
-"\nthe tool has been deprecated, please use 'btrfs inspect-internal dump-super' instead\n");
-
- if (argc > 1 && !strcmp(argv[1], "--help"))
- usage(cmd_inspect_dump_super_usage);
-
- ret = cmd_inspect_dump_super(argc, argv);
-
- return ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/btrfs-zero-log.c new/btrfs-progs-v4.16.1/btrfs-zero-log.c
--- old/btrfs-progs-v4.16/btrfs-zero-log.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/btrfs-zero-log.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2007 Oracle. 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
-#include
-#include "ctree.h"
-#include "disk-io.h"
-#include "transaction.h"
-#include "utils.h"
-#include "help.h"
-
-__attribute__((noreturn)) static void print_usage(void)
-{
- printf("usage: btrfs-zero-log dev\n");
- exit(1);
-}
-
-int main(int argc, char **argv)
-{
- struct btrfs_root *root;
- struct btrfs_trans_handle *trans;
- struct btrfs_super_block *sb;
- int ret;
-
- set_argv0(argv);
- if (check_argc_exact(argc - optind, 1))
- print_usage();
-
- radix_tree_init();
-
- printf("WARNING: this utility is deprecated, please use 'btrfs rescue zero-log'\n\n");
-
- if ((ret = check_mounted(argv[optind])) < 0) {
- fprintf(stderr, "ERROR: could not check mount status: %s\n", strerror(-ret));
- goto out;
- } else if (ret) {
- fprintf(stderr, "ERROR: %s is currently mounted\n", argv[optind]);
- ret = -EBUSY;
- goto out;
- }
-
- root = open_ctree(argv[optind], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
- if (!root) {
- fprintf(stderr, "ERROR: cannot open ctree\n");
- return 1;
- }
-
- sb = root->fs_info->super_copy;
- printf("Clearing log on %s, previous log_root %llu, level %u\n",
- argv[optind],
- (unsigned long long)btrfs_super_log_root(sb),
- (unsigned)btrfs_super_log_root_level(sb));
- trans = btrfs_start_transaction(root, 1);
- BUG_ON(IS_ERR(trans));
- btrfs_set_super_log_root(root->fs_info->super_copy, 0);
- btrfs_set_super_log_root_level(root->fs_info->super_copy, 0);
- btrfs_commit_transaction(trans, root);
- close_ctree(root);
-out:
- return !!ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/check/main.c new/btrfs-progs-v4.16.1/check/main.c
--- old/btrfs-progs-v4.16/check/main.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/check/main.c 2018-04-24 13:42:06.000000000 +0200
@@ -5601,6 +5601,7 @@
int ret;
u64 data_len;
unsigned long leaf_offset;
+ bool verify_csum = !!check_data_csum;
root = root->fs_info->csum_root;
if (!extent_buffer_uptodate(root->node)) {
@@ -5623,6 +5624,16 @@
path.slots[0]--;
ret = 0;
+ /*
+ * For metadata dump (btrfs-image) all data is wiped so verifying data
+ * csum is meaningless and will always report csum error.
+ */
+ if (check_data_csum && (btrfs_super_flags(root->fs_info->super_copy) &
+ (BTRFS_SUPER_FLAG_METADUMP | BTRFS_SUPER_FLAG_METADUMP_V2))) {
+ printf("skip data csum verification for metadata dump\n");
+ verify_csum = false;
+ }
+
while (1) {
if (path.slots[0] >= btrfs_header_nritems(path.nodes[0])) {
ret = btrfs_next_leaf(root, &path);
@@ -5644,7 +5655,7 @@
data_len = (btrfs_item_size_nr(leaf, path.slots[0]) /
csum_size) * root->fs_info->sectorsize;
- if (!check_data_csum)
+ if (!verify_csum)
goto skip_csum_check;
leaf_offset = btrfs_item_ptr_offset(leaf, path.slots[0]);
ret = check_extent_csums(root, key.offset, data_len,
@@ -5959,7 +5970,7 @@
goto out;
if (btrfs_is_leaf(buf)) {
- btree_space_waste += btrfs_leaf_free_space(root, buf);
+ btree_space_waste += btrfs_leaf_free_space(fs_info, buf);
for (i = 0; i < nritems; i++) {
struct btrfs_file_extent_item *fi;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/check/mode-lowmem.c new/btrfs-progs-v4.16.1/check/mode-lowmem.c
--- old/btrfs-progs-v4.16/check/mode-lowmem.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/check/mode-lowmem.c 2018-04-24 13:42:06.000000000 +0200
@@ -390,7 +390,7 @@
total_extent_tree_bytes += eb->len;
if (level == 0) {
- btree_space_waste += btrfs_leaf_free_space(root, eb);
+ btree_space_waste += btrfs_leaf_free_space(root->fs_info, eb);
} else {
free_nrs = (BTRFS_NODEPTRS_PER_BLOCK(root->fs_info) -
btrfs_header_nritems(eb));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/cmds-fi-du.c new/btrfs-progs-v4.16.1/cmds-fi-du.c
--- old/btrfs-progs-v4.16/cmds-fi-du.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/cmds-fi-du.c 2018-04-24 13:42:06.000000000 +0200
@@ -449,7 +449,7 @@
}
pathtmp = pathp;
- if (pathp == path)
+ if (pathp == path || *(pathp - 1) == '/')
ret = sprintf(pathp, "%s", filename);
else
ret = sprintf(pathp, "/%s", filename);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/cmds-inspect-dump-tree.c new/btrfs-progs-v4.16.1/cmds-inspect-dump-tree.c
--- old/btrfs-progs-v4.16/cmds-inspect-dump-tree.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/cmds-inspect-dump-tree.c 2018-04-24 13:42:06.000000000 +0200
@@ -33,8 +33,9 @@
#include "utils.h"
#include "help.h"
-static void print_extents(struct btrfs_root *root, struct extent_buffer *eb)
+static void print_extents(struct extent_buffer *eb)
{
+ struct btrfs_fs_info *fs_info = eb->fs_info;
struct extent_buffer *next;
int i;
u32 nr;
@@ -43,13 +44,13 @@
return;
if (btrfs_is_leaf(eb)) {
- btrfs_print_leaf(root, eb);
+ btrfs_print_leaf(eb);
return;
}
nr = btrfs_header_nritems(eb);
for (i = 0; i < nr; i++) {
- next = read_tree_block(root->fs_info,
+ next = read_tree_block(fs_info,
btrfs_node_blockptr(eb, i),
btrfs_node_ptr_generation(eb, i));
if (!extent_buffer_uptodate(next))
@@ -68,7 +69,7 @@
btrfs_header_level(eb));
goto out;
}
- print_extents(root, next);
+ print_extents(next);
free_extent_buffer(next);
}
@@ -220,12 +221,20 @@
int uuid_tree_only = 0;
int roots_only = 0;
int root_backups = 0;
- unsigned open_ctree_flags = OPEN_CTREE_FS_PARTIAL;
+ unsigned open_ctree_flags;
u64 block_only = 0;
struct btrfs_root *tree_root_scan;
u64 tree_id = 0;
bool follow = false;
+ /*
+ * For debug-tree, we care nothing about extent tree (it's just backref
+ * and usage accounting, only makes sense for RW operations).
+ * Use NO_BLOCK_GROUPS here could also speedup open_ctree() and allow us
+ * to inspect fs with corrupted extent tree blocks, and show as many good
+ * tree blocks as possible.
+ */
+ open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS;
while (1) {
int c;
enum { GETOPT_VAL_FOLLOW = 256 };
@@ -331,7 +340,7 @@
(unsigned long long)block_only);
goto close_root;
}
- btrfs_print_tree(root, leaf, follow);
+ btrfs_print_tree(leaf, follow);
free_extent_buffer(leaf);
goto close_root;
}
@@ -358,20 +367,17 @@
} else {
if (info->tree_root->node) {
printf("root tree\n");
- btrfs_print_tree(info->tree_root,
- info->tree_root->node, 1);
+ btrfs_print_tree(info->tree_root->node, 1);
}
if (info->chunk_root->node) {
printf("chunk tree\n");
- btrfs_print_tree(info->chunk_root,
- info->chunk_root->node, 1);
+ btrfs_print_tree(info->chunk_root->node, 1);
}
if (info->log_root_tree) {
printf("log root tree\n");
- btrfs_print_tree(info->log_root_tree,
- info->log_root_tree->node, 1);
+ btrfs_print_tree(info->log_root_tree->node, 1);
}
}
}
@@ -391,7 +397,7 @@
goto close_root;
}
printf("root tree\n");
- btrfs_print_tree(info->tree_root, info->tree_root->node, 1);
+ btrfs_print_tree(info->tree_root->node, 1);
goto close_root;
}
@@ -401,7 +407,7 @@
goto close_root;
}
printf("chunk tree\n");
- btrfs_print_tree(info->chunk_root, info->chunk_root->node, 1);
+ btrfs_print_tree(info->chunk_root->node, 1);
goto close_root;
}
@@ -411,8 +417,7 @@
goto close_root;
}
printf("log root tree\n");
- btrfs_print_tree(info->log_root_tree, info->log_root_tree->node,
- 1);
+ btrfs_print_tree(info->log_root_tree->node, 1);
goto close_root;
}
@@ -548,7 +553,7 @@
printf(" tree ");
btrfs_print_key(&disk_key);
printf("\n");
- print_extents(tree_root_scan, buf);
+ print_extents(buf);
} else if (!skip) {
printf(" tree ");
btrfs_print_key(&disk_key);
@@ -558,7 +563,7 @@
btrfs_header_level(buf));
} else {
printf(" \n");
- btrfs_print_tree(tree_root_scan, buf, 1);
+ btrfs_print_tree(buf, 1);
}
}
free_extent_buffer(buf);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/cmds-restore.c new/btrfs-progs-v4.16.1/cmds-restore.c
--- old/btrfs-progs-v4.16/cmds-restore.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/cmds-restore.c 2018-04-24 13:42:06.000000000 +0200
@@ -1281,8 +1281,15 @@
for (i = super_mirror; i < BTRFS_SUPER_MIRROR_MAX; i++) {
bytenr = btrfs_sb_offset(i);
+
+ /*
+ * Restore won't allocate extent and doesn't care anything
+ * in extent tree. Skip block group item search will allow
+ * restore to be executed on heavily damaged fs.
+ */
fs_info = open_ctree_fs_info(dev, bytenr, root_location, 0,
- OPEN_CTREE_PARTIAL);
+ OPEN_CTREE_PARTIAL |
+ OPEN_CTREE_NO_BLOCK_GROUPS);
if (fs_info)
break;
fprintf(stderr, "Could not open root, trying backup super\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/cmds-scrub.c new/btrfs-progs-v4.16.1/cmds-scrub.c
--- old/btrfs-progs-v4.16/cmds-scrub.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/cmds-scrub.c 2018-04-24 13:42:06.000000000 +0200
@@ -591,8 +591,6 @@
ret = 0;
_SCRUB_KVREAD(ret, &i, data_extents_scrubbed, avail, l,
&p[curr]->p);
- _SCRUB_KVREAD(ret, &i, data_extents_scrubbed, avail, l,
- &p[curr]->p);
_SCRUB_KVREAD(ret, &i, tree_extents_scrubbed, avail, l,
&p[curr]->p);
_SCRUB_KVREAD(ret, &i, data_bytes_scrubbed, avail, l,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/configure.ac new/btrfs-progs-v4.16.1/configure.ac
--- old/btrfs-progs-v4.16/configure.ac 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/configure.ac 2018-04-24 13:42:06.000000000 +0200
@@ -93,7 +93,11 @@
dnl detect tools to build documentation
ASCIIDOC_TOOL="none"
if test "x$enable_documentation" = xyes; then
- AC_PATH_PROG([XMLTO], [xmlto], [xmlto])
+ AC_PATH_PROG([XMLTO], [xmlto])
+ if test -z "$XMLTO"; then
+ AC_MSG_ERROR([cannot find xmlto, cannot build documentation])
+ fi
+
AC_PATH_PROG([GZIP], [gzip], [gzip])
AC_PATH_PROG([MV], [mv], [mv])
AC_PROG_SED
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/convert/common.c new/btrfs-progs-v4.16.1/convert/common.c
--- old/btrfs-progs-v4.16/convert/common.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/convert/common.c 2018-04-24 13:42:06.000000000 +0200
@@ -116,7 +116,7 @@
btrfs_set_super_bytenr(super, cfg->super_bytenr);
btrfs_set_super_num_devices(super, 1);
- btrfs_set_super_magic(super, BTRFS_MAGIC_PARTIAL);
+ btrfs_set_super_magic(super, BTRFS_MAGIC_TEMPORARY);
btrfs_set_super_generation(super, 1);
btrfs_set_super_root(super, root_bytenr);
btrfs_set_super_chunk_root(super, chunk_bytenr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/convert/main.c new/btrfs-progs-v4.16.1/convert/main.c
--- old/btrfs-progs-v4.16/convert/main.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/convert/main.c 2018-04-24 13:42:06.000000000 +0200
@@ -1140,7 +1140,7 @@
}
root = open_ctree_fd(fd, devname, mkfs_cfg.super_bytenr,
- OPEN_CTREE_WRITES | OPEN_CTREE_FS_PARTIAL);
+ OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
if (!root) {
error("unable to open ctree");
goto fail;
@@ -1230,7 +1230,7 @@
}
root = open_ctree_fd(fd, devname, 0,
- OPEN_CTREE_WRITES | OPEN_CTREE_FS_PARTIAL);
+ OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
if (!root) {
error("unable to open ctree for finalization");
goto fail;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/convert/source-reiserfs.c new/btrfs-progs-v4.16.1/convert/source-reiserfs.c
--- old/btrfs-progs-v4.16/convert/source-reiserfs.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/convert/source-reiserfs.c 2018-04-24 13:42:06.000000000 +0200
@@ -350,8 +350,7 @@
if (ret)
return ret;
- eb = alloc_extent_buffer(&root->fs_info->extent_cache, key.objectid,
- sectorsize);
+ eb = alloc_extent_buffer(root->fs_info, key.objectid, sectorsize);
if (!eb)
return -ENOMEM;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/ctree.c new/btrfs-progs-v4.16.1/ctree.c
--- old/btrfs-progs-v4.16/ctree.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/ctree.c 2018-04-24 13:42:06.000000000 +0200
@@ -480,11 +480,11 @@
(unsigned long long)btrfs_header_bytenr(buf));
goto fail;
}
- if (btrfs_leaf_free_space(root, buf) < 0) {
+ if (btrfs_leaf_free_space(root->fs_info, buf) < 0) {
ret = BTRFS_TREE_BLOCK_INVALID_FREE_SPACE;
fprintf(stderr, "leaf free space incorrect %llu %d\n",
(unsigned long long)btrfs_header_bytenr(buf),
- btrfs_leaf_free_space(root, buf));
+ btrfs_leaf_free_space(root->fs_info, buf));
goto fail;
}
@@ -1193,7 +1193,7 @@
} else {
p->slots[level] = slot;
if (ins_len > 0 &&
- ins_len > btrfs_leaf_free_space(root, b)) {
+ ins_len > btrfs_leaf_free_space(root->fs_info, b)) {
int sret = split_leaf(trans, root, key,
p, ins_len, ret == 0);
BUG_ON(sret > 0);
@@ -1634,16 +1634,17 @@
* the start of the leaf data. IOW, how much room
* the leaf has left for both items and data
*/
-int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf)
+int btrfs_leaf_free_space(struct btrfs_fs_info *fs_info,
+ struct extent_buffer *leaf)
{
- u32 nodesize = (root ? BTRFS_LEAF_DATA_SIZE(root->fs_info) : leaf->len);
int nritems = btrfs_header_nritems(leaf);
int ret;
- ret = nodesize - leaf_space_used(leaf, 0, nritems);
+
+ ret = BTRFS_LEAF_DATA_SIZE(fs_info) - leaf_space_used(leaf, 0, nritems);
if (ret < 0) {
- printk("leaf free space ret %d, leaf data size %u, used %d nritems %d\n",
- ret, nodesize, leaf_space_used(leaf, 0, nritems),
- nritems);
+ printk("leaf free space ret %d, leaf data size %lu, used %d nritems %d\n",
+ ret, BTRFS_LEAF_DATA_SIZE(fs_info),
+ leaf_space_used(leaf, 0, nritems), nritems);
}
return ret;
}
@@ -1691,7 +1692,7 @@
return PTR_ERR(right);
return -EIO;
}
- free_space = btrfs_leaf_free_space(root, right);
+ free_space = btrfs_leaf_free_space(fs_info, right);
if (free_space < data_size) {
free_extent_buffer(right);
return 1;
@@ -1704,7 +1705,7 @@
free_extent_buffer(right);
return 1;
}
- free_space = btrfs_leaf_free_space(root, right);
+ free_space = btrfs_leaf_free_space(fs_info, right);
if (free_space < data_size) {
free_extent_buffer(right);
return 1;
@@ -1843,7 +1844,7 @@
}
left = read_node_slot(fs_info, path->nodes[1], slot - 1);
- free_space = btrfs_leaf_free_space(root, left);
+ free_space = btrfs_leaf_free_space(fs_info, left);
if (free_space < data_size) {
free_extent_buffer(left);
return 1;
@@ -1858,7 +1859,7 @@
return 1;
}
- free_space = btrfs_leaf_free_space(root, left);
+ free_space = btrfs_leaf_free_space(fs_info, left);
if (free_space < data_size) {
free_extent_buffer(left);
return 1;
@@ -2082,7 +2083,7 @@
l = path->nodes[0];
/* did the pushes work? */
- if (btrfs_leaf_free_space(root, l) >= data_size)
+ if (btrfs_leaf_free_space(root->fs_info, l) >= data_size)
return 0;
}
@@ -2239,7 +2240,8 @@
leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &orig_key, path->slots[0]);
- if (btrfs_leaf_free_space(root, leaf) >= sizeof(struct btrfs_item))
+ if (btrfs_leaf_free_space(root->fs_info, leaf) >=
+ sizeof(struct btrfs_item))
goto split;
item_size = btrfs_item_size_nr(leaf, path->slots[0]);
@@ -2259,7 +2261,8 @@
ret = split_leaf(trans, root, &orig_key, path, 0, 0);
BUG_ON(ret);
- BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item));
+ BUG_ON(btrfs_leaf_free_space(root->fs_info, leaf) <
+ sizeof(struct btrfs_item));
leaf = path->nodes[0];
split:
@@ -2311,8 +2314,8 @@
btrfs_mark_buffer_dirty(leaf);
ret = 0;
- if (btrfs_leaf_free_space(root, leaf) < 0) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < 0) {
+ btrfs_print_leaf(leaf);
BUG();
}
kfree(buf);
@@ -2407,8 +2410,8 @@
btrfs_mark_buffer_dirty(leaf);
ret = 0;
- if (btrfs_leaf_free_space(root, leaf) < 0) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < 0) {
+ btrfs_print_leaf(leaf);
BUG();
}
return ret;
@@ -2432,8 +2435,8 @@
nritems = btrfs_header_nritems(leaf);
data_end = leaf_data_end(root->fs_info, leaf);
- if (btrfs_leaf_free_space(root, leaf) < data_size) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < data_size) {
+ btrfs_print_leaf(leaf);
BUG();
}
slot = path->slots[0];
@@ -2441,7 +2444,7 @@
BUG_ON(slot < 0);
if (slot >= nritems) {
- btrfs_print_leaf(root, leaf);
+ btrfs_print_leaf(leaf);
printk("slot %d too large, nritems %d\n", slot, nritems);
BUG_ON(1);
}
@@ -2469,8 +2472,8 @@
btrfs_mark_buffer_dirty(leaf);
ret = 0;
- if (btrfs_leaf_free_space(root, leaf) < 0) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < 0) {
+ btrfs_print_leaf(leaf);
BUG();
}
return ret;
@@ -2518,10 +2521,10 @@
nritems = btrfs_header_nritems(leaf);
data_end = leaf_data_end(root->fs_info, leaf);
- if (btrfs_leaf_free_space(root, leaf) < total_size) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < total_size) {
+ btrfs_print_leaf(leaf);
printk("not enough freespace need %u have %d\n",
- total_size, btrfs_leaf_free_space(root, leaf));
+ total_size, btrfs_leaf_free_space(root->fs_info, leaf));
BUG();
}
@@ -2532,7 +2535,7 @@
unsigned int old_data = btrfs_item_end_nr(leaf, slot);
if (old_data < data_end) {
- btrfs_print_leaf(root, leaf);
+ btrfs_print_leaf(leaf);
printk("slot %d old_data %d data_end %d\n",
slot, old_data, data_end);
BUG_ON(1);
@@ -2579,8 +2582,8 @@
btrfs_fixup_low_keys(root, path, &disk_key, 1);
}
- if (btrfs_leaf_free_space(root, leaf) < 0) {
- btrfs_print_leaf(root, leaf);
+ if (btrfs_leaf_free_space(root->fs_info, leaf) < 0) {
+ btrfs_print_leaf(leaf);
BUG();
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/ctree.h new/btrfs-progs-v4.16.1/ctree.h
--- old/btrfs-progs-v4.16/ctree.h 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/ctree.h 2018-04-24 13:42:06.000000000 +0200
@@ -45,10 +45,12 @@
#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */
/*
- * Fake signature for an unfinalized filesystem, structures might be partially
- * created or missing.
+ * Fake signature for an unfinalized filesystem, which only has barebone tree
+ * structures (normally 6 near empty trees, on SINGLE meta/sys temporary chunks)
+ *
+ * ascii !BHRfS_M, no null
*/
-#define BTRFS_MAGIC_PARTIAL 0x4D5F536652484221ULL /* ascii !BHRfS_M, no null */
+#define BTRFS_MAGIC_TEMPORARY 0x4D5F536652484221ULL
#define BTRFS_MAX_MIRRORS 3
@@ -2662,7 +2664,8 @@
}
int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
-int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
+int btrfs_leaf_free_space(struct btrfs_fs_info *fs_info,
+ struct extent_buffer *leaf);
void btrfs_fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_disk_key *key, int level);
int btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/disk-io.c new/btrfs-progs-v4.16.1/disk-io.c
--- old/btrfs-progs-v4.16/disk-io.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/disk-io.c 2018-04-24 13:42:06.000000000 +0200
@@ -184,8 +184,7 @@
struct extent_buffer* btrfs_find_create_tree_block(
struct btrfs_fs_info *fs_info, u64 bytenr)
{
- return alloc_extent_buffer(&fs_info->extent_cache, bytenr,
- fs_info->nodesize);
+ return alloc_extent_buffer(fs_info, bytenr, fs_info->nodesize);
}
void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
@@ -1117,14 +1116,14 @@
fs_info->ignore_chunk_tree_error = 1;
if ((flags & OPEN_CTREE_RECOVER_SUPER)
- && (flags & OPEN_CTREE_FS_PARTIAL)) {
+ && (flags & OPEN_CTREE_TEMPORARY_SUPER)) {
fprintf(stderr,
- "cannot open a partially created filesystem for recovery");
+ "cannot open a filesystem with temporary super block for recovery");
goto out;
}
- if (flags & OPEN_CTREE_FS_PARTIAL)
- sbflags = SBREAD_PARTIAL;
+ if (flags & OPEN_CTREE_TEMPORARY_SUPER)
+ sbflags = SBREAD_TEMPORARY;
ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr, sbflags,
(flags & OPEN_CTREE_NO_DEVICES));
@@ -1285,8 +1284,8 @@
int csum_size;
if (btrfs_super_magic(sb) != BTRFS_MAGIC) {
- if (btrfs_super_magic(sb) == BTRFS_MAGIC_PARTIAL) {
- if (!(sbflags & SBREAD_PARTIAL)) {
+ if (btrfs_super_magic(sb) == BTRFS_MAGIC_TEMPORARY) {
+ if (!(sbflags & SBREAD_TEMPORARY)) {
error("superblock magic doesn't match");
return -EIO;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/disk-io.h new/btrfs-progs-v4.16.1/disk-io.h
--- old/btrfs-progs-v4.16/disk-io.h 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/disk-io.h 2018-04-24 13:42:06.000000000 +0200
@@ -73,8 +73,12 @@
*/
OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR = (1U << 11),
- /* Allow to open a partially created filesystem */
- OPEN_CTREE_FS_PARTIAL = (1U << 12),
+ /*
+ * Allow to open fs with temporary superblock (BTRFS_MAGIC_PARTIAL),
+ * such fs contains very basic tree layout, just able to be opened.
+ * Such temporary super is used for mkfs or convert.
+ */
+ OPEN_CTREE_TEMPORARY_SUPER = (1U << 12),
/*
* Invalidate the free space tree (i.e., clear the FREE_SPACE_TREE_VALID
@@ -95,7 +99,7 @@
* Read superblock with the fake signature, cannot be used with
* SBREAD_RECOVER
*/
- SBREAD_PARTIAL = (1 << 1),
+ SBREAD_TEMPORARY = (1 << 1),
};
/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/extent-tree.c new/btrfs-progs-v4.16.1/extent-tree.c
--- old/btrfs-progs-v4.16/extent-tree.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/extent-tree.c 2018-04-24 13:42:06.000000000 +0200
@@ -1070,7 +1070,7 @@
printf("Size is %u, needs to be %u, slot %d\n",
(unsigned)item_size,
(unsigned)sizeof(*ei), path->slots[0]);
- btrfs_print_leaf(root, leaf);
+ btrfs_print_leaf(leaf);
return -EINVAL;
}
BUG_ON(item_size < sizeof(*ei));
@@ -1587,7 +1587,7 @@
}
if (ret != 0) {
- btrfs_print_leaf(root, path->nodes[0]);
+ btrfs_print_leaf(path->nodes[0]);
printk("failed to find block number %Lu\n",
(unsigned long long)bytenr);
BUG();
@@ -2273,7 +2273,7 @@
printk(KERN_ERR "umm, got %d back from search"
", was looking for %llu\n", ret,
(unsigned long long)bytenr);
- btrfs_print_leaf(extent_root, path->nodes[0]);
+ btrfs_print_leaf(path->nodes[0]);
}
BUG_ON(ret);
extent_slot = path->slots[0];
@@ -2311,7 +2311,7 @@
printk(KERN_ERR "umm, got %d back from search"
", was looking for %llu\n", ret,
(unsigned long long)bytenr);
- btrfs_print_leaf(extent_root, path->nodes[0]);
+ btrfs_print_leaf(path->nodes[0]);
}
BUG_ON(ret);
extent_slot = path->slots[0];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/extent_io.c new/btrfs-progs-v4.16.1/extent_io.c
--- old/btrfs-progs-v4.16/extent_io.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/extent_io.c 2018-04-24 13:42:06.000000000 +0200
@@ -545,7 +545,7 @@
return ret;
}
-static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
+static struct extent_buffer *__alloc_extent_buffer(struct btrfs_fs_info *info,
u64 bytenr, u32 blocksize)
{
struct extent_buffer *eb;
@@ -558,12 +558,14 @@
eb->len = blocksize;
eb->refs = 1;
eb->flags = 0;
- eb->tree = tree;
eb->fd = -1;
eb->dev_bytenr = (u64)-1;
eb->cache_node.start = bytenr;
eb->cache_node.size = blocksize;
+ eb->fs_info = info;
+ eb->tree = &info->extent_cache;
INIT_LIST_HEAD(&eb->recow);
+ INIT_LIST_HEAD(&eb->lru);
return eb;
}
@@ -572,9 +574,11 @@
{
struct extent_buffer *new;
- new = __alloc_extent_buffer(NULL, src->start, src->len);
+ new = __alloc_extent_buffer(src->fs_info, src->start, src->len);
if (!new)
return NULL;
+ /* cloned eb is not linked into fs_info->extent_cache */
+ new->tree = NULL;
copy_extent_buffer(new, src, 0, 0, src->len);
new->flags |= EXTENT_BUFFER_DUMMY;
@@ -587,7 +591,7 @@
struct extent_io_tree *tree = eb->tree;
BUG_ON(eb->refs);
- BUG_ON(tree->cache_size < eb->len);
+ BUG_ON(tree && tree->cache_size < eb->len);
list_del_init(&eb->lru);
if (!(eb->flags & EXTENT_BUFFER_DUMMY)) {
remove_cache_extent(&tree->cache, &eb->cache_node);
@@ -664,10 +668,11 @@
}
}
-struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
+struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
u64 bytenr, u32 blocksize)
{
struct extent_buffer *eb;
+ struct extent_io_tree *tree = &fs_info->extent_cache;
struct cache_extent *cache;
cache = lookup_cache_extent(&tree->cache, bytenr, blocksize);
@@ -684,7 +689,7 @@
cache_node);
free_extent_buffer(eb);
}
- eb = __alloc_extent_buffer(tree, bytenr, blocksize);
+ eb = __alloc_extent_buffer(fs_info, bytenr, blocksize);
if (!eb)
return NULL;
ret = insert_cache_extent(&tree->cache, &eb->cache_node);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/extent_io.h new/btrfs-progs-v4.16.1/extent_io.h
--- old/btrfs-progs-v4.16/extent_io.h 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/extent_io.h 2018-04-24 13:42:06.000000000 +0200
@@ -91,13 +91,14 @@
struct cache_extent cache_node;
u64 start;
u64 dev_bytenr;
- u32 len;
struct extent_io_tree *tree;
struct list_head lru;
struct list_head recow;
+ u32 len;
int refs;
u32 flags;
int fd;
+ struct btrfs_fs_info *fs_info;
char data[] __attribute__((aligned(8)));
};
@@ -145,7 +146,7 @@
u64 bytenr, u32 blocksize);
struct extent_buffer *find_first_extent_buffer(struct extent_io_tree *tree,
u64 start);
-struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
+struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
u64 bytenr, u32 blocksize);
struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src);
void free_extent_buffer(struct extent_buffer *eb);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/mkfs/common.c new/btrfs-progs-v4.16.1/mkfs/common.c
--- old/btrfs-progs-v4.16/mkfs/common.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/mkfs/common.c 2018-04-24 13:42:06.000000000 +0200
@@ -189,7 +189,7 @@
btrfs_set_super_bytenr(&super, cfg->blocks[MKFS_SUPER_BLOCK]);
btrfs_set_super_num_devices(&super, 1);
- btrfs_set_super_magic(&super, BTRFS_MAGIC_PARTIAL);
+ btrfs_set_super_magic(&super, BTRFS_MAGIC_TEMPORARY);
btrfs_set_super_generation(&super, 1);
btrfs_set_super_root(&super, cfg->blocks[MKFS_ROOT_TREE]);
btrfs_set_super_chunk_root(&super, cfg->blocks[MKFS_CHUNK_TREE]);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/mkfs/main.c new/btrfs-progs-v4.16.1/mkfs/main.c
--- old/btrfs-progs-v4.16/mkfs/main.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/mkfs/main.c 2018-04-24 13:42:06.000000000 +0200
@@ -1099,7 +1099,7 @@
}
fs_info = open_ctree_fs_info(file, 0, 0, 0,
- OPEN_CTREE_WRITES | OPEN_CTREE_FS_PARTIAL);
+ OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
if (!fs_info) {
error("open ctree failed");
goto error;
@@ -1295,6 +1295,12 @@
}
}
+ if (!ret && close_ret) {
+ ret = close_ret;
+ error("failed to close ctree, the filesystem may be inconsistent: %d",
+ ret);
+ }
+
btrfs_close_all_devices();
free(label);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/print-tree.c new/btrfs-progs-v4.16.1/print-tree.c
--- old/btrfs-progs-v4.16/print-tree.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/print-tree.c 2018-04-24 13:42:06.000000000 +0200
@@ -1173,8 +1173,9 @@
}
}
-void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *eb)
+void btrfs_print_leaf(struct extent_buffer *eb)
{
+ struct btrfs_fs_info *fs_info = eb->fs_info;
struct btrfs_item *item;
struct btrfs_disk_key disk_key;
char flags_str[128];
@@ -1190,7 +1191,7 @@
printf("leaf %llu items %d free space %d generation %llu owner ",
(unsigned long long)btrfs_header_bytenr(eb), nr,
- btrfs_leaf_free_space(root, eb),
+ btrfs_leaf_free_space(fs_info, eb),
(unsigned long long)btrfs_header_generation(eb));
print_objectid(stdout, btrfs_header_owner(eb), 0);
printf("\n");
@@ -1290,7 +1291,7 @@
printf("\t\tcsum item\n");
break;
case BTRFS_EXTENT_CSUM_KEY:
- print_extent_csum(eb, root->fs_info, item_size,
+ print_extent_csum(eb, fs_info, item_size,
offset);
break;
case BTRFS_EXTENT_DATA_KEY:
@@ -1351,10 +1352,11 @@
}
}
-void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *eb, int follow)
+void btrfs_print_tree(struct extent_buffer *eb, int follow)
{
u32 i;
u32 nr;
+ struct btrfs_fs_info *fs_info = eb->fs_info;
struct btrfs_disk_key disk_key;
struct btrfs_key key;
struct extent_buffer *next;
@@ -1363,13 +1365,13 @@
return;
nr = btrfs_header_nritems(eb);
if (btrfs_is_leaf(eb)) {
- btrfs_print_leaf(root, eb);
+ btrfs_print_leaf(eb);
return;
}
printf("node %llu level %d items %d free %u generation %llu owner ",
(unsigned long long)eb->start,
btrfs_header_level(eb), nr,
- (u32)BTRFS_NODEPTRS_PER_BLOCK(root->fs_info) - nr,
+ (u32)BTRFS_NODEPTRS_PER_BLOCK(fs_info) - nr,
(unsigned long long)btrfs_header_generation(eb));
print_objectid(stdout, btrfs_header_owner(eb), 0);
printf("\n");
@@ -1383,7 +1385,7 @@
btrfs_print_key(&disk_key);
printf(" block %llu (%llu) gen %llu\n",
(unsigned long long)blocknr,
- (unsigned long long)blocknr / root->fs_info->nodesize,
+ (unsigned long long)blocknr / fs_info->nodesize,
(unsigned long long)btrfs_node_ptr_generation(eb, i));
fflush(stdout);
}
@@ -1391,7 +1393,7 @@
return;
for (i = 0; i < nr; i++) {
- next = read_tree_block(root->fs_info,
+ next = read_tree_block(fs_info,
btrfs_node_blockptr(eb, i),
btrfs_node_ptr_generation(eb, i));
if (!extent_buffer_uptodate(next)) {
@@ -1411,7 +1413,7 @@
free_extent_buffer(next);
continue;
}
- btrfs_print_tree(root, next, 1);
+ btrfs_print_tree(next, 1);
free_extent_buffer(next);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/print-tree.h new/btrfs-progs-v4.16.1/print-tree.h
--- old/btrfs-progs-v4.16/print-tree.h 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/print-tree.h 2018-04-24 13:42:06.000000000 +0200
@@ -19,8 +19,8 @@
#ifndef __PRINT_TREE_H__
#define __PRINT_TREE_H__
-void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l);
-void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *t, int follow);
+void btrfs_print_leaf(struct extent_buffer *l);
+void btrfs_print_tree(struct extent_buffer *t, int follow);
void btrfs_print_key(struct btrfs_disk_key *disk_key);
void print_chunk_item(struct extent_buffer *eb, struct btrfs_chunk *chunk);
void print_extent_item(struct extent_buffer *eb, int slot, int metadata);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/send-utils.c new/btrfs-progs-v4.16.1/send-utils.c
--- old/btrfs-progs-v4.16/send-utils.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/send-utils.c 2018-04-24 13:42:06.000000000 +0200
@@ -757,18 +757,6 @@
return 0;
}
-__attribute__((deprecated))
-char *path_cat(const char *p1, const char *p2)
-{
- int p1_len = strlen(p1);
- int p2_len = strlen(p2);
- char *new = malloc(p1_len + p2_len + 2);
-
- path_cat_out(new, p1, p2);
-
- return new;
-}
-
int path_cat3_out(char *out, const char *p1, const char *p2, const char *p3)
{
int p1_len = strlen(p1);
@@ -788,16 +776,3 @@
return 0;
}
-
-__attribute__((deprecated))
-char *path_cat3(const char *p1, const char *p2, const char *p3)
-{
- int p1_len = strlen(p1);
- int p2_len = strlen(p2);
- int p3_len = strlen(p3);
- char *new = malloc(p1_len + p2_len + p3_len + 3);
-
- path_cat3_out(new, p1, p2, p3);
-
- return new;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/send-utils.h new/btrfs-progs-v4.16.1/send-utils.h
--- old/btrfs-progs-v4.16/send-utils.h 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/send-utils.h 2018-04-24 13:42:06.000000000 +0200
@@ -104,15 +104,6 @@
int btrfs_subvolid_resolve(int fd, char *path, size_t path_len, u64 subvol_id);
-/*
- * DEPRECATED: the functions path_cat and path_cat3 are unsafe and should not
- * be used, use the _out variants and always check the return code.
- */
-__attribute__((deprecated))
-char *path_cat(const char *p1, const char *p2);
-__attribute__((deprecated))
-char *path_cat3(const char *p1, const char *p2, const char *p3);
-
int path_cat_out(char *out, const char *p1, const char *p2);
int path_cat3_out(char *out, const char *p1, const char *p2, const char *p3);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/show-blocks new/btrfs-progs-v4.16.1/show-blocks
--- old/btrfs-progs-v4.16/show-blocks 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/show-blocks 2018-04-24 13:42:06.000000000 +0200
@@ -108,7 +108,7 @@
return X
def run_debug_tree(device):
- p = os.popen('btrfs-debug-tree -e ' + device)
+ p = os.popen('btrfs inspect-internal dump-tree -e ' + device)
data = loaddata(p)
return data
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/tests/fsck-tests/031-metadatadump-check-data-csum/test.sh new/btrfs-progs-v4.16.1/tests/fsck-tests/031-metadatadump-check-data-csum/test.sh
--- old/btrfs-progs-v4.16/tests/fsck-tests/031-metadatadump-check-data-csum/test.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/btrfs-progs-v4.16.1/tests/fsck-tests/031-metadatadump-check-data-csum/test.sh 2018-04-24 13:42:06.000000000 +0200
@@ -0,0 +1,30 @@
+#!/bin/bash
+# To check if "btrfs check" can detect metadata dump (restored by btrfs-iamge)
+# and ignore --check-data-csum option
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs
+check_prereq mkfs.btrfs
+check_prereq btrfs-image
+setup_root_helper
+prepare_test_dev
+
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+run_check_mount_test_dev
+
+run_check $SUDO_HELPER dd if=/dev/urandom of="$TEST_MNT/file" bs=4k count=16
+run_check_umount_test_dev
+
+run_check $SUDO_HELPER "$TOP/btrfs-image" "$TEST_DEV" "restored_image"
+
+# use prepare_test_dev() to wipe all existing data on $TEST_DEV
+# so there is no way that restored image could have mathcing data csum
+prepare_test_dev
+
+run_check $SUDO_HELPER "$TOP/btrfs-image" -r "restored_image" "$TEST_DEV"
+
+# Should not report any error
+run_check "$TOP/btrfs" check --check-data-csum "$TEST_DEV"
+
+rm -rf -- "restored_image*"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/tests/misc-tests/003-zero-log/test.sh new/btrfs-progs-v4.16.1/tests/misc-tests/003-zero-log/test.sh
--- old/btrfs-progs-v4.16/tests/misc-tests/003-zero-log/test.sh 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/tests/misc-tests/003-zero-log/test.sh 2018-04-24 13:42:06.000000000 +0200
@@ -24,11 +24,7 @@
--rootdir "$INTERNAL_BIN/Documentation" \
"$TEST_DEV"
run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
- if [ "$1" = 'standalone' ]; then
- run_check "$TOP/btrfs" rescue zero-log "$TEST_DEV"
- else
- run_check "$TOP/btrfs-zero-log" "$TEST_DEV"
- fi
+ run_check "$TOP/btrfs" rescue zero-log "$TEST_DEV"
log_root=$(get_log_root "$TEST_DEV")
log_root_level=$(get_log_root "$TEST_DEV")
if [ "$log_root" != 0 ]; then
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/tests/misc-tests.sh new/btrfs-progs-v4.16.1/tests/misc-tests.sh
--- old/btrfs-progs-v4.16/tests/misc-tests.sh 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/tests/misc-tests.sh 2018-04-24 13:42:06.000000000 +0200
@@ -46,7 +46,6 @@
check_prereq btrfs-image
check_prereq btrfstune
check_prereq btrfs
-check_prereq btrfs-zero-log
check_prereq btrfs-find-root
check_prereq btrfs-select-super
check_kernel_support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/utils.c new/btrfs-progs-v4.16.1/utils.c
--- old/btrfs-progs-v4.16/utils.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/utils.c 2018-04-24 13:42:06.000000000 +0200
@@ -1050,7 +1050,7 @@
* structures.
*/
if (btrfs_super_magic(disk_super) != BTRFS_MAGIC &&
- btrfs_super_magic(disk_super) != BTRFS_MAGIC_PARTIAL)
+ btrfs_super_magic(disk_super) != BTRFS_MAGIC_TEMPORARY)
goto brelse;
if (!memcmp(disk_super->fsid, root->fs_info->super_copy->fsid,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/btrfs-progs-v4.16/volumes.c new/btrfs-progs-v4.16.1/volumes.c
--- old/btrfs-progs-v4.16/volumes.c 2018-04-06 16:58:04.000000000 +0200
+++ new/btrfs-progs-v4.16.1/volumes.c 2018-04-24 13:42:06.000000000 +0200
@@ -120,14 +120,22 @@
static LIST_HEAD(fs_uuids);
-static struct btrfs_device *__find_device(struct list_head *head, u64 devid,
- u8 *uuid)
+/*
+ * Find a device specified by @devid or @uuid in the list of @fs_devices, or
+ * return NULL.
+ *
+ * If devid and uuid are both specified, the match must be exact, otherwise
+ * only devid is used.
+ */
+static struct btrfs_device *find_device(struct btrfs_fs_devices *fs_devices,
+ u64 devid, u8 *uuid)
{
+ struct list_head *head = &fs_devices->devices;
struct btrfs_device *dev;
list_for_each_entry(dev, head, dev_list) {
if (dev->devid == devid &&
- !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE)) {
+ (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
return dev;
}
}
@@ -166,7 +174,7 @@
fs_devices->lowest_devid = (u64)-1;
device = NULL;
} else {
- device = __find_device(&fs_devices->devices, devid,
+ device = find_device(fs_devices, devid,
disk_super->dev_item.uuid);
}
if (!device) {
@@ -1682,8 +1690,7 @@
if (!fsid ||
(!memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE) ||
fs_info->ignore_fsid_mismatch)) {
- device = __find_device(&cur_devices->devices,
- devid, uuid);
+ device = find_device(cur_devices, devid, uuid);
if (device)
return device;
}