Closed bo0ohXae closed 4 years ago
This seems doable. I may also be able to automatically detect BTRFS with statfs so that this won't even need a new flag.
Thats great! Without these steps (and kernel greater than 5.0) it just keeps failing over and over:
Dec 29 21:17:48 pyre swapspace[1082]: Setting up swapspace version 1, size = 11.
3 GiB (12147392512 bytes)
Dec 29 21:17:48 pyre swapspace[1082]: no label, UUID=d28cab90-52f1-4f16-8aec-10d
88e6a4156
Dec 29 21:17:48 pyre swapspace[1082]: Error: Could not enable swapfile '1': Inva
lid argument
Dec 29 21:17:48 pyre kernel: [26428.813608] swapon: swapfile has holes
Alright initial support has been added in the specialfs branch.
Won't have time to properly test this until the weekend most likely, but the changes were fairly basic. Once I've tested it myself and confirmed that it works I'll merge to master and close this issue.
It works! There seems to be some bug as it logs an error, but still successfully enables swap files.
Dec 30 12:50:36 pyre /usr/local/sbin/swapspace: Allocating swapfile '1'
Dec 30 12:50:36 pyre /usr/local/sbin/swapspace: Could not detect filesystem '1': No such file or directory
Dec 30 12:50:36 pyre kernel: [55136.500858] Adding 5038932k swap on 1. Priority:-2 extents:3 across:5127024k FS
Dec 30 12:50:37 pyre /usr/local/sbin/swapspace: Allocating swapfile '2'
Dec 30 12:50:37 pyre /usr/local/sbin/swapspace: Could not detect filesystem '2': No such file or directory
Dec 30 12:50:37 pyre kernel: [55137.552842] Adding 6187648k swap on 2. Priority:-3 extents:3 across:6391592k FS
Oh duh the swapfiles aren't visible at that point in the process, my bad! Should be fixed now.
The new changes didn't seem to help. I'm still getting the same errors with commit 48df5f60de221355d015ff479fabaf235dcfc790. I kind of forgot how to use git, so I deleted the whole source tree and checked out again just to make sure I'm on the latest commit.. I guess there is still a non-zero chance I did something wrong? :P
Dec 30 14:19:59 pyre /usr/local/sbin/swapspace: Allocating swapfile '1'
Dec 30 14:19:59 pyre /usr/local/sbin/swapspace: Could not detect filesystem '1': No such file or directory
Dec 30 14:19:59 pyre kernel: [60499.163265] Adding 5316824k swap on 1. Priority:-2 extents:6 across:12704408k FS
I think I’m probably misunderstanding something about statfs and/or BTRFS.
Will have to do some of my own testing and report back.
Turns out f_type
is unsigned so I was just detecting errors incorrectly.
It should work now.
Ahh I see. Looks good now. No more error!
Dec 30 21:50:02 pyre /usr/local/sbin/swapspace: Allocating swapfile '1'
Dec 30 21:50:03 pyre kernel: [87502.794356] Adding 10422204k swap on 1. Priority:-2 extents:16 across:336631136k FS
My original patch for this issue was quite problematic as it turns out. Please upgrade to latest master for fixes. A new release will be put out soon, but only after I add proper testing to try and catch things like this in the future.
Jacob
On Dec 30, 2019, at 21:50, Bob Loblaw notifications@github.com wrote:
Ahh I see. Looks good now. No more error!
Dec 30 21:50:02 pyre /usr/local/sbin/swapspace: Allocating swapfile '1' Dec 30 21:50:03 pyre kernel: [87502.794356] Adding 10422204k swap on 1. Priority:-2 extents:16 across:336631136k FS
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi,
Could you add support for btrfs? As of kernel 5.0 it now supports swap.. with several hoops to jump though. Details at https://wiki.archlinux.org/index.php/Swap#Swap_file_creation
Thanks!