kern/106432: Record of disks (DVD-R) through the k3b program leads to lag of system

Andriy Gapon avg at icyb.net.ua
Fri Jan 12 10:00:37 PST 2007


The following reply was made to PR kern/106432; it has been noted by GNATS.

From: Andriy Gapon <avg at icyb.net.ua>
To: bug-followup at FreeBSD.org, andrew at dobrohot.org, h.eichmann at gmx.de
Cc:  
Subject: Re: kern/106432: Record of disks (DVD-R) through the k3b program
 leads to lag of system
Date: Fri, 12 Jan 2007 19:57:06 +0200

 I would like to followup on the portion of this PR that says that k3b
 shows incorrect speed list in its "Speed" drop-down for DVD media.
 
 I have this problem as well and I think that I found a reason. The
 following lines from k3b debug output raised my suspicion:
 
 k3b: (K3bDevice::openDevice) open device /dev/pass0 succeeded.
 k3b: (K3bDevice::ScsiCommand) transport command ac, length: 12
 k3b: (K3bDevice::openDevice) open device /dev/pass0 succeeded.
 k3b: (K3bDevice::ScsiCommand) transport command ac, length: 10
 k3b: (K3bDevice::Device) /dev/cd0:  Number of supported write speeds via
 GET PERFORMANCE: 7
 k3b: (K3bDevice::Device) /dev/cd0 : 13854 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 Invalid DVD speed: 0 KB/s
 
 It seems that the second 0xAC (GET PERFORMANCE) command was sent as
 10-byte command instead of correct 12-byte command. I've checked the
 sources of k3b and dvd+rw-mediainfo and they both send two 0xAC commands
 , first one is to query number of writing profiles and the second one is
 to actually get them. Only dvd+rw-mediainfo does it correctly and k3b
 does it incorrectly.
 
 The problem is in libk3bdevice/k3bdevice_mmc.cpp file, method
 K3bDevice::Device::getPerformance(): the code assumes that some bytes in
 cmd[] will survive the first execution and so they do not need to be set
 again. This might be an incorrect assumption. So I changed the
 corresponding lines so that they look like follows:
 [[[[]]]]
     int numDesc = (dataLen-8)/16;
 
     cmd[0] = MMC_GET_PERFORMANCE;
     cmd[1] = dataType;
     cmd[2] = lba >> 24;
     cmd[3] = lba >> 16;
     cmd[4] = lba >> 8;
     cmd[5] = lba;
     cmd[8] = numDesc>>8;
     cmd[9] = numDesc;
     cmd[10] = type;
     cmd[11] = 0;     // Necessary to set the proper command length
 [[[[]]]]
 
 Now everything is correct:
 k3b: (K3bDevice::openDevice) open device /dev/pass0 succeeded.
 k3b: (K3bDevice::ScsiCommand) transport command ac, length: 12
 k3b: (K3bDevice::openDevice) open device /dev/pass0 succeeded.
 k3b: (K3bDevice::ScsiCommand) transport command ac, length: 12
 k3b: (K3bDevice::Device) /dev/cd0:  Number of supported write speeds via
 GET PERFORMANCE: 7
 k3b: (K3bDevice::Device) /dev/cd0 : 22161 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 22160 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 16621 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 16620 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 11081 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 11080 KB/s
 k3b: (K3bDevice::Device) /dev/cd0 : 5540 KB/s
 
 And I see the correct list in GUI drop-down too.
 Before that I had to always set DVD writing speed to "Ignore", so that
 k3b wouldn't try to force some unnatural speed on my DVD drive.
 
 
 -- 
 Andriy Gapon


More information about the freebsd-bugs mailing list