Re: [PATCH V2] Make virtual tapes more closely emulate physical ones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The difff looks good..
I haven't actually tested it and wont be in a position to for a few days.

I am happy to add my ACK and will test early next week too.


Sent from my iPad

On Jan 19, 2013, at 3:21, FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> wrote:

> Mark, any comment on this?
> 
> On Thu, 17 Jan 2013 16:21:36 -0500
> Jay Fenlason <fenlason@xxxxxxxxxx> wrote:
> 
>> On Thu, Jan 10, 2013 at 11:36:44AM -0500, Jay Fenlason wrote:
>>> On my physical drive (a Sony AIT-2 drive, if it matters) when
>>> userspace reads a file mark, it gets an EOF, and the tape is advanced
>>> past the file mark so that a subsequent read will return data from the
>>> next file on the tape.  With a virtual drive, the file mark is
>>> sticky--reads continue to return EOF until the tape is manually
>>> advanced with a FSF ioctl.  I wrote this quick patch to make the
>>> virtual tape behave like my physical one.
>> 
>> V2: Replace FIXME with correct error flow.  If the attempt to read the
>> next block fails, return ASC_MEDIUM_FORMAT_CORRUPT
>> 
>> Signed-off-by: Jay Fenlason <fenlason@xxxxxxxxxx>
>> 
>> 
>> --- tgt-1.0.32/usr/bs_ssc.c.filemark    2012-09-30 18:39:21.000000000 -0400
>> +++ tgt-1.0.32/usr/bs_ssc.c    2013-01-17 14:39:54.000000000 -0500
>> @@ -325,6 +325,9 @@ static int resp_var_read(struct scsi_cmd
>>        if (h->blk_type == BLK_EOD)
>>            sense_data_build(cmd, 0x40 | BLANK_CHECK,
>>                     NO_ADDITIONAL_SENSE);
>> +        else if (h->blk_type == BLK_FILEMARK)
>> +            ssc_sense_data_build(cmd, NO_SENSE | SENSE_FILEMARK,
>> +                         ASC_MARK, info, sizeof(info));
>>        else
>>            ssc_sense_data_build(cmd, NO_SENSE | 0x20,
>>                         NO_ADDITIONAL_SENSE,
>> @@ -339,8 +342,11 @@ static int resp_var_read(struct scsi_cmd
>> 
>>        result = SAM_STAT_CHECK_CONDITION;
>> 
>> -        if (!length)
>> +        if (!length) {
>> +            if (h->blk_type == BLK_FILEMARK)
>> +                goto skip_and_out;
>>            goto out;
>> +        }
>>    }
>> 
>>    ret = pread64(cmd->dev->fd, buf, length, h->curr + SSC_BLK_HDR_SIZE);
>> @@ -351,6 +357,7 @@ static int resp_var_read(struct scsi_cmd
>>    }
>>    *transferred = length;
>> 
>> +skip_and_out:
>>    ret = skip_next_header(cmd->dev);
>>    if (ret) {
>>        sense_data_build(cmd, MEDIUM_ERROR, ASC_MEDIUM_FORMAT_CORRUPT);
>> --
>> To unsubscribe from this list: send the line "unsubscribe stgt" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux