summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Add basic RAID[56] supportDavid Woodhouse2013-02-01
| | | | | | | | | | | | | | | | David Woodhouse originally contributed this code, and Chris Mason changed it around to reflect the current design goals for raid56. The original code expected all metadata and data writes to be full stripes. This meant metadata block size == stripe size, and had a few other restrictions. This version allows metadata blocks smaller than the stripe size. It implements both raid5 and raid6, although it does not have code to rebuild from parity if one of the drives is missing or incorrect. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Fix alignment during allocationsChris Mason2013-02-01
| | | | | | | We need to align earlier to make sure we're getting things properly setup against the raid56 stripes. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Clear caches when opening and closing devicesChris Mason2013-02-01
| | | | This should fix problems with cache aliases in the kernel
* btrfs-progs: ignore -a option in mkfsDavid Sterba2013-01-17
| | | | | | | | | | | Let mkfs accept '-a' option and not complain. When a partition has non-zero value in the fs_passno filed in /etc/fstab, the fsck is run but fails and boot stops. As fsck does not break things currently, it's safe to ignore the option and let the boot proceed. Reference: https://bugzilla.novell.com/show_bug.cgi?id=655906 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: remove '-h' from btrfs man pageSimon Xu2013-01-17
| | | | | | Remove '-h' from btrfs man page as it's not supported by the btrfs utility. Signed-off-by: Simon Xu <xu.simon@oracle.com>
* btrfs-progs: remove "device show" from btrfs man pageSimon Xu2013-01-17
| | | | | | | Remove "device show" from btrfs man page as it's not supported by the btrfs utility. Signed-off-by: Simon Xu <xu.simon@oracle.com>
* btrfs-progs: Fix getopt on arm platformsLluis Batlle i Rossell2013-01-17
| | | | | | | There, 'char' is unsigned, so once assigned '-1' from getopt, it gets the value 255. Then, it compared to '-1' gives false. Signed-off-by: Lluis Batlle i Rossell <viric@viric.name>
* btrfs-progs: print the right mount checking info in restore.cWang Sheng-Hui2013-01-17
| | | | | | | The mount status is checked against the arg <device> (argv[optind]), not the <directory>. Correct the info printed on <device> mounted. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
* btrfs-progs: fix 32bit int/pointer cast warningsZach Brown2013-01-17
| | | | | | | | | | | | This uses uintptr_t to cast pointers to u64 ioctl arguments to silence some 32bit build warnings: cmds-inspect.c: In function ‘__ino_to_path_fd’: cmds-inspect.c:47:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] cmds-inspect.c: In function ‘cmd_logical_resolve’: cmds-inspect.c:171:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: plug memory leaks in btrfs_scan_one_dir() reported by cppcheck.Kenji Okimoto2013-01-17
| | | | | | [utils.c:983]: (error) Memory leak: fullpath Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
* btrfs-progs: check malloc() resultKenji Okimoto2013-01-17
| | | | Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
* btrfs-progs: plug a memory leak reported by cppcheckKenji Okimoto2013-01-17
| | | | | | [src/btrfs/disk-io.c:462]: (error) Memory leak: log_root Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
* btrfs-progs: update usage description for debug-tree.cWang Sheng-Hui2013-01-17
| | | | | | | There are more options than "-e" only. Update the description for the usage. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
* parse_size(): add new suffixesGoffredo Baroncelli2013-01-17
| | | | | | | | Add new suffixes in parse_size() function. New suffixes are: T as terabyte, P as petabyte, E as exabyte. Note these units are multiply of 2 . Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
* parse_size(): replace atoll() with strtoull()Goffredo Baroncelli2013-01-17
| | | | | | | Replace the function atoll with strtoull(); Check that the suffix for the parse_size() input is of only one character. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
* Move parse_size() to utils.[hc]Goffredo Baroncelli2013-01-17
| | | | | | Move the function from cmds-filesystem.c and mkfs.c to utils.c Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
* btrfs-progs: do not send stream into a terminalDavid Sterba2013-01-17
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Receive: preserve ownership for symlinks, by using 'lchown'Alex Lyakas2013-01-17
| | | | Signed-off-by: Alex Lyakas <alex.btrfs@zadarastorage.com>
* Btrfs-progs: fix unaligned accessesArne Jansen2013-01-17
| | | | | | | | There are some unaligned accesses in progs that cause malfunction or crashes on ARM. This patch fixes the ones we stumbled upon. Signed-off-by: Arne Jansen <sensille@gmx.net>
* btrfs-progs: add -V description in print_usageWang Sheng-Hui2013-01-17
| | | | | | | mkfs supports the option -V/--version. Add its description to print_usage(). Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
* version.sh: fix version when built from tarballSergei Trofimovich2013-01-17
| | | | | | | | | | | | | | [from 0.20-rc1 tarball] Before the patch: $ ./btrfs --version Btrfs Btrfs v0.19 After the patch: $ ./btrfs --version Btrfs v0.20-rc1 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Btrfs-progs: Fix compiler warnings on PPC64Wade Cline2013-01-17
| | | | | | | | | | | | | | | | The kernel uses unsigned long long for u64, but PPC64 uses unsigned long by default. This results in compilation warnings such as: print-tree.c:333: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'u64' To fix this, the macro __KERNEL__ needs to be defined before including the file <asm/types.h>. This can be done by defining the macro in "kerncompat.h" and making it the first included file in the relevant header files; this fixes the compiler warnings on PPC64. Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Wade Cline <clinew@linux.vnet.ibm.com>
* Cast args to min to fix compiler warningsChris Mason2012-10-04
|
* Btrfs-progs: add options to change bufsize in logical to inode translationLiu Bo2012-10-04
| | | | | | | | | Add an option 's' to set bufsize in logical to inode transition, then we are able to read all the refs to the logical address. Meanwhile, set a max value 64k for the bufsize. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Correct un-initialized fsid variableGoffredo Baroncelli2012-10-04
|
* btrfs-progs: pretty print key in extent_itemDavid Sterba2012-10-04
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: btrfs subvolume delete could delete subvolumesAnand Jain2012-10-04
| | | | | | | | | With this user will be able to provide more than one subvolume to delete. eg: btrfs subvolume delete <subvol1> <subvol2> Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: correct the mkfs.btrfs man pageAnand Jain2012-10-04
| | | | | Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Fix up memory leakageZhi Yong Wu2012-10-04
| | | | | | | | | | Some code pathes forget to free memory on exit. Changelog from v1: Fix the variable is used uncorrectly. [Ram Pai] Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Close file descriptor on exitZhi Yong Wu2012-10-04
| | | | | | | Need to close fd on exit. Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: limit the max value of leafsize and nodesizeRobin Dong2012-10-04
| | | | | | | | | | | | | | | | | Using mkfs.btrfs like: mkfs.btrfs -l 131072 /dev/sda will return no error, but after mount it, the dmesg will report: BTRFS: couldn't mount because metadata blocksize (131072) was too large The leafsize and nodesize are equal at present, so we just use one function "check_leaf_or_node_size" to limit leaf and node size below BTRFS_MAX_METADATA_BLOCKSIZE. Signed-off-by: Robin Dong <sanbai@taobao.com> Reviewed-by: David Sterba <dave@jikos.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* pretty_sizes() returns incorrect valuesGoffredo Baroncelli2012-10-04
| | | | | | | | | | | | pretty_sizes() returns incorrect values if the argument is < 1024. pretty_sizes(0) -> 0.00 OK pretty_sizes(102) -> 0.10 WRONG pretty_sizes(1023) -> 1.00 WRONG pretty_sizes(1024) -> 1.00KB OK Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-Progs: update '-s' option without a argument.Wang Shilong2012-10-04
| | | | | | | Since '--sort' options was given ,and we can list snapshots in generation order by --sort=+/-gen to replace '-s [0|1]' totally. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujistsu.com>
* Btrfs-progs: introduces '-a' option into subvolume list commandWang Shilong2012-10-04
| | | | | | | | | | | | | | | We list the subvolumes under current directory according to the input subvolume. However, if we still want to list all the subvolumes in the tree, we can use '-a' option to help us. There may be two kinds of path: absolute path , relative path . The absolute path is beginning with "<FS_TREE>" The relative path is under current path that you input. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
* Btrfs-Progs: fix subvolumes's some full_path invaild problems.Wang Shilong2012-10-04
| | | | | | | | | | | | | In the privous way, we list all the subvolumes in the filesystem default. But if a subvolume mounts on another directory, some result's full_path may be invaild. According to this, we try to list subvolumes under directoy only by default. In this way, all the subvolume can be arrived by the full_path. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
* Btrfs-progs: introduce '-t' option into subvolume list commandMiao Xie2012-10-04
| | | | | | | | This patch introduces '-t' option into subvolume list command. By this option, we can output the result as a table. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: introduce -g -c --sort options into btrfs subvol list commandwangshilong2012-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-g' '-c' '--sort' options The option '-g' can help you filter the subvolumes by the generation, you may use it just like: btrfs subvol list -g +/-value <path> '+' means the generation of the subvolumes should >= the value you specified. '-' means the generation should <= the value If you don't input either '+' nor '-', this command will list the subvolumes that their generation equals to the value. However if you want to find gengeration between value1 and value2 you may use the above like: btrfs sub list -g -value1 -g +value2 <path> The option '-c' can help you filter the subvolumes by the ogeneration, you may use it just like: btrfs subvol list -c +/-value <path> The usage is the same to '-g' You might want to list subvolumes in order of some items, such as root id, gen and so on, you can use '--sort'. Now you can sort the subvolumes by root id, gen, ogen and path. For example: If you want to list subvolumes in order of rootid, you can use the option like that: btrfs sub list --sort=+/-rooid <path> Here, '+' means the result is sorted by ascending order. '-' is by descending order. If you don't specify either '+' nor '-', the result is sorted by default - ascending order. If you want to combine sort items, you do it like that: btrfs sub list --sort=-rootid,+path,ogen,gen <path> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: update the manpage entries for the btrfs subvolume listZhou Bo2012-10-04
| | | | | | | This patch adds the introduction of the new option '-r' into the man page of 'btrfs subvolume list' command. Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
* Btrfs-progs: enhance btrfs subvol list only to show read-only snapshotsMiao Xie2012-10-04
| | | | | | | | | | | | We want 'btrfs subvolume list' only to list readonly subvolumes, this patch set introduces a new option 'r' to implement it. You can use the command like that: btrfs subvolume list -r <path> Original-Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: restructure list_subvolumesMiao Xie2012-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code of list_subvols() has very bad scalability, if we want to add new filter conditions or new sort methods, we have to modify lots of code. Beside that, the most code of list_snapshots() is similar to list_subvols(), So I restructure list_subvols(), and split the subvolume filter function, the subvolume sort function and the output function from list_subvols(). In order to implement it, we defined some importtant structures: struct btrfs_list_filter { btrfs_list_filter_func filter_func; void *data; }; struct btrfs_list_comparer { btrfs_list_comp_func comp_func; int is_descending; }; struct { char *name; char *column_name; int need_print; } btrfs_list_columns[]; If we want to add a new filter condition, we can choose a suitable filter function, or implement a new filter function[1], and add it into a set of the filters, and then pass the filter set into list_subvols(). We also can mix several filters (just add those filters into the set, and pass the set into list_subvols()) if the users specify two or more filter conditions. The subvolume sort function is similar to the subvolume filter function. The differentiation is the order of comparers in the array which is passed into list_subvols() show us the priority of the sort methods. The output function is different with the above two functions, we define a array to manage all the columns that can be outputed, and use a member variant (->need_print) to control the output of the relative column. Some columns are outputed by default. But we can change it according to the requirement of the users. After appling this patch, we needn't implement a independent list_snapshots() function, just pass a filter function which is used to identify the snapshot into list_subvols(). [1]: If we implement new filter functions or compare functions, we must add them into the array all_filter_funcs or the array all_comp_funcs, and modify the relative enum variants(btrfs_list_filter_enum, btrfs_list_comp_enum). Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: fix wrong way to check if the root item contains otime and uuidMiao Xie2012-10-04
| | | | | | | | | | | | | Now we check if the root item contains otime and uuid or not by comparing ->generation_v2 and ->generation of the btrfs_root_item structure, it is wrong because it is possbile that ->generation may equal to the first variant of the next item. We fix this problem by check the size of btrfs_root_item, if it is larger than the original one, the new btrfs_root_item contains otime and uuid. we needn't worry the case that the new filesystem is mounted on the old kernel. because the otime and uuid are not changed on the old kernel, we can get the correct result even on the kernel. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: fix wrong usage of btrfs subvolume list commandMiao Xie2012-10-04
| | | | | | | Since the uuid output function has been implemented, we should update the usage to tell the users. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: fix compile warning of implicit declaration of "list_snapshots"Miao Xie2012-10-04
| | | | | | | This patch fixes the following warning: cmds-subvolume.c:283:3: warning: implicit declaration of function "list_snapshots" Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* Btrfs-progs: move the function declarations to a new head fileZhou Bo2012-10-04
| | | | | | Move the function declarations to a new head file. Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
* Btrfs-progs: seg fault in get_label_unmountedAnand Jain2012-10-04
| | | | | | | | | | btrfs f l / No valid Btrfs found on / Segmentation fault (core dumped) open_ctree can return NULL, we need to check that. Signed-off-by: Anand Jain <anand.jain@oracle.com>
* Btrfs-progs: add -u to show subvol uuidAnand Jain2012-10-04
| | | | | | | Applications would need to know the uuid to manage the configurations associated with the subvol and snapshots Signed-off-by: Anand Jain <anand.jain@oracle.com>
* Btrfs-progs: add otime to the snapshot listAnand Jain2012-10-04
| | | | | Reviewed-by: Alexander Block <ablock84@googlemail.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
* Btrfs-progs: list snapshots by generationLiu Bo2012-10-04
| | | | | | | | | | | | | | | The idea is that we usually use snapshot to backup/restore our data, and the common way can be a cron script which makes lots of snapshots, so we can end up with spending some time to find the latest snapshot to restore. This adds a feature for 'btrfs subvolume list' to let it list snapshots by their _created_ generation. What we need to do is just to list them in descending order and get the latest snapshot. What's more, we can find the oldest snapshot as well by listing snapshots in ascending order. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
* Btrfs-progs: show generation in command btrfs subvol listLiu Bo2012-10-04
| | | | | | | | | | | | | This adds the ability to show root's modification generation when we use btrfs subvol list. NOTE: Like file's atime and ctime, root's generation also has 'creation generation' and 'modification generation'. The generation that we're going to show is 'modification generation', and the next patch is going to show 'creation generation'. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
* Btrfs-progs: search subvolumes with proper objectidLiu Bo2012-10-04
| | | | | | | Btrfs's subvolume/snapshot is limited to [BTRFS_FIRST_FREE_OBJECTID, BTRFS_LAST_FREE_OBJECTID], so just apply the range. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>