[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>
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>
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>
Hi Chris,
below is enclosed a trivial patch, which has the aim to improve the error
reporting of the "btrfs" command.
You can pull from
http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git
branch
strerror
I changed every printf("some-error") to something like:
e = errno;
fprintf(stderr, "ERROR: .... - %s", strerror(e));
so:
1) all the error are reported to standard error
2) At the end of the message is printed the error as returned by the system.
The change is quite simple, I replaced every printf("some-error") to the line
above. I don't touched anything other.
I also integrated a missing "printf" on the basis of the Ben patch.
This patch leads the btrfs command to be more "user friendly" :-)
Regards
G.Baroncelli
btrfs-list.c | 40 ++++++++++++++++++++++--------
btrfs_cmds.c | 77 ++++++++++++++++++++++++++++++++++++++++-----------------
utils.c | 6 ++++
3 files changed, 89 insertions(+), 34 deletions(-)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Update
btrfs filesystem defragment
command explanation. Add explanation of advanced parameters and notes
about general usage.
Add few notes about the
btrfs <command> --help
usage, fix related grammar.
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Btrfs 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Check_mount() should also work with multi device filesystems.
This patch adds checks that allow to detect if a file is a device
file used by a mounted single or multi device btrfs or if it is a
regular file used by a loopback device that is part of a mounted
single or multi device btrfs.
The single device checks also work for non-btrfs filesystems.
This might be helpful to prevent users from running btrfs programs
(e.g. mkfs.btrfs) accidentally on a filesystem used somewhere else.
Signed-off-by: Andi Drebes <lists-receive@programmierforen.de>
btrfs-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.
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>
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>
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>
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>
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>
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>
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>
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>