Thread (17 messages) 17 messages, 3 authors, 2021-07-01

Re: [PATCH v4 00/10] btrfs: defrag: rework to support sector perfect defrag

From: Qu Wenruo <hidden>
Date: 2021-06-23 07:04:11
Subsystem: btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds


On 2021/6/23 下午2:56, riteshh wrote:
On 21/06/10 01:09PM, Qu Wenruo wrote:
[...]
quoted
Thus I'm wondering if the check timing is even correct for the existing
code.
But at least I can't reproduce the nbytes problem on x86_64, thus no yet
sure what the real cause is.
Hi Qu,

Sorry for getting back late on this. I was using my test machines for other
tests hence this got delayed.
No need to hurry, this branch is mostly in archive mode, no active 
development working on that yet.

But still, thank you for the testing.
I did test this whole patch series from your github https://github.com/adam900710/linux/commits/defrag_refactor.
I didn't find any crashes (as you also mentioned). But some tests did fail e.g. btrfs/072.

Is this(btrfs/072) what you are referring to in above (random test failues with subpage
sectorsize)?
Exactly the same thing.
Please do let me know if you would like me to try any of the fstest in loop for
reproducing any error. Or if there is any other tests that you would like me to
run?

1. output from btrfs/072 test.
	_check_btrfs_filesystem: filesystem on /dev/vdc is inconsistent
	*** fsck.btrfs output ***
	[1/7] checking root items
	[2/7] checking extents
	[3/7] checking free space cache
	btrfs: csum mismatch on free space cache
	failed to load free space cache for block group 22020096
	btrfs: csum mismatch on free space cache
	failed to load free space cache for block group 1095761920
	btrfs: csum mismatch on free space cache
	failed to load free space cache for block group 1364197376
	[4/7] checking fs roots
	root 5 inode 323 errors 400, nbytes wrong
Yep, and I even know how to solve it if you really want.

The diff should solve it pretty well:
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index edf597ad515f..40d6a46e43f3 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1235,8 +1235,9 @@ static int defrag_one_locked_target(struct 
btrfs_inode *inode,
         clear_extent_bit(&inode->io_tree, start, start + len - 1,
                          EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |
                          EXTENT_DEFRAG, 0, 0, cached_state);
-       set_extent_defrag(&inode->io_tree, start, start + len - 1,
-                         cached_state);
+       ret = btrfs_set_extent_delalloc(inode, start, start + len - 1,
+                                       EXTENT_DEFRAG, cached_state);
+       ASSERT(!ret);

         /* Update the page status */
         for (i = start_index - first_index; i <= last_index - first_index;

But I don't know why the timing calling set_extent_defrag() is not safe 
enough.


Currently the branch is not a high priority thing, thus feel free to 
ignore the branch and above diff for now.

	ERROR: errors found in fs roots
	Opening filesystem to check...
	Checking filesystem on /dev/vdc
	UUID: b638db59-981c-4502-831e-038930e65cf4
	found 28282880 bytes used, error(s) found
	total csum bytes: 15196
	total tree bytes: 442368
	total fs tree bytes: 331776
	total extent tree bytes: 36864
	btree space waste bytes: 163191
	file data blocks allocated: 37101568
	 referenced 27430912
	*** end fsck.btrfs output

2. btrfs/124 (- I guess this we have seen in past w/o your changes too).
	[ 2565.969989] BTRFS info (device vdc): balance: start -d -m -s
	[ 2565.970727] BTRFS info (device vdc): relocating block group 1513488384 flags data
	[ 2570.693594] BTRFS error (device vdc): bad tree block start, want 31821824 have 0
	[ 2570.725804] BTRFS info (device vdc): read error corrected: ino 0 off 31821824 (dev /dev/vdi sector 21192)
	[ 2581.579592] BTRFS info (device vdc): found 5 extents, stage: move data extents
	[ 2581.818799] BTRFS info (device vdc): found 5 extents, stage: update data pointers
	[ 2582.086796] BTRFS info (device vdc): relocating block group 976617472 flags data
	[ 2598.759264] BTRFS info (device vdc): found 6 extents, stage: move data extents
	[ 2598.991059] BTRFS info (device vdc): found 6 extents, stage: update data pointers
	[ 2599.274253] BTRFS info (device vdc): relocating block group 943063040 flags system
	[ 2599.525191] BTRFS info (device vdc): relocating block group 674627584 flags metadata
	[ 2599.788734] BTRFS info (device vdc): relocating block group 298844160 flags data|raid1
	[ 2609.746593] BTRFS info (device vdc): found 4 extents, stage: move data extents
	[ 2609.989663] BTRFS info (device vdc): found 3 extents, stage: update data pointers
	[ 2610.234642] BTRFS info (device vdc): relocating block group 30408704 flags metadata|raid1
	[ 2610.234889] ------------[ cut here ]------------
	[ 2610.234970] BTRFS: Transaction aborted (error -28)
Yep, I can also see this on our Power8 VM, without my patches.
	[ 2610.235172] WARNING: CPU: 3 PID: 26186 at fs/btrfs/extent-tree.c:2163 btrfs_run_delayed_refs+0x108/0x330
	[ 2610.235364] Modules linked in:
	[ 2610.235426] CPU: 3 PID: 26186 Comm: btrfs Not tainted 5.13.0-rc2-00393-gc0e4bc6f271f #43
	[ 2610.235547] NIP:  c0000000009f0bb8 LR: c0000000009f0bb4 CTR: c000000000e5fb30
	[ 2610.235665] REGS: c000000078fb7320 TRAP: 0700   Not tainted  (5.13.0-rc2-00393-gc0e4bc6f271f)
	[ 2610.235802] MSR:  800000000282b033 &lt;SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE&gt;  CR: 48004222  XER: 20000000
	[ 2610.235961] CFAR: c0000000001cea40 IRQMASK: 0
	               GPR00: c0000000009f0bb4 c000000078fb75c0 c000000001c5dc00 0000000000000026
	               GPR04: 00000000fffff5ff c000000078fb7280 0000000000000027 c0000000ff507e98
	               GPR08: 0000000000000023 0000000000000000 c00000000c286580 c000000001a11050
	               GPR12: 0000000000004400 c00000003ffeae00 0000000000000002 c000000045e4e088
	               GPR16: c000000045e4e000 c000000001334eb0 c000000012654000 0000000001d00000
	               GPR20: c000000012654000 0000000000000e5c 0000000000000000 c000000001662dc8
	               GPR24: 0000000000000014 c000000009ec9800 c000000009ec9b48 c0000000410f6e08
	               GPR28: 0000000000000000 0000000000000001 c000000012654000 ffffffffffffffe4
	[ 2610.237012] NIP [c0000000009f0bb8] btrfs_run_delayed_refs+0x108/0x330
	[ 2610.237111] LR [c0000000009f0bb4] btrfs_run_delayed_refs+0x104/0x330
	[ 2610.237213] Call Trace:
	[ 2610.237254] [c000000078fb75c0] [c0000000009f0bb4] btrfs_run_delayed_refs+0x104/0x330 (unreliable)
	[ 2610.237404] [c000000078fb7680] [c000000000a0c4e4] btrfs_commit_transaction+0xf4/0x1330
	[ 2610.237533] [c000000078fb7770] [c000000000a96e74] prepare_to_relocate+0x104/0x140
	[ 2610.237657] [c000000078fb77a0] [c000000000a9d524] relocate_block_group+0x74/0x5f0
	[ 2610.237770] [c000000078fb7860] [c000000000a9dcd0] btrfs_relocate_block_group+0x230/0x4a0
	[ 2610.237886] [c000000078fb7920] [c000000000a56a60] btrfs_relocate_chunk+0x80/0x1c0
	[ 2610.238002] [c000000078fb79a0] [c000000000a57d3c] btrfs_balance+0x103c/0x1560
	[ 2610.238117] [c000000078fb7b30] [c000000000a6ab98] btrfs_ioctl_balance+0x2d8/0x450
	[ 2610.238232] [c000000078fb7b90] [c000000000a6eb90] btrfs_ioctl+0x1df0/0x3be0
	[ 2610.238328] [c000000078fb7d10] [c00000000058e048] sys_ioctl+0xa8/0x120
	[ 2610.238435] [c000000078fb7d60] [c000000000036524] system_call_exception+0x3d4/0x410
	[ 2610.238551] [c000000078fb7e10] [c00000000000d45c] system_call_common+0xec/0x278
	[ 2610.238666] --- interrupt: c00 at 0x7ffff7be2990

3. There were other failues, but I guess those were either due to mount failure
    or since no compression support yet for subpage blocksize.
Yep, RAID56 mount/convert failures, and compression related output mismatch.

Thanks,
Qu
-ritesh
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help