Skip to content

Implement tell and seek for tapes - #79

Open
tjwoodall wants to merge 1 commit into
fujita:masterfrom
tjwoodall:master
Open

Implement tell and seek for tapes#79
tjwoodall wants to merge 1 commit into
fujita:masterfrom
tjwoodall:master

Conversation

@tjwoodall

Copy link
Copy Markdown

tgtadm --op update --mode sys --name State -v offline tgt-admin -e -c /etc/tgt/targets.conf
tgtadm --op update --mode sys --name State -v ready

iscsiadm --mode node --targetname iqn.2007-03:virtual-tape:hostname --portal ${iscsi_host} --login mtx -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-3-changer load 1 0 mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst rewind mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 1.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst fsf mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 327.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst eod mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 2882.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst bsf mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 2880.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst seek 300 At block 300.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst bsr mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 299.
mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst fsr mt-st -f /dev/tape/by-path/ip-fd01:8b0:bfcd:100:216:3eff:fee0:7253:3260-iscsi-iqn.2007-03:virtual-tape:hostname-lun-1-nst tell At block 300.

@tjwoodall

tjwoodall commented Mar 7, 2026

Copy link
Copy Markdown
Author

This has been implemented very quickly and I'm not very familiar with how scsi works, but at least on linux appears to do the right thing.

How it was tested is documented in the commit log.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for tape position reporting (“tell”) and repositioning (“seek”) by wiring up the relevant SCSI opcode(s) to the SSC backing store implementation.

Changes:

  • Route the SCSI SEEK_10 (0x2b) opcode to the SSC request handler.
  • Extend bs_ssc to support larger block deltas (int64_t) for spacing/seeking.
  • Implement basic READ_POSITION and SEEK_10 handling in the tape backing store path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
usr/ssc.c Enables SSC handling for the 0x2b opcode by mapping it to ssc_rw.
usr/bs_ssc.c Implements SEEK_10 and updates READ_POSITION response behavior and block spacing types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread usr/bs_ssc.c Outdated
Comment thread usr/bs_ssc.c Outdated
Comment thread usr/bs_ssc.c Outdated
@tjwoodall
tjwoodall force-pushed the master branch 3 times, most recently from fbbc9e7 to 0610bc1 Compare March 8, 2026 15:26
@tjwoodall

Copy link
Copy Markdown
Author

FWIW, I'm using this here: https://sourceforge.net/p/dump/code/ci/v0.4b55-wip/ for testing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread usr/bs_ssc.c Outdated
Comment thread usr/bs_ssc.c Outdated
Comment thread usr/bs_ssc.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread usr/bs_ssc.c Outdated
Comment thread usr/bs_ssc.c Outdated
tgtadm --op update --mode sys --name State -v offline
tgt-admin -e -c  /etc/tgt/targets.conf
tgtadm --op update --mode sys --name State -v ready

iscsiadm --mode node --targetname iqn.2007-03:virtual-tape:hostname --portal ${iscsi_host} --login
mtx -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-3-changer load 1 0
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst rewind
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 1.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst fsf
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 327.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst eod
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 2882.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst bsf
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 2880.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst seek 300
At block 300.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst bsr
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 299.
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst fsr
mt-st -f /dev/tape/by-path/ip-fd01\:8b0\:bfcd\:100\:216\:3eff\:fee0\:7253\:3260-iscsi-iqn.2007-03\:virtual-tape\:hostname-lun-1-nst tell
At block 300.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants