summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2011-10-25Print the root generation in btrfs-debug-treeHEADmasterChris Mason1-2/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Btrfs-progs: make btrfs df report profiles for mixed block groupsIlya Dryomov1-2/+2
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>
2011-10-25btrfs-progs: Improvement for making btrfs image from source directory.Zhong, Xin2-16/+17
* 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>
2011-10-25Scan the devices listed in /proc/partitionsGoffredo Baroncelli5-17/+119
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.
2011-10-25Btrfs-progs: specify label length larger than 255 bytes cause mkfs.btrfs ↵Jeff Liu1-2/+2
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>
2011-10-25btrfsck: decode error properlySergei Trofimovich3-3/+3
check_mounted() returns kernel-style negative errors. Patch drops sign for strerror(). Before the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Unknown error 18446744073709551603 After the patch: check_mounted(): Could not open /dev/sdb2 Could not check mount status: Permission denied Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2011-10-25check number of args for btrfs sub snap correctlyAndreas Philipp1-1/+1
Check whether there are the right number of arguments (exatly 2 without the flag -r) in the subcommand handler for the btrfs subvolume snapshot command. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
2011-10-25Btrfs-progs: add "btrfs subvolume get-default" subcommandZhong, Xin5-4/+98
Add subcommand to get the default subvolume of btrfs filesystem V2->V3: * add man page * based on http://git.darksatanic.net/repo/btrfs-progs-unstable.git integration-20110705 Reviewed-by: Andreas Philipp <philipp.andreas@gmail.com> Reviewed-by: Goffredo Baroncelli <kreijack@libero.it> Reported-by: Yang, Yi <yi.y.yang@intel.com> Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
2011-10-25btrfs-progs-unstable: replace debug-tree to btrfs-debug-tree in INSTALLWang Sheng-Hui1-2/+2
From c04da1655df6d75db834ddbd3a3b4a58a0d9a0c9 Mon Sep 17 00:00:00 2001 From: Wang Sheng-Hui <shhuiw@gmail.com> Date: Mon, 18 Jul 2011 02:17:31 -0500 Subject: [PATCH] btrfs-progs-unstable: replace debug-tree to btrfs-debug-tree in INSTALL debug-tree doesn't exist after btrfs-progs installed. Use btrfs-debug-tree to print FS metadata in text form, not debug-tree. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
2011-10-25fix incorrect argument checking for "btrfs sub snap -r"Hugo Mills1-1/+1
Stephane Chazelas and Andreas Philipp spotted that the earlier patch fixing this issue was incomplete, and should also update the argument- count checking code as well. Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: scrub added to manpageJan Schmidt1-1/+63
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: scrub userland implementationJan Schmidt1-0/+1666
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: added check_mounted_whereJan Schmidt2-7/+24
new version of check_mounted() returning more information gathered while searching. check_mounted() is now a wrapper for check_mounted_where(). the new version is needed by scrub.c Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: scrub ioctlsJan Schmidt2-2/+58
- scrub structs added - ioctls for scrub - BTRFS_FSID_SIZE moved Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: commands addedJan Schmidt4-3/+31
- scrub commands added - open_file_or_dir no longer static (needed by scrub.c) Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25remove unused include "version.h"Andreas Philipp1-1/+0
In the file btrfs-list.c version.h was included but not used. So just drop it. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25update manpage entries for btrfs subvolume listAndreas Philipp1-8/+11
Update the manpage entries for the btrfs subvolume list command to reflect the newly created additional option '-p'. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25print parent ID in btrfs suvolume listAndreas Philipp4-11/+43
There was some discussion on "where" subvolumes live in. Why do we not simply print the parent ID for each subvolume in btrfs subvolume list? This patch adds this functionality when called with parameter "-p". Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25some style/layout changesAndreas Philipp1-10/+8
Just do a few simple style/layout changes to make the makefile look better. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25add all targets to clean targetAndreas Philipp1-1/+2
When issuing 'make clean' not all files generated by the individual targets have been deleted since some files have been missing in the definition of the 'make clean' target. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25remove unused variablesHubert Kario2-5/+0
fixes compilation warnings with gcc 4.6.0 20110429 Signed-off-by: Hubert Kario <kario@wit.edu.pl> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25gcc 4.6: fix potentially unused variableHugo Mills1-1/+1
Fix a complaint by gcc 4.6 that "ret" may be unused in process_one_leaf of btrfsck. Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25make btrfs cross compilation friendlyKamble, Nitin A1-16/+16
Attached is a patch to fix a cross compilation issue I observed with btrfs-tools. Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk> Nitin A Kamble Yocto Project www.yoctoproject.org Avoid these kinds of errors while doing cross build: | ccache i586-poky-linux-gcc -march=i586 --sysroot=/disk0/pokybuild/build0/tmp/sysroots/qemux86 -Wp,-MMD,./.btrfsctl.o.d,-MT,btrfsctl.o -Wall -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -pipe -g -feliminate-unused-debug-types -c btrfsctl.c | gcc -O2 -pipe -g -feliminate-unused-debug-types -o btrfsctl btrfsctl.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 -Wl,-O1 -Wl,--as-needed -luuid | /usr/bin/ld: i386 architecture of input file `btrfsctl.o' is incompatible with i386:x86-64 output | /usr/bin/ld: i386 architecture of input file `ctree.o' is incompatible with i386:x86-64 output
2011-10-25mkfs.btrfs: Fix compilation errors with gcc 4.6Hugo Mills1-3/+4
gcc 4.6 complains about several possible use-before-initialise cases in mkfs, and stops. Fix these by initialising one of the variables in question, and using the correct error-handling paths for the remainder. Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Btrfs-progs: Correct path munging in bcpcwillu1-4/+2
Bcp was assuming that a path on the command line would never have a slash after it, which is silly, and would cause the first letter of everything in the root of the source to be truncated. Instead, use os.path.relpath to handle it properly. Signed-off-by: Carey Underwood <cwillu@cwillu.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-map-logical: segfaults when no output file is givenArne Jansen1-0/+1
when no output file is given, info_file stays NULL and the following fprintf segfaults. Default to stdout. Signed-off-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: fix error text in '-r' modeSergei Trofimovich1-1/+1
Smart gcc noticed use of uninitialized warning when compiled with -O0 flags: mkfs.c:1291: error: 'file' may be used uninitialized in this function Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: fix memory leak caused by 'scandir()' callsSergei Trofimovich1-0/+16
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: free buffers allocated by pretty_sizesSergei Trofimovich1-1/+3
found by valgrind: ==2559== 16 bytes in 1 blocks are definitely lost in loss record 3 of 19 ==2559== at 0x4C2720E: malloc (vg_replace_malloc.c:236) ==2559== by 0x412F7E: pretty_sizes (utils.c:1054) ==2559== by 0x4179E9: main (mkfs.c:1395) Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: write zeroes instead on uninitialized data.Sergei Trofimovich2-0/+8
Found by valgrind: ==8968== Use of uninitialised value of size 8 ==8968== at 0x41CE7D: crc32c_le (crc32c.c:98) ==8968== by 0x40A1D0: csum_tree_block_size (disk-io.c:82) ==8968== by 0x40A2D4: csum_tree_block (disk-io.c:105) ==8968== by 0x40A7D6: write_tree_block (disk-io.c:241) ==8968== by 0x40ACEE: __commit_transaction (disk-io.c:354) ==8968== by 0x40AE9E: btrfs_commit_transaction (disk-io.c:385) ==8968== by 0x42CF66: make_image (mkfs.c:1061) ==8968== by 0x42DE63: main (mkfs.c:1410) ==8968== Uninitialised value was created by a stack allocation ==8968== at 0x42B5FB: add_inode_items (mkfs.c:493) 1. On-disk inode format has reserved (and thus, random at alloc time) fields: btrfs_inode_item: __le64 reserved[4] 2. Sometimes extents are created on disk without writing data there. (Or at least not all data is written there). Kernel code always had it kzalloc'ed. Zero them all. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: fix symlink names writingSergei Trofimovich1-1/+3
Found by valgrind: ==8968== Use of uninitialised value of size 8 ==8968== at 0x41CE7D: crc32c_le (crc32c.c:98) ==8968== by 0x40A1D0: csum_tree_block_size (disk-io.c:82) ==8968== by 0x40A2D4: csum_tree_block (disk-io.c:105) ==8968== by 0x40A7D6: write_tree_block (disk-io.c:241) ==8968== by 0x40ACEE: __commit_transaction (disk-io.c:354) ==8968== by 0x40AE9E: btrfs_commit_transaction (disk-io.c:385) ==8968== by 0x42CF66: make_image (mkfs.c:1061) ==8968== by 0x42DE63: main (mkfs.c:1410) ==8968== Uninitialised value was created by a stack allocation ==8968== at 0x42B5FB: add_inode_items (mkfs.c:493) readlink(2) does not write '\0' for us, so make it manually. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: return some defined value instead of garbage when lookup checksumSergei Trofimovich1-0/+1
==31873== Command: ./mkfs.btrfs -r /some/root/ ==31873== Parent PID: 31872 ==31873== ==31873== Conditional jump or move depends on uninitialised value(s) ==31873== at 0x42C3D0: add_file_items (mkfs.c:792) ==31873== by 0x42CAB3: traverse_directory (mkfs.c:948) ==31873== by 0x42CF11: make_image (mkfs.c:1047) ==31873== by 0x42DE53: main (mkfs.c:1401) ==31873== Uninitialised value was created by a stack allocation ==31873== at 0x41B1B1: btrfs_csum_file_block (file-item.c:195) 'ret' value was not initialized for 'found' branch. The same fix sits in kernel: > commit 639cb58675ce9b507eed9c3d6b3335488079b21a > Author: Chris Mason <chris.mason@oracle.com> > Date: Thu Aug 28 06:15:25 2008 -0400 > > Btrfs: Fix variable init during csum creation > > Signed-off-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs.btrfs: fail on scandir error (-r mode)Sergei Trofimovich1-0/+6
mkfs.btrfs does not handle relative pathnames for now. When they are passed to it it creates empty image. So first time I thought it does not work at all. This patch adds error handling for scandir(). With patch it behaves this way: $ mkfs.btrfs -r ./root ... fs created label (null) on output.img nodesize 4096 leafsize 4096 sectorsize 4096 size 256.00MB Btrfs v0.19-52-g438c5ff-dirty scandir for ./root failed: No such file or directory unable to traverse_directory Making image is aborted. mkfs.btrfs: mkfs.c:1402: main: Assertion `!(ret)' failed. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-convert: fix typo: 'all inode' -> 'all inodes'Sergei Trofimovich1-1/+1
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25make "btrfs filesystem label" command actually workFajar A. Nugraha1-0/+6
This simple patch makes "btrfs filesystem label" command actually work. On tmp branch, commit d1dc6a9, "btrfs filesystem label" functionality was introduced. However the commit lacks one component that lets "btrfs" accept "filesystem label" command. Test case: /dev/loop0 WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using fs created label old on /dev/loop0 nodesize 4096 leafsize 4096 sectorsize 4096 size 1.00GB Btrfs Btrfs v0.19 old new FATAL: the filesystem has to be unmounted new Not sure if you need if you need a signoff for something as trivial as this, but here it is just in case. Signed-off-by: Fajar A. Nugraha <list@fajar.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs progs: fix extra metadata chunk allocation in --mixed caseArne Jansen1-3/+4
When creating a mixed fs with mkfs, an extra metadata chunk got allocated. This is because btrfs_reserve_extent calls do_chunk_alloc for METADATA, which in turn wasn't able to find the proper space_info, as __find_space_info did a hard compare of the flags. It is now sufficient for the space_info to include the proper flag. This reflects the change done to the kernel code to support mixed chunks. Also for a subsequent chunk allocation (which should not be hit in the mkfs case), the chunk is now created with the flags from the space_info instead of the requested flags. A better solution would be to pull the full changeset for the mixed case from the kernel into the user mode (or, even better, share the code) The additional chunk probably confused block_rsv calculation, which in turn led to severeal ENOSPC Oopses. Signed-off-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25incorrect argument checking for "btrfs sub snap -r"Stephane Chazelas1-1/+1
Looks like this was missing in integration-20110626 for the readonly snapshot patch: Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: Fix over-sized limit on bufferHugo Mills1-1/+1
gcc-4.4 complains (rightly) that the strncpy has a limit too large for the array it's copying into. Use the correct array length. Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Updated manpage for btrfs subvolume snapshot.Andreas Philipp1-5/+6
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Test the additional ioctl.Andreas Philipp1-0/+1
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Support the new parameters in do_clone(int argc, char** argv).Andreas Philipp1-2/+2
Now 'btrfs subvolume snapshot' takes not two but only at least two parameters. Additionally, the help message is updated accordingly. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Add support for read-only subvolumes.Andreas Philipp1-8/+40
Use BTRFS_IOC_CREATE_SNAP_V2 instead of BTRFS_IOC_CREATE_SNAP and add an option for the creation of a readonly snapshot. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Added support for an additional ioctl.Andreas Philipp1-0/+17
Added BTRFS_IOC_SNAP_CREATE_V2 and struct btrfs_ioctl_vol_args_v2 as defined in fs/btrfs/ioctl.h in the kernel sources. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: cast u64 to long long to avoid printf warningsAnton Blanchard7-9/+14
When building on ppc64 I hit a number of warnings in printf: btrfs-map-logical.c:69: error: format ‘%Lu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u64’ Fix them. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25Fix unused-but-set errors in gcc-4.6Chris Ball12-126/+6
gcc-4.6 (as shipped in Fedora) turns on -Wunused-but-set-variable by default, which breaks the build when combined with -Wall, e.g.: debug-tree.c: In function ‘print_extent_leaf’: debug-tree.c:45:13: error: variable ‘last_len’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:44:13: error: variable ‘last’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:41:21: error: variable ‘item’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors This patch fixes the errors by removing the unused variables. Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25add detailed help messages to btrfs commandHubert Kario1-31/+65
extend the btrfs <cmd> --help command to print detailed help message if available but fallback to basic help message if detailed is unavailable add detailed help message for 'filesystem defragment' command little tweaks in comments Signed-off-by: Hubert Kario <kario@wit.edu.pl> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25add advanced use of --help to help messageHubert Kario1-0/+2
explain how to use btrfs <cmd> --help command in help message Signed-off-by: Hubert Kario <kario@wit.edu.pl> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25mkfs should initialize unused fields properlyJan Schmidt1-0/+10
we discovered speed setting is (probably unintentionally) initialized to 1 in make_btrfs(), while being initialized to 0 in btrfs_add_to_fsid(). initialization in make_btrfs() is due to reuse of buf after pwrite() without clearing it. consequently, code like btrfs_set_extent_generation(buf, extent_item, 1); writes to the same location in buf where speed will be placed, later. It may be a good idea to clear buf after each pwrite(), though leaving the struct btrfs_header intact. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: setting of time to the root directoryTsutomu Itoh1-0/+9
This patch adds the setting of time to the root directory to the mkfs.btrfs command. As a result, the time of the mount point not correctly displayed comes to be displayed correctly. [before] # mkfs.btrfs /dev/sdd10 # mount /dev/sdd10 /test1 # ls -ld /test1 dr-xr-xr-x 1 root root 0 Jan 1 1970 /test1 [after] # date Tue Nov 16 18:06:05 JST 2010 # mkfs.btrfs /dev/sdd10 # mount /dev/sdd10 /test1 # ls -ld /test1 dr-xr-xr-x 1 root root 0 Nov 16 18:06 /test1 Thanks, Tsutomu Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
2011-10-25btrfs-progs: add discard support to mkfsChristoph Hellwig2-4/+38
Discard the whole device before starting to create the filesystem structures. Modelled after similar support in mkfs.xfs. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25btrfs-progs: fix wrong extent buffer size when reading tree blockMiao Xie1-1/+3
the root extent buffer of a tree may not be a leaf, so we must get the right size by its level when reading it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25btrfs-progs: Add new feature to mkfs.btrfs to make file system image file ↵Donggeun Kim3-24/+947
from source directory Changes from V1 to V2: - support extended attributes - move btrfs_alloc_data_chunk function to volumes.c - fix an execution error when additional useless parameters are specified - fix traverse_directory function so that the insertion functions for the common items are invoked in a single point The extended attributes is implemented through llistxattr and getxattr function calls. Thanks Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Btrfs-progs: Update man page for mixed data+metadata option.Mitch Harder1-0/+7
Update the mkfs.btrfs man page for the -M option to mix data and metadata chunks. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Add the "btrfs filesystem label" commandGoffredo Baroncelli9-6/+222
Hi all, this patch adds the command "btrfs filesystem label" to change (or show) the label of a filesystem. This patch is a subset of the one written previously by Morey Roof. I included the user space part only. So it is possible only to change/show a label of a *single device* and *unounted* filesystem. The reason of excluding the kernel space part, is to simplify the patch in order to speed the check and then the merging of the patch itself. In fact I have to point out that in the past there was almost three attempts to propose this patch, without success neither complaints. Chris, let me know how you want to proceed. I know that you are very busy, and you prefer to work to stabilize btrfs instead adding new feature. But I think that changing a label is a *essential* feature for a filesystem managing tool. Think about a mount by LABEL. To show a label $ btrfs filesystem label <device> To set a label $ btrfs filesystem label <device> <newlabel> Please guys, give a look to the source. Comments are welcome. You can pull the source from the branch "label" of the repository http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git Regards G.Baroncelli Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Deprecate btrfsctl, btrfs-show, btrfs-volGoffredo Baroncelli5-0/+21
Hi all, the patch below deprecates the following programs * btrfsctl * btrfs-vol * btrfs-show the reason is simple, these programs are superseded by the btrfs utility, both in terms of documentation, usability and bug. The goal is to avoid to duplicate codes and avoid update two programs. The patch adds a warning in the man pages, in the INSTALL file and in the programs. $ ./btrfsctl ** ** WARNING: this program is considered deprecated ** Please consider to switch to the btrfs utility ** no valid commands given usage: btrfsctl [ -d file|dir] [ -s snap_name subvol|tree ] [-r size] [-A device] [-a] [-c] [-D dir .] -d filename: defragments one file -d directory: defragments the entire Btree -s snap_name dir: creates a new snapshot of dir -S subvol_name dir: creates a new subvolume -r [+-]size[gkm]: resize the FS by size amount -A device: scans the device file for a Btrfs filesystem -a: scans all devices for Btrfs filesystems -c: forces a single FS sync -D: delete snapshot -m [tree id] directory: set the default mounted subvolume to the [tree id] or the directory Below the patch, but it is possible to pull the changes from: http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git branch btrfs-deprecated Comments are welcome. G.Baroncelli INSTALL | 5 +++++ btrfs-show.c | 5 +++++ btrfs-vol.c | 5 +++++ btrfsctl.c | 5 +++++ man/btrfs-show.8.in | 3 +++ man/btrfsctl.8.in | 3 +++ 6 files changed, 26 insertions(+), 0 deletions(-) the tool to create a new snapshot for the filesystem. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Update/clean up btrfs help and man page V2Goffredo Baroncelli3-33/+49
Hi all, enclose you can find a patch which improves the help of the btrfs commands, updates the INSTALL file and the btrfs (command) man page. Regarding the help of the btrfs command: - moved the "subvolume set-default" command in the "subvolume" commands group - removed a wrong new line - small tweak on the basis of Andreas suggestion Regarding the btrfs command man page: - renaming the command "device balance" in "filesystem balance" (thanks to Andreas Phillipp to highlight that) - adding the entry "subvolume find-new" - document the switches of the command "filesystem defrag" - document the <devid> facility of the command "filesystem resize" - small tweak on the basis of Andreas suggestion Regarding the INSTALL file, which was very old, I removed the reference of the old btrfsctl utility and changed the examples using the btrfs command. I removed the old (and now wrong) statement about the inability to delete a subvolume/snapshot Chris, you can pull the patch from the branch "help_cleanup" of the following repository. http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git (or you can browse the changes at http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git/?p=btrfs- progs-unstable-all.git;a=summary) The patch is very simple: only updates the man page, the INSTALL file and moves/updates some lines in the help of btrfs command. Comments are welcome. Regards G.Baroncelli INSTALL | 29 ++++++++++++++++++++--------- btrfs.c | 24 ++++++++++++------------ man/btrfs.8.in | 45 +++++++++++++++++++++++++-------------------- 3 files changed, 57 insertions(+), 41 deletions(-) all the block devices. .TP @@ -138,21 +143,21 @@ can expand the partition before enlarging the filesystem and shrink the partition after reducing the size of the filesystem. .TP -\fBfilesystem show\fR [<uuid>|<label>]\fR -Show the btrfs filesystem with some additional info. If no UUID or label is -passed, \fBbtrfs\fR show info of all the btrfs filesystem. +\fBfilesystem show\fR [<device>|<uuid>|<label>]\fR +Show the btrfs filesystem with some additional info. If no argument is +passed, \fBbtrfs\fR shows info of all the btrfs filesystems. .TP -\fBdevice balance\fR \fI<path>\fR +\fBfilesystem balance\fR \fI<path>\fR Balance the chunks of the filesystem identified by \fI<path>\fR across the devices. .TP -\fBdevice add\fR\fI <dev> [<dev>..] <path>\fR +\fBdevice add\fR\fI <device> [<device>...] <path>\fR Add device(s) to the filesystem identified by \fI<path>\fR. .TP -\fBdevice delete\fR\fI <dev> [<dev>..] <path>\fR +\fBdevice delete\fR\fI <device> [<device>...] <path>\fR Remove device(s) from a filesystem identified by \fI<path>\fR. .PP Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Update for lzo supportLi Zefan5-13/+42
[Btrfs-Progs][V2] Update for lzo support - Add incompat flag, otherwise btrfs-progs will report error when operating on btrfs filesystems mounted with lzo option. - Update man page. - Allow to turn on lzo compression for defrag operation: # btrfs filesystem defragment -c[zlib, lzo] <file> Note: "-c zlib" will fail, because that's how getopt() works for optional arguments. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Btrfs-progs: add support for mixed data+metadata block groupsJosef Bacik6-49/+112
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>
2011-10-25Btrfs-progs: update super fields for space cacheJosef Bacik2-1/+6
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>
2011-10-25Improve error handling in the btrfs commandGoffredo Baroncelli3-34/+89
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>
2011-10-25update man page to new defragment command interfaceHubert Kario1-7/+26
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>
2011-10-25Btrfs-progs utils Informative errorsGoldwyn Rodrigues1-2/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Btrfs-progs use safe string manipulation functionsEduardo Silva4-13/+14
Signed-off-by: Eduardo Silva <eduardo.silva@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-10-25Btrfs-progs: add a btrfs-select-super command to overwrite the superChris Mason4-1/+104
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>
2011-04-22Check for RAID10 in set_avail_alloc_bitsChris Mason1-0/+1
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>
2011-04-22Fill missing devices so degraded filesystems can be readChris Mason2-2/+14
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>
2011-04-22Fix the help text for btrfs-map-logicalChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-10-06btrfs-debug-tree: add -d option to print only the device mappingChris Mason1-14/+17
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-10-05Add rescue command to zero the logChris Mason2-0/+72
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-10-04Add btrfsck option to select the super block copyChris Mason1-4/+25
btrfsck -s 0 uses the defult 0, -s 1 uses copy #1 etc. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-09-23Fix undefined reference to symbol 'error_message'Yan Zheng1-1/+1
defination of error_message was moved into libcom_err.so Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23Fix inode link count checks in btrfsckYan Zheng1-2/+6
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23Handle bad extent type caseFrederic Weisbecker1-0/+9
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>
2010-09-23Fix use after free in close_ctreeJeff Mahoney1-5/+5
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>
2010-09-23Make csum_tree_block_size complain about the right thing.Zhu Yanhai1-1/+1
It dereferenced a wrong pointer before. Signed-off-by: Zhu Yanhai <yanhai.zhu@linux.intel.com>
2010-09-23fix incompat flagsJosef Bacik1-1/+3
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>
2010-09-23Avoid uninitialized variant compile warningZhao Lei1-3/+3
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>
2010-09-23fix a compile fail by strndup in RHEL5 envZhao Lei2-1/+2
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>
2010-09-23fix wrong return valueMiao Xie1-2/+2
btrfsctl returns 1 if it does something successfully. this patch fixes this problem. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
2010-09-23Remove superfluous WARN_ON in btrfsckYan Zheng1-1/+0
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23add mounted-checking for btrfs-volMiao Xie1-2/+16
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>
2010-09-23only print FIRST_CHUNK_TREE for chunk items in debug-treeSage Weil1-2/+5
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>
2010-09-23check slash in deleting subvolumesTARUISI Hiroaki1-0/+11
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>
2010-09-23add missing include for btrfsck.cChristian Hesse1-0/+1
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>
2010-09-23prevent btrfsck to run on mounted filesystemsAndi Drebes1-0/+10
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>
2010-09-23multidevice support for check_mountedAndi Drebes3-33/+210
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>
2010-04-06Btrfs: add btrfs-debug-tree -b <block number> to print a single blockChris Mason6-13/+42
2010-03-18Add btrfs subvol find-new commandChris Mason6-11/+465
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.
2010-03-15Add ioctl-test.c which just prints all the ioctl numbers.Chris Mason2-0/+39
This is used to compare the output on 64 bit and 32 bit machines and make sure all of our ioctls are compat defined.
2010-03-14Btrfs-progs: add btrfs filesystem df to print space infoJosef Bacik4-0/+107
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>
2010-03-11Update the btrfs man page with the new commandsGoffredo Baroncelli1-0/+170
2010-03-11Correct the check of the argument number for the "btrfs dev add|rem" commandsGoffredo Baroncelli2-6/+8
2010-03-11Avoid the exit(2) function; instead return with an appropriate value;Goffredo Baroncelli1-6/+9
2010-03-11Add the program name as the first parameter in the command of the btrfs toolGoffredo Baroncelli2-31/+91
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-03-11new util: 'btrfs'ghigo7-171/+1167
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>
2010-03-11Add new defrag range ioctl that can also compress files on demand.Chris Mason3-3/+185
2010-02-28Btrfs-progs: add command to set default subvolJosef Bacik2-0/+18
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>
2010-02-28Add btrfs-list for listing subvolumesChris Mason4-1/+541
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-11-12Add btrfs-map-logical program to map and read logical block numbersChris Mason2-1/+226
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>
2009-09-21btrfsck: check root back/forward referencesYan, Zheng1-34/+410
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>
2009-09-21btrfsctl: add snapshot/subvolume destroy ioctlYan, Zheng2-1/+17
resend Aaron Straus's patch Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-12used space accounting fix for the converterYan Zheng1-7/+0
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>
2009-06-11btrfs-progs v0.19Chris Mason1-1/+1
2009-06-11Check duplicate backrefs for both data and metadataYan Zheng1-8/+2
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>
2009-06-08Make sure all dirty blocks are written at commit timeYan Zheng1-19/+13
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>
2009-06-08Update converter for the new formatYan Zheng4-168/+145
Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-08Mixed back reference (FORWARD ROLLING FORMAT CHANGE)Chris Mason15-1213/+2725
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
2009-06-03Fix man page headers to include the correct program name.Chris Mason2-2/+2
2009-06-03Fix printf format casting errorsLuca Bruno4-7/+12
There are still some warnings of the form: format '%llu' expects type 'long long unsigned int' but argument has type 'u64' In conjunction with -Werror, this is causing some build failures. Now they're properly casted, avoiding compiler warnings. Signed-off-by: Luca Bruno <lucab@debian.org> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Fix spelling mistake when running 'btrfsck' when argument doesn't exist.nick d1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Update btrfs-debug-tree to output more readable strings.Shen Feng3-31/+102
output objectid in btrfs_disk_key with human readable strings. Other updates are included for more readable output. Thanks Fengguang's fix to this patch. Signed-off-by: Shen Feng <shen@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Add btrfs-show man pagePeng Tao2-1/+24
Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Add -V|--version to mkfs.btrfs argument parserLuca Bruno1-1/+11
mkfs.btrfs now prints its version when invoked with -V|--version and exits without error. All other mkfs.* tools provide this feature and follow this implicit argument naming convention, as it is commonly used to check for helper tools presence. The corrisponding manual already mentions this option, no need to touch it. Signed-off-by: Luca Bruno <lucab@debian.org> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Add btrfs-image man pagePeng Tao2-1/+38
Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03Fix typos in btrfsck, btrfsctl, mkfs.btrfs manualPeng Tao3-3/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-05-13Fix print-tree.c to skip blocks it can't read instead of abortingChris Mason1-0/+6
2009-04-15Add scan of the btrfs log tree to btrfs-debug-treeChris Mason5-11/+73
2009-03-09Fix showblocks to display different colors for different metadata rootsChris Mason1-32/+51
2009-01-21Add man/btrfsck.8.in and Makefile for man pagesGoldwyn Rodrigues2-0/+44
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@gmail.com>
2009-01-21Add man/btrfsctl.8.inGoldwyn Rodrigues1-0/+45
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@gmail.com>
2009-01-21Add man/mkfs.btrfs.8.inGoldwyn Rodrigues1-0/+63
Kept the name with the name in, so that further processing such as BUILD_DATE BUILD_VERSION etc. could be included later. All man pages included in the man directory to avoid file cluttering. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
2009-01-21btrfsck.c: bit-fields should be unsignedWang Cong1-11/+11
Signed-off-by: WANG Cong <wangcong@zeuux.org>
2009-01-21btrfsck: Exit and print error message when not able to open a deviceThadeu Lima de Souza Cascardo2-0/+4
If btrfsck is not able to open a device, it segfaults. This fixes it and prints an error message too.
2009-01-21btrfs-image.c: fix return valuesWang Cong1-3/+3
- Exit with non-zero when fail; - Don't exit in non-main functions, return. Signed-off-by: WANG Cong <wangcong@zeuux.org>
2009-01-21btrfs-progs: make several functions staticWang Cong2-6/+6
Make several functions static, and make one argument const. Signed-off-by: WANG Cong <wangcong@zeuux.org>
2009-01-21Fix misleading error message in btrfsctlCalvin Walton1-0/+4
This updates Peter Klotz's original patch to use perror instead of fprintf when it fails to open /dev/btrfs-control
2009-01-21Mention minimum size on devices that are considered too smallJan Engelhardt1-1/+2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
2009-01-21Modify Makefile to include man directoryGoldwyn Rodrigues1-2/+9
2009-01-21Update convert for uninitialized block groupsYan Zheng1-4/+40
There is a new feature 'uninitialized block groups' in ext4. Block and inode bitmaps in uninitialized block groups are uninitialized. This confuses the converter. The fix is call ext2fs_new_inode for each block group at open time. It set up uninitialized block and inode bitmaps appropriately. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2009-01-21Drop bit-radix.[ch] filesChris Mason1-2/+2
These are no longer in use Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-16Update version.sh to 0.18Chris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-16Fix ioctl arg size (userland incompatible change!)Chris Mason2-9/+4
The structure used to send device in btrfs ioctl calls was not properly aligned, and so 32 bit ioctls would not work properly on 64 bit kernels. We could fix this with compat ioctls, but we're just one byte away and it doesn't make sense at this stage to carry about the compat ioctls forever at this stage in the project. This patch brings the ioctl arg up to an evenly aligned 4k. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-12Update version.sh to v0.17Chris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-12Fix isize/nbytes update bugs in btrfs-convertYan Zheng2-8/+32
These fix a few converter problems found by the new btrfsck code. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2009-01-11Fix mispatch of the experimental warningsChris Mason1-0/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-09Warn user that this release is experimentalJim Owens0-0/+0
Post wiki pointer message for getting version status, limitations, and known problems. Signed-off-by: jim owens <jowens@hp.com>
2009-01-09Fix an accessing freed memory bug in btrfsckYan Zheng1-5/+7
2009-01-07Rename debug-tree to btrfs-debug-treeChris Mason1-3/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-07Add error processing for btrfsctl -aShen Feng2-5/+12
brfsctl -a will do nothing and no error is output if btrfs.ko is not inserted. Since no caller do error processing for btrfs_register_one_device, make its return void and do error processing inside. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
2009-01-07debug-tree output tree/key type instead of idShen Feng2-13/+138
This makes the tree name and key type output more readable. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
2009-01-07Update BUG_ON and WARN_ONShen Feng1-2/+3
Define BUG_ON and WARN_ON as assert for easy debugging. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
2009-01-07Add semantic checks to btrfsck for files and directoriesYan Zheng5-49/+1309
This patch makes btrfsck check more things, including directory items, file extents, checksumming, inode link counts etc. The code for these checks is similar to the code verifies extent back references. The main difference is that shared tree blocks are treated specially. The partial checking results(unresolved references and/or errors) of shared sub-trees are cached. This avoids scanning the shared blocks several times. Thank you, Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2009-01-07Fix compile error in quick-test.c of btrfs progsLiu Hui1-1/+2
2009-01-07Fix mkfs.btrfs usage help to match the current argsShen Feng1-1/+5
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
2009-01-07Make the minimum filesystem size error message more clearShen Feng1-0/+7
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
2008-12-17Btrfs: update converter for the new disk formatYan Zheng12-362/+824
This patch updates the ext3 to btrfs converter for the new disk format. This mainly involves changing the convert's data relocation and free space management code. This patch also ports some functions from kernel module to btrfs-progs. Thank you, Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-12-08Btrfs: Add inode sequence number for NFS and reserved space in a few structsChris Mason2-0/+29
This adds a sequence number to the btrfs inode that is increased on every update. NFS will be able to use that to detect when an inode has changed, without relying on inaccurate time fields. While we're here, this also: Puts reserved space into the super block and inode Adds a log root transid to the super so we can pick the newest super based on the fsync log as well as the main transaction ID. For now the log root transid is always zero, but that'll get fixed. Adds a starting offset to the dev_item. This will let us do better alignment calculations if we know the start of a partition on the disk. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-12-05superblock duplicationYan Zheng7-37/+140
This patch updates btrfs-progs for superblock duplication. Note: I didn't make this patch as complete as the one for kernel since updating the converter requires changing the code again. Thank you, Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-12-08Btrfs: move data checksumming into a dedicated treeChris Mason5-10/+51
Btrfs stores checksums for each data block. Until now, they have been stored in the subvolume trees, indexed by the inode that is referencing the data block. This means that when we read the inode, we've probably read in at least some checksums as well. But, this has a few problems: * The checksums are indexed by logical offset in the file. When compression is on, this means we have to do the expensive checksumming on the uncompressed data. It would be faster if we could checksum the compressed data instead. * If we implement encryption, we'll be checksumming the plain text and storing that on disk. This is significantly less secure. * For either compression or encryption, we have to get the plain text back before we can verify the checksum as correct. This makes the raid layer balancing and extent moving much more expensive. * It makes the front end caching code more complex, as we have touch the subvolume and inodes as we cache extents. * There is potentitally one copy of the checksum in each subvolume referencing an extent. The solution used here is to store the extent checksums in a dedicated tree. This allows us to index the checksums by phyiscal extent start and length. It means: * The checksum is against the data stored on disk, after any compression or encryption is done. * The checksum is stored in a central location, and can be verified without following back references, or reading inodes. This makes compression significantly faster by reducing the amount of data that needs to be checksummed. It will also allow much faster raid management code in general. The checksums are indexed by a key with a fixed objectid (a magic value in ctree.h) and offset set to the starting byte of the extent. This allows us to copy the checksum items into the fsync log tree directly (or any other tree), without having to invent a second format for them. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-12-02Rev the disk format for the compat code and the csum selectionChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-12-02btrfs-progs: support for different csum algorithimsJosef Bacik5-27/+70
This is the btrfs-progs version of the patch to add the ability to have different csum algorithims. Note I didn't change the image maker since it seemed a bit more complicated than just changing some stuff around so I will let Yan take care of that. Everything else was converted and for now a mkfs just sets the type to be BTRFS_CSUM_TYPE_CRC32. Signed-off-by: Josef Bacik <jbacik@redhat.com>
2008-12-02btrfs-progs: add support for compat flagsJosef Bacik1-10/+22
This patch updates btrfs-progs with the disk format changes for the compatability flags. Signed-off-by: Josef Bacik <jbacik@redhat.com>
2008-12-02Fix image tool compile warningsyanhai zhu1-4/+5
2008-11-20Btrfs image toolYan Zheng7-18/+894
This patch adds btrfs image tool. The image tool is a debugging tool that creates/restores btrfs metadump image. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-11-18Update the super magic string to match the seed and root format changesChris Mason1-1/+1
2008-11-18Add disk format requirements for subvol backward and forward refsChris Mason3-19/+70
2008-11-18Modify the subvol and snapshot creation ioctls to work anywhere in the treeChris Mason2-29/+81
This changes the snapshot and subvol ioctl API and command lines so that new snapshots and subvols can be created anywhere. Subvolume creation hasn't changed much: btrfsctl -S subvol_name directory This creates a new subvolume under 'directory' Snapshot creation looks the same, but is actually different: btrfsctl -s full_path_to_new_snapshot file_or_dir For example: btrfsctl -s /mnt/new_snap /mnt/subvol Will create a new snapshot named new_snap under /mnt of the root found in /mnt/subvol. It always snapshots the entire root regardless of which file or directory inside the root you give it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-11-18update btrfs-progs for seed device supportYan Zheng9-52/+342
This patch does the following: 1) Update device management code to match the kernel code. 2) Allocator fixes. 3) Add a program called btrfstune to set/clear the SEEDING super block flags.
2008-10-31Add fallocate support v2Yan Zheng3-24/+46
This patch updates btrfs-progs for fallocate support. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-10-30Avoid tree of tree root cow when committing a clean FSChris Mason1-0/+3
The root node generation number code made commit_tree_root look like the kernel code. It forces a cow of the tree of tree roots even when the FS hasn't changed. This causes errors during fsck and other readonly operations. This adds a check to see if commit_tree_root is going to trigger writes to the tree of tree roots, and bails if none are pending. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-10-29Rev the disk format for compression and root pointer generation fieldsChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-10-29Add root tree pointer transaction idsYan Zheng4-4/+33
This patch adds transaction IDs to root tree pointers. Transaction IDs in tree pointers are compared with the generation numbers in block headers when reading root blocks of trees. This can detect some types of IO errors. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-10-29Add disk format elements for compressionChris Mason2-8/+58
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-10-09Rev the disk format for the new back reference formatChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-10-09Count space allocated to file in bytesYan Zheng2-6/+6
This patch updates btrfs-progs for counting space allocated to file in bytes. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-10-09Remove offset field from struct btrfs_extent_refYan Zheng7-117/+71
The offset field in struct btrfs_extent_ref records the position inside file that file extent is referenced by. In the new back reference system, tree leaves holding reference to file extent are recorded explicitly. We can quickly scan these tree leaves, so the offset field is not required. This patch also makes the back reference system check the objectid when extents are being deleted Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-09-26update mkfs.btrfs for the new space balancing codeZheng Yan1-0/+29
The new space balancing code needs a subvol to store the temporary inode for data extent relocation. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-23Full back reference supportZheng Yan9-666/+929
This patch makes the back reference system to explicit record the location of parent node for all types of extents. The location of parent node is placed into the offset field of backref key. Every time a tree block is balanced, the back references for the affected lower level extents are updated.
2008-09-05Disk format changes required for write ahead tree logChris Mason1-2/+20
2008-08-21Rev the disk formatChris Mason1-1/+1
2008-08-20Switch btrfs_name_hash() to crc32cDavid Woodhouse3-107/+7
Date: Tue, 19 Aug 2008 19:21:22 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-08-20Use git for version number tooDavid Woodhouse1-1/+17
Date: Tue, 19 Aug 2008 18:57:17 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-08-06fix btrfs-progs version scriptEric Sandeen1-1/+1
btrfs-progs-0.16.tar.bz2 seems to be distributed w/o an .hg, which make the version.sh script go bonk. Signed-off-by: Eric Sandeen <sandeen@redhat.com> ---
2008-08-04Added tag v0.16 for changeset 2b26e4f8c71eChris Mason1-0/+1
2008-08-04Update version.sh to v0.16Chris Mason1-1/+1
2008-07-30btrfs-convert: Iterate correctly using libext2fs functionsRadoslaw Szkodzinski1-28/+33
This patch corrects open-coded inode_map iteration, which happens to be illegal in new libext2fs due to inode_map being private, causing warning, which becomes a compile error.
2008-07-30Cleanup btrfsctl help messageemail.ahmedkamal@googlemail.com1-9/+10
Many options were not mentioned in the usage message, fix that and cleaning up the brackets Signed-Off-By: Ahmed Kamal <email.ahmedkamal@googlemail.com>
2008-07-30Fix: btrfsctl arguments handlingAhmed1-1/+1
btrfsctl -A in the current -unstable branch, does not result in the error message designated for it, namely "-A requires an arg\n"
2008-07-30btrfs-convert new dir index supportYan1-10/+12
This patch updates btrfs-convert for the new dir index format.
2008-07-30btrfs-progs: add orphan support to print-treeJosef Bacik2-0/+7
This adds orphan support to print-tree so when debug_tree hits an orphan item it will print out "orphan item" under it so you know what it is
2008-07-24Rev the disk formatChris Mason1-1/+1
2008-07-24btrfs-progs new dir index supportJosef Bacik5-6/+12
2008-07-24Print the version string in a few programsChris Mason6-3/+28
2008-07-23Add version stringsChris Mason1-0/+43
2008-07-23Add .hgignore file to ignore verison.hChris Mason1-0/+1
2008-06-10Add sync and transaction ioctl defsChris Mason2-0/+12
btrfsctl -c forces a single FS sync The transaction ioctls are unsafe for general use because they can lead to deadlocks if the application is not very careful. But, ceph is experimenting with btrfs as a backing store, and these ioctls are required for testing.
2008-06-09btrfsctl: print usage when called with bad argsLinda Knippers1-1/+6
2008-05-29Added tag v0.15 for changeset e6571e2ce0c8Chris Mason1-0/+1
2008-05-13Verify parent generation number on btree readsChris Mason8-14/+58
2008-05-12Pass down the expected generation number when reading tree blocksChris Mason7-50/+52
2008-05-12Fix the pretty print code for num_bytes == 0Chris Mason1-0/+2
2008-05-05Add a readonly flag open_ctree to force RO opensChris Mason9-21/+38
2008-05-02bcp updates for single file copiesChris Mason1-47/+78
2008-05-02Add bcp to test the clone file ioctlChris Mason1-0/+130
2008-05-02Fix compiler warning in volumes.cChris Mason2-1/+4
2008-05-02Add the clone ioctl numberChris Mason1-0/+1
2008-05-01Fix uninitialized variables, and use -O so gcc starts checking for themChris Mason4-6/+7
Gcc only sends warnings for uninitialized variables when you compile with -O, and there were a couple of bugs sprinkled in the code. The biggest was the alloc_start variable for mkfs, which can cause strange things to happen. (thanks to Gabor Micsko for helping to find this)
2008-04-29Added tag v0.14 for changeset 969099968b60Chris Mason1-0/+1
2008-04-28Fix btrfs-convert's large file support.Zhu1-0/+4
This patch add ext2_inode.i_size_high into account when calculating regular file's size in btrfs-convert, which makes it deal with large files bigger than 4GB properly.
2008-04-28Add btrfs-vol command to balance, add and (eventually) remove devicesChris Mason5-2/+162