Btrfs Restoring Support For Swap Files With Linux 4.21
The Btrfs file-system hasn't supported Swap files on it in early a decade, but that support will be restored again with the upcoming Linux 4.21 kernel.
Btrfs hasn't supported Swap files on it since 2009 thus making swap partitions necessary unless having a mix of file-systems on your box (or not caring about any swap capabilities), but now with Linux 4.21 that support will be restored for allowing swap files to be reside on Btrfs.
The change by Facebook's Omar Sandoval explains, "Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, now that the proper restrictions are in place, Btrfs can support swap files through the swap file a_ops, similar to iomap in commit 67482129cdab ("iomap: add a swapfile activation function"). For Btrfs, activation needs to make sure that the file can be used as a swap file, which currently means that it must be fully allocated as NOCOW with no compression on one device. It must also do the proper tracking so that ioctls will not interfere with the swap file. Deactivation clears this tracking."
That support is now queued into btrfs-next ahead of the upcoming Linux 4.21 merge window.
Btrfs hasn't supported Swap files on it since 2009 thus making swap partitions necessary unless having a mix of file-systems on your box (or not caring about any swap capabilities), but now with Linux 4.21 that support will be restored for allowing swap files to be reside on Btrfs.
The change by Facebook's Omar Sandoval explains, "Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, now that the proper restrictions are in place, Btrfs can support swap files through the swap file a_ops, similar to iomap in commit 67482129cdab ("iomap: add a swapfile activation function"). For Btrfs, activation needs to make sure that the file can be used as a swap file, which currently means that it must be fully allocated as NOCOW with no compression on one device. It must also do the proper tracking so that ioctls will not interfere with the swap file. Deactivation clears this tracking."
That support is now queued into btrfs-next ahead of the upcoming Linux 4.21 merge window.
79 Comments