Re: btrfs and swap files on SSD's ?

2009-01-20 Thread Kaspar Schleiser

Hey Cris,

Chris Mason wrote:

This doesn't quite play nicely with btrfs and should lead to all kinds
of problemsI'm looking into how to disable swapfiles completely.
Please try to support swapfiles. I know their drawbacks and still use 
them quite often.


Cheers
Kaspar
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and swap files on SSD's ?

2009-01-20 Thread Dmitri Nikulin
On Wed, Jan 21, 2009 at 12:02 AM, Chris Mason chris.ma...@oracle.com wrote:
 There are patches to support swap over NFS that might make it safe to
 use on btrfs. At any rate, it is a fixable problem.

FreeBSD has been able to run swap over NFS for as long as I can
remember, what is different in Linux that makes it especially
difficult?

I've read that swap over non-trivial filesystems is hazardous as it
may lead to a situation in which memory allocation can fail in the
swap/FS code that was meant to make allocation possible again.

If btrfs is to take the role of a RAID and volume manager, it would
certainly be very useful to be able to run swap on it, since that
frees up other volumes from an administrative standpoint.

-- 
Dmitri Nikulin

Centre for Synchrotron Science
Monash University
Victoria 3800, Australia
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and swap files on SSD's ?

2009-01-20 Thread Anthony Roberts
 The second is an implementation detail of the linux swap file code.  It
 expects filesystems don't move blocks around, and takes a mapping of the
 blocks in the FS once.
 
 This doesn't work with btrfs because we do move blocks around all the
 time.

That's interesting. I have a few questions:

-Is creating a loopback device from the file any different, or does that
lead to the same problems?

-Would mounting a filesystem image via loopback device cause similar
problems?

-Would this be viable if using a dedicated nodatacow subvolume, or is that
still too risky because of the odd case where you do cow?

-Does online defragmentation hurt this as well?

Cheers,

-Anthony

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and swap files on SSD's ?

2009-01-20 Thread Andi Kleen
Dmitri Nikulin dniku...@gmail.com writes:

 On Wed, Jan 21, 2009 at 12:02 AM, Chris Mason chris.ma...@oracle.com wrote:
 There are patches to support swap over NFS that might make it safe to
 use on btrfs. At any rate, it is a fixable problem.

 FreeBSD has been able to run swap over NFS for as long as I can
 remember, what is different in Linux that makes it especially
 difficult?

One big traditional difference is that FreeBSD uses fixed isolated
pools for their networking buffers (that is why you had to tune most
systems for higher network workloads), while Linux has fully
unified[1] memory management including the network stack.
Now I believe recent BSD also moved to more unified network
management and it wouldn't surprise me if they had trouble
with this now too.

[1] at least for now, there are unfortunately some tendencies to move
back to fixed pools too.

 I've read that swap over non-trivial filesystems is hazardous as it
 may lead to a situation in which memory allocation can fail in the
 swap/FS code that was meant to make allocation possible again.

A lot of this has been fixed in the 2.6 timeframe (e.g. there's
now a better enforced global dirty limit), but there are likely still
corner cases that could run into difficulties, so noone is 
really declaring it 100% safe yet.

 If btrfs is to take the role of a RAID and volume manager, it would
 certainly be very useful to be able to run swap on it, since that
 frees up other volumes from an administrative standpoint.

The fixed extent mapping of the swap files is really a different problem,
independent of the memory allocation issue.

In general the memory allocation problem on write out has to be solved
in any ways (even if you don't support swap files), because any dirty 
mmap'ed file effectively acts like a swap file.

-Andi
-- 
a...@linux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html