Commit Graph

4706 Commits (2a8cec4b12d69a63828974823cb0867290d21274)
 

Author SHA1 Message Date
David Sterba 309719fb97 btrfs-progs: help: add helper for unrecognized option error message
Currently any unrecognized option does not print very usable message and
only dumps the whole help. Other common utilities (eg. from the
util-linux suite) print a short message and point to help. And we're
going to do the same.

Example:

  $ btrfs device add --unknown device path
  btrfs device add: unrecognized option '--unknown'
  Try 'btrfs device add --help' for more information

Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-05 12:57:55 +01:00
David Sterba bc78d1f217 btrfs-progs: device: update help texts
Wording and formatting changes.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-05 12:57:54 +01:00
Qu Wenruo e76fb663a7 btrfs-progs: check: Fix false alert about uninitialized variable
GCC 8.2.1 will report the following error:

  check/main.c: In function 'try_repair_inode':
  check/main.c:2606:5: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (!ret) {
       ^
  check/main.c:2584:6: note: 'ret' was declared here
    int ret;
        ^~~

The offending code is in repair_mismatch_dir_hash():

	int ret;

	printf(
	"Deleting bad dir items with invalid hash for root %llu ino %llu\n",
		root->root_key.objectid, rec->ino);
	while (!list_empty(&rec->mismatch_dir_hash)) {
		/* do some repair */
	}
	if (!ret) { <<< Here
		/* do some fix */
	}

The truth is, to enter try_repair_inode(), we must have
I_ERR_MISMATCH_DIR_HASH bit set for rec->errors.

And just after we set I_ERR_MISMATCH_DIR_HASH, we call
add_mismatch_dir_hash() and handled its error correctly.

So it's impossible to to skip the while loop.

Fix it by initializing @ret to -EUCLEAN, so even we hit some impossible
case, repair_mismatch_dir_hash() won't falsely consider the mismatch
hash fixed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-05 12:57:41 +01:00
Anand Jain ae45af7a92 btrfs-progs: dev replace: gracefully handle the exclusive operation report
Replace start fails to report the appropriate error if balance is already
running, as below:

  $ btrfs rep start -B -f /dev/sdb /dev/sde /btrfs
  ERROR: ioctl(DEV_REPLACE_START) on '/btrfs' returns error: <illegal result value>

Translate the positive values, the exclusive operation is reported as
BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS when balance is running.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 17:39:34 +01:00
Anand Jain f79fb2cf3e btrfs-progs: dev replace: check for no result before using results
Userspace understands the ioctl BTRFS_IOC_DEV_REPLACE command status
using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
this value in checking for the error.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 17:39:05 +01:00
Qu Wenruo 3ef4bd5cb8 btrfs-progs: Unify metadata chunk size with kernel
Mkfs tends to create pretty large metadata chunk compared to kernel:
  Node size:          16384
  Sector size:        4096
  Filesystem size:    10.00GiB
  Block group profiles:
    Data:             single            8.00MiB
    Metadata:         DUP               1.00GiB
    System:           DUP               8.00MiB

While kernel only tends to create 256MiB metadata chunk:
		/* for larger filesystems, use larger metadata chunks */
		if (fs_devices->total_rw_bytes > 50ULL * SZ_1G)
			max_stripe_size = SZ_1G;
		else
			max_stripe_size = SZ_256M;

This won't cause problems in real world, but it's still better to make
the behavior unified.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 17:26:02 +01:00
Qu Wenruo 0dd9031159 btrfs-progs: Port kernel fs_devices::total_rw_bytes
Unlike kernel, btrfs-progs doesn't (yet) support devices grow/shrink,
the port only needs to handle open_ctree() time initialization (at
read_one_dev()), and btrfs_add_device() used for mkfs.

This provide the basis for incoming unification of chunk allocator
behavior.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 17:26:02 +01:00
David Sterba aa4e8cbba2 btrfs-progs: device scan: update error messages
Use the errno an %m pattern, update wording.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 17:26:02 +01:00
David Sterba cec1472792 btrfs-progs: docs: add scan --forget
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 16:49:53 +01:00
David Sterba 16f0494b4b btrfs-progs: device scan: update help text
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 16:00:54 +01:00
David Sterba 02f096fb20 btrfs-progs: device scan: update help text
The two modes should be displayed separately for clarity.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 14:02:10 +01:00
David Sterba 6d3458dcfd btrfs-progs: device scan: constify path argument
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 14:01:25 +01:00
Anand Jain dff3fb19d7 btrfs-progs: device scan: add new option to forget one or all scanned devices
This patch adds option --forget to 'device scan'

  $ btrfs device scan --forget [dev...]

to unregister the given device from kernel module. The device cannot be
part of a mounted filesystem, this will be reported as an error.

If no argument is given it will unregister all stale (device which are
not mounted) from the kernel.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
2019-03-01 13:40:21 +01:00
David Sterba 5c748404b9
Btrfs progs v4.20.2
Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:54:18 +01:00
David Sterba becd726a81 btrfs-progs: update CHANGES for v4.20.2
Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:52:35 +01:00
David Sterba f9148e3841 Revert "Btrfs-progs: fix mount point detection due to partial prefix match"
This reverts commit cb8abddb20.

There are several reports in IRC that this patch breaks in some
send/receive environments. There are no exact steps to reproduce, only
approximate descroptions. Until a proper reproducer is known, the patch
is temporarily reverted due to the user-visible impact.

Issue: #162
Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:43:19 +01:00
Nikolay Borisov 2e84a13a10 btrfs-progs: Use a single tab for 'leafsize (deprecated)' row
Since this row is longer than the rest it's enough to use a single tab
character to delimig the value from caption. Without this patch
output looked like:

nodesize		16384
leafsize (deprecated)		16384

With it:

nodesize		16384
leafsize (deprecated)	16384

No functional changes just making the output a bit neater.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:08:25 +01:00
David Sterba e10b8a839c btrfs-progs: ci: switch to newer build environment
Use the Xenial dist for CI so now we have only 2 years old base version,
instead of 4 years old.  Kernel is 4.15, gcc is 5.4, clang 7.0.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:08:21 +01:00
David Sterba cfbf54dea1 btrfs-progs: ci: explicitly request reiserfs support for btrfs-convert
The autodetection of conversion filesystems support will skip the tests
if the library is not available for some reason. This now happens for
reiserfs in the CI environment. We need to know about such case so
request the support.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-02-25 18:08:16 +01:00
David Sterba 6c33832b8c
Btrfs progs v4.20.1
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-23 13:56:53 +01:00
David Sterba b0cabc78fd btrfs-progs: update CHANGES for v4.20.1
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-23 13:55:09 +01:00
David Sterba 6315cf6d37 btrfs-progs: ci: enable library-test
For some reason the test was not enabled in the CI builds and would have
caught the build problem fixed by the previous patch.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-23 13:55:09 +01:00
David Sterba f6f518a081 btrfs-progs: build: fix libbtrfs build
Commit 75b5eabb61 ("btrfs-progs: uuid: Port
btrfs_uuid_tree_add() function") brings code from kernel and introduces
an unsatisfied build dependency for libbtrfs. This fails build for
external library users like snapper.

As a hotfix, shuffle the new UUID functions so the build works. Simply
adding uuid-tree.o to libbtrfs_objects does not work due to other
missing symbols.

    [CC]     uuid-tree.o
    [LD]     libbtrfs.so.0.1
    [LN]     libbtrfs.so
    [TEST PREP]  library-test
	ld: .../libbtrfs.so: undefined reference to `btrfs_alloc_path'
	ld: .../libbtrfs.so: undefined reference to `btrfs_extend_item'
	ld: .../libbtrfs.so: undefined reference to `btrfs_insert_empty_items'
	ld: .../libbtrfs.so: undefined reference to `btrfs_free_path'
	ld: .../libbtrfs.so: undefined reference to `read_extent_buffer'
	ld: .../libbtrfs.so: undefined reference to `btrfs_mark_buffer_dirty'
	ld: .../libbtrfs.so: undefined reference to `write_extent_buffer'
	ld: .../libbtrfs.so: undefined reference to `btrfs_search_slot'

LinK: https://bugs.gentoo.org/675974
Link: https://github.com/openSUSE/snapper/issues/473
Fixes: 75b5eabb61 ("btrfs-progs: uuid: Port btrfs_uuid_tree_add() function")
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-23 13:53:55 +01:00
David Sterba d125381da3
Btrfs progs v4.20
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-19 15:52:01 +01:00
David Sterba 0a529b8395 btrfs-progs: update CHANGES for v4.20
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-19 15:40:54 +01:00
David Sterba 2b209f70d0 btrfs-progs: tests: add option coverage for btrfstune
Add tests that exercise all command line options of btrfstune, the valid
and some invalid combinations.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-17 01:42:33 +01:00
David Sterba 08f8176e7a btrfs-progs: btrfstune: update help string
Reformat and update the help string so it's more aligned with other
utilities (mkfs.btrfs was taken as a source):

- reduce indentation
- group related options
- add references to mkfs features
- wording adjustments

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-17 01:06:34 +01:00
David Sterba 111f1473bd btrfs-progs: docs: document btrfstune -m/-M
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-17 00:52:09 +01:00
David Sterba 45c2b3bb89 btrfs-progs: docs: btrfstune: sort options alphabetically
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-17 00:34:10 +01:00
David Sterba 440e8b9830 btrfs-progs: shared: rename ulist_fini to ulist_release
Sync the file with kernel version.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-16 21:16:14 +01:00
Andrea Gelmini c8d3986ed7 btrfs-progs: docs: update scrub docs
Enhance the note what scrub does not compared to 'check'.

Author: Andrea Gelmini <andrea.gelmini@gelma.net>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:56:04 +01:00
Jeff Mahoney 8bda5132d8 btrfs-progs: fix stray error message in check
Commit e578b59bf6 ("btrfs-progs: convert strerror to implicit %m")
missed adding braces after a conditional so we will see the following
message whenever a tree block needs repair, regardless of whether repair
was successful: "Failed to repair btree: Success"

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
Anand Jain aca8193adb btrfs-progs: handle balance and replace concurrency
Starting device replace and balance does not properly report the status.

1. start replace:
   $ btrfs replace start -B -f /dev/sdd /dev/sdb /btrfs

2. while replace is still running, from another terminal try to start
   balance:
   $ btrfs balance start  --full-balance /btrfs
     Done, had to relocate 0 out of 0 chunks

This returns with exit code 0, which fails to report that balance failed
to start because another exclusive operation is running.
In fact kernel ioctl BTRFS_IOC_BALANCE(_V2) does return error code 8,
but it's incorrectly reset to 0. Fix it by checking for the error code > 0.

After:
  $ btrfs balance start --full-balance /btrfs
    ERROR: balance: add/delete/balance/replace/resize operation in progress

Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
Filipe Manana ccdd01a404 Btrfs-progs: add test for receive
Add a test for a scenario that used to fail due to find_mount_root()
incorrectly determining the mount point for the receive path due to the
fact that a different mount point with a path that is a prefix of the
receive path exists.

This is fixed by a recent patch titled:

  "Btrfs-progs: fix mount point detection due to partial prefix match"

Reported-by: David Disseldorp <ddiss@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
[ adjustments to make the test work when hosted on NFS ]
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
Filipe Manana dc1c561250 Btrfs-progs: add missing error handling in find_mount_root()
The strdup() function can fail, in which case it returns NULL and sets
errno [1]. Therefore add the missing error check after calling strdup()
at find_mount_root().

[1] - http://man7.org/linux/man-pages/man3/strdup.3p.html

Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
Filipe Manana cb8abddb20 Btrfs-progs: fix mount point detection due to partial prefix match
When attempting to find the mount point of a path we can end up returning
an incorrect mount point. This happens because we consider a mount point
valid for the given path even if it only partially matches the path.
Consider the following example, which makes btrfs receive fail:

  $ truncate -s 1G disk1
  $ truncate -s 1G disk2

  $ losetup /dev/loop1 disk1
  $ losetup /dev/loop2 disk2

  $ mkfs.btrfs -f /dev/loop1
  $ mkfs.btrfs -f /dev/loop2

  $ mount /dev/loop1 /mnt
  $ mkdir /mnt/ddis
  $ mkdir /mnt/ddis-not-a-mount
  $ mount /dev/loop2 /mnt/ddis

  $ echo "some data" > /mnt/ddis/file
  $ btrfs subvolume snapshot -r /mnt/ddis /mnt/ddis/snap

  $ btrfs send -f /tmp/send.data /mnt/ddis/snap
  $ btrfs receive -f /tmp/send.data /mnt/ddis-not-a-mount
  At subvol snap
  ERROR: chown  failed: No such file or directory

In that example btrfs receive passes the path "/mnt/ddis-not-a-mount" to
find_mount_root() which picks "/mnt/ddis" as the mount point instead of
"/mnt". The wrong decision happens because "/mnt/ddis" is the longest
string found that is a prefix of "/mnt/ddis-not-a-mount", however it
shouldn't be considered valid because what follows the substring "ddis"
in the given path is not a path separator ("/") nor the null character
('\0'). So fix find_mount_root() to check for the presence of a path
separator or a null byte character after if finds a mount point string
that matches the given path.

A test case will follow soon in a separate patch.

Reported-by: David Disseldorp <ddiss@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
David Sterba 5c880c82c2 btrfs-progs: docs: add swapfile support description to sect. 5
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:14 +01:00
David Sterba 5121b09519 btrfs-progs: docs: update system limits texts in sect. 5
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
David Sterba 428bb2e9c2 btrfs-progs: docs: add metadata_uuid description to sect. 5
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Johannes Thumshirn a36d331f03 btrfs-progs: build: provide etags make target
Provide an 'etags' make target to create tags in the Emacs etags
format, similar to the 'tags' target for VIM's ctags.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo 8addcab0d0 btrfs-progs: Create uuid tree with proper contents
Commit 2a496a5b8b ("btrfs-progs: mkfs: precreate the uuid tree")
creates uuid tree at mkfs time.  However it doesn't populate uuid tree
correctly nor creates an empty root.

It uses create_tree(), which just
copies the content of fs root, containing a meaningless INODE_ITEM:

v4.15 mkfs (no uuid tree creation) + kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30572544 items 1 free space 16250 generation 7 owner UUID_TREE
  leaf 30572544 flags 0x1(WRITTEN) backref revision 1
  fs uuid 33ecddef-fc86-481a-93ce-846b01c11376
  chunk uuid 9e58f646-b0da-43ca-9c7d-8bbe3e120246
	item 0 key (0x92457c59d31491be UUID_KEY_SUBVOL 0xef908b5e79aa76a1) itemoff 16275 itemsize 8
		subvol_id 5

v4.19.1 mkfs (incorrect one), no kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30507008 items 2 free space 16061 generation 4 owner UUID_TREE
  leaf 30507008 flags 0x1(WRITTEN) backref revision 1
  fs uuid 162f5333-9b5d-4217-877c-ddaeaa79398e
  chunk uuid 7bc2c5c6-a6d2-4eec-a513-142b549c6541
	item 0 key (256 INODE_ITEM 0) itemoff 16123 itemsize 160
		generation 3 transid 0 size 0 nbytes 16384
		block group 0 mode 40755 links 1 uid 0 gid 0 rdev 0
		sequence 0 flags 0x0(none)
	item 1 key (256 INODE_REF 256) itemoff 16111 itemsize 12
		index 0 namelen 2 name: ..

This patchset will fix it by populuating uuid tree properly:
(NOTE: due to tree-checker, kernel doesn't accept empty uuid tree, so we
can only fix it by populating uuid tree correctly)

With this patchset, no kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30507008 items 1 free space 16250 generation 4 owner UUID_TREE
  leaf 30507008 flags 0x1(WRITTEN) backref revision 1
  fs uuid ae53079e-dbbc-409b-a565-5326c7b27731
  chunk uuid b5fb1bea-f20d-4af1-80f8-6ca3f0038d67
	item 0 key (0x334ba6b032d89c07 UUID_KEY_SUBVOL 0x86cde09cb78bcca0) itemoff 16275 itemsize 8
		subvol_id 5

For kernel, except tree-checker needs an non-empty uuid tree, both of
the above behavior won't cause problem, but it's always better to keep a
good standardized behavior.

Fixes: 2a496a5b8b ("btrfs-progs: mkfs: precreate the uuid tree")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo 75b5eabb61 btrfs-progs: uuid: Port btrfs_uuid_tree_add() function
This function provides the offline functionality to add new uuid tree
entry.  Also port fs_info->uuid and its initialization and cleanup code
to support uuid tree.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo 97955f8197 btrfs-progs: uuid: Port kernel btrfs_uuid_tree_lookup()
Although we have btrfs_uuid_tree_lookup_any(), it's an online function
utilizing tree search ioctl, not an offline search function.

This patch will port kernel btrfs_uuid_tree_lookup() into btrfs-progs
for later proper uuid tree initialization.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo e4ca845778 btrfs-progs: mkfs: Create data reloc tree from scratch
For data reloc tree creation, we copy its contents from the fs tree just
for its INODE_ITEM, INODE_REF and dirid.  This hides the detail and is
not obvious for why we're copying from fs root.

This patch will create data reloc tree from scratch:
- Create root, including root item and new tree root
- Change dirid to BTRFS_FIRST_FREE_OBJECTID
- Insert root INODE_ITEM and INODE_REF

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo 680f4c8752 btrfs-progs: Export btrfs_create_tree() and move it to disk-io.c
Just as how kernel uses it.

This provides the basis for later uuid creation.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
David Sterba 71ba47d26e btrfs-progs: docs: add bootloader support to section 5
Add the section with brief summary of the support. The supported
features could be mentioned explicitly with versions, and other examples
of "check before use" that could lead to unbootable systems.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
David Sterba 4a654aead4 btrfs-progs: tests: speed up fsck/037 free space tree test
The runtime of the test is over 4 minutes when hosted on NFS, the
fallocate phase takes the most time. As fallocate can't take multiple
arguments, we can't save the overhead by creating the files at once.

Create the files in batches in the background, this improves the runtime
to 2 minutes.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo f7f1700b58 btrfs-progs: tests: check: Make 026-bad-dir-item-name verify if btrfs-check can also repair
Just remove the customized 'test.sh', then generic fsck test will do the
check-repair-check.

Signed-off-by: Qu Wenruo <wqu@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo af816ca930 btrfs-progs: check: orig: Add ability to repair dir item with invalid hash
The repair function is reusing delete_corrupted_dir_item().

Since the error can happen for root dir inode, also call
try_repair_inode() on root dir inode.

This is especially important for old filesystems, since later kernel
introduces stricter tree-checker, which could detect such hash mismatch
and refuse to read the corrupted leaf.

With this repair ability, user could repair with btrfs check --repair.

Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1111991
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00
Qu Wenruo 846f838797 btrfs-progs: check: orig: Use mismatch_dir_hash_record to record bad dir items
This changes reporting from current in-place, like:

  ERROR: DIR_ITEM[256 751495445] name foor.WvG1c1TdU namelen 13 filetype 1 mismatch with its hash, wanted 751495445 have 2870353892
  root 5 root dir 256 error

To new summary report at the end of the pass:

  root 5 root dir 256 error
  root 5 inode 256 errors 40000
  Dir items with mismatch hash:
	  name: foor.WvG1c1Td namelen: 13 wanted 0xab161fe4 has 0x2ccae915

Also, with mismatch_dir_hash_record structure, it provides the base for
later original mode repair.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-01-15 18:42:13 +01:00