Implement tape compression in kernel mode

Hello everyone, I’ve implemented a tape filter driver
to do compression/decompression. This tape filter
driver is an upper filter of tape drive class. I use
NTBACKUP to do backup/restore. I try to make this
solution fully transparent to NTBACKUP.

Once a write operation comes in my filter compresses
the data and then writes the compressed data to the
tape. Since the size of the data after compression may
not be multiple of blocks set by NTBACKUP, so the
filter also hook the IOCTL_TAPE_SET_MEDIA_PARAMS ioctl
command from NTBACKUP. My filter resets the block size
to 0 which forces the underlying tape class driver
uses variable-block mode. I also put a 32-byte
compression frame header before each compressed stream
data. This header provides information necessary for
decompression such as uncompressed data size and
compressed data size.

By this way I can finishe the backup successfully.
That means I can write the compressed data
successfully to the tape. The problem happened during
restore time. At the very begining of the restore
NTBACK wants to verify the data on the tape. So it
sends IOCTL_TAPE_SET_POSITION ioctl command down and
tries to position the tape. Once the position method
is TAPE_LOGICAL_BLOCK or TAPE_SPACE_RELATIVE_BLOCKS, I
just don’t know how to handle this since the data on
the tape is compressed and the size is much smaller
than the original data size. How can I position the
tape so that I can return the correct data which
NTBACK asked for?

My solution is similiar to the hardware compression on
some tape drive. Once hardware compression option is
enabled, how can the tape drive find the correct data
from the compressed data on the tape. Should I need to
keep some logical block info in my compression frame
header? Or can anybody explain how tape drive itself
handles this?

Thanks.


Post your free ad now! http://personals.yahoo.ca