On 12/13/16 01:19, David Sterba wrote:
On Tue, Dec 06, 2016 at 12:39:37PM +0800, Anand Jain wrote:
The command,
btrfs fi defrag -v /btrfs
does nothing, it won't defrag the files under /btrfs as user
may expect. The command with recursive option
btrfs fi defrag -vr /btrfs
would defrag all the files under /btrfs including files in
its sub directories.
While attempting to fix this. The patch below 1/1 provides
a cleanup. And the actual fix is pending, as to my understanding
of nfwt() it does not provide the list of file without
files under its sub directories.
What kind of fix do you mean? We could detect if there's a directory in
the list of arguments and assume the recursive mode. I think this is
what most users expect.
As per BTRFS-FILESYSTEM(8)
:
---------
Note
Directory arguments without -r do not defragment files recursively but
will defragment certain internal trees (extent tree and the subvolume
tree). This has been confusing and could be removed in the future.
---------
I was thinking the following as a fix..
without -r: apply it on the extent tree (current behavior)
(and probably add a warning as you suggest below).
with -r only: error, and say also use (new) per-file option -x,
(instead of applying on all files of dir in arg and
its sub-dir. [*])
with -x: apply it on all the files in the dir in the arg
with -xr: apply it on all files in the dir in the arg and
its sub-dir.
Currently passing a directory will defragment the extent tree, but I
think we should extend the defrag ioctl flags to explictly ask for that.
I am ok with this approach as well, which means,
without -r: apply it on all files in dir. (instead of current way
of applying on the extent tree. [*])
with -r: apply it on all files in dir and its sub-dir.
with -e (new): apply it on extent tree.
[*] changes the current cli semantics
At minimum, a directory without -r could print a warning about what it's
really doing. But I'm open to other ideas.
agreed.
(was on vacation sorry for the delay).
Thanks, Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html