From: Zhao Lei
generic/102 sometimes fails in newest btrfs toolchain,
because it use non-mixed mode in default, which request more space
for metadata, and no space for data writing.
This patch force mixed mode for btrfs in generic/102.
Signed-off-by: Zhao Lei
---
tests/generic/102 | 2 ++
1 f
From: Zhao Lei
New version of btrfs create non-mixed blockgroups in all case.
For generic/027, the filesystem in test is convert from
mixed-blockgroup to non-mixed blockgroup.
And test time is changed from 400s -> 2700s in my node.
To test btrfs with all mountoptions, this testitem need about
7
From: Zhao Lei
Anthony Plack reported a output bug in maillist:
title: btrfs-progs SCRUB reporting aborted but still running - minor
btrfs scrub status report it was aborted but still runs to completion.
# btrfs scrub status /mnt/data
scrub status for f591ac13-1a69-476d-bd30-346f87a491da
From: Zhao Lei
002-bad-transid outout 'transid verify failed' message in screen
which is just a warning in btrfs-image in normal condition of this
test.
This patch move above warning into $RESULTS, to:
1: Avoid trouble screen output
2: Let user known detail if other error happened in btrfs-image
From: Zhao Lei
When using loop device for test, fsck-tests/013-extent-tree-rebuild
failed with following error message:
# ./fsck-tests.sh
...
[TEST] 013-extent-tree-rebuild
failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt
test failed for case 013-extent-tree-
From: Zhao Lei
For example, $TEST_DIR is common used in severial tests, and have
duplicated code for initialize.
These duplicated code not only benifits harddisk vendor, but have
inconsistent details, as:
convert-tests.sh: lack of mkdir
fsck-tests/012-leaf-corruption/test.sh: unnecessary mkd
From: Zhao Lei
To avoid following mount error in test:
mount: /root/btrfs/progs/tests/fsck-tests/012-leaf-corruption/test.img
is not a block device (maybe try `-o loop'?)
Signed-off-by: Zhao Lei
---
tests/fsck-tests/012-leaf-corruption/test.sh | 2 +-
1 file changed, 1 insertion(+), 1 dele
From: Zhao Lei
The timer handle have possibility in using by sub thread,
better to close it after sub process exit.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/task-utils.c b/task-utils.c
index 0390a69..17fd573 100644
--- a
From: Zhao Lei
This code block is common used, move it to common function will
make code clean.
Signed-off-by: Zhao Lei
---
tests/common | 16
tests/fsck-tests/013-extent-tree-rebuild/test.sh | 11 +--
tests/misc-tests/001-btrfstune-
From: Zhao Lei
In current code, (info->periodic.timer_fd == 0) means it is not
valid, as:
if (info->periodic.timer_fd) {
close(info->periodic.timer_fd);
...
We need set its value from -1 to 0 in create-fail case, to make
code like above works.
Signed-off-by: Zhao Lei
---
task-ut
From: Zhao Lei
No need to close timer handle afain in subthread-close-callback,
it is closed by task_stop() automatically.
This patch also add a fflush() to make log output on time.
Signed-off-by: Zhao Lei
---
btrfs-convert.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --gi
From: Zhao Lei
Current code of btrfs-convert have a bug of thread conflict, which caused
invalid memory accessing between threads, and make program panic.
This patch add a test item for above bug, as:
# ./misc-tests.sh
[TEST] 001-btrfstune-features
[TEST] 002-uuid-rewrite
[TEST]
From: Zhao Lei
task_period_stop() is used to close a timer explicitly, to avoid
the timer handle closed again by task_stop(), we should reset its
value after close.
Also add value-reset for info->id for safe.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +-
1 file changed, 5 insertions(+)
From: Zhao Lei
It is v3 patchset of:
Fix wrong address accessing by subthread in btrfs-convert.
Changelog v2->v3:
1: Add $TOP path prefix to btrfs-convert command in:
[PATCH v2 7/7] btrfs-progs: Introduce a misc test for thread conflict in
btrfs-convert
To check prog in btrfs sourc
From: Zhao Lei
btrfs-convert sometimes show 'Assertion failed' in converting a nearly blank
file system, as:
create btrfs filesystem:
blocksize: 4096
nodesize: 16384
features: extref, skinny-metadata (default)
creating btrfs metadata.
creating ext2fs image f
From: Zhao Lei
fsck-tests.sh failed and show following message in my node:
# ./fsck-tests.sh
[TEST] 001-bad-file-extent-bytenr
disk-io.c:1444: write_dev_supers: Assertion `ret != BTRFS_SUPER_INFO_SIZE`
failed.
/root/btrfsprogs/btrfs-image(write_all_supers+0x2d2)[0x41031c]
/root/bt
From: Zhao Lei
To fix following bug:
# ./convert-tests.sh
[TEST] ext2 4k nodesize, btrfs defaults
failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
# tail convert-tests-results.txt
...
### mount /root/btrfsprogs/tests/test.img
/root/btrfsprogs/tests
From: Zhao Lei
The timer handle have possibility in using by sub thread,
better to close it after sub process exit.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/task-utils.c b/task-utils.c
index 0390a69..17fd573 100644
--- a
From: Zhao Lei
This code block is common used, move it to common function will
make code clean.
Signed-off-by: Zhao Lei
---
tests/common | 16
tests/fsck-tests/013-extent-tree-rebuild/test.sh | 11 +--
tests/misc-tests/001-btrfstune-
From: Zhao Lei
Current code of btrfs-convert have a bug of thread conflict, which caused
invalid memory accessing between threads, and make program panic.
This patch add a test item for above bug, as:
# ./misc-tests.sh
[TEST] 001-btrfstune-features
[TEST] 002-uuid-rewrite
[TEST]
From: Zhao Lei
In current code, (info->periodic.timer_fd == 0) means it is not
valid, as:
if (info->periodic.timer_fd) {
close(info->periodic.timer_fd);
...
We need set its value from -1 to 0 in create-fail case, to make
code like above works.
Signed-off-by: Zhao Lei
---
task-ut
From: Zhao Lei
btrfs-convert sometimes show 'Assertion failed' in converting a nearly blank
file system, as:
create btrfs filesystem:
blocksize: 4096
nodesize: 16384
features: extref, skinny-metadata (default)
creating btrfs metadata.
creating ext2fs image f
From: Zhao Lei
No need to close timer handle afain in subthread-close-callback,
it is closed by task_stop() automatically.
This patch also add a fflush() to make log output on time.
Signed-off-by: Zhao Lei
---
btrfs-convert.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --gi
From: Zhao Lei
task_period_stop() is used to close a timer explicitly, to avoid
the timer handle closed again by task_stop(), we should reset its
value after close.
Also add value-reset for info->id for safe.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +-
1 file changed, 5 insertions(+)
From: Zhao Lei
It is v2 patchset of:
Fix wrong address accessing by subthread in btrfs-convert.
Changelog:
1: Move bug test script from patch description into a single script in
test/misc-tests, suggested-by: David Sterba
2: Move code for creating loop device to common [PATCH 6/7]
Zhao
From: Zhao Lei
The timer handle have possibility in using by sub thread,
better to close it after sub process exit.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/task-utils.c b/task-utils.c
index 0390a69..17fd573 100644
--- a
From: Zhao Lei
task_period_stop() is used to close a timer explicitly, to avoid
the timer handle closed again by task_stop(), we should reset its
value after close.
Also add value-reset for info->id for safe.
Signed-off-by: Zhao Lei
---
task-utils.c | 6 +-
1 file changed, 5 insertions(+)
From: Zhao Lei
No need to close timer handle afain in subthread-close-callback,
it is closed by task_stop() automatically.
This patch also add a fflush() to make log output on time.
Signed-off-by: Zhao Lei
---
btrfs-convert.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --gi
From: Zhao Lei
In current code, (info->periodic.timer_fd == 0) means it is not
valid, as:
if (info->periodic.timer_fd) {
close(info->periodic.timer_fd);
...
We need set its value from -1 to 0 in create-fail case, to make
code like above works.
Signed-off-by: Zhao Lei
---
task-ut
From: Zhao Lei
We can reproduce this bug by a simple script:
DEV=/dev/vdh
for ((i = 0; i < 100; i++)); do
echo "loop $i"
mkfs.ext4 "$DEV" &>/dev/null || { echo mkfs fail; break; }
btrfs-convert "$DEV" || break
done
Result is like:
loop 0
...
loop 1
...
loop 3
From: Zhao Lei
Scrub panic in following operation:
mkfs.ext4 /dev/vdh
btrfs-convert /dev/vdh
mount /dev/vdh /mnt/tmp1
btrfs scrub start -B /dev/vdh
(panic)
Reason:
1: In some case, leaf created by btrfs-convert was splited into 2
strips.
2: Scrub bypassed part of above wrong l
From: Zhao Lei
btrfs progs output following error message when doing resize on
no-enouth-free-space case:
# btrfs filesystem resize +10g /mnt/btrfs_5gb
Resize '/mnt/btrfs_5gb' of '+10g'
ERROR: unable to resize '/mnt/btrfs_5gb' - File too large
#
It is not a good description for users, and th
From: Zhao Lei
When we access extent_root in scrub_stripe() and
scrub_raid56_parity(), we need bypass unrelated tree item firstly
before using its contents to do other condition.
It is not a bug fix, only making code sequence in logic.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 16 +++
From: Zhao Lei
We need not load csum of whole strip in scrub because strip is trimed
before use, it is to say, what we really need to calculate csum is
data between [extent_logical, extent_len).
This patch changed to use above segment for btrfs_lookup_csums_range()
in scrub_stripe()
Signed-off-
From: Zhao Lei
For example, in scrub_raid56_parity(), following lines are used
to judge is all data processed:
place1: if (key.objectid > logic_end) ...
place2: if (logic_start >= logic_end) ...
...
(place2 is typo, is should be ">", it is copied from other
place, where logic_end's meaning
From: Zhao Lei
Old code checking cancel and pause request inside scrub stripe
operation, like:
loop() {
if (parity) {
scrub_parity_stripe();
continue;
}
check_cancel_and_pause()
scrub_normal_stripe();
}
Reason is when introduce raid56 stripe scrub, new code is i
From: Zhao Lei
When scrub_extent() failed, we need to free previois created
checksum list.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 8 ++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index f8551b9..24720f6 100644
--- a/fs/btrfs/s
From: Zhao Lei
When mount failed because missing device, we can see following
dmesg:
[ 1060.267743] BTRFS: too many missing devices, writeable mount is not allowed
[ 1060.273158] BTRFS: open_ctree failed
This patch add missing_device_number and tolerated_missing_device_number
to above output,
From: Zhao Lei
Code for updating fs_info->num_tolerated_disk_barrier_failures in
btrfs_balance() lacks raid56 support.
Reason:
Above code was wroten in 2012-08-01, together with
btrfs_calc_num_tolerated_disk_barrier_failures()'s first version.
Then, btrfs_calc_num_tolerated_disk_barrier_fail
From: Zhao Lei
We can get mount-fail in following operation:
# mkfs a raid1 filesystem
mkfs.btrfs -f -d raid1 -m raid1 /dev/vdd /dev/vde
# destroy a disk
dd if=/dev/zero of=/dev/vde bs=1M count=1
# do some fs operation on degraded mode
mount -o degraded /dev/vdd /mnt/test
touch /m
From: Zhao Lei
Code for updating fs_info->num_tolerated_disk_barrier_failures in
btrfs_balance() lacks raid56 support.
Reason:
Above code was wroten in 2012-08-01, together with
btrfs_calc_num_tolerated_disk_barrier_failures()'s first version.
Then, btrfs_calc_num_tolerated_disk_barrier_fail
From: Zhao Lei
1: Use ARRAY_SIZE(types) to replace a static-value variant:
int num_types = 4;
2: Use 'continue' on condition to reduce one level tab
if (!XXX) {
code;
...
}
->
if (XXX)
continue;
code;
...
3: Put setting 'num_tolerated_disk_barrier_failu
From: Zhao Lei
When mount failed because missing device, we can see following
dmesg:
[ 1060.267743] BTRFS: too many missing devices, writeable mount is not allowed
[ 1060.273158] BTRFS: open_ctree failed
This patch add missing_device_number and tolerated_missing_device_number
to above output,
From: Zhao Lei
When read_tree_block() failed, we can see following dmesg:
[ 134.371389] BUG: unable to handle kernel NULL pointer dereference at
0063
[ 134.372236] IP: [] free_extent_buffer+0x21/0x90
[ 134.372236] PGD 0
[ 134.372236] Oops: [#1] SMP
[ 134.372236] Module
From: Zhao Lei
Liu Bo reported a lockdep warning of
delayed_iput_sem in xfstests generic/241:
[ 2061.345955] =
[ 2061.346027] [ INFO: possible recursive locking detected ]
[ 2061.346027] 4.1.0+ #268 Tainted: GW
[ 2061.346027] --
From: Zhao Lei
These variables are not used from introduced version , remove them.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 9 ++---
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index eb35176..f552937 100644
--- a/fs/btrfs/scrub.c
From: Zhao Lei
Use new intruduced scrub_pause_on/off() can make this code block
clean and more readable.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 10 +++---
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index cbfb8c7..a882a34 100644
From: Zhao Lei
xfstests btrfs/070 sometimes failed.
In my test machine, its fail rate is about 30%.
In another vm(vmware), its fail rate is about 50%.
Reason:
btrfs/070 do replace and defrag with fsstress simultaneously,
after above operation, checksum error is found by scrub.
Actually, i
From: Zhao Lei
It can reduce current duplicated code which is similar to
scrub_blocked_if_needed() but can not call it because little
different.
It also used by my next patch which is in same case.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 11 ++-
1 file changed, 10 insertions(+),
From: Zhao Lei
More than one code call set_block_group_ro() and restore rw in fail.
Old code use bool bit to save blockgroup's ro state, it can not
support parallel case(it is confirmd exist in my debug log).
This patch use ref count to store ro state, and rename
set_block_group_ro/set_block_gr
From: Zhao Lei
This patchset is used to fix data checksum error cause by replace with io-load.
It cause xfstests btrfs/070 and btrfs/071 sometimes failed.
See description in [PATCH 4/4] for detail.
Changelog v2->v3:
1: Fix a typo(caused in rebase) which make xfstests failed in
btrfs/073 and
From: Zhao Lei
Although it is a rare case, we'd better free previous allocated
memory on error.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 31 ---
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index ab58115..
From: Zhao Lei
The code in workqueue only do fast initialization and submit a bio
in end, plus, it will not called in interrupe context, no need to
queue a work for this type of work.
Call it directly will make code simple, easy to debug and reduce
potential problem.
Signed-off-by: Zhao Lei
--
From: Zhao Lei
Because btrfs support scrub raid56 parity stripe now.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index a13f91a..5ee5630 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
From: Zhao Lei
It is introduced by:
c404e0dc2c843b154f9a36c3aec10d0a715d88eb
Btrfs: fix use-after-free in the finishing procedure of the device replace
But seems no relationship with that bug, this patch revirt these
code block for cleanup.
Signed-off-by: Zhao Lei
---
fs/btrfs/volumes.c | 2
From: Zhao Lei
lockdep report following warning in test:
[25176.843958] =
[25176.844519] [ INFO: inconsistent lock state ]
[25176.845047] 4.1.0-rc3 #22 Tainted: GW
[25176.845591] -
[25176.846153] inconsistent {SOFTIRQ-ON
From: Zhao Lei
lockdep report following warning in test:
[25176.843958] =
[25176.844519] [ INFO: inconsistent lock state ]
[25176.845047] 4.1.0-rc3 #22 Tainted: GW
[25176.845591] -
[25176.846153] inconsistent {SOFTIRQ-ON
From: Zhao Lei
More than one code call set_block_group_ro() and restore rw in fail.
Old code use bool bit to save blockgroup's ro state, it can not
support parallel case(it is confirmd exist in my debug log).
This patch use ref count to store ro state, and rename
set_block_group_ro/set_block_gr
From: Zhao Lei
Use new intruduced scrub_pause_on/off() can make this code block
clean and more readable.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 10 +++---
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index a3d1546..8da3459 100644
From: Zhao Lei
It can reduce current duplicated code which is similar to
scrub_blocked_if_needed() but can not call it because little
different.
It also used by my next patch which is in same case.
Signed-off-by: Zhao Lei
---
fs/btrfs/scrub.c | 11 ++-
1 file changed, 10 insertions(+),
From: Zhao Lei
xfstests btrfs/070 sometimes failed.
In my test machine, its fail rate is about 30%.
In another vm(vmware), its fail rate is about 50%.
Reason:
btrfs/070 do replace and defrag with fsstress simultaneously,
after above operation, checksum error is found by scrub.
Actually, i
From: Zhao Lei
More than one code call set_block_group_ro() and restore rw in fail.
Old code use bool bit to save blockgroup's ro state, it can not
support parallel case(it is confirmd exist in my debug log).
This patch use ref count to store ro state, and rename
set_block_group_ro/set_block_gr
From: Zhao Lei
xfstests btrfs/070 sometimes failed.
In my test machine, its fail rate is about 30%.
In another vm(vmware), its fail rate is about 50%.
Reason:
btrfs/070 do replace and defrag with fsstress simultaneously,
after above operation, checksum error is found by scrub.
Actually, it have
From: Zhao Lei
Remove int alloc_chunk in btrfs_check_data_free_space() for not
necessary.
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d5ec383..b009987 100644
---
From: Zhao Lei
space_info's value calculation is some complex and easy to cause
bug, add WARN_ON() to help debug.
Changelog v1->v2:
Put WARN_ON()s under the ENOSPC_DEBUG mount option.
Suggested by: David Sterba
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 10 ++
1 file chan
From: Zhao Lei
Steps to reproduce:
while true; do
dd if=/dev/zero of=/btrfs_dir/file count=[fs_size * 75%]
rm /btrfs_dir/file
sync
done
And we'll see dd failed because btrfs return NO_SPACE.
Reason:
Normally, btrfs_commit_transaction() call btrfs_run_delayed_iputs()
in end
From: Zhao Lei
It is another reason for NO_SPACE case.
When we found enough free space in loop and saved them to
max_hole_start/size before, and tail space contains pending extent,
origional innocent max_hole_start/size are reset in retry.
As a result, find_free_dev_extent() returns less space
From: Zhao Lei
btrfs will report no_space when we run following write and delete
file loop:
# FILE_SIZE_M=[ 75% of fs space ]
# DEV=[ some dev ]
# MNT=[ some dir ]
#
# mkfs.btrfs -f "$DEV"
# mount -o nodatacow "$DEV" "$MNT"
# for ((i = 0; i < 100; i++)); do dd if=/dev/zero of="$MNT"/file0
From: Zhao Lei
If we have any chance to make a successful write, we should not give up.
This patch adjust commit-transaction condition from:
pinned >= wanted
to
left + pinned >= wanted
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(
From: Zhao Lei
Reproduce:
while true; do
dd if=/dev/zero of=/mnt/btrfs/file count=[75% fs_size]
rm /mnt/btrfs/file
done
Then we can see above loop failed on NO_SPACE.
It it long-term problem since very beginning, because delayed-iput
after rm are not run.
We already have commit_transac
From: Zhao Lei
Bug1:
space_info->bytes_readonly was set to very large(negative) value in
btrfs_remove_block_group().
Reason:
Current code set block_group_cache->pinned = 0 in btrfs_delete_unused_bgs(),
but above space was not counted to space_info->bytes_readonly.
Then in btrfs_remove
From: Zhao Lei
Old code bypass commit transaction when we don't have enough
pinned space, but another case is there exist freed bgs in current
transction, it have possibility to make alloc_chunk success.
This patch modify the condition to:
if (have_free_bg || have_pinned_space) commit_transactio
xfstests for this case later.
This is available at fix_no_space branch on my tree:
git://github.com/zhaoleidd/btrfs.git
It is also included in integration-for-chris branch in above tree.
Thanks
Zhaolei
Zhao Lei (9):
btrfs: fix condition of commit transaction
btrfs: Fix tail space proces
From: Zhao Lei
Old code bypass commit transaction when we don't have enough
pinned space, but another case is there exist freed bgs in current
transction, it have possibility to make alloc_chunk success.
This patch modify the condition to:
if (have_free_bg || have_pinned_space) commit_transactio
From: Zhao Lei
If we have any chance to make a successful write, we should not give up.
This patch adjust commit-transaction condition from:
pinned >= wanted
to
left + pinned >= wanted
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(
From: Zhao Lei
space_info's value calculation is some complex and easy to cause
bug, add WARN_ON() to help debug.
Changelog v1->v2:
Put WARN_ON()s under the ENOSPC_DEBUG mount option.
Suggested by: David Sterba
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 10 ++
1 file chan
From: Zhao Lei
Reproduce:
while true; do
dd if=/dev/zero of=/mnt/btrfs/file count=[75% fs_size]
rm /mnt/btrfs/file
done
Then we can see above loop failed on NO_SPACE.
It it long-term problem since very beginning, because delayed-iput
after rm are not run.
We already have commit_transac
From: Zhao Lei
Bug1:
space_info->bytes_readonly was set to very large(negative) value in
btrfs_remove_block_group().
Reason:
Current code set block_group_cache->pinned = 0 in btrfs_delete_unused_bgs(),
but above space was not counted to space_info->bytes_readonly.
Then in btrfs_remove
From: Zhao Lei
Remove int alloc_chunk in btrfs_check_data_free_space() for not
necessary.
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 05747d2..b83060f 100644
---
From: Zhao Lei
btrfs will report no_space when we run following write and delete
file loop:
# FILE_SIZE_M=[ 75% of fs space ]
# DEV=[ some dev ]
# MNT=[ some dir ]
#
# mkfs.btrfs -f "$DEV"
# mount -o nodatacow "$DEV" "$MNT"
# for ((i = 0; i < 100; i++)); do dd if=/dev/zero of="$MNT"/file0
From: Zhao Lei
It is another reason for NO_SPACE case.
When we found enough free space in loop and saved them to
max_hole_start/size before, and tail space contains pending extent,
origional innocent max_hole_start/size are reset in retry.
As a result, find_free_dev_extent() returns less space
From: Zhao Lei
Steps to reproduce:
while true; do
dd if=/dev/zero of=/btrfs_dir/file count=[fs_size * 75%]
rm /btrfs_dir/file
sync
done
And we'll see dd failed because btrfs return NO_SPACE.
Reason:
Normally, btrfs_commit_transaction() call btrfs_run_delayed_iputs()
in end
n v4.0-rc5 and no-problem on top of
this patchset.
I'll add xfstests for this case later.
This is available at fix_no_space branch on my tree:
git://github.com/zhaoleidd/btrfs.git
It is also included in integration-for-chris branch in above tree.
Thanks
Zhaolei
Zhao Lei (9):
btrfs: f
From: Zhao Lei
btrfs will report no_space when we run following write and delete
file loop:
# FILE_SIZE_M=[ 75% of fs space ]
# DEV=[ some dev ]
# MNT=[ some dir ]
#
# mkfs.btrfs -f "$DEV"
# mount -o nodatacow "$DEV" "$MNT"
# for ((i = 0; i < 100; i++)); do dd if=/dev/zero of="$MNT"/file0
From: Zhao Lei
This is another fix of no_space case.
All patchs for fix no_space bug are available at fix_no_space
branch on:
git://github.com/zhaoleidd/btrfs
Any suggestions are welcome.
Zhao Lei (1):
btrfs: wait for delayed iputs on no space
fs/btrfs/extent-tree.c | 3 +++
1 file chang
From: Zhao Lei
No need to create additional end_io function for scrub, it can use
existing raid_write_end_io() instead.
This patch also fixed some wrong comments.
Signed-off-by: Zhao Lei
---
fs/btrfs/raid56.c | 36
1 file changed, 8 insertions(+), 28 delet
From: Zhao Lei
We are using different index calculation method for stripe_page in
current code:
1: (rbio->stripe_len / PAGE_CACHE_SIZE) * stripe_index + page_index
2: DIV_ROUND_UP(rbio->stripe_len, PAGE_CACHE_SIZE) * stripe_index + page_index
3: DIV_ROUND_UP(rbio->stripe_len * stripe_index, PAGE_
From: Zhao Lei
We can use rbio->stripe_npages to reduce unnecessary calculation in
many code place.
Signed-off-by: Zhao Lei
---
fs/btrfs/raid56.c | 19 +++
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 645bc37..0d902a
From: Zhao Lei
Current code is trying to calculate rbio->dbitmap's size to make it
align to sizeof(long), but implement haven't achived this object,
it is align to sizeof(char) instead.
This patch fixed above calculation, and use sizeof(long) instead of
fixed "8" to increate compatibility.
Signe
From: Zhao Lei
Signed-off-by: Zhao Lei
---
fs/btrfs/raid56.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 0d902ac..0a40d07 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1049,6 +1049,7 @@ static int alloc_rbio_parity_pages(struct bt
From: Zhao Lei
Signed-off-by: Zhao Lei
---
fs/btrfs/raid56.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 2285e78..c087870 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1464,7 +1464,6 @@ static void raid_rmw_end_io(struct bio *bio,
From: Zhao Lei
Reproduce:
while true; do
dd if=/dev/zero of=/mnt/btrfs/file count=[75% fs_size]
rm /mnt/btrfs/file
done
Then we can see above loop failed on NO_SPACE.
It it long-term problem since very beginning, because delayed-iput
after rm are not run.
We already have commit_transac
From: Zhao Lei
space_info's value calculation is some complex and easy to cause
bug, add WARN_ON() to help debug.
Changelog v1->v2:
Put WARN_ON()s under the ENOSPC_DEBUG mount option.
Suggested by: David Sterba
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 10 ++
1 file chan
From: Zhao Lei
Changelog v1->v2:
[PATCH 2/2] btrfs: add WARN_ON() to check is space_info op current
Put WARN_ON()s under the ENOSPC_DEBUG mount option.
Suggested by: David Sterba
Changelog v1->v2:
drop patch of:
Remove BUG_ON() when failed searching block_group_cache in
unpin_extent_
From: Zhao Lei
Bug1:
space_info->bytes_readonly was set to very large(negative) value in
btrfs_remove_block_group().
Reason:
Current code set block_group_cache->pinned = 0 in btrfs_delete_unused_bgs(),
but above space was not counted to space_info->bytes_readonly.
Then in btrfs_remove
From: Zhao Lei
It is the last patch to fix following write fail case:
while true; do
write a file to 75% fs size
delete above file
sync or sleep
done
Above issue is caused by several reason, and fixed in following patch
respectively:
Btrfs: fix find_free_dev_extent() malfunction in case d
From: Zhao Lei
Steps to reproduce:
while true; do
dd if=/dev/zero of=/btrfs_dir/file count=[fs_size * 75%]
rm /btrfs_dir/file
sync
done
And we'll see dd failed because btrfs return NO_SPACE.
Reason:
Normally, btrfs_commit_transaction() call btrfs_run_delayed_iputs()
in end
From: Zhao Lei
Changelog v1->v2:
drop patch of:
Remove BUG_ON() when failed searching block_group_cache in
unpin_extent_range()
because Filipe Manana already fixed it with
better way.
Zhao Lei (2):
btrfs: Set relative data on clear btrfs_block_group_cache->pinned
btrfs: add WARN_ON()
From: Zhao Lei
space_info's value calculation is some complex and easy to cause
bug, add WARN_ON() to help debug.
Signed-off-by: Zhao Lei
---
fs/btrfs/extent-tree.c | 8
1 file changed, 8 insertions(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 3e7a4af..8b51eb
From: Zhao Lei
Bug1:
space_info->bytes_readonly was set to very large(negative) value in
btrfs_remove_block_group().
Reason:
Current code set block_group_cache->pinned = 0 in btrfs_delete_unused_bgs(),
but above space was not counted to space_info->bytes_readonly.
Then in btrfs_remove
1 - 100 of 182 matches
Mail list logo