summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Btrfs-progs: add support for mixed data+metadata block groupsJosef Bacik2011-10-25
| | | | | | | | | | | | So alot of crazy people (I'm looking at you Meego) want to use btrfs on phones and such with small devices. Unfortunately the way we split out metadata/data chunks it makes space usage inefficient for volumes that are smaller than 1gigabyte. So add a -M option for mixing metadata+data, and default to this mixed mode if the filesystem is less than or equal to 1 gigabyte. I've tested this with xfstests on a 100mb filesystem and everything is a-ok. Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: update super fields for space cacheJosef Bacik2011-10-25
| | | | | | | | | This patch updates the super field to add the cache_generation member. It also makes us set it to -1 on mkfs so any new filesystem will get the space cache stuff turned on. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Improve error handling in the btrfs commandGoffredo Baroncelli2011-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi Chris, below is enclosed a trivial patch, which has the aim to improve the error reporting of the "btrfs" command. You can pull from http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git branch strerror I changed every printf("some-error") to something like: e = errno; fprintf(stderr, "ERROR: .... - %s", strerror(e)); so: 1) all the error are reported to standard error 2) At the end of the message is printed the error as returned by the system. The change is quite simple, I replaced every printf("some-error") to the line above. I don't touched anything other. I also integrated a missing "printf" on the basis of the Ben patch. This patch leads the btrfs command to be more "user friendly" :-) Regards G.Baroncelli btrfs-list.c | 40 ++++++++++++++++++++++-------- btrfs_cmds.c | 77 ++++++++++++++++++++++++++++++++++++++++----------------- utils.c | 6 ++++ 3 files changed, 89 insertions(+), 34 deletions(-) Signed-off-by: Chris Mason <chris.mason@oracle.com>
* update man page to new defragment command interfaceHubert Kario2011-10-25
| | | | | | | | | | | | | | | | | | Update btrfs filesystem defragment command explanation. Add explanation of advanced parameters and notes about general usage. Add few notes about the btrfs <command> --help usage, fix related grammar. Signed-off-by: Hubert Kario <kario@wit.edu.pl> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs utils Informative errorsGoldwyn Rodrigues2011-10-25
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs use safe string manipulation functionsEduardo Silva2011-10-25
| | | | | Signed-off-by: Eduardo Silva <eduardo.silva@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: add a btrfs-select-super command to overwrite the superChris Mason2011-10-25
| | | | | | | | | | | | Btrfs stores multiple copies of the superblock, and for common power-failure crashes where barriers were not in use, one of the super copies is often valid while the first copy is not. This adds a btrfs-select-super -s N /dev/xxx command, which can overwrite all the super blocks with a copy that you have already determined is valid with btrfsck -s Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Check for RAID10 in set_avail_alloc_bitsChris Mason2011-04-22
| | | | | | | | | | | | | When raid is setup with mkfs, it is supposed to cow the initial filesystem it creates up to the desired raid level. RAID10 was not in the list of RAID levels it checked for, so the initial FS created for RAID10 actually only lived on the first disk. This works well enough because all the roots get quickly cowed during the first mount. The exception is the data relocation tree, which only gets cowed when we do a balance. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fill missing devices so degraded filesystems can be readChris Mason2011-04-22
| | | | | | | | When a device is missing, the btrfs tools need to be able to read alternate copies from the remaining devices. This creates placeholder devices that always return -EIO so the tools can limp along. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix the help text for btrfs-map-logicalChris Mason2011-04-22
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-debug-tree: add -d option to print only the device mappingChris Mason2010-10-06
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Add rescue command to zero the logChris Mason2010-10-05
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Add btrfsck option to select the super block copyChris Mason2010-10-04
| | | | | | btrfsck -s 0 uses the defult 0, -s 1 uses copy #1 etc. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix undefined reference to symbol 'error_message'Yan Zheng2010-09-23
| | | | | | defination of error_message was moved into libcom_err.so Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* Fix inode link count checks in btrfsckYan Zheng2010-09-23
| | | | Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* Handle bad extent type caseFrederic Weisbecker2010-09-23
| | | | | | | | | | | | | | | | | | | If we meet a bad extent type, find_updated_files is going to print random things. Better warn the user about what happens. This fixes: btrfs-list.c: Dans la fonction «find_updated_files» : btrfs-list.c:668: attention : «disk_offset» may be used uninitialized in this function btrfs-list.c:668: note: «disk_offset» was declared here btrfs-list.c:667: attention : «disk_start» may be used uninitialized in this function btrfs-list.c:667: note: «disk_start» was declared here btrfs-list.c:666: attention : «len» may be used uninitialized in this function btrfs-list.c:666: note: «len» was declared here make: *** [btrfs-list.o] Erreur 1 Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
* Fix use after free in close_ctreeJeff Mahoney2010-09-23
| | | | | | | | | | | | | | | After the roots are closed, root is freed. Yet close_ctree continues to use it. It works generally because no new memory is allocated in the interim, but with glibc malloc perturbing enabled, it crashes every time. This is because root->fs_info points to garbage. This patch uses the already-cached fs_info variable for the rest of the accesses and fixes the crash. This issue was reported at: https://bugzilla.novell.com/show_bug.cgi?id=603620 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
* Make csum_tree_block_size complain about the right thing.Zhu Yanhai2010-09-23
| | | | | | It dereferenced a wrong pointer before. Signed-off-by: Zhu Yanhai <yanhai.zhu@linux.intel.com>
* fix incompat flagsJosef Bacik2010-09-23
| | | | | | | | I forgot to add BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL to the incompat flags in btrfs-progs. This adds it so that our tools don't freak out when touching a fs with the default subvolume changed. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
* Avoid uninitialized variant compile warningZhao Lei2010-09-23
| | | | | | | | | | | | | | | | | | When we compile btrfs-progs in RHEL5(with default gcc version 4.1.2 20070626), we can get following error: cc1: warnings being treated as errors btrfs-list.c: In function 'find_updated_files': btrfs-list.c:668: warning: 'disk_offset' may be used uninitialized in this function btrfs-list.c:667: warning: 'disk_start' may be used uninitialized in this function btrfs-list.c:666: warning: 'len' may be used uninitialized in this function make: *** [btrfs-list.o] Error 1 These varient are always initialized except inconsistent data in file system. We can set initial value for these variant for this situation. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* fix a compile fail by strndup in RHEL5 envZhao Lei2010-09-23
| | | | | | | | | | | | | | | | | | | | | | When we compile btrfs-progs in RHEL5(with default gcc 4.1.2 and glibc-2.5-18), we can get following error: cc1: warnings being treated as errors btrfs-list.c: In function 'ino_resolve': btrfs-list.c:511: warning: implicit declaration of function 'strndup' btrfs-list.c:511: warning: incompatible implicit declaration of built-in function 'strndup' make: *** [btrfs-list.o] Error 1 ... cc1: warnings being treated as errors btrfs.c: In function 'split_command': btrfs.c:168: warning: implicit declaration of function 'strndup' btrfs.c:168: warning: incompatible implicit declaration of built-in function 'strndup' make: *** [btrfs-list.o] Error 1 We can add _GNU_SOURCE definition according man strndup. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* fix wrong return valueMiao Xie2010-09-23
| | | | | | | btrfsctl returns 1 if it does something successfully. this patch fixes this problem. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Remove superfluous WARN_ON in btrfsckYan Zheng2010-09-23
| | | | Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* add mounted-checking for btrfs-volMiao Xie2010-09-23
| | | | | | | Adding a mounted device is dangerous because it will destroy the filesystem on that mounted device. So we add mounted-checking for btrfs-vol. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* only print FIRST_CHUNK_TREE for chunk items in debug-treeSage Weil2010-09-23
| | | | | | | Otherwise we print FIRST_CHUNK_TREE for any objectid 256, which e.g. for the root tree is the first snap/subvol. Signed-off-by: Sage Weil <sage@newdream.net>
* check slash in deleting subvolumesTARUISI Hiroaki2010-09-23
| | | | | | | | | | | | For now, btrfsctl does not check whether subvolume name contains slash or not. If someone specify subvolume with trailing slash (in case using shell completion), ioctl returns with EINVAL and this error may confuse some careless users like me. So, this patch adds check slashes in subvolume name in deletion same as snapshot/subvolume creating. But considering shell completion, this fix allows trailing slash. Signed-off-by: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
* add missing include for btrfsck.cChristian Hesse2010-09-23
| | | | | | | | compiling btrfs-progs from current git I get an error in btrfsck.c about undefined references. The attached patch adds an include for sys/stat.h which fixes the problem for me. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* prevent btrfsck to run on mounted filesystemsAndi Drebes2010-09-23
| | | | | | | | | As recently discussed on the list, btrfsck should only be run on unmounted filesystems. This patch adds a short check for the mount status at the beginning of btrfsck. If the FS is mounted, the program aborts showing an error message. Signed-off-by: Andi Drebes <lists-receive@programmierforen.de>
* multidevice support for check_mountedAndi Drebes2010-09-23
| | | | | | | | | | | | | | Check_mount() should also work with multi device filesystems. This patch adds checks that allow to detect if a file is a device file used by a mounted single or multi device btrfs or if it is a regular file used by a loopback device that is part of a mounted single or multi device btrfs. The single device checks also work for non-btrfs filesystems. This might be helpful to prevent users from running btrfs programs (e.g. mkfs.btrfs) accidentally on a filesystem used somewhere else. Signed-off-by: Andi Drebes <lists-receive@programmierforen.de>
* Btrfs: add btrfs-debug-tree -b <block number> to print a single blockChris Mason2010-04-06
|
* Add btrfs subvol find-new commandChris Mason2010-03-18
| | | | | | | | btrfs-subvol find-new <subvol> <id> will search through a given subvol and print out all the files with extents newer than a given id. Care must be taken to make sure any pending delalloc is on disk before running this because that won't show up in the output.
* Add ioctl-test.c which just prints all the ioctl numbers.Chris Mason2010-03-15
| | | | | This is used to compare the output on 64 bit and 32 bit machines and make sure all of our ioctls are compat defined.
* Btrfs-progs: add btrfs filesystem df to print space infoJosef Bacik2010-03-14
| | | | | | | | | This goes along with the new space info ioctl. This will spit out the space info all nice and pretty with the type, it's flags (DUP, RAID) and how much space is in that group and how much is in use. Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Update the btrfs man page with the new commandsGoffredo Baroncelli2010-03-11
|
* Correct the check of the argument number for the "btrfs dev add|rem" commandsGoffredo Baroncelli2010-03-11
|
* Avoid the exit(2) function; instead return with an appropriate value;Goffredo Baroncelli2010-03-11
|
* Add the program name as the first parameter in the command of the btrfs toolGoffredo Baroncelli2010-03-11
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* new util: 'btrfs'ghigo2010-03-11
| | | | | | | | | | | | | | | This commit introduces a new command called 'btrfs' for managing a btrfs filesystem. 'btrfs' handles: - snapshot/subvolume creation - adding/removal of volume (ie: disk) - defragment of a tree - scan of a device searching a btrfs filesystem - re-balancing of the chunk on the disks - listing subvolumes and snapshots This has also been updated to include the new defrag range ioctl. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Add new defrag range ioctl that can also compress files on demand.Chris Mason2010-03-11
|
* Btrfs-progs: add command to set default subvolJosef Bacik2010-02-28
| | | | | | | | | | | | | | | | | | This introduces a new btrfsctl option, -m, to allow you to set the default'ly mounted subvolume. You can do btrfsctl -m /your/subvolume and that will make that subvolume the subvolume that is mounted by default, or you can do btrfsctl -m <treeid> /any/subvolume and this will make the subvolume with tree id <treeid> the default'ly mounted subvolume. You can get the treeid by using the listing option. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Add btrfs-list for listing subvolumesChris Mason2010-02-28
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Add btrfs-map-logical program to map and read logical block numbersChris Mason2009-11-12
| | | | | | | | | This allows us to figure out which physical byte offset on which device is the real location for a given logical block number. It can optionally read the block in and save it to a file for debugging analysis. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: check root back/forward referencesYan, Zheng2009-09-21
| | | | | | | | This patch adds semantic checks for links to snapshot/subvolume and root back/forward references. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsctl: add snapshot/subvolume destroy ioctlYan, Zheng2009-09-21
| | | | | | | resend Aaron Straus's patch Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* used space accounting fix for the converterYan Zheng2009-06-12
| | | | | | | | remove code that updates the total used space, since btrfs_update_block_group does that work now. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-progs v0.19Chris Mason2009-06-11
|
* Check duplicate backrefs for both data and metadataYan Zheng2009-06-11
| | | | | | | | | | lookup_inline_extent_backref only checks for duplicate backref for data extent. It assumes backrefs for tree block never conflict. This patch makes lookup_inline_extent_backref check duplicate backrefs for both data and tree block, so that we can detect potential bug earlier. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Make sure all dirty blocks are written at commit timeYan Zheng2009-06-08
| | | | | | | | | Write dirty block groups may make some block groups dirty. This patch make btrfs_write_dirty_block_groups properly handle the recursion. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Update converter for the new formatYan Zheng2009-06-08
| | | | | Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Mixed back reference (FORWARD ROLLING FORMAT CHANGE)Chris Mason2009-06-08
| | | | | | | | | | | | | | | | | This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS. The new back ref provides information about pointer's key, level and in which tree the pointer lives. This information allow us to find the pointer by searching the tree. The shortcoming of the new back ref is that it only works for pointers in tree blocks referenced by their owner trees. This is mostly a problem for snapshots, where resolving one of these fuzzy back references would be O(number_of_snapshots) and quite slow. The solution used here is to use the fuzzy back references in the common case where a given tree block is only referenced by one root, and use the full back references when multiple roots have a reference