directIO on usb mass storage/scsi device in 2.4 kernel

syed khader <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
hi 
  I am having problems getting directIO(file write
using O_DIRECT) work on scsi device(seagate usb hard
drive) on an ARM platform.
 I really dont know if it is a sg driver or USB
problem, so I am posting it here.
  Any pointers would definitely help.
Thanks
Syed

 Here are the details:
1) cat /proc/scsi/sg/version
30125   Version: 3.1.25 (20030529)
2) Linux kernel 2.4.35 
3) mount -t ext2 /dev/sda2 /var/usb
4) echo 1 > /proc/scsi/sg/allow_dio
5) Code used to test:
  int in,out
 wrkBuffRaw= memalign(getpagesize(),
34*getpagesize());
  in = open("/dev/zero", O_RDONLY);
  out = open("/var/usb/temp",
O_RDWR|O_CREAT|O_DIRECT);
(or out = open("/dev/sda2",O_RDWR|O_DIRECT);)
  read(in, wrkBuffRaw, BUFSZ);
  write(out, wrkBuffRaw, BUFSZ)
  The same code works fine if I do read from the sda2
with o_direct(same is the case with sg_dd utility)
6) 
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_SD_EXTRA_DEVS=40
CONFIG_CHR_DEV_SG=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_DEVICEFS=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y

7) This is verbose debug:
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command READ_10 (10 bytes)
usb-storage: 28 00 00 00 00 87 00 00 08 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x26 Trg 0
LUN 0 L 4096 F 128 CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096
bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred
4096/4096
usb-storage: usb_stor_transfer_partial(): transfer
complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x26 R 0
Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command WRITE_10 (10 bytes)
usb-storage: 2a 00 00 00 10 c7 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x27 Trg 0
LUN 0 L 49152 F 0 CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096
bytes
ehci_hcd <NULL>: devpath 1 ep2out 3strikes
usb-storage: usb_stor_bulk_msg() returned -71 xferred
512/4096
usb-storage: usb_stor_transfer_partial(): unknown
error
usb-storage: Bulk data transfer result 0x2
usb-storage: Attempting to get CSW...
usb-storage: command_abort() called
usb-storage: -- transport indicates command was
aborted
usb-storage: Bulk reset requested

usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Bulk soft reset completed
usb-storage: scsi command aborted
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x28 Trg 0
LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x28 R 0
Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command WRITE_10 (10 bytes)
usb-storage: 2a 00 00 00 10 c7 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x29 Trg 0
LUN 0 L 49152 F 0 CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096
bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred
32/4096
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: command_abort() called
usb-storage: -- transport indicates command was
aborted
usb-storage: Bulk reset requested
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Bulk soft reset completed
usb-storage: scsi command aborted
usb-storage: *** thread sleeping.
usb-storage: device_reset() called
usb-storage: Bulk reset requested
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Bulk soft reset completed
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x2a Trg 0
LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x2a R 0
Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command WRITE_10 (10 bytes)
usb-storage: 2a 00 00 00 10 c7 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x2b Trg 0
LUN 0 L 49152 F 0 CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096
bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred
32/4096
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: command_abort() called
usb-storage: -- transport indicates command was
aborted
usb-storage: Bulk reset requested
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Bulk soft reset completed
usb-storage: scsi command aborted
usb-storage: *** thread sleeping.
usb-storage: bus_reset() called
hub.c: port 1, portstatus 511, change 0, 480 Mb/s
hub.c: port 1 of hub 1 not reset yet, waiting 10ms
hub.c: port 1, portstatus 511, change 0, 480 Mb/s
hub.c: port 1 of hub 1 not reset yet, waiting 10ms
hub.c: port 1, portstatus 503, change 0, 480 Mb/s
usb.c: ignoring set_interface for dev 2, iface 0, alt
0
usb-storage: Examinging driver usb-storage...skipping
ourselves.
usb-storage: bus_reset() complete
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x2c Trg 0
LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x2c R 0
Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command WRITE_10 (10 bytes)
usb-storage: 2a 00 00 00 10 c7 00 00 60 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x2d Trg 0
LUN 0 L 49152 F 0 CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096
bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred
32/4096
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: command_abort() called
usb-storage: -- transport indicates command was
aborted
usb-storage: Bulk reset requested
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Bulk soft reset completed
usb-storage: scsi command aborted
usb-storage: *** thread sleeping.
scsi: device set offline - not ready or command retry
failed after bus reset: host 0 channel 0 id 0 lun 0
SCSI disk error : host 0 channel 0 id 0 lun 0 return
code = 50000
 I/O error: dev 08:01, sector 4232
 I/O error: dev 08:01, sector 4240
 I/O error: dev 08:01, sector 4328
 I/O error: dev 08:01, sector 0
 I/O error: dev 08:01, sector 72
 I/O error: dev 08:01, sector 88
writing error: Input/output error
time to transfer data was 159.096150 secs
# 
#  I/O error: dev 08:01, sector 88
 I/O error: dev 08:01, sector 0
EXT2-fs error (device sd(8,1)): ext2_write_inode:
unable to read inode block - inode=12, block=11
 I/O error: dev 08:01, sector 8
 I/O error: dev 08:01, sector 72




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.