
On 10/15/13 7:55 AM, David Sterba wrote:
On Mon, Oct 14, 2013 at 11:05:12AM +0400, Andrey Borzenkov wrote:
Is it expected? I obviously do have enough space and can create (and delete) files and directories but am not able to rename anything. Do I need to open bug report?
As Jeff noted, 10MB is really small and the effects of the safety over-reservation calculations are noticeable.
Following the steps
linux-1a7f:~ # btrfs filesystem df /mnt System: total=4.00MiB, used=4.00KiB Data+Metadata: total=5.00MiB, used=60.00KiB
(~5mb of space to operate)
linux-1a7f:~ # cd /mnt/dir1/ linux-1a7f:/mnt/dir1 # ls -l total 0 drwxr-xr-x 1 root root 0 Oct 14 09:43 dir2 -rw-r--r-- 1 root root 0 Oct 14 09:43 file1 linux-1a7f:/mnt/dir1 # mv dir2 dir3 mv: cannot move ‘dir2’ to ‘dir3’: No space left on device linux-1a7f:/mnt/dir1 # mv file1 file2 mv: cannot move ‘file1’ to ‘file2’: No space left on device
I can rename the files with 3.12-rc5, and I believe this is due to patch "Btrfs: fix worst case calculator for space usage" that should be safe to take to opensuse 13.1, but not at this time of release period.
I still can't rename a file using -rc5, but I have some data as to why. I hacked up two patches to diagnose this. The first is the following, which adds reservation failures to the btrfs_space_reservation trace. You can see it in the line with "failed: 28" (28 = ENOSPC). mv-4103 [001] .... 225.695967: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696005: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696024: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696058: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696163: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696184: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 mv-4103 [001] .... 225.696262: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 reserve 516096 mv-4103 [001] .... 225.696263: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 491520 mv-4103 [001] .... 225.794161: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: failed: 28 reserve 720896 touch-4104 [001] .... 227.817348: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 reserve 327680 touch-4104 [001] .... 227.817354: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: transaction: 62 reserve 327680 touch-4104 [001] .... 227.817376: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 touch-4104 [001] .... 227.817469: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 touch-4104 [001] .... 227.817492: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 touch-4104 [001] .... 227.817510: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 touch-4104 [001] .... 227.817537: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: delayed_inode: 504 reserve 65536 touch-4104 [001] .... 227.817548: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 4096 touch-4104 [001] .... 227.817572: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: delayed_item: 257 reserve 65536 touch-4104 [001] .... 227.817575: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: delayed_inode: 257 reserve 65536 touch-4104 [001] .... 227.817600: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: transaction: 62 release 327680 touch-4104 [001] .... 227.817601: btrfs_space_reservation: 4e4ff907-1979-41da-a754-3f0adb285bd2: space_info: 5 release 110592 The second exports how much space is in the global reservation pool: # cat /sys/fs/btrfs/4e4ff907-1979-41da-a754-3f0adb285bd2/global_rsv 4194304 sled1:/home/jeffm # btrfs fi df /media/test System: total=4.00MiB, used=4.00KiB Data+Metadata: total=6.00MiB, used=1.51MiB So with ~ 4MB reserved, we end up returning ENOSPC for a ~700k reservation for the mv vs the ~300k required for the touch. 4 MB does seem a little high here, since that's about 60% of the size of the file system, but the reservation is rounded up to 4MB chunks. I've looked up the commit that added that, and it's been there since global reservations were introduced, so I'm not sure what the logic is there. Probably just to ballpark it. We already limit the size of the reservation to 512MB, so it might make sense to limit it further to something like 25% of the file system. -Jeff -- Jeff Mahoney SUSE Labs