[PATCH] btrfs: skip file_extent generation check for free_space_inode in run_delalloc_nocow

2018-11-29 Thread Lu Fengqi
path") Signed-off-by: Lu Fengqi --- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d54bdef16d8d..9c5e9629eb6c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1369,7 +1369,8 @@ static no

[PATCH v2 1/3] btrfs: remove always true if branch in find_delalloc_range

2018-11-28 Thread Lu Fengqi
The @found is always false when it comes to the if branch. Besides, the bool type is more suitable for @found. Change the return value of the function and its caller to bool as well. Signed-off-by: Lu Fengqi --- fs/btrfs/extent_io.c | 31 +++ fs/btrfs

Re: [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range

2018-11-28 Thread Lu Fengqi
On Wed, Nov 28, 2018 at 09:01:42AM +0200, Nikolay Borisov wrote: > > >On 28.11.18 г. 5:21 ч., Lu Fengqi wrote: >> The @found is always false when it comes to the if branch. Besides, the >> bool type is more suitable for @found. > >Well if you are ranging the type of f

Re: [RFC PATCH] btrfs: drop file privileges in btrfs_clone_files

2018-11-28 Thread Lu Fengqi
On Wed, Nov 28, 2018 at 09:48:07AM +0200, Nikolay Borisov wrote: > > >On 28.11.18 г. 9:46 ч., Christoph Hellwig wrote: >> On Wed, Nov 28, 2018 at 09:44:59AM +0200, Nikolay Borisov wrote: >>> >>> >>> On 28.11.18 г. 5:07 ч., Lu Fengqi wrote: >>>

[PATCH 3/3] btrfs: remove redundant nowait check for buffered_write

2018-11-27 Thread Lu Fengqi
The generic_write_checks will check the combination of IOCB_NOWAIT and !IOCB_DIRECT. Signed-off-by: Lu Fengqi --- fs/btrfs/file.c | 4 1 file changed, 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3835bb8c146d..190db9a685a2 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs

[PATCH 2/3] btrfs: cleanup the useless DEFINE_WAIT in cleanup_transaction

2018-11-27 Thread Lu Fengqi
When it is introduced at commit f094ac32aba3 ("Btrfs: fix NULL pointer after aborting a transaction"), it's useless. Signed-off-by: Lu Fengqi --- fs/btrfs/transaction.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index f9

[PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range

2018-11-27 Thread Lu Fengqi
The @found is always false when it comes to the if branch. Besides, the bool type is more suitable for @found. Signed-off-by: Lu Fengqi --- fs/btrfs/extent_io.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[RFC PATCH] btrfs: drop file privileges in btrfs_clone_files

2018-11-27 Thread Lu Fengqi
The generic/513 tell that cloning into a file did not strip security privileges (suid, capabilities) like a regular write would. Signed-off-by: Lu Fengqi --- The xfs and ocfs2 call generic_remap_file_range_prep to drop file privileges, I'm not sure whether btrfs should do the same thing. Any

Re: [PATCH 3/6] btrfs: cleanup extent_op handling

2018-11-22 Thread Lu Fengqi
al cleanup work to >cleanup_extent_op so it can be used by check_ref_cleanup() in order to >unify the extent op handling. > >Signed-off-by: Josef Bacik One nitpick below. Reviewed-by: Lu Fengqi >--- > fs/btrfs/extent-tree.c | 36 +++- > 1 file cha

Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

2018-11-14 Thread Lu Fengqi
On Wed, Nov 14, 2018 at 05:05:48PM +0100, David Sterba wrote: >On Wed, Nov 14, 2018 at 03:24:56PM +0800, Lu Fengqi wrote: >> = >> WARNING: suspicious RCU usage >> 4.20.0-rc2+ #23 Tainted: G O >>

[PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

2018-11-13 Thread Lu Fengqi
: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices") Signed-off-by: Lu Fengqi --- fs/btrfs/volumes.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 2186300bab91..6039ae5c549e 100644 --- a/fs/btrfs/volum

Re: [PATCH v15.1 00/13] Btrfs In-band De-duplication

2018-11-13 Thread Lu Fengqi
On Tue, Nov 13, 2018 at 02:45:45PM +0100, David Sterba wrote: >On Tue, Nov 06, 2018 at 02:41:09PM +0800, Lu Fengqi wrote: >> This patchset can be fetched from github: >> https://github.com/littleroad/linux.git dedupe_latest >> >> Now the new base is v4.20-rc1. > &g

[PATCH v10.6 3/5] btrfs-progs: dedupe: Add disable support for inband dedupelication

2018-11-05 Thread Lu Fengqi
From: Qu Wenruo Add disable subcommand for dedupe command group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 5 +++ btrfs-completion | 2 +- cmds-dedupe-ib.c | 41

[PATCH v10.6 1/5] btrfs-progs: Basic framework for dedupe-inband command group

2018-11-05 Thread Lu Fengqi
From: Qu Wenruo Add basic ioctl header and command group framework for later use. Alone with basic man page doc. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/Makefile.in | 1 + Documentation/btrfs-dedupe-inband.asciidoc | 40

[PATCH v10.6 5/5] btrfs-progs: dedupe: introduce reconfigure subcommand

2018-11-05 Thread Lu Fengqi
From: Qu Wenruo Introduce reconfigure subcommand to co-operate with new kernel ioctl modification. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 7 +++ btrfs-completion | 2 +- cmds-dedupe-ib.c

[PATCH v10.6 2/5] btrfs-progs: dedupe: Add enable command for dedupe command group

2018-11-05 Thread Lu Fengqi
From: Qu Wenruo Add enable subcommand for dedupe commmand group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 114 +- btrfs-completion | 6 +- cmds-dedupe-ib.c | 238

[PATCH v10.6 0/5] In-band de-duplication for btrfs-progs

2018-11-05 Thread Lu Fengqi
Patchset can be fetched from github: https://github.com/littleroad/btrfs-progs.git dedupe_latest Inband dedupe(in-memory backend only) ioctl support for btrfs-progs. v7 changes: Update ctree.h to follow kernel structure change Update print-tree to follow kernel structure change V8 changes:

[PATCH v10.6 4/5] btrfs-progs: dedupe: Add status subcommand

2018-11-05 Thread Lu Fengqi
From: Qu Wenruo Add status subcommand for dedupe command group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 3 + btrfs-completion | 2 +- cmds-dedupe-ib.c | 80

[PATCH v15.1 09/13] btrfs: introduce type based delalloc metadata reserve

2018-11-05 Thread Lu Fengqi
normal 128M extent size is supported. More types will follow soon. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 43 ++--- fs/btrfs/extent-tree.c | 48 --- fs/btrfs/file.c | 30

[PATCH v15.1 10/13] btrfs: dedupe: Inband in-memory only de-duplication implement

2018-11-05 Thread Lu Fengqi
implement restore all dedupe hash in memory rb-tree, with LRU behavior to control the limit. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 4 +- fs/btrfs/dedupe.h | 15 ++ fs/btrfs/extent-tree.c | 31 +++- fs/btrfs/extent_io.c

[PATCH v15.1 02/13] btrfs: dedupe: Introduce function to initialize dedupe info

2018-11-05 Thread Lu Fengqi
From: Wang Xiaoguang Add generic function to initialize dedupe info. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/Makefile | 2 +- fs/btrfs/dedupe.c | 169 + fs

[PATCH v15.1 11/13] btrfs: dedupe: Add ioctl for inband deduplication

2018-11-05 Thread Lu Fengqi
). Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 50 ++ fs/btrfs/dedupe.h | 17 +--- fs/btrfs/disk-io.c | 3 ++ fs/btrfs/ioctl.c | 85 ++ fs

[PATCH v15.1 06/13] btrfs: dedupe: Introduce function to search for an existing hash

2018-11-05 Thread Lu Fengqi
-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 210 +- 1 file changed, 209 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dedupe.c b/fs/btrfs/dedupe.c index 951fefd19fde

[PATCH v15.1 01/13] btrfs: dedupe: Introduce dedupe framework and its header

2018-11-05 Thread Lu Fengqi
From: Wang Xiaoguang Introduce the header for btrfs in-band(write time) de-duplication framework and needed header. The new de-duplication framework is going to support 2 different dedupe methods and 1 dedupe hash. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu

[PATCH v15.1 04/13] btrfs: dedupe: Introduce function to remove hash from in-memory tree

2018-11-05 Thread Lu Fengqi
possible race. Cc: Mark Fasheh Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 131 +++--- 1 file changed, 125 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/dedupe.c b/fs/btrfs/dedupe.c index

[PATCH v15.1 13/13] btrfs: dedupe: Introduce new reconfigure ioctl

2018-11-05 Thread Lu Fengqi
--block-size 64k /mnt # btrfs dedupe enable --force --limit-hash 1m /mnt Will reset blocksize to default value: dedupe blocksize: 128K << reset dedupe hash limit nr: 1m Suggested-by: David Sterba Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c

[PATCH v15.1 12/13] btrfs: relocation: Enhance error handling to avoid BUG_ON

2018-11-05 Thread Lu Fengqi
returned -ENOENT in relocate_tree_block() and continue balancing. Reported-by: Satoru Takeuchi Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/relocation.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/rel

[PATCH v15.1 00/13] Btrfs In-band De-duplication

2018-11-05 Thread Lu Fengqi
This patchset can be fetched from github: https://github.com/littleroad/linux.git dedupe_latest Now the new base is v4.20-rc1. Normal test cases from auto group exposes no regression, and ib-dedupe group can pass without problem. xfstests ib-dedupe group can be fetched from github:

[PATCH v15.1 03/13] btrfs: dedupe: Introduce function to add hash into in-memory tree

2018-11-05 Thread Lu Fengqi
From: Wang Xiaoguang Introduce static function inmem_add() to add hash into in-memory tree. And now we can implement the btrfs_dedupe_add() interface. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 150

[PATCH v15.1 05/13] btrfs: delayed-ref: Add support for increasing data ref under spinlock

2018-11-05 Thread Lu Fengqi
-by: Qu Wenruo Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 53 +- fs/btrfs/delayed-ref.h | 15 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c

[PATCH v15.1 08/13] btrfs: ordered-extent: Add support for dedupe

2018-11-05 Thread Lu Fengqi
From: Wang Xiaoguang Add ordered-extent support for dedupe. Note, current ordered-extent support only supports non-compressed source extent. Support for compressed source extent will be added later. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik ---

[PATCH v15.1 07/13] btrfs: dedupe: Implement btrfs_dedupe_calc_hash interface

2018-11-05 Thread Lu Fengqi
From: Wang Xiaoguang Unlike in-memory or on-disk dedupe method, only SHA256 hash method is supported yet, so implement btrfs_dedupe_calc_hash() interface using SHA256. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs

Re: [PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Lu Fengqi
On Tue, Oct 30, 2018 at 05:14:42PM -0700, Omar Sandoval wrote: >From: Omar Sandoval > >There's a race between close_ctree() and cleaner_kthread(). >close_ctree() sets btrfs_fs_closing(), and the cleaner stops when it >sees it set, but this is racy; the cleaner might have already checked >the bit

Re: [PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Lu Fengqi
On Tue, Oct 30, 2018 at 05:14:42PM -0700, Omar Sandoval wrote: >From: Omar Sandoval > >There's a race between close_ctree() and cleaner_kthread(). >close_ctree() sets btrfs_fs_closing(), and the cleaner stops when it >sees it set, but this is racy; the cleaner might have already checked >the bit

[PATCH 3/3] btrfs: fix pinned underflow after transaction aborted

2018-10-24 Thread Lu Fengqi
p_transaction(), another fsstress is running btrfs_commit_transaction(). The btrfs_finish_extent_commit() may get the same range as btrfs_destroy_pinned_extent() got, which causes the pinned underflow. Signed-off-by: Lu Fengqi --- fs/btrfs/disk-io.c | 12 +++- 1 file changed, 11 i

[PATCH 0/3] fix pinned underflow in generic/475

2018-10-24 Thread Lu Fengqi
When running generic/475, pinned underflow may occur. This patch will fix this problem, but there are still other warnings need to addressed in this case. Patch 1-2 introduce a macro and wrappers to help detect underflow Patch 3 the fix patch of pinned underflow Lu Fengqi (2): btrfs: extent

[PATCH 2/3] btrfs: extent-tree: Detect bytes_pinned underflow earlier

2018-10-24 Thread Lu Fengqi
Introduce a new wrapper update_bytes_pinned to replace open coded bytes_pinned modifiers. Signed-off-by: Lu Fengqi --- fs/btrfs/extent-tree.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index c0147a1307e7

[PATCH 1/3] btrfs: extent-tree: Detect bytes_may_use underflow earlier

2018-10-24 Thread Lu Fengqi
From: Qu Wenruo Although we have space_info::bytes_may_use underflow detection in btrfs_free_reserved_data_space_noquota(), we have more callers who are subtracting number from space_info::bytes_may_use. So instead of doing underflow detection for every caller, introduce a new wrapper

[PATCH] btrfs: delayed-ref: extract find_first_ref_head from find_ref_head

2018-10-15 Thread Lu Fengqi
The find_ref_head shouldn't return the first entry even if no exact match is found. So move the hidden behavior to higher level. Besides, remove the useless local variables in the btrfs_select_ref_head. Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 45

Re: [PATCH 0/6] Some trivail cleanup about dealyed-refs

2018-10-14 Thread Lu Fengqi
On Thu, Oct 11, 2018 at 01:51:37PM +0200, David Sterba wrote: >On Thu, Oct 11, 2018 at 01:40:32PM +0800, Lu Fengqi wrote: >> There is no functional change. Just improve readablity. >> >> PATCH 1-4 parameter cleanup patches >> PATCH 5 cleanup about btrfs_select_ref

Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables

2018-10-14 Thread Lu Fengqi
On Thu, Oct 11, 2018 at 02:45:04PM +0200, David Sterba wrote: >On Thu, Oct 11, 2018 at 03:28:15PM +0300, Nikolay Borisov wrote: >> > I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the >> > extent-tree.c. I am a bit curious whether it has been forgotten by >> > everyone, I have not

Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables

2018-10-14 Thread Lu Fengqi
On Thu, Oct 11, 2018 at 03:28:15PM +0300, Nikolay Borisov wrote: > > >On 11.10.2018 15:15, Lu Fengqi wrote: >> On Thu, Oct 11, 2018 at 09:40:52AM +0300, Nikolay Borisov wrote: >>> >>> >>> On 11.10.2018 08:40, Lu Fengqi wrote: >>>> If

Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables

2018-10-11 Thread Lu Fengqi
On Thu, Oct 11, 2018 at 09:40:52AM +0300, Nikolay Borisov wrote: > > >On 11.10.2018 08:40, Lu Fengqi wrote: >> If the return value of find_ref_head() is NULL, the only possibility is >> that delayed_refs' head ref rbtree is empty. Hence, the second >> find_ref_head()

[PATCH] btrfs: qgroup: move the qgroup->members check out from (!qgroup)'s else branch

2018-10-10 Thread Lu Fengqi
There is no reason to put this check in (!qgroup)'s else branch because if qgroup is null, it will goto out directly. So move it out to reduce indent. No Functional Change. Signed-off-by: Lu Fengqi --- fs/btrfs/qgroup.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff

[PATCH 0/6] Some trivail cleanup about dealyed-refs

2018-10-10 Thread Lu Fengqi
There is no functional change. Just improve readablity. PATCH 1-4 parameter cleanup patches PATCH 5 cleanup about btrfs_select_ref_head PATCH 6 switch int to bool; add some comment Lu Fengqi (6): btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head() btrfs: delayed-ref

[PATCH 2/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock()

2018-10-10 Thread Lu Fengqi
Since trans is only used for referring to delayed_refs, there is no need to pass it instead of delayed_refs to btrfs_delayed_ref_lock(). No functional change. Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 5 + fs/btrfs/delayed-ref.h | 2 +- fs/btrfs/extent-tree.c | 2 +- 3 files

[PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head()

2018-10-10 Thread Lu Fengqi
Since trans is only used for referring to delayed_refs, there is no need to pass it instead of delayed_refs to btrfs_select_ref_head(). No functional change. Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 5 + fs/btrfs/delayed-ref.h | 2 +- fs/btrfs/extent-tree.c | 2 +- 3 files

[PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables

2018-10-10 Thread Lu Fengqi
If the return value of find_ref_head() is NULL, the only possibility is that delayed_refs' head ref rbtree is empty. Hence, the second find_ref_head() is pointless. Besides, the local variables loop and start are unnecessary, just remove them. Signed-off-by: Lu Fengqi --- fs/btrfs/delayed

[PATCH 4/6] btrfs: remove fs_info from btrfs_should_throttle_delayed_refs

2018-10-10 Thread Lu Fengqi
The avg_delayed_ref_runtime can be referenced from the transaction handle. Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 3 +-- fs/btrfs/extent-tree.c | 5 ++--- fs/btrfs/inode.c | 5 ++--- fs/btrfs/transaction.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git

[PATCH 3/6] btrfs: remove fs_info from btrfs_check_space_for_delayed_refs

2018-10-10 Thread Lu Fengqi
It can be referenced from the transaction handle. Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 3 +-- fs/btrfs/extent-tree.c | 6 +++--- fs/btrfs/inode.c | 2 +- fs/btrfs/transaction.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs

[PATCH 6/6] btrfs: switch return_bigger to bool in find_ref_head

2018-10-10 Thread Lu Fengqi
Using bool is more suitable than int here, and add the comment about the return_bigger. Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 2726d2fb4bbe

Re: [PATCH 0/3] Misc refactoring of check_file_extent

2018-09-13 Thread Lu Fengqi
types is moved first in >check_file_extent, >followed by the code to handle inline extents and finally the existing code to >handle regular/prealloc extents is left intact. > >This patchset brings no functional changes. For the series, Reviewed-by: Lu Fengqi -- Thanks, Lu &g

Re: [PATCH] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent

2018-09-13 Thread Lu Fengqi
On Thu, Sep 13, 2018 at 12:12:27PM +0300, Nikolay Borisov wrote: > > >On 13.09.2018 11:20, Lu Fengqi wrote: >> In the check_inode_item function, the extent_end variable used to store the >> end of the last file extent that has checked. When it passes to >> check

Re: [PATCH] btrfs: Handle error of get_old_root

2018-09-13 Thread Lu Fengqi
ader is read. Fix this by checking the >return value and properly handling NULL by setting ret to -EIO and >returning gracefully. > >CID: 1087503 >Signed-off-by: Nikolay Borisov Reviewed-by: Lu Fengqi -- Thanks, Lu >--- > fs/btrfs/ctree.c | 4 > 1 file changed, 4 in

Re: [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup

2018-09-13 Thread Lu Fengqi
hen the loop is prematurely terminated by 'goto out'. >On the other hand, if the error value is ENOENT then a subsequent >if branch is executed that always re-assigns 'ret' and in case it's >an error just terminates the loop. No functional changes. > >CID: 1437392 >Signed-off-by: Nik

Re: [PATCH] btrfs-progs: calibrate extent_end when found a gap

2018-09-13 Thread Lu Fengqi
On Thu, Sep 13, 2018 at 04:30:28PM +0800, Lu Fengqi wrote: >On Tue, Sep 11, 2018 at 04:41:21PM +0200, David Sterba wrote: >>On Tue, Sep 04, 2018 at 08:42:01PM +0800, Lu Fengqi wrote: >>> The extent_end will be used to check whether there is gap between this >>

Re: [PATCH] btrfs-progs: calibrate extent_end when found a gap

2018-09-13 Thread Lu Fengqi
On Tue, Sep 11, 2018 at 04:41:21PM +0200, David Sterba wrote: >On Tue, Sep 04, 2018 at 08:42:01PM +0800, Lu Fengqi wrote: >> The extent_end will be used to check whether there is gap between this >> extent and next extent. If it is not calibrated, check_file_extent will

[PATCH] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent

2018-09-13 Thread Lu Fengqi
("btrfs-progs: check: introduce function to check file extent") Signed-off-by: Lu Fengqi --- check/mode-lowmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 1bce44f5658a..370318f0e631 100644 --- a/check/mode-lowmem.c +

Re: [RFC PATCH v2 1/4] btrfs: factor out btrfs_link_subvol from create_subvol

2018-09-11 Thread Lu Fengqi
On Tue, Sep 11, 2018 at 07:57:03PM +0800, Qu Wenruo wrote: > > >On 2018/9/11 下午7:29, Lu Fengqi wrote: >> The function btrfs_link_subvol is responsible to link the subvolume to >> the specified directory, which is the opposite of what >> btrfs_unlink_subvol does.

Re: [PATCH v3 00/10] undelete subvolume offline version

2018-09-11 Thread Lu Fengqi
On Mon, May 07, 2018 at 11:10:23AM +0800, Lu Fengqi wrote: >This patchset will add undelete-subvol subcommand for btrfs rescue. > Hi David Although there are some disagreements about undeleting subvolumes online implementation, the offline version is considered more acceptable. Would yo

[RFC PATCH v2 2/2] btrfs-progs: subvolume: undelete: add btrfs subvolume undelete subcommand

2018-09-11 Thread Lu Fengqi
Add the undelete subcommand, this is depend on the BTRFS_IOC_SUBVOL_UNDELETE ioctl. Signed-off-by: Lu Fengqi --- btrfs-completion | 2 +- cmds-subvolume.c | 70 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/btrfs-completion b

[RFC PATCH v2 1/2] btrfs-progs: ioctl: add BTRFS_IOC_SUBVOL_UNDELETE to ioctl.h

2018-09-11 Thread Lu Fengqi
Copied from uapi/linux/btrfs.h. Signed-off-by: Lu Fengqi --- ioctl.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/ioctl.h b/ioctl.h index 709e996f401c..75978a4e8265 100644 --- a/ioctl.h +++ b/ioctl.h @@ -670,6 +670,11 @@ struct btrfs_ioctl_send_args_64 { } __attribute__((packed

[RFC PATCH v2 4/4] btrfs: undelete: Add BTRFS_IOCTL_SUBVOL_UNDELETE ioctl

2018-09-11 Thread Lu Fengqi
This ioctl will provide user the ability to recover the subvolume of the given id to the given directory. Note: It will lock fs_info->cleaner_mutex to keep the cleaner kthread from deleting the subvolume which we want to recover. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c |

[RFC PATCH v2 3/4] btrfs: undelete: introduce btrfs_undelete_subvolume

2018-09-11 Thread Lu Fengqi
The function will do the following things which are almost the opposite of what btrfs_delete_subvolume() does: 1. link the subvolume to the parent specified; 2. clear root flag and set root_refs to 1; 3. add the subvol to the uuid_tree; 4. delete the orphan_item. Signed-off-by: Lu Fengqi

[RFC PATCH v2 0/4] undelete subvolume online version

2018-09-11 Thread Lu Fengqi
subvolume. # btrfs subvolume undelete [-n ] btrfs online undelete version: https://github.com/littleroad/linux.git undelete btrfs-progs online undelete version: https://github.com/littleroad/btrfs-progs.git online_undelete Issue: #82 Lu Fengqi (4): btrfs: factor out btrfs_link_subvol from

[RFC PATCH v2 1/4] btrfs: factor out btrfs_link_subvol from create_subvol

2018-09-11 Thread Lu Fengqi
The function btrfs_link_subvol is responsible to link the subvolume to the specified directory, which is the opposite of what btrfs_unlink_subvol does. No functional change. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 64 +++- 1 file changed, 41

[RFC PATCH v2 2/4] btrfs: don't BUG_ON() in btrfs_link_subvol()

2018-09-11 Thread Lu Fengqi
Both of btrfs_update_inode() and btrfs_add_root_ref() may fail because of ENOMEM. So there's no reason to panic here, we can replace BUG_ON() with btrfs_abort_transaction() here. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

[PATCH] btrfs-progs: calibrate extent_end when found a gap

2018-09-04 Thread Lu Fengqi
The extent_end will be used to check whether there is gap between this extent and next extent. If it is not calibrated, check_file_extent will mistake that there are gaps between the remaining extents. Signed-off-by: Lu Fengqi --- check/mode-lowmem.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH v10.5 2/5] btrfs-progs: dedupe: Add enable command for dedupe command group

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Add enable subcommand for dedupe commmand group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 114 +- btrfs-completion | 6 +- cmds-dedupe-ib.c | 238

[PATCH v10.5 5/5] btrfs-progs: dedupe: introduce reconfigure subcommand

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Introduce reconfigure subcommand to co-operate with new kernel ioctl modification. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 7 +++ btrfs-completion | 2 +- cmds-dedupe-ib.c

[PATCH v10.5 3/5] btrfs-progs: dedupe: Add disable support for inband dedupelication

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Add disable subcommand for dedupe command group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 5 +++ btrfs-completion | 2 +- cmds-dedupe-ib.c | 41

[PATCH v10.5 4/5] btrfs-progs: dedupe: Add status subcommand

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Add status subcommand for dedupe command group. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/btrfs-dedupe-inband.asciidoc | 3 + btrfs-completion | 2 +- cmds-dedupe-ib.c | 80

[PATCH v10.5 0/5] In-band de-duplication for btrfs-progs

2018-09-04 Thread Lu Fengqi
Patchset can be fetched from github: https://github.com/littleroad/btrfs-progs.git dedupe_latest Inband dedupe(in-memory backend only) ioctl support for btrfs-progs. v7 changes: Update ctree.h to follow kernel structure change Update print-tree to follow kernel structure change V8 changes:

[PATCH v10.5 1/5] btrfs-progs: Basic framework for dedupe-inband command group

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Add basic ioctl header and command group framework for later use. Alone with basic man page doc. Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- Documentation/Makefile.in | 1 + Documentation/btrfs-dedupe-inband.asciidoc | 40

[PATCH v15 09/13] btrfs: introduce type based delalloc metadata reserve

2018-09-04 Thread Lu Fengqi
normal 128M extent size is supported. More types will follow soon. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 43 ++--- fs/btrfs/extent-tree.c | 48 --- fs/btrfs/file.c | 30

[PATCH v15 03/13] btrfs: dedupe: Introduce function to add hash into in-memory tree

2018-09-04 Thread Lu Fengqi
From: Wang Xiaoguang Introduce static function inmem_add() to add hash into in-memory tree. And now we can implement the btrfs_dedupe_add() interface. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 150

[PATCH v15 00/13] Btrfs In-band De-duplication

2018-09-04 Thread Lu Fengqi
This patchset can be fetched from github: https://github.com/littleroad/linux.git dedupe_latest Now the new base is v4.19-rc2, and drop the patch about compression which conflict with compression heuristic. Normal test cases from auto group exposes no regression, and ib-dedupe group can pass

[PATCH v15 13/13] btrfs: dedupe: Introduce new reconfigure ioctl

2018-09-04 Thread Lu Fengqi
--block-size 64k /mnt # btrfs dedupe enable --force --limit-hash 1m /mnt Will reset blocksize to default value: dedupe blocksize: 128K << reset dedupe hash limit nr: 1m Suggested-by: David Sterba Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c

[PATCH v15 12/13] btrfs: relocation: Enhance error handling to avoid BUG_ON

2018-09-04 Thread Lu Fengqi
From: Qu Wenruo Since the introduction of btrfs dedupe tree, it's possible that balance can race with dedupe disabling. When this happens, dedupe_enabled will make btrfs_get_fs_root() return PTR_ERR(-ENOENT). But due to a bug in error handling branch, when this happens backref_cache->nr_nodes

[PATCH v15 07/13] btrfs: dedupe: Implement btrfs_dedupe_calc_hash interface

2018-09-04 Thread Lu Fengqi
From: Wang Xiaoguang Unlike in-memory or on-disk dedupe method, only SHA256 hash method is supported yet, so implement btrfs_dedupe_calc_hash() interface using SHA256. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs

[PATCH v15 11/13] btrfs: dedupe: Add ioctl for inband deduplication

2018-09-04 Thread Lu Fengqi
). Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 50 + fs/btrfs/dedupe.h | 17 +++--- fs/btrfs/disk-io.c | 3 ++ fs/btrfs/ioctl.c | 65

[PATCH v15 04/13] btrfs: dedupe: Introduce function to remove hash from in-memory tree

2018-09-04 Thread Lu Fengqi
possible race. Cc: Mark Fasheh Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 131 +++--- 1 file changed, 125 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/dedupe.c b/fs/btrfs/dedupe.c index

[PATCH v15 02/13] btrfs: dedupe: Introduce function to initialize dedupe info

2018-09-04 Thread Lu Fengqi
From: Wang Xiaoguang Add generic function to initialize dedupe info. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/Makefile | 2 +- fs/btrfs/dedupe.c | 169 + fs

[PATCH v15 10/13] btrfs: dedupe: Inband in-memory only de-duplication implement

2018-09-04 Thread Lu Fengqi
implement restore all dedupe hash in memory rb-tree, with LRU behavior to control the limit. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 4 +- fs/btrfs/dedupe.h | 15 ++ fs/btrfs/extent-tree.c | 31 +++- fs/btrfs/extent_io.c

[PATCH v15 05/13] btrfs: delayed-ref: Add support for increasing data ref under spinlock

2018-09-04 Thread Lu Fengqi
-by: Qu Wenruo Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/delayed-ref.c | 53 +- fs/btrfs/delayed-ref.h | 15 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c

[PATCH v15 08/13] btrfs: ordered-extent: Add support for dedupe

2018-09-04 Thread Lu Fengqi
From: Wang Xiaoguang Add ordered-extent support for dedupe. Note, current ordered-extent support only supports non-compressed source extent. Support for compressed source extent will be added later. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik ---

[PATCH v15 01/13] btrfs: dedupe: Introduce dedupe framework and its header

2018-09-04 Thread Lu Fengqi
From: Wang Xiaoguang Introduce the header for btrfs in-band(write time) de-duplication framework and needed header. The new de-duplication framework is going to support 2 different dedupe methods and 1 dedupe hash. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Signed-off-by: Lu

[PATCH v15 06/13] btrfs: dedupe: Introduce function to search for an existing hash

2018-09-04 Thread Lu Fengqi
-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs/btrfs/dedupe.c | 210 +- 1 file changed, 209 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dedupe.c b/fs/btrfs/dedupe.c index 951fefd19fde

[PATCH v3] btrfs: fix qgroup_free wrong num_bytes in btrfs_subvolume_reserve_metadata()

2018-08-08 Thread Lu Fengqi
for the qgroup_reserved that does not exist and add a comment about use_global_rsv. Fixes: c4c129db5da8 ("btrfs: drop unused parameter qgroup_reserved") Signed-off-by: Lu Fengqi --- Changelog: v2->v3: update the subject and commit message to reflect this is a fixes v1->v2: break the

Re: [PATCH 2/5] btrfs: use a separate variable to store the num_bytes of the qgroup_reserve

2018-08-08 Thread Lu Fengqi
David Sterba 于2018年8月8日周三 下午9:57写道: > > On Wed, Aug 08, 2018 at 11:04:37AM +0800, Lu Fengqi wrote: > > On Tue, Aug 07, 2018 at 06:19:12PM +0200, David Sterba wrote: > > >On Sat, Aug 04, 2018 at 09:10:54PM +0800, Lu Fengqi wrote: > > >> After btrfs_qgroup_r

Re: [RFC PATCH 0/4] undelete subvolume online version

2018-08-08 Thread Lu Fengqi
On Wed, Aug 08, 2018 at 02:11:24PM +0800, Qu Wenruo wrote: > > >On 2018年08月08日 00:39, David Sterba wrote: >> On Sun, Aug 05, 2018 at 06:39:57PM +0800, Lu Fengqi wrote: >>> This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online >>> btrfs subv

Re: [PATCH 2/5] btrfs: use a separate variable to store the num_bytes of the qgroup_reserve

2018-08-07 Thread Lu Fengqi
On Tue, Aug 07, 2018 at 06:19:12PM +0200, David Sterba wrote: >On Sat, Aug 04, 2018 at 09:10:54PM +0800, Lu Fengqi wrote: >> After btrfs_qgroup_reserve_meta_prealloc(), num_bytes will be assigned >> again by btrfs_calc_trans_metadata_size(). Therefore, once block_rsv >> fail

Re: [RFC PATCH 0/4] undelete subvolume online version

2018-08-07 Thread Lu Fengqi
On Tue, Aug 07, 2018 at 06:39:50PM +0200, David Sterba wrote: >On Sun, Aug 05, 2018 at 06:39:57PM +0800, Lu Fengqi wrote: >> This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online >> btrfs subvolume undelete. >> >> And btrfs subvolume undelete subcomma

Re: [PATCH v3] btrfs: qgroup: Remove qgroup items along with subvolume deletion

2018-08-07 Thread Lu Fengqi
nce level 0 qgroup cannot be used/inherited by any other subvolume, >let's remove them automatically when subvolume is deleted >(to be precise, when the subvolume root is dropped). > >Reviewed-by: Lu Fengqi >Reviewed-by: Qu Wenruo >Signed-off-by: Misono Tomohiro >--- >v2 ->

Re: [PATCH v2 00/12] mkfs: Quota support through -R|--runtime quota

2018-08-07 Thread Lu Fengqi
On Mon, Jul 30, 2018 at 01:03:00PM +0800, Qu Wenruo wrote: >Ping the 3rd time? > >Or should I just rebase the patchset? Hi Qu Could you rebase this patchset? Because I want to test existing test cases with enabled quota, mkfs_qgroup seems to ease my workload. -- Thanks, Lu > >Thanks, >Qu >

[RFC PATCH 4/4] btrfs: undelete: Add the btrfs_ioctl_undelete

2018-08-05 Thread Lu Fengqi
The function will traverse the root from the fs_info->dead_roots and try to call btrfs_undelete_subvolume() to recover them. Note: It will lock fs_info->cleaner_mutex to keep the cleaner kthread from deleting the subvolume which we want to recover. Signed-off-by: Lu Fengqi --- fs/btrfs/i

[RFC PATCH 0/4] undelete subvolume online version

2018-08-05 Thread Lu Fengqi
to dir named to . # btrfs subvolume undelete [-p ] btrfs online undelete version: https://github.com/littleroad/linux.git undelete btrfs-progs online undelete version: https://github.com/littleroad/btrfs-progs.git online_undelete Issue: #82 Lu Fengqi (4): btrfs: factor out btrfs_link_subvol

[RFC PATCH 1/4] btrfs: factor out btrfs_link_subvol from create_subvol

2018-08-05 Thread Lu Fengqi
The function btrfs_link_subvol is responsible to link the subvolume to the specified directory, which is the opposite of what btrfs_unlink_subvol does. No functional change. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 65 ++-- 1 file changed, 41

[RFC PATCH 3/4] btrfs: undelete: introduce btrfs_undelete_subvolume

2018-08-05 Thread Lu Fengqi
The function will do the following things which are almost the opposite of what btrfs_delete_subvolume() does: 1. link the subvolume to the parent specified; 2. clear root flag and set root_refs to 1; 3. add the subvol to the uuid_tree; 4. delete the orphan_item. Signed-off-by: Lu Fengqi

[RFC PATCH 2/4] btrfs: don't BUG_ON() in btrfs_link_subvol()

2018-08-05 Thread Lu Fengqi
Both of btrfs_update_inode() and btrfs_add_root_ref() may fail because of ENOMEM. So there's no reason to panic here, we can replace BUG_ON() with btrfs_abort_transaction() here. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

  1   2   3   4   5   >