Re: [PATCH v2] btrfs-progs: subvol: change subvol set-default to also accept subvol path

2017-10-02 Thread Misono, Tomohiro
On 2017/10/02 18:01, Hugo Mills wrote: > On Mon, Oct 02, 2017 at 11:39:05AM +0300, Andrei Borzenkov wrote: >> On Mon, Oct 2, 2017 at 11:19 AM, Misono, Tomohiro >> <misono.tomoh...@jp.fujitsu.com> wrote: >>> This patch changes "subvol set-default

[PATCH v2] btrfs-progs: subvol: change subvol set-default to also accept subvol path

2017-10-02 Thread Misono, Tomohiro
This patch changes "subvol set-default" to also accept the subvolume path for convenience. This is the one of the issue on github: https://github.com/kdave/btrfs-progs/issues/35 If there are two args, they are assumed as subvol id and path to the fs (the same as current behavior), and if there

Re: [PATCH] btrfs-progs: subvol: change subvol set-default to also accept subvol path

2017-10-02 Thread Misono, Tomohiro
I rethink this and conclude that we should only allow the absolute path to the subvolume in order to prevent setting wrong filesystem by mistake when multiple filesystems are used. I will submit the patch again and please ignore this. Regards, Tomohiro On 2017/10/02 15:25, Misono, Tomohiro

[PATCH] btrfs-progs: subvol: change subvol set-default to also accept subvol path

2017-10-02 Thread Misono, Tomohiro
This patch changes "subvol set-default" to also accept the subvolume path for convenience. This is the one of the issue on github: https://github.com/kdave/btrfs-progs/issues/35 If there are two args, they are assumed as subvol id and path to the fs (the same as current behavior), and if there

[PATCH v2 5/5] btrfs-progs: subvol: fix subvol del --commit-after

2017-09-26 Thread Misono, Tomohiro
Fix subvol del --commit-after to work properly: - SYNC ioctl will be issued even when last delete is failed - SYNC ioctl will be issued on each file system only once in the end To achieve this, get_fsid() and add_seen_fsid() is called after each delete to keep only one fd for each fs. In the

[PATCH v2 4/5] btrfs-progs: change seen_fsid to hold fd and DIR*

2017-09-26 Thread Misono, Tomohiro
Change seen_fsid to hold fd and DIR* in order to keep access to each fs. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo --- cmds-filesystem.c | 4 ++-- utils.c | 6

[PATCH v2 3/5] btrfs-progs: move seen_fsid to util.c

2017-09-26 Thread Misono, Tomohiro
Make is_seen_fsid()/add_seen_fsid()/free_seen_fsid() to common functions. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo --- cmds-filesystem.c | 88

[PATCH v2 2/5] btrfs-progs: move get_fsid() to util.c

2017-09-26 Thread Misono, Tomohiro
Make get_fsid() to a common function. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo --- cmds-property.c | 30 -- utils.c | 31

[PATCH v2 1/5] btrfs-progs: subvol: exchange subvol del --commit-after and --commit-each

2017-09-26 Thread Misono, Tomohiro
Current code is reversed in --commit-after and --commit-each operation. i.e. --commit-after means --commit-each actually. This patch fix this and also introduces enum type for more readable code. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo

[PATCH v2 0/5] btrfs-progs: subvol: fix del --commit-after

2017-09-26 Thread Misono, Tomohiro
Fix subvol del --commit-after to work properly: - SYNC ioctl will be issued even when last delete is failed - SYNC ioctl will be issued on each file system only once in the end To achieve this, each deleted subvol's (parent's) fsid is checked each time. If the fsid is seen for the first time,

Re: [PATCH 3/4] btrfs-progs: change seen_fsid to hold fd and DIR*

2017-09-26 Thread Misono, Tomohiro
On 2017/09/26 22:08, Qu Wenruo wrote: > > > On 2017年09月26日 13:45, Misono, Tomohiro wrote: >> Change seen_fsid to hold fd and DIR* in order to keep access to each fs. >> This will be used for 'subvol delete --commit-after'. > > It is already quite good, good enough for

[PATCH 3/4] btrfs-progs: change seen_fsid to hold fd and DIR*

2017-09-25 Thread Misono, Tomohiro
Change seen_fsid to hold fd and DIR* in order to keep access to each fs. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono --- cmds-filesystem.c | 4 ++-- utils.c | 6 +- utils.h | 5 - 3 files

[PATCH 4/4] btrfs-progs: subvol: fix subvol del --commit-after

2017-09-25 Thread Misono, Tomohiro
Fix subvol del --commit-after to work properly: - SYNC ioctl will be issued even when last delete is failed - SYNC ioctl will be issued on each file system only once in the end To achieve this, get_fsid() and add_seen_fsid() is called after each delete to keep only one fd for each fs. In the

[PATCH 2/4] btrfs-progs: move seen_fsid to util.c

2017-09-25 Thread Misono, Tomohiro
Make is_seen_fsid()/add_seen_fsid()/free_seen_fsid() to common functions. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono --- cmds-filesystem.c | 88 --- utils.c |

[PATCH 1/4] btrfs-progs: move get_fsid() to util.c

2017-09-25 Thread Misono, Tomohiro
Make get_fsid() to a common function. This will be used for 'subvol delete --commit-after'. Signed-off-by: Tomohiro Misono --- cmds-property.c | 30 -- utils.c | 31 +++ utils.h | 1 + 3

[PATCH 0/4] btrfs-progs: subvol: fix del --commit-after

2017-09-25 Thread Misono, Tomohiro
Fix subvol del --commit-after to work properly: - SYNC ioctl will be issued even when last delete is failed - SYNC ioctl will be issued on each file system only once in the end To achieve this, each deleted subvol's (parent's) fsid is checked each time. If the fsid is seen for the first time,

[PATCH 4/4] btrfs: remove unused setup_root_args()

2017-09-25 Thread Misono, Tomohiro
Since setup_root_args() is not used anymore, just remove it. Signed-off-by: Tomohiro Misono --- fs/btrfs/super.c | 35 --- 1 file changed, 35 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 7edd74d..f589c5b

[PATCH 3/4] btrfs: split parse_early_options() in two

2017-09-25 Thread Misono, Tomohiro
Now parse_early_options() is used by both btrfs_mount() and mount_root(). However, the former only needs subvol related part and the latter needs the others. Therefore extract the subvol related parts from parse_early_options() and move it to new parse function (parse_subvol_options()).

[PATCH 2/4] btrfs: cleanup btrfs_mount() using mount_root()

2017-09-25 Thread Misono, Tomohiro
Cleanups btrfs_mount() by using mount_root(). This avoids getting btrfs_mount() called twice in mount path. Old btrfs_mount() will do: 0. VFS layer calls vfs_kern_mount() with registered file_system_type (for btrfs, btrfs_fs_type). btrfs_mount() is called on the way. 1.

[PATCH 1/4] btrfs: add mount_root() and new file_system_type

2017-09-25 Thread Misono, Tomohiro
Add mount_root() and new file_system_type for preparation of cleanup of btrfs_mount(). Code path is not changed yet. mount_root() is almost the same as current btrfs_mount(), but doesn't have subvolume related part. Signed-off-by: Tomohiro Misono ---

[PATCH v3 0/4] btrfs: cleanup mount path

2017-09-25 Thread Misono, Tomohiro
Summary: Cleanup mount path by avoiding calling btrfs_mount() twice. No functional change. See below for longer explanation. Changelog: v3: Reorganized patches again into four and added comments to the source. Each patch can be applied and compiled while maintaining functionality. The first

Re: [PATCH v2 3/3] btrfs: introduce new btrfs_mount()

2017-09-22 Thread Misono, Tomohiro
> (1) parse subvol id related options for later use in mount_subtree() > (3) return by calling mount_subtree() Sorry, this is not mount_subtree(), but mount_subvol(). Thanks, Tomohiro -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to

[PATCH v2 3/3] btrfs: introduce new btrfs_mount()

2017-09-22 Thread Misono, Tomohiro
Introduce new btrfs_mount() using previous setups. This will do: (1) parse subvol id related options for later use in mount_subtree() (2) mount device's root by calling vfs_kern_mount() with btrfs_root_fs_type. As a result, mount_root() is called (3) return by calling mount_subtree() The

[PATCH v2 2/3] btrfs: split parse_early_options() in two

2017-09-21 Thread Misono, Tomohiro
Extract the part related to subvol option from parse_early_options() and move it to new parse function (parse_subvol_options()). This is because mount_root() doesn't need to handle subvol options. Signed-off-by: Tomohiro Misono --- fs/btrfs/super.c | 75

[PATCH v2 1/3] btrfs: change btrfs_mount() to mount_root()

2017-09-21 Thread Misono, Tomohiro
Remove subvol related part from btrfs_mount() and change its name to mount_root(). Also, file_system_type having mount_root() is defined for the third patch. New btrfs_mount() will be introduced in the third patch. Signed-off-by: Tomohiro Misono ---

[PATCH v2 0/3] btrfs: cleanup mount path

2017-09-21 Thread Misono, Tomohiro
Summary: Cleanup mount path by avoiding calling btrfs_mount() twice. No functional change. change to v2: split the patch into three parts. Long Explanation: btrfs uses mount_subtree() to mount a subvolume directly. This function needs a vfsmount* of device's root (/), which is a return value of

Re: btrfs-progs: suggestion of removing --commit-after option of subvol delete

2017-09-20 Thread Misono, Tomohiro
On 2017/09/20 23:21, Qu Wenruo wrote: > > > On 2017年09月20日 22:03, David Sterba wrote: >> On Wed, Sep 20, 2017 at 08:22:54AM +0800, Qu Wenruo wrote: >>> The costly part will be tracking the filesystems of subvolumes. >>> We must do it for each subvolume and batch them to address the final >>>

Re: btrfs-progs: suggestion of removing --commit-after option of subvol delete

2017-09-19 Thread Misono, Tomohiro
On 2017/09/19 23:48, David Sterba wrote: > On Tue, Sep 19, 2017 at 04:50:04PM +0900, Misono, Tomohiro wrote: >> I read the code of "subvolume delete" and found that --commit-after option is >> not working well. >> >> Since it issues BTRFS_IOC_START/W

btrfs-progs: suggestion of removing --commit-after option of subvol delete

2017-09-19 Thread Misono, Tomohiro
Hello, I read the code of "subvolume delete" and found that --commit-after option is not working well. Since it issues BTRFS_IOC_START/WAIT_SYNC to the last fd (of directory containing the last deleted subvolume), 1. sync operation affects only the last fd's filesystem. ("subvolume delete"

[PATCH] btrfs-progs: subvolume: outputs message only when operation succeeds

2017-09-19 Thread Misono, Tomohiro
"btrfs subvolume create/delete" outputs the message of "Create/Delete subvolume ..." even when an operation fails. Since it is confusing, let's outputs the message only when an operation succeeds. Signed-off-by: Tomohiro Misono --- cmds-subvolume.c | 8

[PATCH] btrfs: cleanup mount path

2017-09-18 Thread Misono, Tomohiro
Summary: Cleanup mount path by avoiding calling btrfs_mount() twice. This is for more understandable code and no functional change. Explanation: btrfs uses mount_subtree() to mount a subvolume directly. This function needs a vfsmount* of device's root (/), which is a return value of

Fwd: [PATCH] btrfs: remove BTRFS_FS_QUOTA_DISABLING flag

2017-09-11 Thread Misono, Tomohiro
Hello, Does anyone have a comment on this? Regards, Tomohiro Forwarded Message Subject: [PATCH] btrfs: remove BTRFS_FS_QUOTA_DISABLING flag Date: Wed, 30 Aug 2017 16:33:16 +0900 From: Misono, Tomohiro <misono.tomoh...@jp.fujitsu.com> To: linux-btrfs@vger.kernel.org Cur

[PATCH] btrfs-progs: cleanup whitespaces of btrfs-completion

2017-09-11 Thread Misono, Tomohiro
Clean up spaces and use only tabs. No functional change. Signed-off-by: Tomohiro Misono --- btrfs-completion | 188 +++ 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/btrfs-completion

[PATCH] btrfs-progs: update btrfs-completion

2017-09-10 Thread Misono, Tomohiro
This patch updates btrfs-completion: - add "filesystem du" and "rescure zero-log" - restrict _btrfs_mnts to show btrfs type only - add more completion in last case statements (This file contains both spaces/tabs and may need cleanup.) Signed-off-by: Tomohiro Misono

[PATCH v2] btrfs-progs: test: add new test for inspect-internal rootid

2017-09-06 Thread Misono, Tomohiro
This new test checks inspect-internal rootid - handle path to subvolume/directory/file as an argument - get different id for each subvolume - get the expected id for each file/directory (i.e. the same as containing subvolume) Signed-off-by: Tomohiro Misono

[PATCH] btrfs-progs: test: add new test for inspect-internal rootid

2017-09-04 Thread Misono, Tomohiro
This new test checks inspect-internal rootid - handle path to subvolume/directory/file as an argument - get different id for each subvolume - get the expected id for each file/directory (i.e. the same as containing subvolume) Signed-off-by: Tomohiro Misono

[PATCH 2/2] btrfs-progs: test: fix name generation not to contain trailing spaces

2017-09-04 Thread Misono, Tomohiro
First patch causes test-convert fails. This is because generate_dataset() creates a name containing trailing spaces for "slow_symlink" type, and cause getfacl error in convert_test_perm(). (This is not noticed since original run_check_stdout() throws away the error.) Fix this by use space for

[PATCH 1/2] btrfs-progs: test: fix run_check_stdout() call _fail()

2017-09-04 Thread Misono, Tomohiro
run_check_stdout() uses "... | tee ... || _fail". However, since tee won't fail, _fail() is not called even if first command fails. Fix this by checking PIPESTATUS in the end. Signed-off-by: Tomohiro Misono --- tests/common | 7 +-- 1 file changed, 5

[PATCH] btrfs-progs: inspect-internal rootid: Allow a file to be specified

2017-09-03 Thread Misono, Tomohiro
Since cmd_inspect_rootid() calls btrfs_open_dir(), it rejects a file to be spcified. But as the document says, a file should be supported. This patch introduces btrfs_open_file_or_dir(), which is a counterpart of btrfs_open_dir(), to safely check and open btrfs file or directory. The original

[PATCH 2/2] Use common filter function in several tests

2017-08-31 Thread Misono, Tomohiro
Use newly introduced common function to filter both $TEST_DIR and $SCRATCH_MNT. Signed-off-by: Tomohiro Misono --- common/filter | 2 +- tests/btrfs/029 | 11 +++ tests/generic/409 | 3 +-- tests/generic/410 | 3 +-- tests/generic/411 | 3 +-- 5

[PATCH 1/2] Add new common filter function

2017-08-31 Thread Misono, Tomohiro
Several tests uses both _filter_test_dir and _filter_scratch concatenated by pipe to filter $TEST_DIR and $SCRATCH_MNT. However, this would fail if the shorter string is a substring of the other (like "/mnt" and "/mnt2"). This patch introduces new common filter function to safely call both

Re: [PATCH] btrfs/029: fix wrong usage of name filter

2017-08-31 Thread Misono, Tomohiro
On 2017/08/31 16:33, Eryu Guan wrote: > On Thu, Aug 31, 2017 at 08:53:09AM +0900, Misono, Tomohiro wrote: >> On 2017/08/30 20:09, Eryu Guan wrote: >>> On Wed, Aug 30, 2017 at 04:38:16PM +0900, Misono, Tomohiro wrote: >>>> btrfs/029 uses _filter_testdirs() t

Re: [PATCH] btrfs/029: fix wrong usage of name filter

2017-08-30 Thread Misono, Tomohiro
On 2017/08/30 20:09, Eryu Guan wrote: > On Wed, Aug 30, 2017 at 04:38:16PM +0900, Misono, Tomohiro wrote: >> btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and >> $SCRATCH_MNT directory. >> >> In this function, it calls both _filter_test_dir and _filt

[PATCH] btrfs/029: fix wrong usage of name filter

2017-08-30 Thread Misono, Tomohiro
btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and $SCRATCH_MNT directory. In this function, it calls both _filter_test_dir and _filter_scratch concatenated by pipe. Therefore if $TEST_DIR is a prefix of $SCRATCH_MNT, this filter function gives wrong filtered name for

[PATCH] btrfs: remove BTRFS_FS_QUOTA_DISABLING flag

2017-08-30 Thread Misono, Tomohiro
Currently, "btrfs quota enable" would fail after "btrfs quota disable" on the first time with syslog output "qgroup_rescan_init failed with -22", but it would succeed on the second time. When "quota disable" is called, BTRFS_FS_QUOTA_DISABLING flag bit will be set in fs_info->flags in

Re: [PATCH] btrfs/029: fix wrong usage of name filter

2017-08-30 Thread Misono, Tomohiro
Sorry, this patch contains leading spaces, I will resend this soon. On 2017/08/30 11:44, Misono, Tomohiro wrote: > btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and > $SCRATCH_MNT directory. > > In this function, it calls both _filter_test_dir and _fi

Re: [PATCH] btrfs: remove BTRFS_FS_QUOTA_DISABLING flag

2017-08-30 Thread Misono, Tomohiro
Sorry, this patch contains leading spaces, I will resend this soon. On 2017/08/30 10:51, Misono, Tomohiro wrote: > Currently, "btrfs quota enable" would fail after "btrfs quota disable" on > the first time with syslog output "qgroup_rescan_init failed wi

[PATCH] btrfs/029: fix wrong usage of name filter

2017-08-29 Thread Misono, Tomohiro
btrfs/029 uses _filter_testdirs() to filter the name of $TEST_DIR and $SCRATCH_MNT directory. In this function, it calls both _filter_test_dir and _filter_scratch concatenated by pipe. Therefore if $TEST_DIR is a prefix of $SCRATCH_MNT, this filter function gives wrong filtered name for

[PATCH] btrfs: remove BTRFS_FS_QUOTA_DISABLING flag

2017-08-29 Thread Misono, Tomohiro
Currently, "btrfs quota enable" would fail after "btrfs quota disable" on the first time with syslog output "qgroup_rescan_init failed with -22", but it would succeed on the second time. When "quota disable" is called, BTRFS_FS_QUOTA_DISABLING flag bit will be set in fs_info->flags in

Re: [PATCH] btrfs-progs: doc: fix btrfs-inspect-internal rootid doc

2017-08-24 Thread Misono, Tomohiro
On 2017/08/25 2:37, David Sterba wrote: On Thu, Aug 24, 2017 at 04:39:53PM +0900, Misono, Tomohiro wrote: "btrfs inspect-internal rootid " rejects a file to be specified in the implementation. Therefore change "file or directory" to "directory" in the doc. Is th

[PATCH] btrfs-progs: doc: add figure 1 to btrfs quota doc

2017-08-24 Thread Misono, Tomohiro
The document of btrfs quota is missing figure 1. I notice the body is copy of http://sensille.com/qgroups.pdf (whi ch is linked from https://btrfs.wiki.kernel.org/index.php/Quota_support), and insert the figure. Signed-off-by: Tomohiro Misono ---

[PATCH] btrfs-progs: doc: fix btrfs-inspect-internal rootid doc

2017-08-24 Thread Misono, Tomohiro
"btrfs inspect-internal rootid " rejects a file to be specified in the implementation. Therefore change "file or directory" to "directory" in the doc. Signed-off-by: Tomohiro Misono --- Documentation/btrfs-inspect-internal.asciidoc | 2 +- 1 file changed, 1

[PATCH] btrfs-progs: change document in accordance with usage info

2017-08-24 Thread Misono, Tomohiro
Usage info of "btrfs check" shows "-Q|--qgroup-report" (and first patch enables -Q), but the document only shows "--qgroup-report". Therefore add -Q to the doc. Signed-off-by: Tomohiro Misono --- Documentation/btrfs-check.asciidoc | 2 +- 1 file changed, 1

[PATCH 3/3] btrfs-progs: fix option handling for some commands

2017-08-23 Thread Misono, Tomohiro
This fixes "btrfs inspect-internal dump-super --bytenr" Signed-off-by: Tomohiro Misono --- cmds-inspect-dump-super.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/cmds-inspect-dump-super.c b/cmds-inspect-dump-super.c index 98e0270..c7afd80 100644

[PATCH 2/3] btrfs-progs: fix option handling for some commands

2017-08-23 Thread Misono, Tomohiro
This fixes "btrfs receive -E" Signed-off-by: Tomohiro Misono --- cmds-receive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-receive.c b/cmds-receive.c index 72e9c8f..e584cef 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -1277,7

[PATCH 1/3] btrfs-progs: fix option handling for some commands

2017-08-23 Thread Misono, Tomohiro
I found some btrfs commands options are not working because of inappropriate getopt_long() setting. This fixes "btrfs check -Q/-E" Signed-off-by: Tomohiro Misono --- cmds-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-check.c

Re: [PATCH 1/3] btrfs-progs: fix option handling for some commands

2017-08-23 Thread Misono, Tomohiro
Sorry, this patch's encoding is wrong. Please ignore this and I will resend the patch. On 2017/08/24 13:03, Misono, Tomohiro wrote: I found some btrfs commands options are not working because of inappropriate getopt_long() setting. This fixes "btrfs check -Q/-E" Signed-off-by

[PATCH 1/3] btrfs-progs: fix option handling for some commands

2017-08-23 Thread Misono, Tomohiro
I found some btrfs commands options are not working because of inappropriate getopt_long() setting. This fixes "btrfs check -Q/-E" Signed-off-by: Tomohiro Misono ---  cmds-check.c | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-check.c

<    1   2   3   4