diff options
author | Forrest Liu <forrestl@synology.com> | 2015-02-09 17:30:47 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-26 06:26:59 -0700 |
commit | 1b9845081633072c18f30d8cfd09c267adf0b109 (patch) | |
tree | 7f323994cb18808d9f557ac4e932d21b8052a5f9 /fs/qnx6 | |
parent | e4c88f007be78d38eaef316c599a1ee2f0272c15 (diff) | |
download | linux-1b9845081633072c18f30d8cfd09c267adf0b109.tar.gz linux-1b9845081633072c18f30d8cfd09c267adf0b109.tar.bz2 linux-1b9845081633072c18f30d8cfd09c267adf0b109.zip |
Btrfs: fix find_free_dev_extent() malfunction in case device tree has hole
If device tree has hole, find_free_dev_extent() cannot find available
address properly.
The problem can be reproduce by following script.
mntpath=/btrfs
loopdev=/dev/loop0
filepath=/home/forrest/image
umount $mntpath
losetup -d $loopdev
truncate --size 100g $filepath
losetup $loopdev $filepath
mkfs.btrfs -f $loopdev
mount $loopdev $mntpath
# make device tree with one big hole
for i in `seq 1 1 100`; do
fallocate -l 1g $mntpath/$i
done
sync
for i in `seq 1 1 95`; do
rm $mntpath/$i
done
sync
# wait cleaner thread remove unused block group
sleep 300
fallocate -l 1g $mntpath/aaa
# failed to allocate new chunk
fallocate -l 1g $mntpath/bbb
Above script will make device tree with one big hole, and can only allocate
just one chunk in a transaction, so failed to allocate new chunk for $mntpath/bbb
item 8 key (1 DEV_EXTENT 2185232384) itemoff 15859 itemsize 48
dev extent chunk_tree 3
chunk objectid 256 chunk offset 106292051968 length 1073741824
item 9 key (1 DEV_EXTENT 104190705664) itemoff 15811 itemsize 48
dev extent chunk_tree 3
chunk objectid 256 chunk offset 103108575232 length 1073741824
Signed-off-by: Forrest Liu <forrestl@synology.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/qnx6')
0 files changed, 0 insertions, 0 deletions