[Stgt-devel] stgt backing store & SSC
Mark Harvey
markh794
Tue Jul 31 11:57:41 CEST 2007
Hi One and all,
I'm after some input on the best way to incorporate the SSC device with
the current backing store implementations.
The 'block' format used currently for SBC, MMC devices do not map well
for streaming device(s). - For both implicit and explicit addressing mode.
The 'problem':
==========
For Variable block SSC device, the block size written needs to be
tracked. Otherwise the SSC device will be unable to correctly handle the
scenario where a read request arrives (from the application client) that
requests a 'large block'. The SSC device needs the ability to set the
REQUEST SENSE with ILI bit set correctly.
e.g.
A application client wrote a previous write of a 1k block of data:
An application client reserves 64k and requests a 'read'. The lu
receives a 64k read request.
The lu should now return 1k of data with REQUEST SENSE and ILI set
correctly.
Without some sore of way of tracking each block written, I can see no
way of achieving this.
My current thoughts of a solution:
========================
A block header describes each block written -> Analogy to the 'tar'
format where a header is written, followed by the 'data' followed by
another header, followed by more data...repeat...until blank header...
/**
* Tape layout
*
* @block_type: (BOT, Uncompress data, compressed data, EOT etc)
* @blk_size: Uncompressed size of data block
* @disk_blk_size: Amount of space block takes up in the backing 'file'
*
* @prev_blk, curr_blk & next_blk form a 'poor mans DLL'
*/
struct blk_header {
uint32_t blk_type;
uint32_t blk_size;
uint32_t disk_blk_size;
loff_t blk_number;
loff_t prev_blk;
loff_t curr_blk;
loff_t next_blk;
};
The file format I've used before is similar to:
<Beginning of tape blk_header>
<Media Aux Memory>
<blk header>
<Blk size data>
[repeat header/data blocks n times for n writes]
<End of Data blk header>
However the current implementation for iSCSI -> bs_sync uses a
pread64()/pwrite64() and writes data based on information stored in
scsi_cmd -
pwrite64(fd, cmd->uaddr, cmd->len, cmd->offset)
pread64(fd, cmd->uaddr, cmd->len, cmd->offset)
Would it be OK to add a 'blk_header' structure to struct scsi_cmd and if
blk_header is set, write this blk header as well ?
I will attempt to put the above idea into code and submit for comment...
Or does somebody have a better / cleaner way of achieving this ?
Regards
Mark
More information about the stgt
mailing list