[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 --- fs/btrfs

[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

[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: https://githu

[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 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 09/13] btrfs: introduce type based delalloc metadata reserve

2018-11-05 Thread Lu Fengqi
only 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

[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 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
alue will be (0). 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 +++

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

2018-11-05 Thread Lu Fengqi
e the 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/btrf

[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 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 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 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 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

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] 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] 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 >>

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

2018-11-22 Thread Lu Fengqi
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

[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.

[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

[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 ind

[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

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: >>>>

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

[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

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

2018-11-29 Thread Lu Fengqi
ocow 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 @@ stat

[PATCH 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-02-02 Thread Lu Fengqi
The function is used to determine whether the subvolume is intact. Signed-off-by: Lu Fengqi --- Makefile | 3 ++- undelete-subvol.c | 53 + undelete-subvol.h | 17 + 3 files changed, 72 insertions(+), 1 deletion

[PATCH 05/10] btrfs-progs: undelete-subvol: introduce recover_dead_root

2018-02-02 Thread Lu Fengqi
The function will find the root_item specified by the subvol_id, clear the BTRFS_ROOT_SUBVOL_DEAD flag and set root_refs to one. Signed-off-by: Lu Fengqi --- ctree.h | 1 + undelete-subvol.c | 55 +++ 2 files changed, 56 insertions

[PATCH 07/10] btrfs-progs: undelete-subvol: introduce btrfs_undelete_intact_subvols

2018-02-02 Thread Lu Fengqi
The function will traverse the all orphan items on the tree root, and recover the all intact subvolumes. Signed-off-by: Lu Fengqi --- undelete-subvol.c | 60 +++ undelete-subvol.h | 2 ++ 2 files changed, 62 insertions(+) diff --git a

[PATCH 01/10] btrfs-progs: copy btrfs_del_orphan_item from kernel

2018-02-02 Thread Lu Fengqi
Add btrfs_del_orphan_item for the later subvolume undelete. Signed-off-by: Lu Fengqi --- ctree.h | 2 ++ inode.c | 30 ++ 2 files changed, 32 insertions(+) diff --git a/ctree.h b/ctree.h index 17cdac76c58c..84bad186a349 100644 --- a/ctree.h +++ b/ctree.h @@ -2784,6

[PATCH 03/10] btrfs-progs: use btrfs_find_free_dir_index to find free inode index

2018-02-02 Thread Lu Fengqi
Since we have an existing function to find free inode index, we can reuse it here. Signed-off-by: Lu Fengqi --- inode.c | 27 +++ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/inode.c b/inode.c index 478036562652..86905365dfd8 100644 --- a/inode.c +++ b

[PATCH 00/10] btrfs-progs: introduce btrfs rescue undelete-subvol subcommand

2018-02-02 Thread Lu Fengqi
This command will undelete all subvolumes those are still intact on the device, and all the recovered subvolumes will link with the name "sub" to the lost+found directory. Lu Fengqi (10): btrfs-progs: copy btrfs_del_orphan_item from kernel btrfs-progs: extract btrfs_link_s

[PATCH 02/10] btrfs-progs: extract btrfs_link_subvol from btrfs_mksubvol

2018-02-02 Thread Lu Fengqi
ass a trans argument for later subvolume undelete. No functional changes for the btrfs_mksubvol. Signed-off-by: Lu Fengqi --- convert/main.c | 57 + ctree.h| 5 +++-- inode.c| 46 +---

[PATCH 09/10] btrfs-progs: tests: add testcase for undelete-subvol

2018-02-02 Thread Lu Fengqi
The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi --- .../029-undelete-subvol/deleted_subvolume.img | Bin 0 -> 4096 bytes .../029-un

[PATCH 08/10] btrfs-progs: undelete-subvol: add undelete-subvol subcommand

2018-02-02 Thread Lu Fengqi
Add the undelete-subvol subcommand for btrfs rescue. This subcommand is used to recover all deleted subvolume left intact on the device. Signed-off-by: Lu Fengqi --- cmds-rescue.c | 47 +++ 1 file changed, 47 insertions(+) diff --git a/cmds-rescue.c

[PATCH 06/10] btrfs-progs: undelete-subvol: introduce link_subvol_to_lostfound

2018-02-02 Thread Lu Fengqi
The function will create lost+found directory, link the deleted subvolume specified by the subvol_id to the directory, update the information of root_item and cleanup the associated orphan item. Signed-off-by: Lu Fengqi --- undelete-subvol.c | 76

[PATCH 10/10] btrfs-progs: undelete-subvol: update completion and documentation

2018-02-02 Thread Lu Fengqi
Add undelete-subvol to btrfs-completion, and update btrfs-rescue documentation to introduce undelete-subvol. Signed-off-by: Lu Fengqi --- Documentation/btrfs-rescue.asciidoc | 6 ++ btrfs-completion| 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a

[PATCH] btrfs-progs: check/lowmem: Fix the incorrect error message of check_extent_data_item

2018-02-27 Thread Lu Fengqi
Instead of the disk_bytenr and disk_num_bytes of the extent_item which the file extent references, we should output the objectid and offset of the file extent. Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree") Signed-off-by: Lu Fengqi

[PATCH v2 1/3] btrfs-progs: check/lowmem: Fix the incorrect error message of check_extent_data_item

2018-02-28 Thread Lu Fengqi
("btrfs-progs: check: introduce function to check data backref in extent tree") Signed-off-by: Lu Fengqi --- V2: Output the objectid of the root and the owner of the leaf. check/mode-lowmem.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/check/mode-lowmem

[PATCH 3/3] btrfs-progs: fsck-tests: Introduce test case with keyed data backref with the extent offset

2018-02-28 Thread Lu Fengqi
ile11 btrfs subvolume snapshot $mnt $mnt/snap1 umount $mnt btrfs-image -c9 $dev extent_data_ref.img -- Signed-off-by: Lu Fengqi --- .../fsck-tests/020-extent-ref-cases/extent_data_ref.img | Bin 0 -> 6144 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/f

[PATCH 2/3] btrfs-progs: check/lowmem: Fix false alert of data extent backref lost for snapshot

2018-02-28 Thread Lu Fengqi
(file offset - extent offset). What caused the false alert is the code mix up the owner root objectid and the file tree objectid. Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree") Signed-off-by: Lu Fengqi --- check/mode-lowmem.c | 4 ++

[PATCH] fstests: btrfs/004: increase the buffer size of logical-resolve to the maximum value 64K

2018-03-05 Thread Lu Fengqi
Because of commit e76e13ce8c0b ("fsstress: implement the clonerange/deduperange ioctls"), dedupe makes the number of references to the same extent item increase so much that the default 4K buffer of logical-resolve is no longer sufficient. Signed-off-by: Lu Fengqi --- tests/btrfs/004

[PATCH] fstests: btrfs/146: make sure hit all stripes in the case of compression

2018-03-07 Thread Lu Fengqi
In the case of compression, each 128K input data chunk will be compressed to 4K (because of the characters written are duplicate). Therefore we have to write (128K * 16) to make sure every stripe can be hit. Signed-off-by: Lu Fengqi --- tests/btrfs/146 | 11 +-- 1 file changed, 9

[PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression

2018-03-07 Thread Lu Fengqi
In the case of compression, each 128K input data chunk will be compressed to 4K (because of the characters written are duplicate). Therefore we have to write (128K * 16) to make sure every stripe can be hit. Signed-off-by: Lu Fengqi --- V2: Modify the regular expression to ensure that it

Re: [PATCH v2] fstests: btrfs/146: make sure hit all stripes in the case of compression

2018-03-08 Thread Lu Fengqi
On Thu, Mar 08, 2018 at 02:10:59PM +0800, Eryu Guan wrote: >On Thu, Mar 08, 2018 at 01:56:45PM +0800, Lu Fengqi wrote: >> In the case of compression, each 128K input data chunk will be compressed >> to 4K (because of the characters written are duplicate). Therefore we have >>

[PATCH v3] fstests: btrfs/146: make sure hit all stripes in the case of compression

2018-03-08 Thread Lu Fengqi
In the case of compression, each 128K input data chunk will be compressed to 4K (because of the characters written are duplicate). Therefore we have to write (128K * 16) to make sure every stripe can be hit. Signed-off-by: Lu Fengqi --- V3: Write ($number_of_devices * 2048)K data unconditionally

Re: [PATCH 1/2] Btrfs-progs: check, fix false error reports for shared prealloc extents

2018-03-13 Thread Lu Fengqi
On Wed, Mar 14, 2018 at 09:32:50AM +0800, Qu Wenruo wrote: > > >On 2018年03月14日 02:47, fdman...@kernel.org wrote: >> From: Filipe Manana >> >> Under some cases the filesystem checker reports an error when it finds >> checksum items for an extent that is referenced by an inode as a prealloc >> exte

[PATCH v2 05/10] btrfs-progs: undelete-subvol: introduce recover_dead_root

2018-03-27 Thread Lu Fengqi
The function will find the root_item specified by the subvol_id, clear the BTRFS_ROOT_SUBVOL_DEAD flag and set root_refs to one. Signed-off-by: Lu Fengqi --- ctree.h | 1 + undelete-subvol.c | 55 +++ 2 files changed, 56 insertions

[PATCH v2 00/10] undelete subvolume offline version

2018-03-27 Thread Lu Fengqi
ume which will be recovered. The first six patches are not modified. 7th-8th add the -s option to specify subvol_id instead of recovering all subvolumes. 9th add shell quoting to test script. 10th just add the -s option documentation. Lu Fengqi (10): btrfs-progs: copy btrfs_del_orphan_item from ker

[PATCH v2 10/10] btrfs-progs: undelete-subvol: update completion and documentation

2018-03-27 Thread Lu Fengqi
Add undelete-subvol to btrfs-completion, and update btrfs-rescue documentation to introduce undelete-subvol. Signed-off-by: Lu Fengqi --- v2: just add -s option documentation. Documentation/btrfs-rescue.asciidoc | 12 btrfs-completion| 2 +- 2 files changed

[PATCH v2 02/10] btrfs-progs: extract btrfs_link_subvol from btrfs_mksubvol

2018-03-27 Thread Lu Fengqi
ass a trans argument for later subvolume undelete. No functional changes for the btrfs_mksubvol. Signed-off-by: Lu Fengqi --- convert/main.c | 57 + ctree.h| 5 +++-- inode.c| 46 +---

[PATCH v2 06/10] btrfs-progs: undelete-subvol: introduce link_subvol_to_lostfound

2018-03-27 Thread Lu Fengqi
The function will create lost+found directory, link the deleted subvolume specified by the subvol_id to the directory, update the information of root_item and cleanup the associated orphan item. Signed-off-by: Lu Fengqi --- undelete-subvol.c | 76

[PATCH v2 07/10] btrfs-progs: undelete-subvol: introduce btrfs_undelete_intact_subvols

2018-03-27 Thread Lu Fengqi
The function default will traverse the all orphan items on the tree root, and recover the all intact subvolumes. If subvol_id is specified, then only the corresponding subvolume will be recovered. Signed-off-by: Lu Fengqi --- v2: add subvol_id argumenta to specify subvol_id instead of recovering

[PATCH v2 08/10] btrfs-progs: undelete-subvol: add undelete-subvol subcommand

2018-03-27 Thread Lu Fengqi
Add the undelete-subvol subcommand for btrfs rescue. This subcommand is used to recover deleted subvolume left intact on the device. Signed-off-by: Lu Fengqi --- v2: add -s option to specify subvol_id. cmds-rescue.c | 70 +++ 1 file

[PATCH v2 01/10] btrfs-progs: copy btrfs_del_orphan_item from kernel

2018-03-27 Thread Lu Fengqi
Add btrfs_del_orphan_item for the later subvolume undelete. Signed-off-by: Lu Fengqi --- ctree.h | 2 ++ inode.c | 30 ++ 2 files changed, 32 insertions(+) diff --git a/ctree.h b/ctree.h index fa861ba0b4c3..0fc31dd8d998 100644 --- a/ctree.h +++ b/ctree.h @@ -2793,6

[PATCH v2 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-03-27 Thread Lu Fengqi
The function is used to determine whether the subvolume is intact. Signed-off-by: Lu Fengqi --- Makefile | 3 ++- undelete-subvol.c | 53 + undelete-subvol.h | 17 + 3 files changed, 72 insertions(+), 1 deletion

[PATCH v2 03/10] btrfs-progs: use btrfs_find_free_dir_index to find free inode index

2018-03-27 Thread Lu Fengqi
Since we have an existing function to find free inode index, we can reuse it here. Signed-off-by: Lu Fengqi --- inode.c | 27 +++ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/inode.c b/inode.c index 478036562652..86905365dfd8 100644 --- a/inode.c +++ b

[PATCH v2 09/10] btrfs-progs: tests: add testcase for undelete-subvol

2018-03-27 Thread Lu Fengqi
The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi --- v2: add shell quoting to test script. .../030-undelete-subvol/deleted_subvolume.img | Bin

[PATCH] btrfs-progs: build: modify cscope/ctags rules to include directories such as check

2018-03-27 Thread Lu Fengqi
Modify cscope/ctags rule to include directories such as check/ libbtrfsutil/kernel-lib/kernel-shared. Signed-off-by: Lu Fengqi --- Makefile | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6065522a615f..8afc8f6ed6a3 100644 --- a/Makefile

Re: [PATCH v2 0/5] btrfs-progs: extent buffer related refactor and cleanup

2018-03-30 Thread Lu Fengqi
s-progs: Unify btrfs_leaf_free_psace() parameter with kernel > btrfs-progs: print-tree: Remove btrfs_root parameter The patchset looks good to me. Reviewed-by: Lu Fengqi > > btrfs-corrupt-block.c | 2 +- > check/main.c | 2 +- > check/mode-lowmem.c | 2 +-

Re: [PATCH] btrfs: print-tree: output enhancement

2018-04-08 Thread Lu Fengqi
btrfs-progs > >Please note that, although function btrfs_print_tree() is not called by >anyone right now, it's still a pretty useful function to debug kernel. >So that function is still kept for later use. > >Signed-off-by: Qu Wenruo Looks good to me. Reviewed-by: Lu Fe

[PATCH] btrfs-progs: print-tree: remove dead code from btrfs_print_tree

2018-04-08 Thread Lu Fengqi
Since the out label has been deleted, this free_extent_buffer will never be executed. Fixes: f37ae8d275c2 ("btrfs-progs: print-tree: Enhance warning on tree block level mismatch and error handling") Signed-off-by: Lu Fengqi --- print-tree.c | 2 -- 1 file changed, 2 deletions(-) di

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

2018-04-17 Thread Lu Fengqi
On Tue, Mar 27, 2018 at 03:06:48PM +0800, Lu Fengqi wrote: >This patchset will add undelete-subvol subcommand for btrfs rescue. This >enhancement allows undeleting a subvolume on an unmounted filesystem. Gentle ping. Any advice about this patchset will be welcomed. -- Thanks, Lu >

Re: [PATCH v2 02/10] btrfs-progs: extract btrfs_link_subvol from btrfs_mksubvol

2018-05-06 Thread Lu Fengqi
On Wed, Apr 18, 2018 at 01:02:43PM +0800, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The original btrfs_mksubvol is too specific to specify the directory that the subvolume will link to. Furthermore, in this transaction, we don't only need to create root_ref/dir-item, but

Re: [PATCH v2 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-05-06 Thread Lu Fengqi
On Wed, Apr 18, 2018 at 01:12:10PM +0800, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The function is used to determine whether the subvolume is intact. Signed-off-by: Lu Fengqi --- Makefile | 3 ++- undelete-subvol.c | 53

Re: [PATCH v2 05/10] btrfs-progs: undelete-subvol: introduce recover_dead_root

2018-05-06 Thread Lu Fengqi
On Wed, Apr 18, 2018 at 01:16:55PM +0800, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The function will find the root_item specified by the subvol_id, clear the BTRFS_ROOT_SUBVOL_DEAD flag and set root_refs to one. Sorry I didn't point it out in btrfs_link_subvol() patch, b

Re: [PATCH v2 06/10] btrfs-progs: undelete-subvol: introduce link_subvol_to_lostfound

2018-05-06 Thread Lu Fengqi
On 04/18/2018 01:21 PM, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The function will create lost+found directory, link the deleted subvolume specified by the subvol_id to the directory, update the information of root_item and cleanup the associated orphan item. Signed-off-by: Lu

Re: [PATCH v2 07/10] btrfs-progs: undelete-subvol: introduce btrfs_undelete_intact_subvols

2018-05-06 Thread Lu Fengqi
On Wed, Apr 18, 2018 at 01:28:23PM +0800, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The function default will traverse the all orphan items on the tree root, and recover the all intact subvolumes. If subvol_id is specified, then only the corresponding subvolume will be recovered

Re: [PATCH v2 08/10] btrfs-progs: undelete-subvol: add undelete-subvol subcommand

2018-05-06 Thread Lu Fengqi
On 04/18/2018 01:32 PM, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: Add the undelete-subvol subcommand for btrfs rescue. This subcommand is used to recover deleted subvolume left intact on the device. Signed-off-by: Lu Fengqi --- v2: add -s option to specify subvol_id. cmds

Re: [PATCH v2 09/10] btrfs-progs: tests: add testcase for undelete-subvol

2018-05-06 Thread Lu Fengqi
On 04/18/2018 01:42 PM, Qu Wenruo wrote: On 2018年03月27日 15:06, Lu Fengqi wrote: The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi --- v2: add she

[PATCH v3 08/10] btrfs-progs: undelete-subvol: add undelete-subvol subcommand

2018-05-06 Thread Lu Fengqi
Add the undelete-subvol subcommand for btrfs rescue. This subcommand is used to recover deleted subvolume left intact on the device. Signed-off-by: Lu Fengqi --- V3: remove OPEN_CTREE_PARTIAL flag. V2: add -s option to specify subvol_id. cmds-rescue.c | 69

[PATCH v3 07/10] btrfs-progs: undelete-subvol: introduce btrfs_undelete_subvols

2018-05-06 Thread Lu Fengqi
The function default will traverse the all orphan items on the tree root, and recover the all intact subvolumes. If subvol_id is specified, then only the corresponding subvolume will be recovered. Signed-off-by: Lu Fengqi --- V3: pass btrfs_fs_info instead of btrfs_root; rename

[PATCH v3 00/10] undelete subvolume offline version

2018-05-06 Thread Lu Fengqi
. The first patch are not modified. For the rest, please see the changelog in the patches. Lu Fengqi (10): btrfs-progs: copy btrfs_del_orphan_item from kernel btrfs-progs: extract btrfs_link_subvol from btrfs_mksubvol btrfs-progs: use btrfs_find_free_dir_index to find free inode index btrfs

[PATCH v3 05/10] btrfs-progs: undelete-subvol: introduce recover_dead_root

2018-05-06 Thread Lu Fengqi
The function will find the root_item specified by the subvol_id and clear the BTRFS_ROOT_SUBVOL_DEAD flag. Signed-off-by: Lu Fengqi --- V3: remove btrfs_root argument; don't modify root_refs. ctree.h | 1 + undelete-subvol.c | 51 +

[PATCH v3 03/10] btrfs-progs: use btrfs_find_free_dir_index to find free inode index

2018-05-06 Thread Lu Fengqi
Since we have an existing function to find free inode index, we can reuse it here. Signed-off-by: Lu Fengqi Reviewed-by: Qu Wenruo --- V3: add Reviewed-by from Qu Wenruo. inode.c | 27 +++ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/inode.c b/inode.c

[PATCH v3 02/10] btrfs-progs: extract btrfs_link_subvol from btrfs_mksubvol

2018-05-06 Thread Lu Fengqi
trans argument for later subvolume undelete. And rename the original btrfs_mksubvol to link_subvol_for_convert since it is a less generic btrfs_link_subvol. No functional changes. Signed-off-by: Lu Fengqi --- V3: rename the btrfs_mksubvol to link_subvol_for_convert; remove the redundant parameter co

[PATCH v3 01/10] btrfs-progs: copy btrfs_del_orphan_item from kernel

2018-05-06 Thread Lu Fengqi
Add btrfs_del_orphan_item for the later subvolume undelete. Signed-off-by: Lu Fengqi --- ctree.h | 2 ++ inode.c | 30 ++ 2 files changed, 32 insertions(+) diff --git a/ctree.h b/ctree.h index 1fef37c93485..46a1dbfd2f27 100644 --- a/ctree.h +++ b/ctree.h @@ -2796,6

[PATCH v3 04/10] btrfs-progs: undelete-subvol: introduce is_subvol_intact

2018-05-06 Thread Lu Fengqi
The function is used to determine whether the subvolume is intact. Signed-off-by: Lu Fengqi --- V3: add SPDX-License-Identifier; pass btrfs_fs_info instead of btrfs_root; use btrfs_read_fs_root instead of manually search; remove empty header file. Makefile | 3 ++- undelete-subvol.c

[PATCH v3 09/10] btrfs-progs: tests: add testcase for undelete-subvol

2018-05-06 Thread Lu Fengqi
The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi --- V3: rename testcase to 031-undelete-subvol; rename images and add image description to test.s

[PATCH v3 10/10] btrfs-progs: undelete-subvol: update completion and documentation

2018-05-06 Thread Lu Fengqi
Add undelete-subvol to btrfs-completion, and update btrfs-rescue documentation to introduce undelete-subvol. Signed-off-by: Lu Fengqi --- V2: just add -s option documentation. Documentation/btrfs-rescue.asciidoc | 12 btrfs-completion| 2 +- 2 files changed

[PATCH v3 06/10] btrfs-progs: undelete-subvol: introduce link_subvol_to_lostfound

2018-05-06 Thread Lu Fengqi
The function will create lost+found directory, link the deleted subvolume specified by the subvol_id to the directory, update the information of root_item and cleanup the associated orphan item. Signed-off-by: Lu Fengqi Reviewed-by: Qu Wenruo --- V3: pass btrfs_fs_info instead of btrfs_root

[PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation

2018-05-07 Thread Lu Fengqi
parameters is wrong and causes qgroup show to output the wrong qgroup parent-child relationship. Fixes: aaf2dac5ef37 ("btrfs-progs: qgroup: split update_qgroup to reduce arguments") Issue: #129 Signed-off-by: Lu Fengqi --- qgroup.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletion

Re: How about adding an ioctl to convert a directory to a subvolume?

2017-11-29 Thread Lu Fengqi
On Tue, Nov 28, 2017 at 07:48:28PM +0100, David Sterba wrote: >On Mon, Nov 27, 2017 at 05:41:56PM +0800, Lu Fengqi wrote: >> As we all know, under certain circumstances, it is more appropriate to >> create some subvolumes rather than keep everything in the same >> subvolume

[PATCH v2 3/4] btrfs-progs: qgroup: show subvol path when qgroup show

2017-12-04 Thread Lu Fengqi
Show the absolute subvol path for the associated level-0 qgroup. Signed-off-by: Lu Fengqi --- Changelog: v2: rebase on the qgroup cleanup qgroup.c | 111 +++ qgroup.h | 1 + 2 files changed, 106 insertions(+), 6 deletions(-) diff

[PATCH 0/4] qgroup cleanup and add show path feature

2017-12-04 Thread Lu Fengqi
The first two patches are the rest of the qgroup cleanup, the two remaining patches add show path feature. Lu Fengqi (4): btrfs-progs: qgroup: move btrfs_show_qgroups's error handler to __qgroup_search btrfs-progs: qgroup: cleanup __qgroup_search btrfs-progs: qgroup: show subvol

[PATCH 1/4] btrfs-progs: qgroup: move btrfs_show_qgroups's error handler to __qgroup_search

2017-12-04 Thread Lu Fengqi
in this routine has been reported, so we don't need to report again in cmd_qgroup_show. Signed-off-by: Lu Fengqi --- cmds-qgroup.c | 4 qgroup.c | 14 -- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 38382ea9..d07

[PATCH v2 2/4] btrfs-progs: qgroup: cleanup __qgroup_search

2017-12-04 Thread Lu Fengqi
Replace the if statement with the switch statement, and return the appropriate value for the future use rather than directly exit. Signed-off-by: Lu Fengqi --- Changelog: v2: 1. revoke incorrect goto pattern 2. split the error handler movement to another patch qgroup.c | 48

[PATCH v2 4/4] btrfs-progs: qgroup: allow show qgroup in order of subvol path

2017-12-04 Thread Lu Fengqi
You may want to sort qgroup with the subvol path, now you can use --sort=path. Signed-off-by: Lu Fengqi --- Changelog: v2: rebase on the qgroup cleanup Documentation/btrfs-qgroup.asciidoc | 2 +- cmds-qgroup.c | 2 +- qgroup.c| 22

[PATCH v14.5 02/14] btrfs: Introduce COMPRESS reserve type to fix false enospc for compression

2017-12-11 Thread Lu Fengqi
3): outstanding_extents = 1023 reserved_extents = 1023 And in Step 5) we reserve correct amount of metadata space. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo Signed-off-by: Lu Fengqi --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/extent-tree.c | 2 ++ fs/btrfs/extent_io.c | 7 +++-- fs/

[PATCH v14.5 10/14] btrfs: ordered-extent: Add support for dedupe

2017-12-11 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 --- fs/btrfs

[PATCH v14.5 08/14] btrfs: dedupe: Introduce function to search for an existing hash

2017-12-11 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 | 189 ++ 1 file changed, 189 insertions(+) diff --git a/fs/btrfs/dedupe.c b/fs/btrfs/dedupe.c index 762960edb251

[PATCH v14.5 07/14] btrfs: delayed-ref: Add support for increasing data ref under spinlock

2017-12-11 Thread Lu Fengqi
From: Qu Wenruo For in-band dedupe, btrfs needs to increase data ref with delayed_ref locked, so add a new function btrfs_add_delayed_data_ref_lock() to increase extent ref with delayed_refs already locked. Signed-off-by: Qu Wenruo Reviewed-by: Josef Bacik Signed-off-by: Lu Fengqi --- fs

[PATCH v14.5 13/14] btrfs: relocation: Enhance error handling to avoid BUG_ON

2017-12-11 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 is

[PATCH v14.5 05/14] btrfs: dedupe: Introduce function to add hash into in-memory tree

2017-12-11 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 --- fs/btrfs/dedupe.c | 151 +

  1   2   3   4   5   >