Re: [PATCH] Btrfs: rework outstanding_extents

2017-08-24 Thread Lu Fengqi
g_extents much more explicit. >Every successful call to btrfs_reserve_delalloc_metadata _must_ now be >combined with btrfs_release_delalloc_extents, even in the error case, as >that is the only function that actually modifies the >outstanding_extents counter. s/btrfs_reserve_delalloc_me

[PATCH 1/6] btrfs-progs: check: enable repair in lowmem mode

2017-08-22 Thread Lu Fengqi
From: Su Yue Turn on the option --repair with --mode==lowmem in btrfsck. Signed-off-by: Su Yue --- cmds-check.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index c5faa2b..829f7c5

[PATCH 4/6] btrfs-progs: check: Introduce repair_chunk_item()

2017-08-22 Thread Lu Fengqi
From: Su Yue Because this patchset concentrates on repair of extent tree, repair_chunk_item() now only inserts missed chunk group item into extent tree. There are some things left TODO, for example dev_item. Signed-off-by: Su Yue ---

[PATCH 3/6] btrfs-progs: check: delete wrong items in lowmem repair

2017-08-22 Thread Lu Fengqi
From: Su Yue Introduce delete_extent_tree_item() and repair_extent_item() to do delete only. while checking a extent tree, just delete wrong item. For extent item, free wrong backref. Otherwise, do delete. So the rest items in extent tree should be correct.

[PATCH 5/6] [btrfs-progs: check: Introduce repair_tree_block_ref()

2017-08-22 Thread Lu Fengqi
From: Su Yue The only thing repair_tree_block_ref() does is that adding backref of the tree_block. Just like what origin repair do: It first searches the correspond extent item then 1. If the extent item exists but backref is missing, add one backref to the extent.

[PATCH 0/6] btrfs-progs: check: extent tree lowmem repair

2017-08-22 Thread Lu Fengqi
From: Su Yue This is part 2 of lowmem repair patchsets: 1. Change the way of traversal under lowmem check to use walk_up_tree_v2() and walk_down_tree_v2() and it scans all trees now. 2. Repair cases: block group missing, tree block backref missing, extent item

[PATCH 6/6] btrfs-progs: check: Introduce repair_extent_data_item()

2017-08-22 Thread Lu Fengqi
From: Su Yue The only thing repair_extent_data_item() does is that adding backref of the tree_block. Just like what origin repair do: It first searches the correspond extent item then 1. If the extent item exists but backref is missing, add one backref to the extent.

[PATCH 2/6] btrfs-progs: check: change traversal way of lowmem mode

2017-08-22 Thread Lu Fengqi
From: Su Yue This patch is a preparation for extent-tree repair in lowmem mode. In the lowmem mode, checking tree blocks of various tree is in recursive way. But if during repair, add or delete of item(s) may modify upper nodes which will cause the repair to be

[PATCH] btrfs: use btrfsic_submit_bio instead of submit_bio in write_dev_flush

2017-08-18 Thread Lu Fengqi
references block M @29523968 (sdb1/37912576/0) which is not flushed out of disk's write cache (block flush_gen=1, dev->flush_gen=0)! Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/d

Re: [PATCH] fstests: btrfs: enhance regression test for nocsum dio read's repair

2017-08-15 Thread Lu Fengqi
On Tue, Aug 15, 2017 at 05:16:06PM +0800, Eryu Guan wrote: >On Mon, Aug 14, 2017 at 03:03:13PM +0800, Lu Fengqi wrote: >> I catch this following error from dmesg when this testcase fails. >> >> [17446.661127] Buffer I/O error on dev sdb1, logical block 64, async page >

[PATCH] fstests: btrfs: enhance regression test for nocsum dio read's repair

2017-08-14 Thread Lu Fengqi
task-filter to solve this problem. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- tests/btrfs/142 | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/btrfs/142 b/tests/btrfs/142 index 414af1b2..5bd8b728 100755 --- a/tests/btrfs/142 +++ b

[PATCH] btrfs: verify_dir_item fails in replay_xattr_deletes

2017-08-01 Thread Lu Fengqi
From: Su Yue In replay_xattr_deletes(), the argument @slot of verify_dir_item() should be variable @i instead of path->slots[0]. The bug causes failure of generic/066 and shared/002 in xfstest. dmesg: [12507.810781] BTRFS critical (device dm-0): invalid dir item name

[PATCH v14.4 09/15] btrfs: dedupe: Introduce function to search for an existing hash

2017-07-12 Thread Lu Fengqi
lement the btrfs_dedupe_search() interface. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Wang Xiaoguang <wangxg.f...@cn.fujitsu.com> Reviewed-by: Josef Bacik <jba...@fb.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com>

[PATCH v14.4 01/15] btrfs: improve inode's outstanding_extents computation

2017-07-12 Thread Lu Fengqi
tion will only handle about 2MB data. So btrfs_dirty_pages() won't need to handle cases cross 2 extents. Signed-off-by: Wang Xiaoguang <wangxg.f...@cn.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/inode.c | 63 +

[PATCH v14.4 02/15] btrfs: introduce type based delalloc metadata reserve

2017-07-12 Thread Lu Fengqi
rently only normal 128M extent size is supported. More types will follow soon. Signed-off-by: Wang Xiaoguang <wangxg.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/ctree.h |

[PATCH v14.4 08/15] btrfs: delayed-ref: Add support for increasing data ref under spinlock

2017-07-12 Thread Lu Fengqi
gt; Reviewed-by: Josef Bacik <jba...@fb.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/delayed-ref.c | 35 +++ fs/btrfs/delayed-ref.h | 10 ++ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/delayed-

[PATCH v14.4 13/15] btrfs: dedupe: Add ioctl for inband dedupelication

2017-07-12 Thread Lu Fengqi
mit_nr/limit_mem, the value will be (0). Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> Signed-off-by: Wang Xiaoguang <wangxg.f...@cn.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/dedupe.c | 50 ++ fs/btrf

[PATCH v14.4 04/15] btrfs: dedupe: Introduce dedupe framework and its header

2017-07-12 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

[PATCH v14.4 00/15] Btrfs In-band De-duplication

2017-07-12 Thread Lu Fengqi
This patchset can be fetched from github: https://github.com/littleroad/linux.git dedupe_20170712 This is just a normal rebase update. Now the new base is kdave/for-4.13-part1 Normal test cases from auto group exposes no regression, and ib-dedupe group can pass without problem. Changelog: v2:

Re: ctree.c:197: update_ref_for_cow: BUG_ON `ret` triggered, value -5

2017-07-07 Thread Lu Fengqi
On Thu, Jul 06, 2017 at 10:39:53PM -0700, Marc MERLIN wrote: >On Thu, Jul 06, 2017 at 10:37:18PM -0700, Marc MERLIN wrote: >> I'm still trying to fix my filesystem. >> It seems to work well enough since the damage is apparently localized, but >> I'd really want check --repair to actually bring it

Re: Btrfs check reports errors, filesystem seems fine

2017-07-04 Thread Lu Fengqi
On Mon, Jul 03, 2017 at 08:34:52AM +0800, Qu Wenruo wrote: > > >At 07/01/2017 07:59 PM, Filippe LeMarchand wrote: >> Hello everyone. >> >> I have an btrfs root partition on Intel 530 ssd, which mounts without errors >> and seem to work fine, >> but `btrfs check` gives me foloowing output (and

Re: [PATCH v3 2/4] btrfs-progs: lowmem check: Fix false alert about referencer count mismatch

2017-07-02 Thread Lu Fengqi
On Sun, Jul 02, 2017 at 03:50:31PM +0200, Henk Slager wrote: > >With this patch applied to v4.11, I ran: ># btrfs check -p --mode lowmem /dev/mapper/smr > >no 'referencer count mismatch' anymore, but likely due to other hidden >corruption, the check took more time than I had planned, so after 5

Re: [PATCH] Btrfs-progs: convert: do not clear header rev

2017-06-30 Thread Lu Fengqi
On Fri, Jun 30, 2017 at 04:52:54PM +0200, David Sterba wrote: >On Tue, Jun 27, 2017 at 12:07:13PM -0700, Liu Bo wrote: >> On Mon, Jun 26, 2017 at 05:55:02PM -0600, Liu Bo wrote: >> > So btrfs_set_header_flags() vs btrfs_set_header_flag, the difference is >> > sort of >> > similar to "=" vs "|=",

Re: How to fix errors that check --mode lomem finds, but --mode normal doesn't?

2017-06-30 Thread Lu Fengqi
On Thu, Jun 29, 2017 at 08:30:35AM -0700, Marc MERLIN wrote: >On Thu, Jun 29, 2017 at 09:36:15PM +0800, Lu Fengqi wrote: >> On Wed, Jun 28, 2017 at 07:43:48AM -0700, Marc MERLIN wrote: >> >[cc trimmed] >> > >> >On Wed, Jun 28, 2017 at 03:10:27PM +0800, Lu Fe

Re: How to fix errors that check --mode lomem finds, but --mode normal doesn't?

2017-06-29 Thread Lu Fengqi
On Wed, Jun 28, 2017 at 07:43:48AM -0700, Marc MERLIN wrote: >[cc trimmed] > >On Wed, Jun 28, 2017 at 03:10:27PM +0800, Lu Fengqi wrote: >> Because the output is abnormal, except for the relevant DIR_ITEM and >> DIR_INDEX, I can't find the above mentiond INODE_ITEM and EXT

Re: How to fix errors that check --mode lomem finds, but --mode normal doesn't?

2017-06-28 Thread Lu Fengqi
On Tue, Jun 27, 2017 at 04:11:46PM -0700, Marc MERLIN wrote: >On Mon, Jun 26, 2017 at 06:46:16PM +0800, Lu Fengqi wrote: >> Thanks for the updated information. I'm sorry that the false alert make >> you feel nervous. > >If you can help me find out whether those are real erro

[PATCH] fstests: btrfs: reorder the arguments of btrfs replace in btrfs/027

2017-06-27 Thread Lu Fengqi
The option parser only accept options before non-option argument. Although David Sterba has submitted commit df8c7225ba00 ("btrfs: reorder arguments so that options come first"), but this case seems to be left out. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- tes

[PATCH] btrfs-progs: lowmem: check: Output more detailed information about file extent interrupt

2017-06-27 Thread Lu Fengqi
Make lowmem mode output more detailed information about file extent interrupt. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- Sorry for any inconvenience caused. Please ignore this message(https://www.spinics.net/lists/linux-btrfs/msg66803.html). cmds-check.c | 4 ++-- 1 file c

Re: [PATCH v2] btrfs-progs: lowmem check: Fix false alert about file extent interrupt

2017-06-26 Thread Lu Fengqi
On Mon, Jun 26, 2017 at 04:55:04PM +0200, David Sterba wrote: >On Thu, Jun 22, 2017 at 04:12:56PM +0800, Lu Fengqi wrote: >> As Qu mentioned in this thread >> (https://www.spinics.net/lists/linux-btrfs/msg64469.html), compression >> can cause regular extent to co-exis

Re: How to fix errors that check --mode lomem finds, but --mode normal doesn't?

2017-06-26 Thread Lu Fengqi
On 2017年06月24日 10:34, Marc MERLIN wrote: On Fri, Jun 23, 2017 at 09:17:50AM -0700, Marc MERLIN wrote: Thanks for looking at this. I have applied your patch and I'm still re-running check in lowmem. It takes about 24H so I'll post the full results when it's done. Ok, here is the output of the

[PATCH v3 4/4] btrfs-progs: test: Add test image for lowmem mode referencer count mismatch false alert

2017-06-26 Thread Lu Fengqi
Add a image which can reproduce the extent item referencer count mismatch false alert for lowmem mode. Reported-by: Marc MERLIN <m...@merlins.org> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- .../ref_count_mismatch_false_alert.img | Bin 0 -> 409

[PATCH v3 3/4] btrfs-progs: test: Add test image for lowmem mode file extent interrupt

2017-06-26 Thread Lu Fengqi
Add a image that the inlined extent coexist with the regular extent. Reported-by: Marc MERLIN <m...@merlins.org> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- .../020-extent-ref-cases/inline_regular_coexist.img | Bin 0 -> 4096 bytes 1 file changed, 0 insertions(

[PATCH v3 1/4] btrfs-progs: lowmem check: Fix false alert about file extent interrupt

2017-06-26 Thread Lu Fengqi
, the extent_end of inlined extent also need to record. Reported-by: Marc MERLIN <m...@merlins.org> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- Changlog: v2: Just fix reported-by v3: Output verbose information when file extent interrupt cmds-check.c | 5 +++-- 1 file changed, 3 inse

[PATCH v3 2/4] btrfs-progs: lowmem check: Fix false alert about referencer count mismatch

2017-06-26 Thread Lu Fengqi
The normal back reference counting doesn't care about the extent referred by the extent data in the shared leaf. The check_extent_data_backref function need to skip the leaf that owner mismatch with the root_id. Reported-by: Marc MERLIN <m...@merlins.org> Signed-off-by: Lu Fengqi &

Re: How to fix errors that check --mode lomem finds, but --mode normal doesn't?

2017-06-23 Thread Lu Fengqi
On 2017年06月23日 12:06, Marc MERLIN wrote: Well, there is only the output from extent tree. I was also expecting output from subvolue (11930) tree. It could be done by # btrfs-debug-tree -t 11930 | grep -C 10 3886187384832 I apologize if this was not made clear. But please pay attention

[PATCH v2] btrfs-progs: lowmem check: Fix false alert about file extent interrupt

2017-06-22 Thread Lu Fengqi
, the extent_end of inlined extent also need to record. Reported-by: Marc MERLIN <m...@merlins.org> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- Sorry, I mistook the reporter in v1. Changes since v1: - Fix the reported-by. cmds-check.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH] btrfs-progs: lowmem check: Fix false alert about file extent interrupt

2017-06-22 Thread Lu Fengqi
, the extent_end of inlined extent also need to record. Reported-by: Chris Murphy <li...@colorremedies.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- cmds-check.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmds-check.c b/cmds-check.c index c052f66e..c173d285 100644 --- a/

[PATCH] btrfs-progs: Fix fuzz-test for bko-161821.raw.txt

2017-05-02 Thread Lu Fengqi
not exist in the function btrfs_read_fs_root. 2. Free useless fs_info->quota_root in the function btrfs_setup_all_roots to reduce confusion. 3. free_extent_buffer even if check_child_node failed in the function walk_down_tree. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- cmds-check.c

[PATCH] btrfs-progs: tests: fssum, fix memory leak

2017-04-25 Thread Lu Fengqi
Free the alloced memory and close dir before exit. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- tests/fssum.c | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/tests/fssum.c b/tests/fssum.c index 83bd4106..8be44547

[PATCH v2 2/2] btrfs-progs: print-tree: add validation to print_chunk

2017-04-20 Thread Lu Fengqi
In print_chunk, validate the value of uuid_offset when read the dev_uuid of stripe. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- cmds-inspect-dump-super.c | 1 + print-tree.c | 20 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git

[PATCH v2 1/2] btrfs-progs: dump-super: check array_size in print_sys_chunk_array

2017-04-20 Thread Lu Fengqi
Without validation of array_size, the dump-super may lead to a bad memory access. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- v2: Accept David's advice, no longer use BTRFS_SUPER_INFO_SIZE instead of sizeof(*sb). --- cmds-inspect-dump-super.c | 11 +-- 1 file c

Re: [PATCH 1/2] btrfs-progs: dump-super: check array_size in print_sys_chunk_array

2017-04-20 Thread Lu Fengqi
On 2017年04月19日 23:41, David Sterba wrote: - buf = malloc(sizeof(*buf) + sizeof(*sb)); + buf = malloc(sizeof(*buf) + BTRFS_SUPER_INFO_SIZE); This seems to be unnecessary, the super block structure should contain entier sys_array. Alright, I will remove it. -- Thanks, Lu -- To

[PATCH 2/2] btrfs-progs: print-tree: add validation to print_chunk

2017-04-05 Thread Lu Fengqi
In print_chunk, validate the value of uuid_offset when read the dev_uuid of stripe. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- cmds-inspect-dump-super.c | 1 + print-tree.c | 20 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git

[PATCH 1/2] btrfs-progs: dump-super: check array_size in print_sys_chunk_array

2017-04-05 Thread Lu Fengqi
Without validation of array_size, the dump-super may lead to a bad memory access. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- cmds-inspect-dump-super.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmds-inspect-dump-super.c b/cmds-inspec

[PATCH 08/13] btrfs-progs: check: introduce function to check inode item

2016-07-28 Thread Lu Fengqi
Introduce a new function check_inode_item() to check INODE_ITEM and related ITEMs that have the same inode id. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-c

[PATCH 12/13] btrfs-progs: check: fix the return value bug of cmd_check()

2016-07-28 Thread Lu Fengqi
will solve the problem. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-check.c | 42 +++--- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index e

[PATCH 07/13] btrfs-progs: check: introduce function to check file extent

2016-07-28 Thread Lu Fengqi
Introduce a new function check_file_extent() to check file extent, such as datasum, hole, size. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-check.c | 94

[PATCH 03/13] btrfs-progs: check: introduce function to check inode_ref

2016-07-28 Thread Lu Fengqi
Introduce a new function check_inode_ref() to check INODE_REF, and call find_dir_item() to find the related DIR_ITEM/DIR_INDEX. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-

[PATCH 06/13] btrfs-progs: check: introduce a function to check dir_item

2016-07-28 Thread Lu Fengqi
Introduce a new function check_dir_item() to check DIR_ITEM/DIR_INDEX, and call find_inode_ref() to find the related INODE_REF/INODE_EXTREF. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-c

[PATCH 09/13] btrfs-progs: check: introduce function to check fs root

2016-07-28 Thread Lu Fengqi
Introduce a new function check_fs_root_v2() to check fs root, and call check_inode_item to check the items in the tree. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-

[PATCH 13/13] btrfs-progs: check: fix false warning for check_extent_item()

2016-07-28 Thread Lu Fengqi
In the case that a extent doesn't have inline ref, this function shouldn't report ITEM_SIZE_MISMATCH. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-check.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-)

[PATCH 11/13] btrfs-progs: check: introduce low_memory mode fs_tree check

2016-07-28 Thread Lu Fengqi
Introduce a new function check_fs_roots_v2() for check fs_tree in low_memory mode. It call check_fs_root_v2() to check fs_root, and call check_root_ref() to check root_ref. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> ---

[PATCH 10/13] btrfs-progs: check: introduce function to check root ref

2016-07-28 Thread Lu Fengqi
Introduce a new function check_root_ref() to check root_ref/root_backref. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-check.c | 93 1 file changed, 9

[PATCH 02/13] btrfs-progs: check: introduce function to find dir_item

2016-07-28 Thread Lu Fengqi
Introduce a new function find_dir_item() to find DIR_ITEM for the given key, and check it with the specified INODE_REF/INODE_EXTREF match. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-c

[PATCH 00/13] btrfs-progs: check: check fs roots in low_memory mode

2016-07-28 Thread Lu Fengqi
This patchset implements check fs trees in low memory mode, and fix the return value bug of the function cmd_check(). Lu Fengqi (13): btrfs-progs: move btrfs_extref_hash() to hash.h btrfs-progs: check: introduce function to find dir_item btrfs-progs: check: introduce function to check

[PATCH 05/13] btrfs-progs: check: introduce function to find inode_ref

2016-07-28 Thread Lu Fengqi
Introduce a new function find_inode_ref() to find INODE_REF/INODE_EXTREF for the given key, and check it with the specified DIR_ITEM/DIR_INDEX match. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-c

[PATCH 04/13] btrfs-progs: check: introduce function to check inode_extref

2016-07-28 Thread Lu Fengqi
Introduce a new function check_inode_extref() to check INODE_EXTREF, and call find_dir_item() to find the related DIR_ITEM/DIR_INDEX. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- cmds-

[PATCH 01/13] btrfs-progs: move btrfs_extref_hash() to hash.h

2016-07-28 Thread Lu Fengqi
Move btrfs_extref_hash() from inode-item.c to hash.h, so that the function can be called elsewhere. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- hash.h | 10 ++ inode-item.c | 8 +--- 2 files changed, 1

[PATCH v4] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-13 Thread Lu Fengqi
Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count or freeing an extent. Although current qgroup can handle it, we still need to prevent any regression which may break current qgroup. Signed-off-by:

Re: [PATCH v3] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-13 Thread Lu Fengqi
At 06/13/2016 05:49 PM, Filipe Manana wrote: On Mon, Jun 13, 2016 at 9:06 AM, Lu Fengqi <lufq.f...@cn.fujitsu.com> wrote: At 06/13/2016 03:29 PM, Lu Fengqi wrote: At 06/13/2016 11:04 AM, Eryu Guan wrote: On Mon, Jun 13, 2016 at 10:10:50AM +0800, Lu Fengqi wrote: Test if qgroup can

Re: [PATCH v3] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-13 Thread Lu Fengqi
At 06/13/2016 03:29 PM, Lu Fengqi wrote: At 06/13/2016 11:04 AM, Eryu Guan wrote: On Mon, Jun 13, 2016 at 10:10:50AM +0800, Lu Fengqi wrote: Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count

Re: [PATCH v3] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-13 Thread Lu Fengqi
At 06/13/2016 11:04 AM, Eryu Guan wrote: On Mon, Jun 13, 2016 at 10:10:50AM +0800, Lu Fengqi wrote: Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count or freeing an extent. Although current qgroup

[PATCH v3] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-12 Thread Lu Fengqi
Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count or freeing an extent. Although current qgroup can handle it, we still need to prevent any regression which may break current qgroup. Signed-off-by:

Re: [PATCH v2] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-12 Thread Lu Fengqi
At 06/12/2016 12:38 AM, Eryu Guan wrote: On Wed, Jun 01, 2016 at 02:40:11PM +0800, Lu Fengqi wrote: Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count or freeing an extent. Although current qgroup

[PATCH v4] btrfs: fix check_shared for fiemap ioctl

2016-06-12 Thread Lu Fengqi
of the ref_tree to check if the unique_refs is greater than one.Because once there are two references to return SHARED, so the time complexity is close to the constant. Reported-by: Tsutomu Itoh <t-i...@jp.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/backr

Re: [PATCH v3] btrfs: fix check_shared for fiemap ioctl

2016-06-12 Thread Lu Fengqi
At 06/09/2016 05:15 PM, David Sterba wrote: On Wed, Jun 08, 2016 at 08:53:00AM -0700, Mark Fasheh wrote: On Wed, Jun 08, 2016 at 01:13:03PM +0800, Lu Fengqi wrote: Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent

[PATCH v3] btrfs: fix check_shared for fiemap ioctl

2016-06-07 Thread Lu Fengqi
of the ref_tree to check if the unique_refs is greater than one.Because once there are two references to return SHARED, so the time complexity is close to the constant. Reported-by: Tsutomu Itoh <t-i...@jp.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- The caller is fiemap

Re: btrfs: fix check_shared for fiemap ioctl

2016-06-07 Thread Lu Fengqi
At 06/08/2016 01:18 AM, Dan Carpenter wrote: Hello Lu Fengqi, The patch ac8332f0c3ac: "btrfs: fix check_shared for fiemap ioctl" from Jun 1, 2016, leads to the following static checker warning: fs/btrfs/backref.c:277 ref_tree_add() error: dereferencing freed memory

Re: [PATCH v2] btrfs: fix check_shared for fiemap ioctl

2016-06-05 Thread Lu Fengqi
At 06/03/2016 10:02 PM, Josef Bacik wrote: On 06/01/2016 01:48 AM, Lu Fengqi wrote: Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent was referred by different offset of same file, it should also be identified

Re: [PATCH v2] btrfs: fix check_shared for fiemap ioctl

2016-06-01 Thread Lu Fengqi
At 06/02/2016 05:15 AM, Mark Fasheh wrote: Thanks for trying to fix this problem, comments below. On Wed, Jun 01, 2016 at 01:48:05PM +0800, Lu Fengqi wrote: Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent

[PATCH v2] fstests: btrfs: add test for qgroup handle extent de-reference

2016-06-01 Thread Lu Fengqi
Test if qgroup can handle extent de-reference during reallocation. "extent de-reference" means that reducing an extent's reference count or freeing an extent. Although current qgroup can handle it, we still need to prevent any regression which may break current qgroup. Signed-off-by:

[PATCH v2] btrfs: fix check_shared for fiemap ioctl

2016-05-31 Thread Lu Fengqi
of the ref_tree to check if the unique_refs is greater than one.Because once there are two references to return SHARED, so the time complexity is close to the constant. Reported-by: Tsutomu Itoh <t-i...@jp.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/backr

[PATCH] btrfs-progs: fix uninit variables in btrfs-image

2016-05-31 Thread Lu Fengqi
Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- btrfs-image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-image.c b/btrfs-image.c index d121951..7c2fa94 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -1757,6 +1757,7 @@ static void *restore_worker(void

[PATCH] fstests: btrfs: add test for qgroup handle de-refer

2016-05-30 Thread Lu Fengqi
Test if qgroup can handle de-reference reallocation. Although current qgroup can handle it, we still need to prevent any regression which may break current qgroup. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- common/rc | 4 +-- tests/btrfs/028

[PATCH] btrfs-progs: tests: add 020-extent-ref-cases

2016-05-29 Thread Lu Fengqi
In order to confirm that btrfsck supports to check a variety of refs, add the following cases: * keyed_block_ref * keyed_data_ref * shared_block_ref * shared_data_ref * no_inline_ref (a extent item without inline ref) * no_skinny_ref Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.

[PATCH] btrfs-progs: make btrfs-image restore to support dup

2016-05-26 Thread Lu Fengqi
store a additional physical just for the dup case when build the in-memory chunk-tree. Currently btrfsck on the restored file system, only single and dup is no problem. raid* support should be added in the future. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- btrfs-image.c

[PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-15 Thread Lu Fengqi
of the ref_tree to check if the unique_refs is greater than one.Because once there are two references to return SHARED, so the time complexity is close to the constant. Reported-by: Tsutomu Itoh <t-i...@jp.fujitsu.com> Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- fs/btrfs/backr

[PATCH] btrfs-progs: Add new option for specify chunk root bytenr

2016-03-06 Thread Lu Fengqi
Add new btrfsck option, '--chunk-root', to specify chunk root bytenr.And allow open_ctree_fs_info() function accept chunk_root_bytenr to override the bytenr in superblock.This will be mainly used when chunk tree corruption. Signed-off-by: Lu Fengqi <lufq.f...@cn.fujitsu.com> --- btrfs

[PATCH] btrfs-progs: Add new option for specify chunk root bytenr

2016-03-06 Thread Lu Fengqi
Add new btrfsck option, '--chunk-root', to specify chunk root bytenr.Modify open_ctree_fs_info() function to accept chunk_root_bytenr to override the bytenr in superblock. Lu Fengqi (1): btrfs-progs: Add new option for specify chunk root bytenr btrfs-debug-tree.c | 2 +- btrfs-find-root.c

<    1   2   3   4   5