Re: Raw-io & Swap partitions

Riley Williams (rhw@bigfoot.com)
Tue, 22 Dec 1998 10:58:48 +0000 (GMT)


Hi there.

>>> There seem to be fairly significant parallels between Linux's
>>> support of special partitions for swap, and the arguments for
>>> raw disk I/O.

>>> If the arguments against raw-io are technically correct, why do
>>> we still support partition level access to swap ?

>> I'm no expert on this, but my understanding is that swap needs to
>> have the entire swap area in contiguous sectors, which can't be
>> guaranteed for files, but is a given with partitions.

> Of course this is not a case :-) At least for last four years ...

Like I said, I'm no expert...but your comments appear to indicate that
my comments are correct...

>> Indeed, as I understand it, on the ext2 file system, ANY file
>> that's over 16 Megs in size is of necessity split into several
>> separate fragments...

> Hm. Looks like not all you statements are lie. This is correct.

I have to admit that comment surprises me, as I never expected you to
admit that somebody other than yourself can tell the truth...

>>> Assuming there's little performance difference between swap
>>> partitions and swap files, swap files are a big win. No hardwired
>>> decision on how much swap is needed, just create a swap file in
>>> one of the filesystems. If you find it's too big or too small it
>>> can be resized easilly. (Unlike a partition).

>>> On the flip side, if swap partitions do give some advantages,
>>> surely the same justification can be made for supporting raw-io.

>> I don't believe it can, since the specific advantage gained by
>> swap partitions that I mentioned above is in general irrelevant in
>> all other contexts...

> This is not so relevant for swap partition as well :-))

WHy do you claim later in your missive that it is then?

>>> Note: I'm not saying the two cases are identical, just that there
>>> are fairly major simillarities.

>> Unfortunately, swap also has some unique requirements which make
>> the difference...

> Not, of course.

So why do you claim that they do have later in the same missive?

>>> I appreciate that it's far easier to keep something out of the
>>> kernel in the first place than to remove it later. However in the
>>> case of swap partitions I'm confident they could be removed
>>> painlessly. Just turn the partition into an e2fs one and create one
>>> large file. (Worst case).

>> Unfortunately wouldn't work - you'd have to creat a whole bunch of
>> separate files, each just below the fragmentation limit, and each
>> residing in a separate "block group" (the kernel's name, not mine),
>> as otherwise, they'd be unusable...

> You are joking ??? Gosh. Why you are permanently wrote something to
> show your incompetency ? Of course this absolutely not a case. Do
> you ever read `man mkswap` ? This is from there:

> -- cut --
> To setup a swap file, it is necessary to create that file
> before running mkswap . A sequence of commands similar to
> the following is reasonable for this purpose:
>
> # dd if=/dev/zero of=swapfile bs=1024 count=8192
> # mkswap swapfile 8192
> # sync
> # swapon swapfile
>
> Note that a swap file must not contain any holes (so,
> using cp(1) to create the file is not acceptable).
> -- cut --

Yes, I read that - and, as it points out, an 8 Meg swapfile created
with the dd command is not a problem, since that's only half the size
of the "block groups" that ext2 uses.

Your claim that I could replace any of my seven 126 Meg swap
partitions with an ext2 partition containing one dirty great swap file
is NOT consistant with that though, or have you overlooked the last
sentence in your quote? It does say "no holes", and that isn't
possible on ext2 for files larger than the block group, AS YOU
ADMITTED ABOVE...

> I'm does not have swap partition here at all (this was BIG problem
> while setting up RedHat 5.1 -- I was REALLY mad when found that I'm
> could not setup RedHat 5.1 without swap partition like RedHat 4.x
> or RedHat 5.0 @##%^$%$^#$@). Instead I'm have commands

> -- cut --
> mkswap /dos/d-w95/windows/win386.swp
> sync
> swapon /dos/d-w95/windows/win386.swp
> -- cut --

I note that you're using VFAT partitions, not EXT2 ones like you were
referring to in your original post. This is presumably because (unlike
your claims) swap files larger than the block group size don't work on
EXT2 partitions...

> This way I'm could use the same swap file in Linux and Windows 98
> :-) And of course for last four years Linux was able to use swap
> file instead of swap partition -- no problems with "block groups"
> or whatever. On FAT (including FAT32 via VFAT as in example above
> :-), ext2fs, etc.

On FAT or VFAT, sure - I've never said otherwise. It's your stupid
claim that 126 Meg swapfiles will work happily on EXT2 partitions that
I'm challenging, and so far, you've succeeded in proving me right to
challenge it...

> P.S. In fact there are problem with swap file: you should be able
> to mount partition with swap file before use of this file ! This
> could be problem for tiny computers with 2Mb RAM... But 2.1.1xx
> could not use them anyway...

In other words, swap files do indeed have special requirements that
are not applicable to other uses of raw I/O. Thanks for confirming my
claims...

Best wishes from Riley.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/