Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-12-01 Thread David Sterba
On Mon, Nov 24, 2014 at 02:03:02PM -0800, Omar Sandoval wrote: Alright, I took a look at this. My understanding is that a PREALLOC extent represents a region on disk that has already been allocated but isn't in use yet, but please correct me if I'm wrong. Judging by this comment in

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-24 Thread Omar Sandoval
On Sat, Nov 22, 2014 at 12:03:57PM -0800, Omar Sandoval wrote: On Fri, Nov 21, 2014 at 07:00:45PM +0100, David Sterba wrote: + ret = -EINVAL; + goto out; + } + if (test_bit(EXTENT_FLAG_COMPRESSED, em-flags)) { +

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-24 Thread Brendan Hide
On 2014/11/25 00:03, Omar Sandoval wrote: [snip] The snapshot issue is a little tricker to resolve. I see a few options: 1. Just do the COW and hope for the best 2. As part of btrfs_swap_activate, COW any shared extents. If a snapshot happens while a swap file is active, we'll fall back to 1.

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-22 Thread Omar Sandoval
On Fri, Nov 21, 2014 at 07:00:45PM +0100, David Sterba wrote: + pr_err(BTRFS: swapfile has holes); + ret = -EINVAL; + goto out; + } + if (em-block_start == EXTENT_MAP_INLINE) { + pr_err(BTRFS:

[PATCH v2 5/5] btrfs: enable swap file support

2014-11-21 Thread Omar Sandoval
Implement the swap file a_ops on btrfs. Activation simply checks for a usable swap file: it must be fully allocated (no holes), support direct I/O (so no compressed or inline extents) and should be nocow (I'm not sure about that last one). Signed-off-by: Omar Sandoval osan...@osandov.com ---

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-21 Thread David Sterba
On Fri, Nov 21, 2014 at 02:08:31AM -0800, Omar Sandoval wrote: Implement the swap file a_ops on btrfs. Activation simply checks for a usable swap file: it must be fully allocated (no holes), support direct I/O (so no compressed or inline extents) and should be nocow (I'm not sure about that

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-21 Thread Filipe David Manana
On Fri, Nov 21, 2014 at 6:00 PM, David Sterba dste...@suse.cz wrote: On Fri, Nov 21, 2014 at 02:08:31AM -0800, Omar Sandoval wrote: Implement the swap file a_ops on btrfs. Activation simply checks for a usable swap file: it must be fully allocated (no holes), support direct I/O (so no