| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current code of list_subvols() has very bad scalability, if we want to
add new filter conditions or new sort methods, we have to modify lots of code.
Beside that, the most code of list_snapshots() is similar to list_subvols(),
So I restructure list_subvols(), and split the subvolume filter function,
the subvolume sort function and the output function from list_subvols().
In order to implement it, we defined some importtant structures:
struct btrfs_list_filter {
btrfs_list_filter_func filter_func;
void *data;
};
struct btrfs_list_comparer {
btrfs_list_comp_func comp_func;
int is_descending;
};
struct {
char *name;
char *column_name;
int need_print;
} btrfs_list_columns[];
If we want to add a new filter condition, we can choose a suitable filter
function, or implement a new filter function[1], and add it into a set of
the filters, and then pass the filter set into list_subvols(). We also can
mix several filters (just add those filters into the set, and pass the set
into list_subvols()) if the users specify two or more filter conditions.
The subvolume sort function is similar to the subvolume filter function. The
differentiation is the order of comparers in the array which is passed into
list_subvols() show us the priority of the sort methods.
The output function is different with the above two functions, we define a
array to manage all the columns that can be outputed, and use a member variant
(->need_print) to control the output of the relative column. Some columns are
outputed by default. But we can change it according to the requirement of the
users.
After appling this patch, we needn't implement a independent list_snapshots()
function, just pass a filter function which is used to identify the snapshot
into list_subvols().
[1]: If we implement new filter functions or compare functions, we must add
them into the array all_filter_funcs or the array all_comp_funcs, and modify
the relative enum variants(btrfs_list_filter_enum, btrfs_list_comp_enum).
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now we check if the root item contains otime and uuid or not by comparing
->generation_v2 and ->generation of the btrfs_root_item structure, it is
wrong because it is possbile that ->generation may equal to the first
variant of the next item. We fix this problem by check the size of btrfs_root_item,
if it is larger than the original one, the new btrfs_root_item contains otime
and uuid. we needn't worry the case that the new filesystem is mounted on the
old kernel. because the otime and uuid are not changed on the old kernel, we can
get the correct result even on the kernel.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
| |
Since the uuid output function has been implemented, we should update
the usage to tell the users.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
| |
This patch fixes the following warning:
cmds-subvolume.c:283:3: warning: implicit declaration of function "list_snapshots"
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
| |
Move the function declarations to a new head file.
Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
| |
btrfs f l /
No valid Btrfs found on /
Segmentation fault (core dumped)
open_ctree can return NULL, we need to check that.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
|
| |
Applications would need to know the uuid to manage the configurations
associated with the subvol and snapshots
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
| |
Reviewed-by: Alexander Block <ablock84@googlemail.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea is that we usually use snapshot to backup/restore our data, and the
common way can be a cron script which makes lots of snapshots, so we can end
up with spending some time to find the latest snapshot to restore.
This adds a feature for 'btrfs subvolume list' to let it list snapshots by their
_created_ generation.
What we need to do is just to list them in descending order and get the latest
snapshot. What's more, we can find the oldest snapshot as well by listing
snapshots in ascending order.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the ability to show root's modification generation when we use
btrfs subvol list.
NOTE:
Like file's atime and ctime, root's generation also has 'creation generation'
and 'modification generation'.
The generation that we're going to show is 'modification generation', and the
next patch is going to show 'creation generation'.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
|
|
|
|
|
|
|
| |
Btrfs's subvolume/snapshot is limited to
[BTRFS_FIRST_FREE_OBJECTID, BTRFS_LAST_FREE_OBJECTID], so just apply the range.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
|
|
|
|
|
|
|
| |
If we find the block by seach corresponding fs tree, we should return 0,
and tell the caller we pass the check.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
btrfsck misinformed "unresolved ref root" message when there were several
snapshots in the file system. The patch(commit cfdd42686c70) tried to fix
this bug, but didn't fix it completely. If the metadata was stored in a
shared leaf of the tree, the problem would happen again. This patch fixes
it by another way, we don't check the relationship of the trees when we
traverse the fs/file tree, we just do the check when we merge the snapshot
records to the root cache.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
|
| |
The variant named 'leaf' in is_child_root() still hold old result after
we get the next leaf, it make btrfsck returns the wrong result, such as
"unresolved ref root ..", fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixed the following warning:
cmds-send.c:464:6: warning: ‘ret' may be used uninitialized in this function [-Wuninitialized]
crc32c.c:121:1: warning: control reaches end of non-void function [-Wreturn-type]
send-utils.c:69:11: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized]
send-utils.c:126:6: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized]
send-utils.c:99:22: warning: ‘entry' may be used uninitialized in this function [-Wuninitialized]
btrfs.c:261:2: warning: implicit declaration of function ‘crc32c_optimization_init' [-Wimplicit-function-declaration]
btrfs.c:105:2: warning: ‘cmd' may be used uninitialized in this function [-Wuninitialized]
restore.c:435:12: warning: ignoring return value of ‘ftruncate', declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Segmentation fault occurred in the following command.
# btrfs qgroup limit
Segmentation fault
So, we should check a minimum number of arguments.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
My patch
04609add88ef8428d725de6ef60f46a3ff0dbc8e
introduced a regression where if you mkfs'ed a group of disks with different
sizes it limited the disks to the size of the first one that is specified.
This was not the intent of my patch, I only want it to limit the size based
on the -b option, so I've reworked the code to pass in a max block count and
that fixes the issue. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
|
|
|
|
|
|
| |
Short options have to be repeated at the getopt_long call.
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
| |
That's what all other mkfs do and there's no reason for 0555.
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
|
| |
The original patch named the option -T, mkfs.xfs uses -K let's keep it
same.
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Arne Jansen <sensille@gmx.net>
|
|
|
|
|
|
|
|
|
|
|
| |
find_mount_root had the problem that it tried to conclude from a file system
path to a mount point, taking the fsid as an indicator. This only works if
no two subvolumes (sharing the same btrfs fsid) are mounted in the same
hierarchy.
Now instead, we're parsing /etc/mtab and look for the longest match.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
|
|
|
|
|
|
|
|
| |
The initial btrfs send code was easily confused by relative paths and by
anything that wasn't in the root of the FS. This fixes it to take
relative paths.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
|
|
|
|
| |
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
|
|
|
|
| |
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
|
|
|
|
|
|
|
|
|
|
| |
Add user space commands for btrfs send/receive.
Signed-off-by: Alexander Block <ablock84@googlemail.com>
Reviewed-by: David Sterba <dave@jikos.cz>
Reviewed-by: Arne Jansen <sensille@gmx.net>
Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
|
|
|
|
|
|
| |
Add btrfs_ioctl_send_args and BTRFS_IOC_SEND to ioctl.h
Signed-off-by: Alexander Block <ablock84@googlemail.com>
|
|
|
|
|
|
| |
Update ctree.h and ioctl.h for the new uuid+times for subvolumes.
Signed-off-by: Alexander Block <ablock84@googlemail.com>
|
|
|
|
|
|
| |
Add printing of inode transid and dir item data field.
Signed-off-by: Alexander Block <ablock84@googlemail.com>
|
|
|
|
|
|
|
| |
Added missing btrfs_ioctl_clone_range_args and BTRFS_IOC_CLONE_RANGE
to ioctl.h
Signed-off-by: Alexander Block <ablock84@googlemail.com>
|
|
|
|
|
|
|
|
| |
Btrfs send/receive and btrfs props needs this ioctl. This patch
requires a recent kernel with the "Btrfs: use _IOR for
BTRFS_IOC_SUBVOL_GETFLAGS" patch applied.
Signed-off-by: Alexander Block <ablock84@googlemail.com>
|
|
|
|
| |
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
|
|
|
|
|
|
|
| |
A recent commit was null terminating the root listing
strings one byte too short.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before commit a46e7ff2 was merged it was possible to create dup for
data+metadata chunks (mixed mode) by giving -m raid1 -d raid1 -M to
mkfs. a46e7ff2 purposefully disabled behind the scenes profile
upgrading/downgrading, so give users a chance to pick dup explicitly and
bail if dup for data is requested in normal mode.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
This adds proper formatting for free space and inode cache items in
btrfs-debug-tree output.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Commit bab2c565 accidentally broke 'subvol get-default' command by
removing almost all of the underlying code. Bring it back with some
fixes and improvements.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Don't pass a pointer to root_id to resolve_root(). It's always the same as
ri->root_id, passing a pointer hints that root_id can somehow change which is
not true.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
|
| |
| |
| |
| |
| |
| | |
There's no need to zero out things twice.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
The right option is 'o' not 'c'. And this tool is used for the block devices
on which there is a btrfs file system, so change "mount_point" to "device".
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
| |
| |
| |
| |
| |
| | |
The old usage is a copy of btrfs-map-logical, it's wrong, fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Usage of balancing btrfs is "btrfs filesystem balance",
not "btrfs device balance". And remove unneeded
usage of "btrfs filesystem defrag".
Also fix some typos and over 80 columns.
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
|
| |
| |
| |
| | |
Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
|
| |
| |
| |
| |
| |
| |
| | |
There were extra spaces around some of the arguments in the man
page for mkfs.
Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The function scrub_fs_info( ) closes and reopen a file handle
passed as argument, when a caller uses the file handle even after the
call.
The function scrub_fs_info( ) is updated to remove the file handle
argument, and instead uses a private own file handle.
The callers are updated to not pass the argument.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The btrfs filesystem resize command defaults to only resizing the
filesystem for devid 1, and must have a devid passed in to resize the
filesystem for the other devices in the filesystem.
Additionally the documentation lacked information on how to actually
resize the underlying partition so this provides a little more detail.
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
Andrei Popa reported that there were two typos of default as dafault,
this patch fixes those two typos up.
Signed-off-by: Chris Samuel <chris@csamuel.org>
|
| |
| |
| |
| | |
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I had a test that creates a 7gig raid1 device but it was ending up wonky
because the second device that gets added is the full size of the disk
instead of the limited size. So enforce the limited size on all disks
passed in at mkfs time, otherwise our threshold calculations end up wonky
when doing chunk allocations. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the fs/file tree is not the parent of the snapshot, it is reasonable
that we can not find the relative reference and back reference. But btrfsck
doesn't consider this case, and reports "unresolved refs" message, it's wrong,
fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
|