summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* btrfs-progs: check: lowmem: release path in repair_extent_data_item()Su Yue2018-06-07
| | | | | | | | | In repair_extent_data_item(), path is not released if some errors occurs which causes extent buffer leak. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dir-item: Make btrfs_delete_one_dir_name more robust to handle ↵Qu Wenruo2018-06-07
| | | | | | | | | | | | | | | | | | | corrupted name len Function btrfs_delete_one_dir_name() will check if the dir_item is the last content of the item, and delete the whole item if needed. However if @name_len of one dir_item/dir_index is corrupted and larger than the item size, the function will still try to treat it as partly remove, which will screw up the whole leaf. This patch will enhance the item deletion check, to cover corrupted name len, so in that case we just delete the whole item. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dir-item: Don't do extra filetype validation check for ↵Qu Wenruo2018-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btrfs_match_dir_item_name verify_dir_item() is called in btrfs_match_dir_item_name() to ensure we won't search beyond item boundary and does extra filetype check. However in the following call chain, such extra filetype check can cause problems: 1) btrfs_add_link() |- check_dir_conflict() |- btrfs_lookup_dir_index() |- btrfs_match_dir_item_name() And if we have an offending dir index whose filetype is invalid, btrfs_match_dir_item_name() will return NULL, meaning no match dir index is found. So btrfs_add_link() will still try to insert a dir index, which may have same key->offset and leading to duplicated dir index. 2) btrfs_unlink() |- btrfs_lookup_dir_index() |- btrfs_lookup_dir_index() |- btrfs_match_dir_item_name() For the same offending dir index with invalid filetype, this will return NULL, and btrfs_unlink() will just consider there is no existing dir_index and do nothing. Leave an orphan and invalid dir_index hanging there forever. The patch removes the extra filetype check, as "btrfs check" can already handle invalid filetype correctly for both modes. And this makes "btrfs check --repair --mode=lowmem" to delete the offending dir index to repair it correctly. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: lowmem: Remove corupted link before readding correct linkQu Wenruo2018-05-07
| | | | | | | | | | | | | | | | | | | For repair_ternary_lowmem() used in lowmem mode, if it found 1 of DIR_INDEX/DIR_ITEM/INODE_REF missing, it will try to insert correct link. However for case like invalid type in DIR_INDEX, we should delete the corrupted DIR_INDEX first before inserting the correct link. This patch will remove the corrupted link before re-inserting. This should solve the duplicated DIR_INDEX problem in old lowmem mode repair. Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.16.1David Sterba2018-04-24
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.16.1David Sterba2018-04-24
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use more loose open ctree flags for dump-tree and restoreQu Wenruo2018-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | Corrupted extent tree (either the root node or leaf) can normally block us from open the fs. As normally open_ctree() has the following call chain: __open_ctree_fd() |- btrfs_setup_all_roots() |- btrfs_read_block_groups() And we will search block group items in extent tree. And considering how block group items are scattered around the whole extent tree, any error would block the fs from being mounted. Fortunately, we already have OPEN_CTREE_NO_BLOCK_GROUPS flags to disable block group items search, which will not only allow us to open some fs, but also hugely speed up open time. Currently dump-tree and btrfs-restore is ensured that they care nothing about block group items. So specify OPEN_CTREE_NO_BLOCK_GROUPS flag as default. Reported-by: Christoph Anton Mitterer <calestyo@scientia.net> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Rename OPEN_CTREE_FS_PARTIAL to OPEN_CTREE_TEMPORARY_SUPERQu Wenruo2018-04-24
| | | | | | | | | | | | | | | | | | | | | | | | The old flag OPEN_CTREE_FS_PARTIAL is in fact quite easy to be confused with OPEN_CTREE_PARTIAL, which allow btrfs-progs to open damaged filesystem (like corrupted extent/csum tree). However OPEN_CTREE_FS_PARTIAL, unlike its name, is just allowing btrfs-progs to open fs with temporary superblocks (which only has 6 basic trees on SINGLE meta/sys chunks). The usage of FS_PARTIAL is really confusing here. So rename OPEN_CTREE_FS_PARTIAL to OPEN_CTREE_TEMPORARY_SUPER, and add extra comment for its behavior. Also rename BTRFS_MAGIC_PARTIAL to BTRFS_MAGIC_TEMPORARY to keep the naming consistent. And with above comment, the usage of FS_PARTIAL in dump-tree is obviously incorrect, fix it. Fixes: 8698a2b9ba89 ("btrfs-progs: Allow inspect dump-tree to show specified tree block even some tree roots are corrupted") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build btrfs.static needs libbtrfsutil to buildBaruch Siach2018-04-24
| | | | | | | | | | | | | | | | Add libbtrfsutil objects to btrfs.static link command. This fixes static build failure: utils.static.o: In function `parse_qgroupid': utils.c:(.text.parse_qgroupid+0xb0): undefined reference to `btrfs_util_is_subvolume' props.static.o: In function `prop_read_only': props.c:(.text.prop_read_only+0x70): undefined reference to `btrfs_util_set_subvolume_read_only' ... Makefile:457: recipe for target 'btrfs.static' failed make[1]: *** [btrfs.static] Error 1 Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: configure: check if xmlto exists at configure timeMisono Tomohiro2018-04-24
| | | | | | | | | | AC_PATH_PROG won't fail even if it fails to find command path. xmlto is required for document build and we should report error if it doesn't exist at configure time. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: reorder extent buffer members for better packingDavid Sterba2018-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Afther the fs_info was added, the size was over 128 bytes but we still have 8 bytes of holes, so with minor reordering we get back to that size. Before: struct extent_buffer { struct cache_extent cache_node; /* 0 48 */ u64 start; /* 48 8 */ u64 dev_bytenr; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 len; /* 64 4 */ /* XXX 4 bytes hole, try to pack */ struct extent_io_tree * tree; /* 72 8 */ struct list_head lru; /* 80 16 */ struct list_head recow; /* 96 16 */ int refs; /* 112 4 */ u32 flags; /* 116 4 */ int fd; /* 120 4 */ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 2 boundary (128 bytes) --- */ struct btrfs_fs_info * fs_info; /* 128 8 */ char data[0]; /* 136 0 */ /* size: 136, cachelines: 3, members: 12 */ /* sum members: 128, holes: 2, sum holes: 8 */ /* last cacheline: 8 bytes */ }; After: struct extent_buffer { struct cache_extent cache_node; /* 0 48 */ u64 start; /* 48 8 */ u64 dev_bytenr; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct extent_io_tree * tree; /* 64 8 */ struct list_head lru; /* 72 16 */ struct list_head recow; /* 88 16 */ u32 len; /* 104 4 */ int refs; /* 108 4 */ u32 flags; /* 112 4 */ int fd; /* 116 4 */ struct btrfs_fs_info * fs_info; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ char data[0]; /* 128 0 */ /* size: 128, cachelines: 2, members: 12 */ }; Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Remove btrfs_root parameterQu Wenruo2018-04-24
| | | | | | | | | | | | Just like kernel cleanup made by David, btrfs_print_leaf() and btrfs_print_tree() doesn't need btrfs_root parameter at all. With previous patches as preparation, now we can remove the btrfs_root parameter. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Unify btrfs_leaf_free_space() parameter with kernelQu Wenruo2018-04-24
| | | | | | | | | | Instead of struct btrfs_root, use struct btrfs_fs_info, since nodesize is now a per-fs setting, and with the need to pass a @root, caller don't need to wonder which root should be passed. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extent_io: Refactor alloc_extent_buffer() to follow kernel ↵Qu Wenruo2018-04-24
| | | | | | | | | | | | | parameters Instead of using the internal struct extent_io_tree, use struct fs_info. This does not only unify the interface between kernel and btrfs-progs, but also makes later btrfs_print_tree() use fewer parameters. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extent_io: Init eb->lru to avoid NULL pointer dereferenceQu Wenruo2018-04-24
| | | | | | | | | | | | | | | | | | | | | | | | eb->lru is not initialized in __alloc_extent_buffer(), so in the following call chain, it could call NULL pointer dereference: btrfs_clone_extent_buffer() |- __alloc_extent_buffer() |- Now eb->lru is NULL (not initialized) free_extent_buffer_final() |- list_del_init(&eb->lru) Thankfully, current btrfs-progs won't trigger such bug as the only btrfs_clone_extent_buffer() user is paths_from_inode(), which is not used by anyone. (But due to the usefulness of that function in future offline scrub, I'd like to keep this dead code.) Anyway, initialize eb->lru in __alloc_extent_bufer() bring no harm. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extent_io: Fix NULL pointer dereference in ↵Qu Wenruo2018-04-24
| | | | | | | | | | | | | | | | | | free_extent_buffer_final() In free_extent_buffer_final() we access eb->tree->cache_size in BUG_ON(). However eb->tree can be NULL if it's a cloned extent buffer. Currently the cloned extent buffer is only used in backref.c, paths_from_inode() function. Thankfully that function is not used yet (but could be pretty useful to convert inode number to path, so I'd like to keep such function). Anyway, check eb->tree before accessing its member. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Do not add extra slash if given path end with itGu Jinxiang2018-04-24
| | | | | | | | | | | | | | | | When use a given path end with a slash like below, the output of path will have double slash. Do not add extra slash if there is already one in the given path. $ btrfs filesystem du ./test/ output: Total Exclusive Set shared Filename 0.00B 0.00B - /home/gujx/device/tmp/test//foo Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/fsck: Add test case to check if btrfs check can skip data ↵Qu Wenruo2018-04-24
| | | | | | | csum verfication for metadata dump Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Skip data csum verification for metadata dumpQu Wenruo2018-04-24
| | | | | | | | | | | | For metadata dump (fs restored by btrfs-image), no data is restored and check sum verification will definitely report error. Add such check in check_csums() and prompt for user input. Issue: #103 Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove duplicate value-get for data_extents_scrubbedGu Jinxiang2018-04-24
| | | | | | | | | Get data_extents_scrubbed value for twice, since there is only one data_extents_scrubbed in struct btrfs_scrub_progress, remove the duplicate one. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Let function find_device to be consistent with kernelGu Jinxiang2018-04-24
| | | | | | | | | | | | Make find_device to be consistent with kernel according 35c70103a528 ("btrfs: refactor find_device helper") And, modify the compare condition from both devid and uuid to devid or devid and uuid according 8f18cf13396c ("Btrfs: Make the resizer work based on shrinking and growing devices") Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove deprecated btrfs-calc-size toolNikolay Borisov2018-04-24
| | | | | | | | | | | Its function has been superseded by btrfs inspect-internal tree-stats. Just remove it. Deprecated since 4.8. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove deprecated btrfs-show-superNikolay Borisov2018-04-24
| | | | | | | | | | | Its function has been superseded by btrfs inspect-internal show-super. Furthermore the tools is currently not built by default. Just remove it. Deprecated since 4.8. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove deprecated btrfs-zero-log standalone toolNikolay Borisov2018-04-24
| | | | | | | | | | | Its function has been subsumed by "btrfs rescue zero-log". Remove its source file and adjust make/tests soruces accordingly. Deprecated since 4.0. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove btrfs-debug-tree commandNikolay Borisov2018-04-24
| | | | | | | | | | | | | There is already a replacement in the face of btrfs inspect-internal dump-tree. And this command is just a simple wrapper around it. Just remove it and adjust the show-blocks script to call the main btrfs binary to achieve the same effect. Informally deprecated since 4.4. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: send-utils: remove unused functions path_cat and path_cat3Gu Jinxiang2018-04-24
| | | | | | | | Since function path_cat and path_cat3 are not used anymore, remove them. They have been reprecated since version 4.0. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: return nozero value on thin provisioned deviceSu Yue2018-04-11
| | | | | | | | | | | | | | | | With mkfs.btrfs on a thin provisioned device with very small backing size and big virtual size, all code works well in mkfs.btrfs until close_ctree() is called. close_ctree() fails to sync device due to small backing size while closing devices. However, mkfs returns 0 in such situation which causes failure of fstests generic/405. So, let mkfs returns nonzero value if previous steps succeeded but close_ctree() failed. Then fstests generic/405 passes now. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add compat bit to the recognized fieldsDavid Sterba2018-04-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add csum_typeDavid Sterba2018-04-11
| | | | | | Let SET and GET work on superblock::csum_type. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add preliminary support for non-u64 typesDavid Sterba2018-04-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.16David Sterba2018-04-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.16David Sterba2018-04-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs rootdir: use lgetxattr() not to follow a symbolic linkMisono Tomohiro2018-04-06
| | | | | | | | | | | | | mkfs-test 016 "rootdir-bad-symbolic-link" fails when selinux is enabled. This is because add_xattr_item() uses getxattr() and tries to follow a bad symbolic link for selinux item, which causes ENOENT error. The line above already uses llistxattr() for getting list of xattr in order not to follow a symbolic link, so just use lgetxattr() too. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: Do not use cp -a to install library linksPeter Kjellerstedt2018-04-06
| | | | | | | | | | | | Using cp -a to install files will preserve the ownership of the original files (if possible), which is typically not wanted. E.g. if the files were built by a normal user, but are being installed by root, then the installed files would maintain the UIDs/GIDs of the user that built the files rather than be owned by root. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix typosDavid Sterba2018-03-31
| | | | | | | | A few more typo fixes, merged with the pull request. Pull-request: #120 Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: fix test assumptions about top-level subvolumeOmar Sandoval2018-03-30
| | | | | | | | | | Since "btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE", the top-level subvolume has a non-zero UUID, ctime, and otime. Fix the subvolume_info() test to not check for zero. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: always build libbtrfsutil.so.$MAJOROmar Sandoval2018-03-30
| | | | | | | Otherwise, make test-libbtrfsutil from a fresh checkout fails. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: use local mkfs.btrfs for tests if it existsOmar Sandoval2018-03-30
| | | | | | | The system might not have mkfs installed at all. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: fix memory leak in deleted_subvolumes()Omar Sandoval2018-03-30
| | | | | | | If we fail to reallocate the ID array, we still need to free it. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: don't return free space cache inodes from deleted_subvolumes()Omar Sandoval2018-03-30
| | | | | | | | | | | Deleted free space cache inodes also get an orphan item in the root tree, but we shouldn't report those as deleted subvolumes. Deleted subvolumes will still have the root item, so we can just do an extra tree search. Reported-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: precreate the uuid treeDavid Sterba2018-03-30
| | | | | | | | | We can easily create the uuid tree that's usually created after first mount. The kernel will still check the tree on first mount so we don't try to fake the uuid tree generation so it appears consistent, even if it's empty. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Test if btrfs-image can handle RAID1 missing deviceQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix offset-by-one error in read_data_extent()Qu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | For read_data_extent() in convert/main.c it's using mirror number in a incorrect way, which will not get correct copy for RAID1: for (cur_mirror = 0; cur_mirror < num_copies; cur_mirror++) { In such case, for RAID1 @cur_mirror will only be 0 and 1. However for 0 and 1 case, btrfs_map_block() will only return the first copy. To reach the 2nd copy, it correct @cur_mirror range should be 1 and 2. So with this off-by-one error, btrfs-image will never be able to read out data extent if the first stripe of the chunk is the missing one. Fix it by starting @cur_mirror from 1 and to @num_copies (including). Fixes: 2d46558b30f5 ("btrfs-progs: Use existing facility to replace read_data_extent function") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: disk-io: Fix read_extent_data() error handler for missing deviceQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | When device is missing, read_extent_data() (function exported from old btrfs check code) has the following problems: 1) Modifies @len parameter if device is missing If device returned in @multi is missing, @len can be larger than @max_len (originl length). This could confuse caller and underflow in the read loop. 2) Still returns 0 for missing device It only handles read error, missing device is not handled and 0 is returned. 3) Wrong check for device->fd In fact, 0 is also a valid fd. Although not possible under most cases, but still needs fix. Fix them all. Fixes: 1bad2f2f2dfe ("Btrfs-progs: fsck: add an option to check data csums") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Test if mkfs.btrfs --rootdir can handle ng symlinkQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove unused parameterGu Jinxiang2018-03-30
| | | | | | | | Parameter usagestr is not used, remove it. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Don't follow symbolic link when calcuating sizeQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [BUG] If we have a symbolic link in rootdir pointing to non-existing location, mkfs.btrfs --rootdir will just fail: ------ $ mkfs.btrfs -f --rootdir /tmp/rootdir/ /dev/data/btrfs btrfs-progs v4.15.1 See http://btrfs.wiki.kernel.org for more information. ERROR: ftw subdir walk of /tmp/rootdir/ failed: No such file or directory ------ [CAUSE] Commit 599a0abed564 ("btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easier") add extra ftw walk to estimate the filesystem size. Such default ftw walk will follow symbolic link and gives ENOENT error. [FIX] Use nftw() to specify FTW_PHYS so we won't follow symbolic link for size calculation. Issue: #109 Reported-by: Alexander Kanavin <alexander.kanavin@intel.com> Fixes: 599a0abed564 ("btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easier") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: modify cscope/ctags rules to include directories such as ↵Lu Fengqi2018-03-30
| | | | | | | | | | check Modify cscope/ctags rule to include directories such as check/ libbtrfsutil/kernel-lib/kernel-shared. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add tool to edit super blocksDavid Sterba2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | $ make btrfs-sb-mod $ ./btrfs-sb-mod image field1 operation1 ... Fields (only u64 supported for now): * total_bytes * root * generation * chunk_root * chunk_root_generation * cache_generation * uuid_tree_generation Operations: * read value ?0 * set value =NUMBER * add to +NUMBER * subtract from value -NUMBER * xor with value ^NUMBER * byteswap (u64) @0 Use with care! Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check/original: Remove unused variable first_keyQu Wenruo2018-03-30
| | | | | | | | | | | | | | This @first_key variable is introduced in f5c4c4f3b75b ("btrfsck: add code to rebuild extent records"), however it's not only unused, but also used incorrectly. It's calling btrfs_item_key_to_cpu() on an node extent buffer. Anyway, just remove it. Fixes: f5c4c4f3b75b ("btrfsck: add code to rebuild extent records") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>