Programming Recommendations
As an aid to those who wish to develop using the Raw File System, here are
a few recommendations based on the implementation that will help make the
most of your efforts.
Note: Be careful when using the Raw File System! While it can be
very useful and powerful, it will not stop you from destroying the data
on your disks if you are not careful.
Physical vs. Logical Disks
Physical disk refers
to the actual hard disk drives installed in the system. The Raw File System
supports up to 128 installed physical disks. Logical disks refers to partitions
located on the physical disks, including floppy and CD-ROM drives, that
have been formatted for a specific file system, such as FAT or HPFS. OS/2
is limited to 26 such partitions, the first two of which are reserved for
floppy drives.
Physical Disk Numbering
Physical
disk numbers directly correspond with the number assigned using the FDISK
utility program.
Physical Disk Formatting
When
using the Raw File System to manage data on a physical disk, the disk should
not be formatted for use by another file system. The FDISK utility will
show the disk as unformatted.
Drive Locking
To
make a physical disk accessible only by the current process, use the OPEN_SHARE_DENYREADWRITE
flag on the DosOpen call. The lock will
automatically be released when DosClose is
called.
In order to lock a logical partition, a call to DosDevIOCtl
with category 8, function DSK_LOCKDRIVE must called. This must be done
before any reads or writes can succeed. Upon completion, DosDevIOCtl
with category 8, function DSK_UNLOCKDRIVE must be called before DosClose
in order to unlock the disk.
Memory Buffer Sizes
The Raw File System supports large memory buffers
for reading and writing. For best performance, keep your memory buffers
less than 64KB in size. Buffers larger than this are broken up into multiple
requests in order not to overload the system buffers.
Aligned
Memory Buffers
The Raw File System is implemented
with performance critical applications in mind. Implementation details
dictate that memory buffers used for I/O should begin on page boundaries
in order to achieve maximum performance. Unaligned memory buffers will
result in poorer performance. See the example code in the DosListIO
function to see how to align a buffer.
DosListIO
Function
The DosListIO
function should be used when multiple reads and writes are necessary.
This will greatly reduce the number of instructions needed to perform the
I/O operations and as a result help minimize utilization of system resources.
This is most beneficial under heavy workloads.
Disks
Larger than 2 GB
The Raw File System supports physical
disks up to 1 TB (terabyte) in size. To allow easier addressing of such
large disks, a new mode bit, FILE_SECTOR, has been added to DosSetFilePtr
and DosListIO which allows offsets
to be specified in sectors rather than bytes.
For
Maximum Performance...
To achieve maximum performance
using the Raw File System, the application should use the DosListIO
function with page aligned memory buffers less than 64 KB in size directed
to data on physical drives.
[Back: Raw File System]
[Next: DosClose]