Re: Raw-io & Swap partitions

Khimenko Victor (khim@sch57.msk.ru)
Mon, 21 Dec 1998 22:14:03 +0300 (MSK)


21-Dec-98 14:54 you wrote:
> Hi Peter.

>> 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 ...

> 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.

>> 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 :-))

>> 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.

>> 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 --
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 --
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.

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...

-
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/