summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Btrfsck: add the ability to prune corrupt extent allocation tree blocksChris Mason2012-02-21
| | | | | | | When we discover bad blocks in the extent allocation tree, repair can now discard them and recreate the references from the rest of the trees. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: remove extents from the fsck reference tracker as they are freedChris Mason2012-02-10
| | | | | | | | | | | | | | | | | | | During btrfsck --repair, we make an index of extents that have incorrect reference counts. Once we've collect the whole index, we go through and modify the extent allocation tree to reflect the correct results. Changing the extent allocation tree may free blocks, and so it may end up removing a block that had a missing reference structure. The fsck code may then circle back around and add the reference back. The result is an extent that isn't actually used, but is recorded in the extent allocation tree. This commit adds a hook called as extents are freed. The hook searches the index of incorrect references and updates it to reflect the freeing of the extent. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: make sure we fix the block group accounting during repairChris Mason2012-02-09
| | | | | | | | The block group accounting is fixed after we check the extent back references. This makes sure the accounting is fixed unless we were not able to repair the backrefs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: add --init-csum-tree to replace the csum root with an empty oneChris Mason2012-02-09
| | | | | | | This will effectively delete all of your crcs, but at least you'll be able to mount the FS with nodatasum. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: make sure to dirty all block groups as we fix accountingChris Mason2012-02-09
| | | | | | | | | The code that corrects the count of bytes used in each block group was only marking block groups dirty when they contained extents. This fixes things to dirty all the block groups, so any empty block groups are written with their correct (zero) count. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix btrfs-convert, btrfs-restore and btrfs-find-root buildChris Mason2012-02-08
| | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com> fixit Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Turn off some commands in MakefileChris Mason2012-02-08
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Merge branch 'for-chris' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-08
|\
| * Btrfs-progs: allow multi-line command group synopsisIlya Dryomov2012-02-08
| | | | | | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | btrfsck: fix block group accounting during repairChris Mason2012-02-08
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfs-corrupt-block: add -E option to randomly corrupt the extent_rootChris Mason2012-02-07
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: add code to rebuild extent recordsChris Mason2012-02-07
| | | | | | | | | | | | | | This also includes a new --repair btrfsck option. For now it can only fix errors in the extent allocation tree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfs-corrupt-block: add -e option to corrupt the extent recordChris Mason2012-02-07
| | | | | | | | | | | | This will zero out the extent allocation tree records for the extent. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: don't BUG on corrupted extent recordsChris Mason2012-02-06
| |
* | Allow extent_buffers to use more ramChris Mason2012-02-06
| | | | | | | | | | | | | | | | This changes free_some_buffers (called each time we allocate an extent buffer) to allow a higher hard limit on the number of extent buffers in use. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: print some progressChris Mason2012-02-06
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | Add open_ctree_fs_info for partial FS opensChris Mason2012-02-05
|/ | | | | | | | | | fsck needs to be able to open a damaged FS, which means open_ctree needs to be able to return a damaged FS. This adds a new open_ctree_fs_info which can be used to open any and all roots that are valid. btrfs-debug-tree is changed to use it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Merge branch 'restriper' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\
| * Btrfs-progs: fall back to the v1 ioctl if the new balance ioctl failsChris Mason2012-02-05
| | | | | | | | | | | | | | | | This only falls back if the plain version of balance start is used. Any args make us report the ioctl isn't supported. Signed-off-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Merge branch 'restriper' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\|
| * Btrfs-progs: add restriper commandsIlya Dryomov2012-02-03
| | | | | | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: add 'balance' command group infrastructureIlya Dryomov2012-02-03
| | | | | | | | | | | | | | Add balance command group under both 'btrfs' and 'btrfs filesystem'. Preserve the old 'btrfs filesystem balance <path>' behaviour. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: add restriper headersIlya Dryomov2012-02-03
| | | | | | | | | | | | Add restriper headers and update print-tree.c Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Merge branch 'parser' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\|
| * Btrfs-progs: switch all existing commands to a new parserIlya Dryomov2012-02-03
| | | | | | | | | | | | | | The new infrastructure offloads checking number of arguments passed to a command to individual command handlers. Fix them up accordingly. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: implement new subcommand parserIlya Dryomov2012-02-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This completely replaces the existing subcommand infrastructure, which is not flexible enough to accomodate our needs. Instead of a global command table we now have per-level tables and command group handlers, which allows command-group-specific handling of options and subcommands. The new parser exports a clear interface and gets out of the way - all control over how matching is done is passed to commands and command group handlers. One side effect of this is that command implementors have to check the number of arguments themselves - patch to fix up all existing commands follows. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: rearrange files in the repoIlya Dryomov2012-02-03
| | | | | | | | | | | | | | Separate every command group into its own file (cmds_<group>.c) and rearrange includes. Remove btrfs_cmds.c. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Btrfs-progs: change the way mkfs picks raid profilesIlya Dryomov2011-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently mkfs in response to mkfs.btrfs -d raid10 dev1 dev2 instead of telling "you can't do that" creates a SINGLE on two devices, and only rebalance can transform it to raid0. Generally, it never warns users about decisions it makes and it's not at all obvious which profile it picks when. Fix this by checking the number of effective devices and reporting back if the specified profile is impossible to create. Do not create FS in case invalid profile was given. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Btrfs-progs: fail gracefully on error from open_ctree()Ilya Dryomov2011-12-12
|/ | | | | | | Error checking block got moved mistakenly exposing us to a potential segmentation fault. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: Relocate -lpthread in makefileArnd Hannemann2011-12-01
| | | | | | | | | | | | | | | | | | | | | This patch fixes the following compile error when compiled with gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3): gcc -lpthread -g -O0 -o btrfs btrfs.o btrfs_cmds.o scrub.o \ ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o btrfslabel.o -luuid scrub.o: In function `scrub_start': /home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1342: undefined reference to `pthread_create' /home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1360: undefined reference to `pthread_create' /home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1374: undefined reference to `pthread_join' /home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1430: undefined reference to `pthread_cancel' /home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1432: undefined reference to `pthread_join' collect2: ld returned 1 exit status make: *** [btrfs] Error 1 The gcc man page says: "[...] the placement of the -l option is significant." so lets include -lpthread together with the usual $(LIBS) Signed-off-by: Arnd Hannemann <arnd@arndnet.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-progs: make sure btrfs-zero-log writes somethingChris Mason2011-11-21
| | | | | | | The close_ctree code does a check to see if the FS has changed before it does any IO. This forces the commit. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: add the tree history log to btrfs-progsChris Mason2011-11-05
| | | | | | This also adds btrfs-debug-tree -R to print the history Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: fix raid10 reading mathChris Mason2011-11-03
| | | | | | | | The btrfs-progs raid10 code has been silently reading the wrong raid10 block forever. We didn't notice because it was always fixed up by the retry code. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: added ioctls and commands to resolve inodes and logical addrsJan Schmidt2011-11-02
| | | | | | | | | two new commands that make use of the new path resolving functions implemented for scrub, doing the resolving in-kernel. the result for both commands is a list of files belonging to that inode / logical address. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: added resolve commands to man pageJan Schmidt2011-11-02
| | | | | | | Added "inspect-internal inode-resolve" and "inspect-internal logical-resolve" to the btrfs(8) man page. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
* Fix missing entries in listing of subvolumesLi Zefan2011-11-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stephane Chazelas <stephane.chazelas@gmail.com> writes: > I've got a btrfs FS with 84 subvolumes in it (some created with > "btrfs sub create", some with "btrfs sub snap" of the other > ones). There's no nesting of subvolumes at all (all direct children > of the root subvolume). > > The "btrfs subvolume list" is only showing 80 subvolumes. The 4 > missing ones (1 original volume, 3 snapshots) do exist on disk and > files in there have different st_devs from any other subvolume. > > I found > http://thread.gmane.org/gmane.comp.file-systems.btrfs/8123/focus=8208 > > which looks like the same issue, with Li Zefan saying he had a > fix, but I couldn't find any mention that it was actually fixed. Li Zefan <lizf@cn.fujitsu.com> replied: > After that, I posted a patch to fix btrfs-progs, which Chris aggreed > on: > > http://marc.info/?l=linux-btrfs&m=129238454714319&w=2 So this btrfs-progs patch should fix missing subvolumes in the output of "subvolume list": Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
* Btrfs-progs: btrfs-list: split list_subvolsChris Mason2011-11-02
| | | | | | | | | split list_subvols to separate functions and allow printing only in the containing function. lets us make use of those functions when resolving logical addresses. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Merge branch 'recovery-beta' of ↵Chris Mason2011-10-31
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs
| * btrfs-progs: remove old debugging statementChris Mason2011-10-27
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
| * btrfs-progs: add a utility to corrupt a single blockChris Mason2011-10-27
| |
| * btrfs-debug-tree: add -r option to print only the rootsChris Mason2011-10-27
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
| * restore: deal with holes and set i_size correctlyChris Mason2011-10-27
| | | | | | | | | | | | | | | | This changes restore to set the i_size of the files it copies out based on the size in the inode. It also changes it to skip over holes. Signed-off-by: Chris Mason <chris.mason@oracle.com>
| * btrfs-progs: fixup is_mounted checksChris Mason2011-10-27
| | | | | | | | | | | | | | | | | | | | /proc/mounts contains device names that don't exist, we end up erroring out because we're not able to stat the device (that doesn't exist). Fix this by allowing the mkfs when the target device doesn't exist. Signed-off-by: Chris Mason <chris.mason@oracle.com>
| * btrfs-progs: add a recovery utility to pull files from damanged filesystemsJosef Bacik2011-10-27
| | | | | | | | | | Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
| * Print the root generation in btrfs-debug-treeChris Mason2011-10-27
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | Print the root generation in btrfs-debug-treeChris Mason2011-10-25
|/ | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: make btrfs df report profiles for mixed block groupsIlya Dryomov2011-10-25
| | | | | | | | Profiles other than SINGLE for mixed chunks might sound a bit strange, but there is nothing in the filesystem that prevents a crazy user from doing it. So make "btrfs fi df" report them properly. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* btrfs-progs: Improvement for making btrfs image from source directory.Zhong, Xin2011-10-25
| | | | | | | | | | | | * Initialize ret in btrfs_csum_file_block * Do not abort when xattr is not supported in the source directory * Remove size limitation of 256M * Alloc data chunk in a smaller size (8M) to make btrfs image smaller * Let user specify the btrfs image name Depends on below patch from samsung guys: http://marc.info/?l=linux-btrfs&m=127858068226025&w=2 Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
* Scan the devices listed in /proc/partitionsGoffredo Baroncelli2011-10-25
| | | | | | | | | | | During the commands: - btrfs filesystem show - btrfs device scan the devices "scanned" are extracted from /proc/partitions. This should avoid to scan devices not suitable for a btrfs filesystem like cdrom and floppy or to scan not existant devices. The old behavior (scan all the block devices under /dev) may be forced passing the "--all-devices" switch.
* Btrfs-progs: specify label length larger than 255 bytes cause mkfs.btrfs ↵Jeff Liu2011-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buffer overflow Hello, While going through the mkfs.c, I noticed there is an issue for label length checking, mkfs.btrfs will crashed if the label length exceeding 255 bytes, it's easy to triggered that out as below: jeff@pibroch:~/opensource/btrfs-progs$ sudo ./mkfs.btrfs -L `perl -e 'print "A"x256'` /usr/src/linux-3.0/img0 WARNING! - Btrfs v0.19-35-g1b444cd IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using *** buffer overflow detected ***: ./mkfs.btrfs terminated ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0xb7774df0] /lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0xb7773cca] /lib/i386-linux-gnu/libc.so.6(__strcpy_chk+0x3f)[0xb777305f] ./mkfs.btrfs[0x805acc4] ./mkfs.btrfs[0x805def6] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0xb76a5e37] ./mkfs.btrfs[0x8048ef1] ======= Memory map: ======== ...... a tiny patch could fix it. Signed-off-by: Jie Liu <jeff.liu@oracle.com>