Misono, Tomohiro [Tue, 5 Sep 2017 05:49:02 +0000 (14:49 +0900)]
btrfs-progs: test: fix run_check_stdout() call _fail()
run_check_stdout() uses "... | tee ... || _fail". However, since tee
won't fail, _fail() is not called even if first command fails.
Fix this by checking PIPESTATUS in the end.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Tue, 5 Sep 2017 01:24:15 +0000 (10:24 +0900)]
btrfs-progs: tests: Add test case for mkfs --rootdir parameter
Add test case which checks if -r|--rootdir mkfs option can handle
symlink/char/block/fifo files.
Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 4 Sep 2017 03:43:19 +0000 (12:43 +0900)]
btrfs-progs: mkfs: Fix wrong file type for dir items and indexes when specifying root directory
[Bug]
If using mkfs.btrfs with "-r" parameter and specified directory has
fifo/socket/char/block special file, then created filesystem can't pass
fsck:
------
checking fs roots
unresolved ref dir 241158 index 3 namelen 9 name S.dirmngr filetype 0 errors 80, filetype mismatch
ERROR: errors found in fs roots
------
[Reason]
Btrfs dir items/indexes records inode type, while "-r" only handles
directories, regular files and symlink, it makes such special files type
to be regular file and caused the problem.
[Fix]
Add missing types for add_directory_items(), so that result of
"mkfs.btrfs -r" can pass mkfs.
Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Gu Jinxiang [Fri, 25 Aug 2017 07:23:36 +0000 (15:23 +0800)]
btrfs-progs: mkfs: Move the tree root creation to own function
make_btrfs is too long to understand, make creatation of root tree
in a function.
Some of the tree roots are now created in a loop, where the code is just
copypasted. We now make use of the reference_root_table to translate
block index to root objectid.
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ updated changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 4 Sep 2017 16:33:48 +0000 (18:33 +0200)]
btrfs-progs: tests: missing device and slack space report
Verify that a missing device will not result in reporting a negative
value interpreted as 16EiB.
Signed-off-by: David Sterba <dsterba@suse.com>
Patrik Lundquist [Thu, 31 Aug 2017 11:00:24 +0000 (13:00 +0200)]
btrfs-progs: device usage: don't calculate slack on missing device
Print Device slack: 0.00B
instead of Device slack: 16.00EiB
Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Mon, 4 Sep 2017 05:05:34 +0000 (14:05 +0900)]
btrfs-progs: inspect rootid: Allow a file to be specified
Since cmd_inspect_rootid() calls btrfs_open_dir(), it rejects a file to
be specified. But as the document says, a file should be supported.
This patch introduces btrfs_open_file_or_dir(), which is a counterpart
of btrfs_open_dir(), to safely check and open btrfs file or directory.
The original btrfs_open_dir() content is moved to btrfs_open() and shared
by both function.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 1 Sep 2017 18:18:20 +0000 (20:18 +0200)]
btrfs-progs: tests: convert misc/011-delete-missing-device to loopdevs
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 1 Sep 2017 18:14:55 +0000 (20:14 +0200)]
btrfs-progs: tests: convert misc/006-image-on-missing-device to loopdevs
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 1 Sep 2017 18:14:03 +0000 (20:14 +0200)]
btrfs-progs: tests: move loopdev helpers out of the testcase to common
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 1 Sep 2017 17:32:16 +0000 (19:32 +0200)]
btrfs-progs: tests: cleanup loop device helpers
Make the loop device helpers a bit more generic before moving them to
the common helpers.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out extent_csum dump
Factor out code to own helper and tweak the format so it matches the
rest.
Signed-off-by: David Sterba <dsterba@suse.com>
Josef Bacik [Fri, 25 Aug 2017 15:11:46 +0000 (11:11 -0400)]
btrfs-progs: print the csum length in debug-tree
While looking at a log of a corrupted fs I needed to verify we were
missing csums for a given range. Make this easier by printing out the
range of bytes a csum item covers.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 1 Sep 2017 14:45:34 +0000 (16:45 +0200)]
btrfs-progs: tests: add testcase for 'fi du' and empty subvol
Signed-off-by: David Sterba <dsterba@suse.com>
Goffredo Baroncelli [Fri, 18 Aug 2017 07:04:21 +0000 (09:04 +0200)]
btrfs-progs: fi du: don't call lookup_path_rootid for BTRFS_EMPTY_SUBVOL_DIR_OBJECTID
When ino is BTRFS_EMPTY_SUBVOL_DIR_OBJECTID, the item is not referred to
any file-tree. So lookup_path_rootid() doesn't return any meaningful
value.
As was reported, this can be triggered by
$ btrfs sub create test1
$ btrfs sub create test1/test2
$ btrfs sub snap test1 test1.snap
$ btrfs fi du -s test1
Total Exclusive Set shared Filename
0.00B 0.00B 0.00B test1
$ btrfs fi du -s test1.snap
Total Exclusive Set shared Filename
ERROR: cannot check space of 'test1.snap': Inappropriate ioctl for device
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.com>
Goffredo Baroncelli [Fri, 18 Aug 2017 07:04:20 +0000 (09:04 +0200)]
btrfs-progs: reset the ret value when ignoring an error from du_add_file
In du_walk_dir(), when du_add_file() returns an error it is usually
ignored. However if the error is returned querying the last item, the
error is returned to the caller.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 16:49:38 +0000 (18:49 +0200)]
btrfs-progs: tests: add test for check --force
Basic test of the --force functionality, on an empty filesystem.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 16:34:37 +0000 (18:34 +0200)]
btrfs-progs: check: add option to skip mount checks
Sometimes it's needed to do a check on a mounted filesystem. This should
work fine on a quiescent filesystem or a read-only mount. Changes on the
block device done by kernel might confuse the userspace checker and it
might crash when it reads some stale data.
Repair without mount checks is not supported right now.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out temporary_item dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out persistent_item dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out qgroup_limit dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out qgroup_info dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out qgroup_status dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out dev_extent dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out free_space_info dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out shared_data_ref dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out extent_data_ref dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 15:07:00 +0000 (17:07 +0200)]
btrfs-progs: print-tree: factor out block_group_item dump
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 14:57:47 +0000 (16:57 +0200)]
btrfs-progs: print-tree: don't print the item type for all items
In some cases it's clear from the context which item is being printed,
so we can remove them. If the item has no data, some description is
still desired (eg. orphan or various backrefs).
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 31 Aug 2017 14:34:15 +0000 (16:34 +0200)]
btrfs-progs: print-tree: rename item callbacks to match the key name
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:47:50 +0000 (19:47 +0200)]
btrfs-progs: check: move fs roots check mode switch to a helper
Simplify main a bit.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:52:44 +0000 (19:52 +0200)]
btrfs-progs: check: cleanup use of fs_info in check_fs_roots
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:50:31 +0000 (19:50 +0200)]
btrfs-progs: check: pass fs_info to check_fs_roots
The root pointer is not used anyway, will be cleaned up next.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:47:50 +0000 (19:47 +0200)]
btrfs-progs: check: move chunk and extent check mode switch to a helper
Simplify main a bit.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:38:02 +0000 (19:38 +0200)]
btrfs-progs: check: pass fs_info to check_chunks_and_extents_v2
The root pointer is set to fs_root as was originally.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:41:15 +0000 (19:41 +0200)]
btrfs-progs: check: use local fs_info in check_chunks_and_extents
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:38:02 +0000 (19:38 +0200)]
btrfs-progs: check: pass fs_info to check_chunks_and_extents
The root pointer is set to fs_root as was originally.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 17:25:11 +0000 (19:25 +0200)]
btrfs-progs: check: verify critical root pointers before use
The pointers to critical roots must be valid before we start using them,
eg. as the space clearing code.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 16:57:03 +0000 (18:57 +0200)]
btrfs-progs: check: move more of space cache clearing to a helper
Move the code out of main.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 14:56:51 +0000 (16:56 +0200)]
btrfs-progs: check: remove old mixed backref code
A code added in 2009 (
95d3f20b51e9b) for a very short-lived change in
the format is no concern to us nowadays.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 30 Aug 2017 14:56:23 +0000 (16:56 +0200)]
btrfs-progs: tests: add more sanitizer message patterns to log scanner
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 17:42:10 +0000 (19:42 +0200)]
btrfs-progs: convert: don't print message when fs is not recognized, ext2
Bad magic error means it's not the desired filesystem so the error
message is just noise.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 16:41:30 +0000 (18:41 +0200)]
btrfs-progs: tests: limit size of log dump from conver tests
The convert tests generate lots of log material, travis CI has limit 4MB
so we don't see anything useful when a late test fails.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 16:19:03 +0000 (18:19 +0200)]
btrfs-progs: handle failed search in find_search_start better
The warning can pop up frequently on a fuzzed image, the message seems
to be enough. Add a more fitting error code too.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 15:53:39 +0000 (17:53 +0200)]
btrfs-progs: add more error handling to btrfs_free_block_group
As btrfs_update_block_group fails when the block group is not found in
cache, we can exit btrfs_free_block_group, not much to rollback. The
caller will also exit in turn.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 15:42:28 +0000 (17:42 +0200)]
btrfs-progs: tests: fix TEST_LOG=dump in convert tests
Test failure in convert tests with log dump does not happen because
_fail is called before that and exits. Other test types are ok.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 15:22:39 +0000 (17:22 +0200)]
btrfs-progs: handle transaction start failure in close_ctree
Closing the fs will try to commit a pending transaction, but may fail to
do so if the filesystem state is not well defined. This will eg. fail
for some fuzz tests. The data structures are freed but no furhter
attempt to commit is made.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 15:07:15 +0000 (17:07 +0200)]
btrfs-progs: tests: update README
Wording, runtime dependencies.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 14:36:15 +0000 (16:36 +0200)]
btrfs-progs: tests: install missing CI packages
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 14:35:01 +0000 (16:35 +0200)]
btrfs-progs: tests: add more checks for tools used in convert tests
Tools that may not be present in common installations should be checked
in the tests.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 14:16:44 +0000 (16:16 +0200)]
btrfs-progs: tests: build preparation phases out of script section
The logs of before_install are folded and we don't need to see the
details, unlike the test logs.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 29 Aug 2017 12:55:37 +0000 (14:55 +0200)]
btrfs-progs: don't start or commit after transaction abort
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:44:41 +0000 (17:44 +0200)]
btrfs-progs: start framework for transaction abort
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:43:10 +0000 (17:43 +0200)]
btrfs-progs: store pointer to fs_info in transaction handle
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:39:26 +0000 (17:39 +0200)]
btrfs-progs: move transaction code out of disk-io
Temporarily export the low-level helpers.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:27:08 +0000 (17:27 +0200)]
btrfs-progs: move transaction implementation out of header
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:21:05 +0000 (17:21 +0200)]
btrfs-progs: use kzalloc to allocate transaction handle
Use the kernel-style allocation helpers and remove redundant zeroing.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 15:16:51 +0000 (17:16 +0200)]
btrfs-progs: switch fs_info::system_allocs to bit
The value really is 0 or 1, the test in btrfs_reserve_extent can be
simplified.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 14:54:12 +0000 (16:54 +0200)]
btrfs-progs: return errors from btrfs_start_transaction
Now that all callers will catch errors, we can return them from the
function.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 14:48:16 +0000 (16:48 +0200)]
btrfs-progs: add crude error handling when transaction start fails
Currently transaction bugs out insided btrfs_start_transaction in case
of error, we want to lift the error handling to the callers. This patch
adds the BUG_ON anywhere it's been missing so far. This is not the best
way of course. Transforming BUG_ON to a proper error handling highly
depends on the caller and should be dealt with case by case.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 12:28:53 +0000 (14:28 +0200)]
btrfs-progs: tests: pull and build reiserfs lib inside CI
The functionality needed to support reiserfs in convert has been added
recently and is not yet available in the CI images, so we'll download
and build it there.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 11:54:02 +0000 (13:54 +0200)]
btrfs-progs: tests: add build checks for sanitization features
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 11:38:32 +0000 (13:38 +0200)]
btrfs-progs: build: fix asan and ubsan build
Probably with a new gcc (7.1.1) I started to see asan/ubsan link failures.
Fixed by explicitly linking the libraries.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 28 Aug 2017 11:33:19 +0000 (13:33 +0200)]
btrfs-progs: build: fix building libbtrfs.so with tsan
Except libbtrfs.so object, all other tools compile fine. The error is:
ld: send-stream.o: relocation R_X86_64_PC32 against symbol
`stderr@@GLIBC_2.2.5' can not be used when making a shared object;
recompile with -fPIC
Compiling with -fPIC fixes the problem.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 18:09:34 +0000 (20:09 +0200)]
btrfs-progs: build: properly pass the LDFLAGS during tsan build
The variable LD_FLAGS does not exist and the flags are not used, we need
to use the newly added internal debugging linker flags.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 18:04:48 +0000 (20:04 +0200)]
btrfs-progs: build: add internal LDFLAGS for the D= features
We might want to pass additional linker flags for various sanitization
features.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 17:21:01 +0000 (19:21 +0200)]
btrfs-progs: tests: add more fuzzed images from bugzilla
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 17:08:37 +0000 (19:08 +0200)]
btrfs-progs: handle blockgroup errors when opening filesystem
The call to btrfs_read_block_groups could loop if the metadata are
damaged (reported eg. for an unaligned block), due to lack of error
handling. We have to check for restored images or currently created
filesystems, that do not contain the blockgroups.
Can be reproduced by fuzzed image bko-155551.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=155551
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 16:07:15 +0000 (18:07 +0200)]
btrfs-progs: drop blocksize argument from readahead_tree_block
Tree blocks are always nodesize. As readahead is only an optimization,
exact size is not required and is only advisory.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 15:44:22 +0000 (17:44 +0200)]
btrfs-progs: drop blocksize argument from btrfs_find_create_tree_block
Metadata blocks are always nodesize. When reading the
superblock::sys_array, the actual size of data is fixed to 4k and
smaller than nodesize, but otherwise everything works as before.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 15:30:34 +0000 (17:30 +0200)]
btrfs-progs: drop redundant check of blocksize in read_tree_block
The tree blocks are supposed to be always of nodesize. Before the
parameter has been dropped, it was unlikely but possible to pass a
misaligned value.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 15:21:03 +0000 (17:21 +0200)]
btrfs-progs: check: cleanup use of level_size
Nodesize is same for all levels, besides it's been only set and not
used, in root_item_record.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 14:54:16 +0000 (16:54 +0200)]
btrfs-progs: drop blocksize from read_tree_block
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 14:20:16 +0000 (16:20 +0200)]
btrfs-progs: drop local blocksize variables if they're nodesize
Prep work so we can drop the blocksize argument from several functions.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 12:26:51 +0000 (14:26 +0200)]
btrfs-progs: build: fix PIE build
Patch from Marcus Meissner <meissner@suse.com>. The CFLAGS are passed to
the linker and mix up the compilation and linker flags for PIE support.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 24 Aug 2017 13:48:48 +0000 (15:48 +0200)]
btrfs-progs: convert: move reiserfs struct definitions to header
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 22 Aug 2017 18:43:49 +0000 (20:43 +0200)]
btrfs-progs: convert: move and rename dev_t helpers to common file
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 22 Aug 2017 18:34:36 +0000 (20:34 +0200)]
btrfs-progs: convert: move acl helper to common source file
There were 2 copies of ext2_acl_count and acl_ea_size.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 22 Aug 2017 18:30:43 +0000 (20:30 +0200)]
btrfs-progs: convert: move duplicated acl code to common header
The ACL types and macros are same for both source filesystem.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 22 Aug 2017 17:18:48 +0000 (19:18 +0200)]
btrfs-progs: docs: update btrfs-convert regarding reiserfs
Signed-off-by: David Sterba <dsterba@suse.com>
Jeff Mahoney [Tue, 22 Aug 2017 16:32:57 +0000 (18:32 +0200)]
btrfs-progs: tests: add support for converting reiserfs
Many of the test cases for convert apply regardless of what the source
file system is and using ext4 is sufficient. I've included several
test cases that are reiserfs-specific.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
[ patch split from the previous one, minor cleanups in common.convert ]
Signed-off-by: David Sterba <dsterba@suse.com>
Jeff Mahoney [Tue, 22 Aug 2017 16:30:43 +0000 (18:30 +0200)]
btrfs-progs: convert: add support for converting reiserfs
This patch adds support to convert reiserfs file systems in-place to btrfs.
It will convert extended attribute files to btrfs extended attributes,
translate ACLs, coalesce tails that consist of multiple items into one item,
and convert tails that are too big into indirect files.
This requires that libreiserfscore 3.6.27 be available.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Nikolay Borisov [Thu, 27 Jul 2017 08:17:00 +0000 (11:17 +0300)]
btrfs-progs: Use named constants for common sizes
There multiple places where we use well-known sizes - 1,8,16,32 megabytes. We
also have them defined as constants in the sizes.h header. So let's use them.
No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Gu Jinxiang [Wed, 28 Jun 2017 09:59:24 +0000 (17:59 +0800)]
btrfs-progs: mkfs: Replace number with enum
For code maintainability and scalability,
replace hardcoded constant with a meaningful enum.
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ add MKFS_ prefix ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 13:44:24 +0000 (15:44 +0200)]
btrfs-progs: tests: fix _is_file_or_command detection
type -p returns an empty string for nonexistent commands, but the -f
test on an empty string does not behave the same on all shells. To be
safe, use the quoted value.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Aug 2017 13:11:11 +0000 (15:11 +0200)]
Btrfs progs v4.12.1
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 31 Mar 2017 12:20:21 +0000 (14:20 +0200)]
btrfs-progs: update CHANGES for v4.12.1
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Thu, 24 Aug 2017 17:45:55 +0000 (19:45 +0200)]
btrfs-progs: docs: add figure 1 to btrfs quota doc
The document of btrfs quota is missing figure 1.
I notice the body is copy of http://sensille.com/qgroups.pdf (which is
linked from https://btrfs.wiki.kernel.org/index.php/Quota_support), and
insert the figure.
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Thu, 24 Aug 2017 06:06:41 +0000 (15:06 +0900)]
btrfs-progs: docs: add missing short option for qroup-report
Usage info of "btrfs check" shows "-Q|--qgroup-report" (and first patch
enables -Q), but the document only shows "--qgroup-report".
Therefore add -Q to the doc.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Thu, 24 Aug 2017 05:25:29 +0000 (14:25 +0900)]
btrfs-progs: dump-super: add missing long option bytenr to getopt
This fixes "btrfs inspect-internal dump-super --bytenr"
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Thu, 24 Aug 2017 05:24:03 +0000 (14:24 +0900)]
btrfs-progs: recieve: add missing short option E to getopt
This fixes "btrfs receive -E".
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Misono, Tomohiro [Thu, 24 Aug 2017 05:18:25 +0000 (14:18 +0900)]
btrfs-progs: check: add missing short options E and Q to getopt
I found some btrfs commands options are not working because of
inappropriate getopt_long() setting.
This fixes "btrfs check -Q/-E"
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 24 Aug 2017 16:32:18 +0000 (18:32 +0200)]
btrfs-progs: move command definitions to commands.h
There are some trivial helpers, we can group the command declarations in
one place.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 23 Aug 2017 17:26:42 +0000 (19:26 +0200)]
btrfs-progs: tests: catch bad usage of run_mustfail
This function has an extra argument and can get forgotten, add a sanity
check so the bad usage can be caught during development.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 23 Aug 2017 17:19:47 +0000 (19:19 +0200)]
btrfs-progs: tests: scan results for commands not found
In case of typos or messed up command execution, we'd like to be able to
catch that.
Signed-off-by: David Sterba <dsterba@suse.com>
Su Yue [Fri, 14 Jul 2017 07:47:46 +0000 (15:47 +0800)]
btrfs-progs: fsck-test: case for corrupted dir item name
In this test case, all name in dir_item, dir_index, inode_ref
are corrupted to another one.
btrfs check should report errors about the corrupted dir_item but
btrfs can't repair the case now.
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Su Yue [Fri, 14 Jul 2017 07:47:45 +0000 (15:47 +0800)]
btrfs-progs: check: verify dir item name and hash in lowmem mode
Although lowmem mode can detect name and hash mismatch in dir_item,
it's done by checking inode_ref to expose such problem.
This patch will enhance dir_item check, by also comparing name and
hash when checking dir_items.
Reported-by: Filippe LeMarchand <gasinvein@gmail.com>
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Su Yue [Fri, 14 Jul 2017 07:47:44 +0000 (15:47 +0800)]
btrfs-progs: check: verify name in dir_item for original mode
In original mode, we don't check if the name in dir_item matches the
hash in key.offset.
In the following case, original mode will report nothing wrong while
lowmem mode will detect the name and hash mismatch.
------
item 72 key (79177 DIR_ITEM
54846528) itemoff 12380 itemsize 88
location key (4222342 INODE_ITEM 0) type FILE
transid 170929 data_len 0 name_len 14
name: deprecated.sxt
location key (
13590433 INODE_ITEM 0) type FILE
transid 796448 data_len 0 name_len 14
name: deprecated.txt
------
In above case, hash of "deprecated.txt" matches with
54846528,
while hash of "deprecated.sxt" should be
2008317993.
Reported-by: Filippe LeMarchand <gasinvein@gmail.com>
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Jeff Mahoney [Tue, 22 Aug 2017 17:44:44 +0000 (19:44 +0200)]
btrfs-progs: tests: fix typo in convert-tests/008-readonly-image
The dd in convert-tests/008-readonly-image is expected to fail, so
there being a typo in the file name has gone unnoticed.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Jeff Mahoney [Thu, 27 Jul 2017 15:47:21 +0000 (11:47 -0400)]
btrfs-progs: convert: use search_cache_extent in migrate_one_reserved_range
When we are looking for extents in migrate_one_reserved_range, it's likely
that there will be multiple extents that fall into the 0-1MB range.
If lookup_cache_extent is called with a range that covers multiple cache
entries, it will return the first entry it encounters while searching
from the top of the tree that happens to fall in that range. That
means that we can end up skipping regions within that range, resulting
in a file system image that can't be rolled back since it wasn't
all migrated properly.
This is reproducible using convert-tests/008-readonly-image. There was
a range from 0-160kB, but the only entry that was returned began at
~ 280kB.
The fix is to use search_cache_extent to iterate through multiple regions
within that range.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>