naota / linux

Linux kernel source tree
Other
3 stars 1 forks source link

Auto reclaim fixes #41

Open morbidrsa opened 3 years ago

morbidrsa commented 3 years ago

David reported that auto-reclaim has problems: Reporoducer:

#!/bin/sh -x                                                                                                                                                                                    

dev=/dev/nullb0                                                                                                                                                                                 
umount mnt                                                                                                                                                                                      
blkzone report $dev                                                                                                                                                                             
blkzone reset $dev                                                                                                                                                                              
blkzone report $dev                                                                                                                                                                             
./mkfs.btrfs -L ZONED -f -d single -m single $dev                                                                                                                                               
blkzone report $dev                                                                                                                                                                             

mount $dev mnt                                                                                                                                                                                  

for i in `seq 10`; do                                                                                                                                                                           
        dd if=/dev/zero of=mnt/file$i bs=1M count=129 status=progress                                                                                                                           
        btrfs filesystem df mnt                                                                                                                                                                 
        df -h mnt                                                                                                                                                                               
        blkzone report $dev                                                                                                                                                                     
        btrfs filesystem sync mnt                                                                                                                                                               
done                                                                                                                                                                                            

for i in `seq 1 2 10`; do                                                                                                                                                                       
        rm -f mnt/file$i                                                                                                                                                                        
done                                                                                                                                                                                            
sync                                                                                                                                                                                            

btrfs filesystem df mnt                                                                                                                                                                         
df -h mnt                                                                                                                                                                                       
blkzone report $dev                                                                                                                                                                             

echo "zones are probably full"                                                                                                                                                                  
for i in `seq 10`; do                                                                                                                                                                           
        rm -f mnt/file$i                                                                                                                                                                        
done                                                                                                                                                                                            
sync                                                                                                                                                                                            

btrfs filesystem df mnt                                                                                                                                                                         
df -h mnt                                                                                                                                                                                       
blkzone report $dev                                                                                                                                                                             

sync                                                                                                                                                                                            
ls -lR mnt                                                                                                                                                                                      
sleep 30                                                                                                                                                                                        
blkzone report $dev | grep fu                                                                                                                                                                   

umount mnt