]> git.baikalelectronics.ru Git - kernel.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)
commit2fc66403b95a42b2348edf1b1444724c496e0df7
tree3ec4fbcb730f93ea3f3a103ba16788e2534bdd1e
parenta4578ccbe4cb69bc0c823639090295357d400d52
Btrfs: support swap files

Btrfs has not allowed swap files since commit 646bb749fcb0 ("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 52b2f0840152
("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