* Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
@ 2001-04-17 12:25 Stefan Jaschke
2001-04-18 10:39 ` Jens Axboe
0 siblings, 1 reply; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-17 12:25 UTC (permalink / raw)
To: linux-kernel
Judging from the thread started Jan 1, 2001, by Andre Hedrick,
I thought IDE DVD-RAM just works out of the box and got a
Toshiba SD-W2002.
Problem: /dev/hdc cannot be read or written to when the drive contains
DVD-RAM media. The behavior is the same for the stock 2.4.3 kernel
and the SuSE-2.4.0 kernel. Strangely enough, the disk can be read,
but not written to, with the 2.2.18 kernel.
Diagnostics:
(1) The hardware is properly connected: mounting CD-ROMs and the SuSE-7.1
DVD-ROM works.
(2) The drive is recognized at boot time (2.4.3 kernel):
from "/var/log/boot.msg":
<4>ide_setup: idebus=33
<4>ide_setup: ide0=dma
<4>ide_setup: ide0=ata66
<4>ide: Assuming 33MHz system bus speed for PIO modes
<4>AMD7409: IDE controller on PCI bus 00 dev 39
<4>AMD7409: chipset revision 7
<4>AMD7409: not 100%% native mode: will probe irqs later
<4>AMD7409: ATA-66/100 forced bit set (WARNING)!!
<4> ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:pio
<4> ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:DMA, hdd:pio
<4>hda: IBM-DTLA-307030, ATA DISK drive
<4>hdc: TOSHIBA DVD-RAM SD-W2002, ATAPI CD/DVD-ROM drive
<4>ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
<4>ide1 at 0x170-0x177,0x376 on irq 15
<6>hda: 60036480 sectors (30739 MB) w/1916KiB Cache, CHS=3737/255/63, UDMA(66)
<4>hdc: ATAPI 24X DVD-ROM DVDAM drive, 8192kB Cache, DMA
<6>Uniform CD-ROM driver Revision: 3.12
# cat /proc/sys/dev/cdrom/info
CD-ROM information, Id: cdrom.c 3.12 2000/10/18
drive name: hdc
drive speed: 0
drive # of slots: 1
Can close tray: 1
Can open tray: 1
Can lock tray: 1
Can change speed: 1
Can select disk: 0
Can read multisession: 1
Can read MCN: 1
Reports media changed: 1
Can play audio: 1
Can write CD-R: 0
Can write CD-RW: 0
Can read DVD: 1
Can write DVD-R: 0
Can write DVD-RAM: 1
# cat /proc/ide/hdc/settings
name value min max mode
---- ----- --- --- ----
breada_readahead 4 0 127 rw
current_speed 34 0 69 rw
dsc_overlap 0 0 1 rw
file_readahead 0 0 2097151 rw
ide_scsi 0 0 1 rw
init_speed 34 0 69 rw
io_32bit 0 0 3 rw
keepsettings 0 0 1 rw
max_kb_per_request 127 1 127 rw
nice1 1 0 1 rw
number 2 0 3 rw
pio_mode write-only 0 255 w
slow 0 0 1 rw
unmaskirq 0 0 1 rw
using_dma 1 0 1 rw
(3) the DVD-RAM medium cannot be read from or written to:
# dd if=/dev/hdc of=/dev/null bs=2048 count=8
0+0 records in
0+0 records out
# dd if=/dev/null of=/dev/hdc bs=2048 count=8
0+0 records in
0+0 records out
# fdisk /dev/hdc
Unable to read /dev/hdc
# badblocks /dev/hdc
0
1
2
3
4
...
# mke2fs -v -b 2048 -m 0 /dev/hdc
mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
/dev/hdc: Memory allocation failed while setting up superblock
# mkudf --media-type=dvdram --blocksize=2048 /dev/hdc
7200 (CEST)/-120
mkudf: min blocks=1762
(Just to make sure, I tried 2 different DVD-RAM media.)
______________________________________________________________________________
I am somewhat clueless what to do next.
Are there any experiences with this or other IDE DVD-RAM drives?
Stefan J.
--
Stefan R. Jaschke <stefan@jaschke-net.de>
http://www.jaschke-net.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-17 12:25 Problems with Toshiba SD-W2002 DVD-RAM drive (IDE) Stefan Jaschke
@ 2001-04-18 10:39 ` Jens Axboe
2001-04-18 12:39 ` Jens Axboe
0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2001-04-18 10:39 UTC (permalink / raw)
To: stefan; +Cc: linux-kernel
On Tue, Apr 17 2001, Stefan Jaschke wrote:
> Judging from the thread started Jan 1, 2001, by Andre Hedrick,
> I thought IDE DVD-RAM just works out of the box and got a
> Toshiba SD-W2002.
>
> Problem: /dev/hdc cannot be read or written to when the drive contains
> DVD-RAM media. The behavior is the same for the stock 2.4.3 kernel
> and the SuSE-2.4.0 kernel. Strangely enough, the disk can be read,
> but not written to, with the 2.2.18 kernel.
It should work, note that I recently spotted some quite severe bugs in
the pio write handling for ATAPI which I've almost fixed here now. It
seems you drive is in DMA mode though, so it shouldn't be affecting you.
Please send me strace info when reading/writing to the drive (or at
least attempting to), this looks very queer indeed.
--
Jens Axboe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-18 10:39 ` Jens Axboe
@ 2001-04-18 12:39 ` Jens Axboe
2001-04-18 22:12 ` Stefan Jaschke
2001-04-19 11:39 ` Stefan Jaschke
0 siblings, 2 replies; 12+ messages in thread
From: Jens Axboe @ 2001-04-18 12:39 UTC (permalink / raw)
To: stefan; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 919 bytes --]
On Wed, Apr 18 2001, Jens Axboe wrote:
> On Tue, Apr 17 2001, Stefan Jaschke wrote:
> > Judging from the thread started Jan 1, 2001, by Andre Hedrick,
> > I thought IDE DVD-RAM just works out of the box and got a
> > Toshiba SD-W2002.
> >
> > Problem: /dev/hdc cannot be read or written to when the drive contains
> > DVD-RAM media. The behavior is the same for the stock 2.4.3 kernel
> > and the SuSE-2.4.0 kernel. Strangely enough, the disk can be read,
> > but not written to, with the 2.2.18 kernel.
>
> It should work, note that I recently spotted some quite severe bugs in
> the pio write handling for ATAPI which I've almost fixed here now. It
> seems you drive is in DMA mode though, so it shouldn't be affecting you.
Attached patch for 2.4.4-pre4 which fixes all known DVD-RAM ATAPI bugs.
Both pio and dma mode work fine here, using ext2, on a 9.4gb HITACHI
DVD-RAM GF-2000 drive.
--
Jens Axboe
[-- Attachment #2: cd-244p4-1 --]
[-- Type: text/plain, Size: 14843 bytes --]
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
--- /opt/kernel/linux-2.4.4-pre4/drivers/cdrom/cdrom.c Thu Mar 29 21:56:07 2001
+++ linux/drivers/cdrom/cdrom.c Wed Apr 18 13:27:36 2001
@@ -279,6 +279,9 @@
static int lockdoor = 1;
/* will we ever get to use this... sigh. */
static int check_media_type;
+static unsigned long *cdrom_numbers;
+static DECLARE_MUTEX(cdrom_sem);
+
MODULE_PARM(debug, "i");
MODULE_PARM(autoclose, "i");
MODULE_PARM(autoeject, "i");
@@ -340,6 +343,38 @@
check_media_change: cdrom_media_changed,
};
+/*
+ * get or clear a new cdrom number, run under cdrom_sem
+ */
+static int cdrom_get_entry(void)
+{
+ int i, nr, foo;
+
+ nr = 0;
+ foo = -1;
+ for (i = 0; i < CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8); i++) {
+ if (cdrom_numbers[i] == ~0UL) {
+ nr += sizeof(unsigned long) * 8;
+ continue;
+ }
+ foo = ffz(cdrom_numbers[i]);
+ set_bit(foo, &cdrom_numbers[i]);
+ nr += foo;
+ break;
+ }
+
+ return foo == -1 ? foo : nr;
+}
+
+static void cdrom_clear_entry(struct cdrom_device_info *cdi)
+{
+ int bit_nr = cdi->nr & ~(sizeof(unsigned long) * 8);
+ int cd_index = cdi->nr / (sizeof(unsigned long) * 8);
+
+ clear_bit(bit_nr, &cdrom_numbers[cd_index]);
+}
+
+
/* This macro makes sure we don't have to check on cdrom_device_ops
* existence in the run-time routines below. Change_capability is a
* hack to have the capability flags defined const, while we can still
@@ -354,7 +389,6 @@
struct cdrom_device_ops *cdo = cdi->ops;
int *change_capability = (int *)&cdo->capability; /* hack */
char vname[16];
- static unsigned int cdrom_counter;
cdinfo(CD_OPEN, "entering register_cdrom\n");
@@ -395,7 +429,17 @@
if (!devfs_handle)
devfs_handle = devfs_mk_dir (NULL, "cdroms", NULL);
- sprintf (vname, "cdrom%u", cdrom_counter++);
+
+ /*
+ * get new cdrom number
+ */
+ down(&cdrom_sem);
+ cdi->nr = cdrom_get_entry();
+ up(&cdrom_sem);
+ if (cdi->nr == -1)
+ return -ENOMEM;
+
+ sprintf(vname, "cdrom%u", cdi->nr);
if (cdi->de) {
int pos;
devfs_handle_t slave;
@@ -418,9 +462,13 @@
S_IFBLK | S_IRUGO | S_IWUGO,
&cdrom_fops, NULL);
}
- cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
+
+ down(&cdrom_sem);
cdi->next = topCdromPtr;
topCdromPtr = cdi;
+ up(&cdrom_sem);
+
+ cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
return 0;
}
#undef ENSURE
@@ -429,12 +477,14 @@
{
struct cdrom_device_info *cdi, *prev;
int major = MAJOR(unreg->dev);
+ int bit_nr, cd_index;
cdinfo(CD_OPEN, "entering unregister_cdrom\n");
if (major < 0 || major >= MAX_BLKDEV)
return -1;
+ down(&cdrom_sem);
prev = NULL;
cdi = topCdromPtr;
while (cdi != NULL && cdi->dev != unreg->dev) {
@@ -442,14 +492,20 @@
cdi = cdi->next;
}
- if (cdi == NULL)
+ if (cdi == NULL) {
+ up(&cdrom_sem);
return -2;
+ }
+
+ cdrom_clear_entry(cdi);
+
if (prev)
prev->next = cdi->next;
else
topCdromPtr = cdi->next;
+ up(&cdrom_sem);
cdi->ops->n_minors--;
- devfs_unregister (cdi->de);
+ devfs_unregister(cdi->de);
cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name);
return 0;
}
@@ -458,10 +514,14 @@
{
struct cdrom_device_info *cdi;
+ down(&cdrom_sem);
+
cdi = topCdromPtr;
while (cdi != NULL && cdi->dev != dev)
cdi = cdi->next;
+ up(&cdrom_sem);
+
return cdi;
}
@@ -2418,6 +2478,8 @@
}
pos = sprintf(info, "CD-ROM information, " VERSION "\n");
+
+ down(&cdrom_sem);
pos += sprintf(info+pos, "\ndrive name:\t");
for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
@@ -2487,6 +2549,8 @@
for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_DVD_RAM) != 0);
+ up(&cdrom_sem);
+
strcpy(info+pos,"\n\n");
return proc_dostring(ctl, write, filp, buffer, lenp);
@@ -2633,6 +2697,10 @@
static int __init cdrom_init(void)
{
+ int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
+
+ cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
+
#ifdef CONFIG_SYSCTL
cdrom_sysctl_register();
#endif
@@ -2643,6 +2711,7 @@
static void __exit cdrom_exit(void)
{
printk(KERN_INFO "Uniform CD-ROM driver unloaded\n");
+ kfree(cdrom_numbers);
#ifdef CONFIG_SYSCTL
cdrom_sysctl_unregister();
#endif
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- /opt/kernel/linux-2.4.4-pre4/drivers/ide/ide-cd.c Fri Feb 9 20:30:23 2001
+++ linux/drivers/ide/ide-cd.c Wed Apr 18 14:28:30 2001
@@ -977,8 +977,7 @@
/* If we've filled the present buffer but there's another
chained buffer after it, move on. */
- if (rq->current_nr_sectors == 0 &&
- rq->nr_sectors > 0)
+ if (rq->current_nr_sectors == 0 && rq->nr_sectors)
cdrom_end_request (1, drive);
/* If the buffers are full, cache the rest of the data in our
@@ -1192,6 +1191,55 @@
return cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
}
+static inline int cdrom_merge_requests(struct request *rq, struct request *nxt)
+{
+ int ret = 1;
+
+ /*
+ * partitions not really working, but better check anyway...
+ */
+ if (rq->cmd == nxt->cmd && rq->rq_dev == nxt->rq_dev) {
+ rq->nr_sectors += nxt->nr_sectors;
+ rq->hard_nr_sectors += nxt->nr_sectors;
+ rq->bhtail->b_reqnext = nxt->bh;
+ rq->bhtail = nxt->bhtail;
+ list_del(&nxt->queue);
+ blkdev_release_request(nxt);
+ ret = 0;
+ }
+
+ return ret;
+}
+
+/*
+ * the current request will always be the first one on the list
+ */
+static void cdrom_attempt_remerge(ide_drive_t *drive, struct request *rq)
+{
+ struct list_head *entry;
+ struct request *nxt;
+ unsigned long flags;
+
+ spin_lock_irqsave(&io_request_lock, flags);
+
+ while (1) {
+ entry = rq->queue.next;
+ if (entry == &drive->queue.queue_head)
+ break;
+
+ nxt = blkdev_entry_to_request(entry);
+ if (rq->sector + rq->nr_sectors != nxt->sector)
+ break;
+ else if (rq->nr_sectors + nxt->nr_sectors > SECTORS_MAX)
+ break;
+
+ if (cdrom_merge_requests(rq, nxt))
+ break;
+ }
+
+ spin_unlock_irqrestore(&io_request_lock, flags);
+}
+
/* Fix up a possibly partially-processed request so that we can
start it over entirely, or even put it back on the request queue. */
static void restore_request (struct request *rq)
@@ -1203,6 +1251,8 @@
rq->sector -= n;
}
rq->current_nr_sectors = rq->bh->b_size >> SECTOR_BITS;
+ rq->hard_nr_sectors = rq->nr_sectors;
+ rq->hard_sector = rq->sector;
}
/*
@@ -1216,20 +1266,22 @@
/* If the request is relative to a partition, fix it up to refer to the
absolute address. */
- if ((minor & PARTN_MASK) != 0) {
+ if (minor & PARTN_MASK) {
rq->sector = block;
minor &= ~PARTN_MASK;
- rq->rq_dev = MKDEV (MAJOR(rq->rq_dev), minor);
+ rq->rq_dev = MKDEV(MAJOR(rq->rq_dev), minor);
}
/* We may be retrying this request after an error. Fix up
any weirdness which might be present in the request packet. */
- restore_request (rq);
+ restore_request(rq);
/* Satisfy whatever we can of this request from our cached sector. */
if (cdrom_read_from_buffer(drive))
return ide_stopped;
+ cdrom_attempt_remerge(drive, rq);
+
/* Clear the local sector buffer. */
info->nsectors_buffered = 0;
@@ -1477,7 +1529,7 @@
static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
{
- int stat, ireason, len, sectors_to_transfer;
+ int stat, ireason, len, sectors_to_transfer, uptodate;
struct cdrom_info *info = drive->driver_data;
int i, dma_error = 0, dma = info->dma;
ide_startstop_t startstop;
@@ -1498,6 +1550,9 @@
return startstop;
}
+ /*
+ * using dma, transfer is complete now
+ */
if (dma) {
if (dma_error)
return ide_error(drive, "dma error", stat);
@@ -1519,12 +1574,13 @@
/* If we're not done writing, complain.
* Otherwise, complete the command normally.
*/
+ uptodate = 1;
if (rq->current_nr_sectors > 0) {
printk("%s: write_intr: data underrun (%ld blocks)\n",
- drive->name, rq->current_nr_sectors);
- cdrom_end_request(0, drive);
- } else
- cdrom_end_request(1, drive);
+ drive->name, rq->current_nr_sectors);
+ uptodate = 0;
+ }
+ cdrom_end_request(uptodate, drive);
return ide_stopped;
}
@@ -1533,26 +1589,42 @@
if (cdrom_write_check_ireason(drive, len, ireason))
return ide_stopped;
- /* The number of sectors we need to read from the drive. */
sectors_to_transfer = len / SECTOR_SIZE;
- /* Now loop while we still have data to read from the drive. DMA
- * transfers will already have been complete
+ /*
+ * now loop and write out the data
*/
while (sectors_to_transfer > 0) {
- /* If we've filled the present buffer but there's another
- chained buffer after it, move on. */
- if (rq->current_nr_sectors == 0 && rq->nr_sectors > 0)
- cdrom_end_request(1, drive);
+ int this_transfer;
+
+ if (!rq->current_nr_sectors) {
+ printk("ide-cd: write_intr: oops\n");
+ break;
+ }
+
+ /*
+ * Figure out how many sectors we can transfer
+ */
+ this_transfer = MIN(sectors_to_transfer,rq->current_nr_sectors);
+
+ while (this_transfer > 0) {
+ atapi_output_bytes(drive, rq->buffer, SECTOR_SIZE);
+ rq->buffer += SECTOR_SIZE;
+ --rq->nr_sectors;
+ --rq->current_nr_sectors;
+ ++rq->sector;
+ --this_transfer;
+ --sectors_to_transfer;
+ }
- atapi_output_bytes(drive, rq->buffer, rq->current_nr_sectors);
- rq->nr_sectors -= rq->current_nr_sectors;
- rq->current_nr_sectors = 0;
- rq->sector += rq->current_nr_sectors;
- sectors_to_transfer -= rq->current_nr_sectors;
+ /*
+ * current buffer complete, move on
+ */
+ if (rq->current_nr_sectors == 0 && rq->nr_sectors)
+ cdrom_end_request (1, drive);
}
- /* arm handler */
+ /* re-arm handler */
ide_set_handler(drive, &cdrom_write_intr, 5 * WAIT_CMD, NULL);
return ide_started;
}
@@ -1583,10 +1655,26 @@
return cdrom_transfer_packet_command(drive, &pc, cdrom_write_intr);
}
-static ide_startstop_t cdrom_start_write(ide_drive_t *drive)
+static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
{
struct cdrom_info *info = drive->driver_data;
+ /*
+ * writes *must* be 2kB frame aligned
+ */
+ if ((rq->nr_sectors & 3) || (rq->sector & 3)) {
+ cdrom_end_request(0, drive);
+ return ide_stopped;
+ }
+
+ /*
+ * for dvd-ram and such media, it's a really big deal to get
+ * big writes all the time. so scour the queue and attempt to
+ * remerge requests, often the plugging will not have had time
+ * to do this properly
+ */
+ cdrom_attempt_remerge(drive, rq);
+
info->nsectors_buffered = 0;
/* use dma, if possible. we don't need to check more, since we
@@ -1629,7 +1717,7 @@
if (rq->cmd == READ)
action = cdrom_start_read(drive, block);
else
- action = cdrom_start_write(drive);
+ action = cdrom_start_write(drive, rq);
}
info->last_block = block;
return action;
@@ -1832,6 +1920,7 @@
pc.buffer = buf;
pc.buflen = buflen;
+ pc.quiet = 1;
pc.c[0] = GPCMD_READ_TOC_PMA_ATIP;
pc.c[6] = trackno;
pc.c[7] = (buflen >> 8);
@@ -2826,7 +2915,12 @@
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
HWIF(drive)->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME;
+ /*
+ * reset block size, ide_revalidate_disk incorrectly sets it to
+ * 1024 even for CDROM's
+ */
blk_size[HWIF(drive)->major] = HWIF(drive)->gd->sizes;
+ set_blocksize(MKDEV(HWIF(drive)->major, minor), CD_FRAMESIZE);
}
static
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/drivers/ide/ide-cd.h linux/drivers/ide/ide-cd.h
--- /opt/kernel/linux-2.4.4-pre4/drivers/ide/ide-cd.h Tue Mar 27 01:49:15 2001
+++ linux/drivers/ide/ide-cd.h Wed Apr 18 13:09:13 2001
@@ -37,11 +37,12 @@
/************************************************************************/
-#define SECTOR_SIZE 512
#define SECTOR_BITS 9
-#define SECTORS_PER_FRAME (CD_FRAMESIZE / SECTOR_SIZE)
+#define SECTOR_SIZE (1 << SECTOR_BITS)
+#define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)
#define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
-#define SECTORS_BUFFER (SECTOR_BUFFER_SIZE / SECTOR_SIZE)
+#define SECTORS_BUFFER (SECTOR_BUFFER_SIZE >> SECTOR_BITS)
+#define SECTORS_MAX (131072 >> SECTOR_BITS)
#define BLOCKS_PER_FRAME (CD_FRAMESIZE / BLOCK_SIZE)
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/drivers/scsi/sr.c linux/drivers/scsi/sr.c
--- /opt/kernel/linux-2.4.4-pre4/drivers/scsi/sr.c Mon Feb 19 19:25:17 2001
+++ linux/drivers/scsi/sr.c Wed Apr 18 13:00:32 2001
@@ -262,7 +262,7 @@
static int sr_scatter_pad(Scsi_Cmnd *SCpnt, int s_size)
{
struct scatterlist *sg, *old_sg = NULL;
- int i, fsize, bsize, sg_ent;
+ int i, fsize, bsize, sg_ent, sg_count;
char *front, *back;
back = front = NULL;
@@ -290,17 +290,24 @@
/*
* extend or allocate new scatter-gather table
*/
- if (SCpnt->use_sg)
+ sg_count = SCpnt->use_sg;
+ if (sg_count)
old_sg = (struct scatterlist *) SCpnt->request_buffer;
else {
- SCpnt->use_sg = 1;
+ sg_count = 1;
sg_ent++;
}
- SCpnt->sglist_len = ((sg_ent * sizeof(struct scatterlist)) + 511) & ~511;
- if ((sg = scsi_malloc(SCpnt->sglist_len)) == NULL)
+ i = ((sg_ent * sizeof(struct scatterlist)) + 511) & ~511;
+ if ((sg = scsi_malloc(i)) == NULL)
goto no_mem;
+ /*
+ * no more failing memory allocs possible, we can safely assign
+ * SCpnt values now
+ */
+ SCpnt->sglist_len = i;
+ SCpnt->use_sg = sg_count;
memset(sg, 0, SCpnt->sglist_len);
i = 0;
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
--- /opt/kernel/linux-2.4.4-pre4/drivers/scsi/sr_ioctl.c Fri Dec 29 23:07:22 2000
+++ linux/drivers/scsi/sr_ioctl.c Wed Apr 18 13:00:32 2001
@@ -530,6 +530,8 @@
target = MINOR(cdi->dev);
switch (cmd) {
+ case BLKGETSIZE:
+ return put_user(scsi_CDs[target].capacity >> 1, (long *) arg);
case BLKROSET:
case BLKROGET:
case BLKRASET:
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.4-pre4/include/linux/cdrom.h linux/include/linux/cdrom.h
--- /opt/kernel/linux-2.4.4-pre4/include/linux/cdrom.h Wed Apr 18 14:37:43 2001
+++ linux/include/linux/cdrom.h Wed Apr 18 13:02:10 2001
@@ -577,6 +577,8 @@
struct dvd_manufact manufact;
} dvd_struct;
+#define CDROM_MAX_CDROMS 256
+
/*
* DVD authentication ioctl
*/
@@ -732,6 +734,7 @@
devfs_handle_t de; /* real driver creates this */
/* specifications */
kdev_t dev; /* device number */
+ int nr; /* cdrom entry */
int mask; /* mask of capability: disables them */
int speed; /* maximum speed for reading data */
int capacity; /* number of discs in jukebox */
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-18 12:39 ` Jens Axboe
@ 2001-04-18 22:12 ` Stefan Jaschke
2001-04-19 11:39 ` Stefan Jaschke
1 sibling, 0 replies; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-18 22:12 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
On Wednesday 18 April 2001 14:39, Jens Axboe wrote:
> Please send me strace info when reading/writing to the drive (or at
> least attempting to), this looks very queer indeed.
>
> Attached patch for 2.4.4-pre4 which fixes all known DVD-RAM ATAPI bugs.
> Both pio and dma mode work fine here, using ext2, on a 9.4gb HITACHI
> DVD-RAM GF-2000 drive.
I'll try the patch asap.
Here is a quick strace (on the SuSE 2.4.0 kernel, since my SMC Etherpower
doesn't work with 2.4.3) of a read with DVD-RAM medium inserted:
# strace dd if=/dev/hdc of=/dev/null bs=2k count=3
<... loading libraries ...>
close(0) = 0
open("/dev/hdc", O_RDONLY|O_LARGEFILE) = 0
close(1) = 0
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 1
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGUSR1, {0x8049440, [], 0x4000000}, NULL, 8) = 0
brk(0x8054000) = 0x8054000
read(0, "", 2048) = 0
write(2, "0+0 records in\n", 150+0 records in
) = 15
write(2, "0+0 records out\n", 160+0 records out
) = 16
close(0) = 0
close(1) = 0
_exit(0) = ?
--------------------------------
Writing works, the LED is blinking. (I didn't know the difference
between /dev/zero and /dev/null when I did the first post. Sorry.):
# strace dd if=/dev/zero of=/dev/hdc bs=2k count=3
<... loading libraries ...>
close(0) = 0
open("/dev/zero", O_RDONLY|O_LARGEFILE) = 0
close(1) = 0
open("/dev/hdc", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 1
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGUSR1, {0x8049440, [], 0x4000000}, NULL, 8) = 0
brk(0x8054000) = 0x8054000
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) =
2048
write(2, "3+0 records in\n", 153+0 records in
) = 15
write(2, "3+0 records out\n", 163+0 records out
) = 16
close(0) = 0
close(1) = 0
_exit(0) = ?
-------------------------------------
But mke2fs does not work:
# strace mke2fs -b 2048 /dev/hdc
... <libraries loaded> ...
write(2, "mke2fs 1.19, 13-Jul-2000 for EXT"..., 52mke2fs 1.19, 13-Jul-2000
for EXT2 FS 0.5b, 95/08/09
) = 52
stat64("/dev/hdc", {st_mode=S_IFBLK|0660, st_rdev=makedev(22, 0), ...}) = 0
open("/etc/mtab", O_RDONLY) = 3
brk(0x8050000) = 0x8050000
fstat64(3, {st_mode=S_IFREG|0644, st_size=234, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40017000
read(3, "/dev/sda3 / ext2 rw 0 0\nproc /pr"..., 4096) = 234
read(3, "", 4096) = 0
close(3) = 0
munmap(0x40017000, 4096) = 0
open("/dev/hdc", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, BLKGETSIZE, 0xbffff524) = 0
close(3) = 0
open("/dev/hdc", O_RDWR|O_LARGEFILE) = 3
time(NULL) = 987630857
old_mmap(NULL, 488173568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
brk(0x251df000) = 0x8050000
old_mmap(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-1, 0) = 0x40159000
munmap(0x40159000, 684032) = 0
munmap(0x40300000, 364544) = 0
mprotect(0x40200000, 32768, PROT_READ|PROT_WRITE) = 0
old_mmap(NULL, 488173568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
old_mmap(NULL, 488173568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
close(3) = 0
write(2, "/dev/hdc", 8/dev/hdc) = 8
write(2, ": ", 2: ) = 2
write(2, "Memory allocation failed", 24Memory allocation failed) = 24
write(2, " ", 1 ) = 1
write(2, "while setting up superblock", 27while setting up superblock) = 27
) = 1
write(2, "\n", 1
) = 1
_exit(1) = ?
___________________________________
Another story: With the SuSE DVD-ROM in the drive, the
"dd if=/dev/hdc of=/dev/null bs=2k count=3" also just reads 0 bytes as above,
but the "mount -t iso9660 /dev/hdc /dvd" and then reading from
/dvd succeeds.
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-18 12:39 ` Jens Axboe
2001-04-18 22:12 ` Stefan Jaschke
@ 2001-04-19 11:39 ` Stefan Jaschke
2001-04-19 11:46 ` Jens Axboe
1 sibling, 1 reply; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-19 11:39 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
Hi Jens,
I applied your patch to 2.4.4-pre4. It compiled fine, but crashed during
boot (just right after the IDE init) with
-------------------
Uniform CD-ROM driver Revision: 3.12
Unable to handle kernel NULL pointer dereference at virtual address 00000000
printing eip: ...
Oops: 0000
...
-------------------
I looked up the eip. It's in
c01a5490 t cdrom_get_entry
c01a5490 t gcc2_compiled.
(Although I don't know what the second line on the same address means.)
Please let me know, if you need more info or I can help in any other way.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 11:39 ` Stefan Jaschke
@ 2001-04-19 11:46 ` Jens Axboe
2001-04-19 12:13 ` Stefan Jaschke
0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2001-04-19 11:46 UTC (permalink / raw)
To: stefan; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 415 bytes --]
On Thu, Apr 19 2001, Stefan Jaschke wrote:
> Hi Jens,
>
> I applied your patch to 2.4.4-pre4. It compiled fine, but crashed during
> boot (just right after the IDE init) with
> -------------------
> Uniform CD-ROM driver Revision: 3.12
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> printing eip: ...
> Oops: 0000
> ...
> -------------------
This should fix it.
--
Jens Axboe
[-- Attachment #2: cd-get-entry-1 --]
[-- Type: text/plain, Size: 743 bytes --]
--- drivers/cdrom/cdrom.c~ Thu Apr 19 13:44:46 2001
+++ drivers/cdrom/cdrom.c Thu Apr 19 13:45:33 2001
@@ -350,6 +350,12 @@
{
int i, nr, foo;
+ if (!cdrom_numbers) {
+ int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
+ cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
+ memset(cdrom_numbers, 0, n_entries * sizeof(unsigned long));
+ }
+
nr = 0;
foo = -1;
for (i = 0; i < CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8); i++) {
@@ -2696,10 +2702,6 @@
static int __init cdrom_init(void)
{
- int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
-
- cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
-
#ifdef CONFIG_SYSCTL
cdrom_sysctl_register();
#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 11:46 ` Jens Axboe
@ 2001-04-19 12:13 ` Stefan Jaschke
2001-04-19 12:15 ` Jens Axboe
0 siblings, 1 reply; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-19 12:13 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
> > I applied your patch to 2.4.4-pre4. It compiled fine, but crashed during
> > boot (just right after the IDE init) with
>
> This should fix it.
It boots now. But I still cannot read a DVD-RAM disk (same behavior
as before):
# strace dd of=/dev/null if=/dev/hdc bs=2k count=3
open("/dev/hdc", O_RDONLY|O_LARGEFILE) = 0
close(1) = 0
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 1
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x80493d0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGUSR1, {0x8049440, [], 0x4000000}, NULL, 8) = 0
brk(0x8054000) = 0x8054000
read(0, "", 2048) = 0
write(2, "0+0 records in\n", 150+0 records in
) = 15
write(2, "0+0 records out\n", 160+0 records out
) = 16
close(0) = 0
close(1) = 0
_exit(0) = ?
------------------
Nor mke2fs:
# strace mke2fs -b 2048 /dev/hdc
open("/dev/hdc", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, BLKGETSIZE, 0xbffff524) = 0
close(3) = 0
open("/dev/hdc", O_RDWR|O_LARGEFILE) = 3
time(NULL) = 987682145
old_mmap(NULL, 472477696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
brk(0x242e7000) = 0x8050000
old_mmap(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-1, 0) = 0x40159000
munmap(0x40159000, 684032) = 0
munmap(0x40300000, 364544) = 0
mprotect(0x40200000, 32768, PROT_READ|PROT_WRITE) = 0
old_mmap(NULL, 472477696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
old_mmap(NULL, 472477696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
close(3) = 0
write(2, "/dev/hdc", 8/dev/hdc) = 8
write(2, ": ", 2: ) = 2
write(2, "Memory allocation failed", 24Memory allocation failed) = 24
write(2, " ", 1 ) = 1
write(2, "while setting up superblock", 27while setting up superblock) = 27
) = 1
write(2, "\n", 1
) = 1
_exit(1) = ?
Cheers,
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 12:13 ` Stefan Jaschke
@ 2001-04-19 12:15 ` Jens Axboe
2001-04-19 12:44 ` Stefan Jaschke
0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2001-04-19 12:15 UTC (permalink / raw)
To: stefan; +Cc: linux-kernel
On Thu, Apr 19 2001, Stefan Jaschke wrote:
> > > I applied your patch to 2.4.4-pre4. It compiled fine, but crashed during
> > > boot (just right after the IDE init) with
> >
> > This should fix it.
>
> It boots now. But I still cannot read a DVD-RAM disk (same behavior
> as before):
This is really strange, are you sure your drive is ok? Does mounting
dvd-rom and cd-rom's work fine?
--
Jens Axboe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 12:15 ` Jens Axboe
@ 2001-04-19 12:44 ` Stefan Jaschke
2001-04-19 13:03 ` Jens Axboe
0 siblings, 1 reply; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-19 12:44 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
On Thursday 19 April 2001 14:15, Jens Axboe wrote:
> This is really strange, are you sure your drive is ok? Does mounting
> dvd-rom and cd-rom's work fine?
OK. I'll check again with 2.4.4-pre4+patches:
(1) Mounting the SuSE DVD-ROM (-t iso9660) from /dev/hdc on /dvd and
reading from /dvd works. Same for CD-ROMs. I don't have a formatted
DVD-RAM.
(2) Reading with "dd if=/dev/hdc ..."
(2.1) works with CD-ROM inserted
(2.2) fails with DVD-ROM inserted
(2.3) fails with DVD-RAM inserted
(3) Writing with "dd of=/dev/hdc ..." works (with DVD-RAM inserted).
(4) "mke2fs -b 2048 /dev/hdc" fails (with DVD-RAM inserted).
As if the drive gives the driver wrong information (like size=0)?
If nothing helps, I have to plug the drive into a Windows machine
to make sure it really works with Toshiba's own drivers. This would
be a major hassle, though. No place for Windows on my own machine.
Hence some amount of screwing... :-(
--
Stefan R. Jaschke <stefan@jaschke-net.de>
http://www.jaschke-net.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 12:44 ` Stefan Jaschke
@ 2001-04-19 13:03 ` Jens Axboe
2001-04-19 21:11 ` Stefan Jaschke
2001-04-21 16:47 ` Stefan Jaschke
0 siblings, 2 replies; 12+ messages in thread
From: Jens Axboe @ 2001-04-19 13:03 UTC (permalink / raw)
To: stefan; +Cc: linux-kernel
On Thu, Apr 19 2001, Stefan Jaschke wrote:
> On Thursday 19 April 2001 14:15, Jens Axboe wrote:
> > This is really strange, are you sure your drive is ok? Does mounting
> > dvd-rom and cd-rom's work fine?
>
> OK. I'll check again with 2.4.4-pre4+patches:
> (1) Mounting the SuSE DVD-ROM (-t iso9660) from /dev/hdc on /dvd and
> reading from /dvd works. Same for CD-ROMs. I don't have a formatted
> DVD-RAM.
> (2) Reading with "dd if=/dev/hdc ..."
> (2.1) works with CD-ROM inserted
> (2.2) fails with DVD-ROM inserted
dd fails with DVD-ROM inserted??? In the same way? Is this the SuSE DVD,
and not a movie DVD? Also, check dmesg for errors.
> (2.3) fails with DVD-RAM inserted
> (3) Writing with "dd of=/dev/hdc ..." works (with DVD-RAM inserted).
> (4) "mke2fs -b 2048 /dev/hdc" fails (with DVD-RAM inserted).
Side note -- use as big a block size as you can for a DVD-RAM hosted fs,
4kB is better than 2kB.
> As if the drive gives the driver wrong information (like size=0)?
Could be, try
cat /proc/ide/hdc/capacity
and see what that says.
But at least it looks like your drive is just fine.
> If nothing helps, I have to plug the drive into a Windows machine
> to make sure it really works with Toshiba's own drivers. This would
> be a major hassle, though. No place for Windows on my own machine.
Lets not go that far yet :)
> Hence some amount of screwing... :-(
And lets stick to hardware for now, ok? :-)
--
Jens Axboe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 13:03 ` Jens Axboe
@ 2001-04-19 21:11 ` Stefan Jaschke
2001-04-21 16:47 ` Stefan Jaschke
1 sibling, 0 replies; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-19 21:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
On Thursday 19 April 2001 15:03, Jens Axboe wrote:
> On Thu, Apr 19 2001, Stefan Jaschke wrote:
> > OK. I'll check again with 2.4.4-pre4+patches:
> > (1) Mounting the SuSE DVD-ROM (-t iso9660) from /dev/hdc on /dvd and
> > reading from /dvd works. Same for CD-ROMs. I don't have a formatted
> > DVD-RAM.
> > (2) Reading with "dd if=/dev/hdc ..."
> > (2.1) works with CD-ROM inserted
> > (2.2) fails with DVD-ROM inserted
>
> dd fails with DVD-ROM inserted??? In the same way? Is this the SuSE DVD,
> and not a movie DVD? Also, check dmesg for errors.
> > (2.3) fails with DVD-RAM inserted
"dd if=/dev/hdc of=/dev/null bs=2k count=3" produces the same strace, whether
the DVD-RAM or the SuSE DVD-ROM is inserted. I interpret the fact that the
first read() returns 0 as some lower layer coming to the conclusion that
"/dev/hdc" has length 0.
The only line that appears in the system logs is
"VFS: Disk change detected on device ide1(22,0)"
when I change the disks.
> > (3) Writing with "dd of=/dev/hdc ..." works (with DVD-RAM inserted).
> > (4) "mke2fs -b 2048 /dev/hdc" fails (with DVD-RAM inserted).
I took a closer look at the strace of the "mke2fs ...". The first system call
that fails is
old_mmap(NULL, 504938496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM
It asks for 481MB, which I simply don't have. (128MB RAM, 256MB swap).
So, this may be unrelated to the kernel, just a quirk of mke2fs to ask for
that much memory.
> Could be, try
> cat /proc/ide/hdc/capacity
0 (with empty tray)
8946816 (with single-sided 4.7GB DVD-RAM)
4875840 (with single-sided 2.6GB DVD-RAM)
9106700 (with SuSE DVD-ROM)
1325240 (with SuSE CD-ROM)
Seem to be 512 Byte blocks. Looks OK.
> And lets stick to hardware for now, ok? :-)
This means "There is hope to get the drive working under Linux"?
Correct me if I am wrong in my interpretations.
There are two mysteries (for me at least) left:
(1) Why does mke2fs need 481MB memory?
(2) Why does the very first read() on /dev/hdc return EOF?
What would you suggest to try next?
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)
2001-04-19 13:03 ` Jens Axboe
2001-04-19 21:11 ` Stefan Jaschke
@ 2001-04-21 16:47 ` Stefan Jaschke
1 sibling, 0 replies; 12+ messages in thread
From: Stefan Jaschke @ 2001-04-21 16:47 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
Hi Jens,
I took some time to try to understand why "mke2fs -b 2048 /dev/hdc"
wants 500MB memory. Here is a first explanation:
# mke2fs -m 0 -n /dev/hdc
mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
406650880 inodes, 813284544 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
24820 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
813284544 4k blocks would be 3.7 Terabyte.
(Strangely enough, calling mke2fs with any blocksize parameter results in a memory
allocation larger then my memory available.)
I took some more time to understand at what point the wrong size is introduced.
I got the source rpm, set CFLAGS to "-g", ran gdb, and nailed down the point:
(gdb) l
80 #endif
81 if (fd < 0)
82 return errno;
83
84 #ifdef BLKGETSIZE
85 if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
86 close(fd);
87 *retblocks = size / (blocksize / 512);
88 return 0;
89 }
(gdb) n
86 close(fd);
(gdb) print size
$1 = -2083658236
(gdb) bt
#0 ext2fs_get_device_size (file=0xbffff911 "/dev/hdc", blocksize=1024,
retblocks=0xbffff534) at ../../../lib/ext2fs/getsize.c:86
#1 0x804aca3 in PRS (argc=4, argv=0xbffff75c) at ../../misc/mke2fs.c:993
#2 0x804af2e in main (argc=4, argv=0xbffff75c) at ../../misc/mke2fs.c:1081
#3 0x40044baf in __libc_start_main () from /lib/libc.so.6
I am afraid I'd need help to go deeper.
Cheers,
Stefan J.
--
Stefan R. Jaschke <stefan@jaschke-net.de>
http://www.jaschke-net.de
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-04-21 16:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-17 12:25 Problems with Toshiba SD-W2002 DVD-RAM drive (IDE) Stefan Jaschke
2001-04-18 10:39 ` Jens Axboe
2001-04-18 12:39 ` Jens Axboe
2001-04-18 22:12 ` Stefan Jaschke
2001-04-19 11:39 ` Stefan Jaschke
2001-04-19 11:46 ` Jens Axboe
2001-04-19 12:13 ` Stefan Jaschke
2001-04-19 12:15 ` Jens Axboe
2001-04-19 12:44 ` Stefan Jaschke
2001-04-19 13:03 ` Jens Axboe
2001-04-19 21:11 ` Stefan Jaschke
2001-04-21 16:47 ` Stefan Jaschke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox