platform/upstream/btrfs-progs.git
13 years agogcc 4.6: fix potentially unused variable
Hugo Mills [Thu, 28 Jul 2011 21:17:57 +0000 (22:17 +0100)]
gcc 4.6: fix potentially unused variable

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>
13 years agomake btrfs cross compilation friendly
Kamble, Nitin A [Tue, 28 Jun 2011 19:11:35 +0000 (12:11 -0700)]
make btrfs cross compilation friendly

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

13 years agomkfs.btrfs: Fix compilation errors with gcc 4.6
Hugo Mills [Sun, 26 Jun 2011 18:41:18 +0000 (19:41 +0100)]
mkfs.btrfs: Fix compilation errors with gcc 4.6

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>
13 years agoBtrfs-progs: Correct path munging in bcp
cwillu [Mon, 13 Jun 2011 22:24:11 +0000 (16:24 -0600)]
Btrfs-progs: Correct path munging in bcp

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>
13 years agobtrfs-map-logical: segfaults when no output file is given
Arne Jansen [Mon, 14 Mar 2011 11:57:49 +0000 (12:57 +0100)]
btrfs-map-logical: segfaults when no output file is given

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>
13 years agomkfs.btrfs: fix error text in '-r' mode
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:24 +0000 (11:19 +0300)]
mkfs.btrfs: fix error text in '-r' mode

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>
13 years agomkfs.btrfs: fix memory leak caused by 'scandir()' calls
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:23 +0000 (11:19 +0300)]
mkfs.btrfs: fix memory leak caused by 'scandir()' calls

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
13 years agomkfs.btrfs: free buffers allocated by pretty_sizes
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:22 +0000 (11:19 +0300)]
mkfs.btrfs: free buffers allocated by pretty_sizes

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>
13 years agomkfs.btrfs: write zeroes instead on uninitialized data.
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:21 +0000 (11:19 +0300)]
mkfs.btrfs: write zeroes instead on uninitialized data.

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>
13 years agomkfs.btrfs: fix symlink names writing
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:20 +0000 (11:19 +0300)]
mkfs.btrfs: fix symlink names writing

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>
13 years agomkfs.btrfs: return some defined value instead of garbage when lookup checksum
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:19 +0000 (11:19 +0300)]
mkfs.btrfs: return some defined value instead of garbage when lookup checksum

==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>
13 years agomkfs.btrfs: fail on scandir error (-r mode)
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:18 +0000 (11:19 +0300)]
mkfs.btrfs: fail on scandir error (-r mode)

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>
13 years agobtrfs-convert: fix typo: 'all inode' -> 'all inodes'
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:17 +0000 (11:19 +0300)]
btrfs-convert: fix typo: 'all inode' -> 'all inodes'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
13 years agomake "btrfs filesystem label" command actually work
Fajar A. Nugraha [Thu, 2 Jun 2011 02:54:27 +0000 (09:54 +0700)]
make "btrfs filesystem label" command actually work

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>
13 years agobtrfs progs: fix extra metadata chunk allocation in --mixed case
Arne Jansen [Thu, 5 May 2011 14:16:12 +0000 (16:16 +0200)]
btrfs progs: fix extra metadata chunk allocation in --mixed case

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>
13 years agoincorrect argument checking for "btrfs sub snap -r"
Stephane Chazelas [Thu, 30 Jun 2011 12:34:38 +0000 (13:34 +0100)]
incorrect argument checking for "btrfs sub snap -r"

Looks like this was missing in integration-20110626 for the
readonly snapshot patch:

Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
13 years agobtrfs-progs: Fix over-sized limit on buffer
Hugo Mills [Sun, 12 Jun 2011 20:52:39 +0000 (21:52 +0100)]
btrfs-progs: Fix over-sized limit on buffer

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>
13 years agoUpdated manpage for btrfs subvolume snapshot.
Andreas Philipp [Tue, 26 Apr 2011 08:02:44 +0000 (10:02 +0200)]
Updated manpage for btrfs subvolume snapshot.

Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
13 years agoTest the additional ioctl.
Andreas Philipp [Tue, 26 Apr 2011 08:02:43 +0000 (10:02 +0200)]
Test the additional ioctl.

Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
13 years agoSupport the new parameters in do_clone(int argc, char** argv).
Andreas Philipp [Tue, 26 Apr 2011 08:02:42 +0000 (10:02 +0200)]
Support the new parameters in do_clone(int argc, char** argv).

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>
13 years agoAdd support for read-only subvolumes.
Andreas Philipp [Tue, 26 Apr 2011 08:02:41 +0000 (10:02 +0200)]
Add support for read-only subvolumes.

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>
13 years agoAdded support for an additional ioctl.
Andreas Philipp [Tue, 26 Apr 2011 08:02:40 +0000 (10:02 +0200)]
Added support for an additional ioctl.

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>
13 years agobtrfs-progs: cast u64 to long long to avoid printf warnings
Anton Blanchard [Thu, 7 Apr 2011 11:02:04 +0000 (21:02 +1000)]
btrfs-progs: cast u64 to long long to avoid printf warnings

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>
13 years agoFix unused-but-set errors in gcc-4.6
Chris Ball [Mon, 7 Mar 2011 15:05:21 +0000 (10:05 -0500)]
Fix unused-but-set errors in gcc-4.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>
13 years agoadd detailed help messages to btrfs command
Hubert Kario [Sun, 23 Jan 2011 12:42:43 +0000 (13:42 +0100)]
add detailed help messages to btrfs command

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>
13 years agoadd advanced use of --help to help message
Hubert Kario [Sun, 23 Jan 2011 12:39:36 +0000 (13:39 +0100)]
add advanced use of --help to help message

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>
13 years agomkfs should initialize unused fields properly
Jan Schmidt [Fri, 19 Nov 2010 15:05:27 +0000 (16:05 +0100)]
mkfs should initialize unused fields properly

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>
13 years agobtrfs-progs: setting of time to the root directory
Tsutomu Itoh [Wed, 17 Nov 2010 01:07:52 +0000 (10:07 +0900)]
btrfs-progs: setting of time to the root directory

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>
13 years agobtrfs-progs: add discard support to mkfs
Christoph Hellwig [Thu, 21 Apr 2011 20:24:07 +0000 (16:24 -0400)]
btrfs-progs: add discard support to mkfs

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>
13 years agobtrfs-progs: fix wrong extent buffer size when reading tree block
Miao Xie [Tue, 13 Jul 2010 09:18:04 +0000 (09:18 +0000)]
btrfs-progs: fix wrong extent buffer size when reading tree block

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>
13 years agobtrfs-progs: Add new feature to mkfs.btrfs to make file system image file from source...
Donggeun Kim [Thu, 8 Jul 2010 09:17:59 +0000 (09:17 +0000)]
btrfs-progs: Add new feature to mkfs.btrfs to make file system image file 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>
13 years agoBtrfs-progs: Update man page for mixed data+metadata option.
Mitch Harder [Mon, 15 Nov 2010 16:32:12 +0000 (16:32 +0000)]
Btrfs-progs: Update man page for mixed data+metadata option.

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>
13 years agoAdd the "btrfs filesystem label" command
Goffredo Baroncelli [Sun, 5 Dec 2010 17:46:44 +0000 (17:46 +0000)]
Add the "btrfs filesystem label" command

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>
13 years agoDeprecate btrfsctl, btrfs-show, btrfs-vol
Goffredo Baroncelli [Sun, 5 Dec 2010 17:47:36 +0000 (17:47 +0000)]
Deprecate btrfsctl, btrfs-show, btrfs-vol

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>
13 years agoUpdate/clean up btrfs help and man page V2
Goffredo Baroncelli [Sun, 5 Dec 2010 17:47:45 +0000 (17:47 +0000)]
Update/clean up btrfs help and man page V2

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>
13 years agoUpdate for lzo support
Li Zefan [Thu, 18 Nov 2010 03:49:56 +0000 (03:49 +0000)]
Update for lzo support

[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>
13 years agoBtrfs-progs: add support for mixed data+metadata block groups
Josef Bacik [Thu, 9 Dec 2010 18:31:08 +0000 (18:31 +0000)]
Btrfs-progs: add support for mixed data+metadata block groups

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>
13 years agoBtrfs-progs: update super fields for space cache
Josef Bacik [Thu, 9 Dec 2010 18:27:03 +0000 (18:27 +0000)]
Btrfs-progs: update super fields for space cache

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>
13 years agoImprove error handling in the btrfs command
Goffredo Baroncelli [Mon, 20 Dec 2010 20:06:19 +0000 (20:06 +0000)]
Improve error handling in the btrfs command

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>
13 years agoupdate man page to new defragment command interface
Hubert Kario [Sun, 23 Jan 2011 15:31:07 +0000 (15:31 +0000)]
update man page to new defragment command interface

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>
13 years agoBtrfs-progs utils Informative errors
Goldwyn Rodrigues [Mon, 7 Feb 2011 07:34:36 +0000 (07:34 +0000)]
Btrfs-progs utils Informative errors

Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs-progs use safe string manipulation functions
Eduardo Silva [Mon, 7 Feb 2011 11:55:04 +0000 (08:55 -0300)]
Btrfs-progs use safe string manipulation functions

Signed-off-by: Eduardo Silva <eduardo.silva@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
13 years agoBtrfs-progs: add a btrfs-select-super command to overwrite the super
Chris Mason [Thu, 9 Dec 2010 21:36:29 +0000 (16:36 -0500)]
Btrfs-progs: add a btrfs-select-super command to overwrite the super

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>
13 years agoCheck for RAID10 in set_avail_alloc_bits
Chris Mason [Wed, 15 Dec 2010 21:02:45 +0000 (16:02 -0500)]
Check for RAID10 in set_avail_alloc_bits

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>
13 years agoFill missing devices so degraded filesystems can be read
Chris Mason [Wed, 15 Dec 2010 21:00:23 +0000 (16:00 -0500)]
Fill missing devices so degraded filesystems can be read

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>
13 years agoFix the help text for btrfs-map-logical
Chris Mason [Wed, 15 Dec 2010 20:58:19 +0000 (15:58 -0500)]
Fix the help text for btrfs-map-logical

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agobtrfs-debug-tree: add -d option to print only the device mapping
Chris Mason [Wed, 6 Oct 2010 13:53:38 +0000 (09:53 -0400)]
btrfs-debug-tree: add -d option to print only the device mapping

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoAdd rescue command to zero the log
Chris Mason [Tue, 5 Oct 2010 14:14:48 +0000 (10:14 -0400)]
Add rescue command to zero the log

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoAdd btrfsck option to select the super block copy
Chris Mason [Mon, 4 Oct 2010 19:41:10 +0000 (15:41 -0400)]
Add btrfsck option to select the super block copy

btrfsck -s 0 uses the defult 0, -s 1 uses copy #1 etc.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoFix undefined reference to symbol 'error_message'
Yan Zheng [Thu, 9 Sep 2010 13:42:42 +0000 (21:42 +0800)]
Fix undefined reference to symbol 'error_message'

defination of error_message was moved into libcom_err.so

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
14 years agoFix inode link count checks in btrfsck
Yan Zheng [Thu, 9 Sep 2010 13:41:48 +0000 (21:41 +0800)]
Fix inode link count checks in btrfsck

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
14 years agoHandle bad extent type case
Frederic Weisbecker [Thu, 9 Sep 2010 06:10:28 +0000 (14:10 +0800)]
Handle bad extent type case

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>
14 years agoFix use after free in close_ctree
Jeff Mahoney [Thu, 9 Sep 2010 06:06:09 +0000 (14:06 +0800)]
Fix use after free in close_ctree

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>
14 years agoMake csum_tree_block_size complain about the right thing.
Zhu Yanhai [Thu, 9 Sep 2010 06:02:57 +0000 (14:02 +0800)]
Make csum_tree_block_size complain about the right thing.

It dereferenced a wrong pointer before.

Signed-off-by: Zhu Yanhai <yanhai.zhu@linux.intel.com>
14 years agofix incompat flags
Josef Bacik [Thu, 9 Sep 2010 05:51:49 +0000 (13:51 +0800)]
fix incompat flags

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>
14 years agoAvoid uninitialized variant compile warning
Zhao Lei [Thu, 9 Sep 2010 05:50:26 +0000 (13:50 +0800)]
Avoid uninitialized variant compile warning

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>
14 years agofix a compile fail by strndup in RHEL5 env
Zhao Lei [Thu, 9 Sep 2010 05:49:14 +0000 (13:49 +0800)]
fix a compile fail by strndup in RHEL5 env

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>
14 years agofix wrong return value
Miao Xie [Thu, 9 Sep 2010 05:47:32 +0000 (13:47 +0800)]
fix wrong return value

btrfsctl returns 1 if it does something successfully.
this patch fixes this problem.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
14 years agoRemove superfluous WARN_ON in btrfsck
Yan Zheng [Thu, 9 Sep 2010 05:42:49 +0000 (13:42 +0800)]
Remove superfluous WARN_ON in btrfsck

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
14 years agoadd mounted-checking for btrfs-vol
Miao Xie [Thu, 9 Sep 2010 05:41:47 +0000 (13:41 +0800)]
add mounted-checking for btrfs-vol

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>
14 years agoonly print FIRST_CHUNK_TREE for chunk items in debug-tree
Sage Weil [Thu, 9 Sep 2010 03:46:22 +0000 (11:46 +0800)]
only print FIRST_CHUNK_TREE for chunk items in debug-tree

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>
14 years agocheck slash in deleting subvolumes
TARUISI Hiroaki [Thu, 9 Sep 2010 03:19:25 +0000 (11:19 +0800)]
check slash in deleting subvolumes

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>
14 years agoadd missing include for btrfsck.c
Christian Hesse [Thu, 9 Sep 2010 03:05:12 +0000 (11:05 +0800)]
add missing include for btrfsck.c

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>
14 years agoprevent btrfsck to run on mounted filesystems
Andi Drebes [Thu, 9 Sep 2010 02:58:43 +0000 (10:58 +0800)]
prevent btrfsck to run on mounted filesystems

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>
14 years agomultidevice support for check_mounted
Andi Drebes [Thu, 9 Sep 2010 02:57:02 +0000 (10:57 +0800)]
multidevice support for check_mounted

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>
14 years agoBtrfs: add btrfs-debug-tree -b <block number> to print a single block
Chris Mason [Tue, 6 Apr 2010 13:30:17 +0000 (09:30 -0400)]
Btrfs: add btrfs-debug-tree -b <block number> to print a single block

14 years agoAdd btrfs subvol find-new command
Chris Mason [Thu, 18 Mar 2010 16:32:32 +0000 (12:32 -0400)]
Add btrfs subvol find-new command

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.

14 years agoAdd ioctl-test.c which just prints all the ioctl numbers.
Chris Mason [Mon, 15 Mar 2010 15:24:20 +0000 (11:24 -0400)]
Add ioctl-test.c which just prints all the ioctl numbers.

This is used to compare the output on 64 bit and 32 bit machines and
make sure all of our ioctls are compat defined.

14 years agoBtrfs-progs: add btrfs filesystem df to print space info
Josef Bacik [Wed, 13 Jan 2010 18:21:23 +0000 (18:21 +0000)]
Btrfs-progs: add btrfs filesystem df to print space info

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>
14 years agoUpdate the btrfs man page with the new commands
Goffredo Baroncelli [Thu, 11 Mar 2010 21:32:50 +0000 (22:32 +0100)]
Update the btrfs man page with the new commands

14 years agoCorrect the check of the argument number for the "btrfs dev add|rem" commands
Goffredo Baroncelli [Thu, 11 Mar 2010 21:07:10 +0000 (22:07 +0100)]
Correct the check of the argument number for the "btrfs dev add|rem" commands

14 years agoAvoid the exit(2) function; instead return with an appropriate value;
Goffredo Baroncelli [Thu, 11 Mar 2010 20:51:36 +0000 (21:51 +0100)]
Avoid the exit(2) function; instead return with an appropriate value;

14 years agoAdd the program name as the first parameter in the command of the btrfs tool
Goffredo Baroncelli [Thu, 11 Mar 2010 20:08:22 +0000 (21:08 +0100)]
Add the program name as the first parameter in the command of the btrfs tool

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agonew util: 'btrfs'
ghigo [Sun, 24 Jan 2010 17:00:05 +0000 (18:00 +0100)]
new util: 'btrfs'

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>
14 years agoAdd new defrag range ioctl that can also compress files on demand.
Chris Mason [Thu, 11 Mar 2010 14:38:52 +0000 (09:38 -0500)]
Add new defrag range ioctl that can also compress files on demand.

14 years agoBtrfs-progs: add command to set default subvol
Josef Bacik [Fri, 11 Dec 2009 21:12:07 +0000 (21:12 +0000)]
Btrfs-progs: add command to set default subvol

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>
14 years agoAdd btrfs-list for listing subvolumes
Chris Mason [Sun, 28 Feb 2010 20:29:47 +0000 (15:29 -0500)]
Add btrfs-list for listing subvolumes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoAdd btrfs-map-logical program to map and read logical block numbers
Chris Mason [Thu, 12 Nov 2009 19:34:09 +0000 (14:34 -0500)]
Add btrfs-map-logical program to map and read logical block numbers

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>
15 years agobtrfsck: check root back/forward references
Yan, Zheng [Mon, 21 Sep 2009 20:03:57 +0000 (16:03 -0400)]
btrfsck: check root back/forward references

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>
15 years agobtrfsctl: add snapshot/subvolume destroy ioctl
Yan, Zheng [Mon, 21 Sep 2009 20:03:57 +0000 (16:03 -0400)]
btrfsctl: add snapshot/subvolume destroy ioctl

resend Aaron Straus's patch

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoused space accounting fix for the converter
Yan Zheng [Fri, 12 Jun 2009 16:55:50 +0000 (12:55 -0400)]
used space accounting fix for the converter

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>
15 years agobtrfs-progs v0.19
Chris Mason [Thu, 11 Jun 2009 16:56:15 +0000 (12:56 -0400)]
btrfs-progs v0.19

15 years agoCheck duplicate backrefs for both data and metadata
Yan Zheng [Thu, 11 Jun 2009 13:27:31 +0000 (09:27 -0400)]
Check duplicate backrefs for both data and metadata

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>
15 years agoMake sure all dirty blocks are written at commit time
Yan Zheng [Wed, 3 Jun 2009 15:59:47 +0000 (11:59 -0400)]
Make sure all dirty blocks are written at commit time

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>
15 years agoUpdate converter for the new format
Yan Zheng [Wed, 3 Jun 2009 15:59:47 +0000 (11:59 -0400)]
Update converter for the new format

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoMixed back reference (FORWARD ROLLING FORMAT CHANGE)
Chris Mason [Fri, 29 May 2009 20:35:30 +0000 (16:35 -0400)]
Mixed back reference  (FORWARD ROLLING FORMAT CHANGE)

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

15 years agoFix man page headers to include the correct program name.
Chris Mason [Wed, 3 Jun 2009 16:13:01 +0000 (12:13 -0400)]
Fix man page headers to include the correct program name.

15 years agoFix printf format casting errors
Luca Bruno [Wed, 3 Jun 2009 16:04:41 +0000 (12:04 -0400)]
Fix printf format casting errors

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>
15 years agoFix spelling mistake when running 'btrfsck' when argument doesn't exist.
nick d [Wed, 3 Jun 2009 16:04:41 +0000 (12:04 -0400)]
Fix spelling mistake when running 'btrfsck' when argument doesn't exist.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoUpdate btrfs-debug-tree to output more readable strings.
Shen Feng [Wed, 3 Jun 2009 16:02:23 +0000 (12:02 -0400)]
Update btrfs-debug-tree to output more readable strings.

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>
15 years agoAdd btrfs-show man page
Peng Tao [Wed, 3 Jun 2009 16:00:20 +0000 (12:00 -0400)]
Add btrfs-show man page

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoAdd -V|--version to mkfs.btrfs argument parser
Luca Bruno [Wed, 3 Jun 2009 16:00:20 +0000 (12:00 -0400)]
Add -V|--version to mkfs.btrfs argument parser

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>
15 years agoAdd btrfs-image man page
Peng Tao [Wed, 3 Jun 2009 16:00:20 +0000 (12:00 -0400)]
Add btrfs-image man page

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoFix typos in btrfsck, btrfsctl, mkfs.btrfs manual
Peng Tao [Wed, 3 Jun 2009 16:00:20 +0000 (12:00 -0400)]
Fix typos in btrfsck, btrfsctl, mkfs.btrfs manual

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoFix print-tree.c to skip blocks it can't read instead of aborting
Chris Mason [Wed, 13 May 2009 15:27:35 +0000 (11:27 -0400)]
Fix print-tree.c to skip blocks it can't read instead of aborting

15 years agoAdd scan of the btrfs log tree to btrfs-debug-tree
Chris Mason [Wed, 15 Apr 2009 18:30:14 +0000 (14:30 -0400)]
Add scan of the btrfs log tree to btrfs-debug-tree

15 years agoFix showblocks to display different colors for different metadata roots
Chris Mason [Mon, 9 Mar 2009 17:00:44 +0000 (13:00 -0400)]
Fix showblocks to display different colors for different metadata roots

15 years agoAdd man/btrfsck.8.in and Makefile for man pages
Goldwyn Rodrigues [Wed, 21 Jan 2009 18:22:49 +0000 (13:22 -0500)]
Add man/btrfsck.8.in and Makefile for man pages

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@gmail.com>
15 years agoAdd man/btrfsctl.8.in
Goldwyn Rodrigues [Wed, 21 Jan 2009 18:22:49 +0000 (13:22 -0500)]
Add man/btrfsctl.8.in

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@gmail.com>
15 years agoAdd man/mkfs.btrfs.8.in
Goldwyn Rodrigues [Wed, 21 Jan 2009 18:22:49 +0000 (13:22 -0500)]
Add man/mkfs.btrfs.8.in

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>