• Omar Sandoval's avatar
    Btrfs: support swap files · ed46ff3d
    Omar Sandoval authored
    Btrfs has not allowed swap files since commit 35054394 ("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 67482129
    ("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: default avatarOmar Sandoval <osandov@fb.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ed46ff3d
inode.c 293 KB