]> asedeno.scripts.mit.edu Git - linux.git/commit
Btrfs: support swap files
authorOmar Sandoval <osandov@fb.com>
Thu, 3 Nov 2016 17:28:14 +0000 (10:28 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:29 +0000 (14:51 +0100)
commited46ff3d423780fa5173b38a844bf0fdb210a2a7
tree3ec4fbcb730f93ea3f3a103ba16788e2534bdd1e
parent60ca842e345716eb8c3f7df070511848b9f1a796
Btrfs: support swap files

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.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c