[LWN Logo]
[LWN.net]
From:	 Jens Axboe <axboe@suse.de>
To:	 Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH][CFT] CD-MRW (Mt Rainier) support
Date:	 Thu, 21 Mar 2002 14:12:01 +0100

Hi,

I've written the basic kernel and user space code to support the "new"
mt rainier cd-rw drives (hence forth known as cd-mrw in this mail).

What are these drives? They are basically CD-RW drives with a twist. The
twist, to put it shortly:

- back ground formatting support is a requirement
- read-modify-write cycle support is in firmware, not software
- bad block management is in firmware, not file system

The drives use regular CD-RW media. The media needs to be initialized
before use, the supplied mtr tool can help you do that. Basically you
just need to start a back ground format:

# ./mtr -d /dev/hdc -f full

This will take ~10 seconds or so, after which the media can be used for
writing. No more waiting for format completion. Should you wish to enjoy
the silence and watch the media format, there's a -p poll switch for
that:

# ./mtr -d /dev/hdc -p

(can of course also be used while starting the format). If you want to
remove the media before the format has completed, you need to suspend
it.

# ./mtr -d /dev/hdc -s

ide-cd will do this automagically if you remove the driver while a
format is in progress, btw (from dmesg).

cdrom: issuing MRW bgformat suspend

The mtr tool can restart a format for you as well:

# ./mtr -d /dev/hdc -f restart

ide-cd will also do this automagically if you mount a media rw which is
partially formatted, if you didn't disable the bgformat restart option
when loading cdrom.o (new options, mrw_format_restart, defaults to 1):

cdrom: mount opening for WRITE
cdrom open: mrw_status 'bgformat inactive'
cdrom: Restarting format

I dunno which drives have cd-mrw support yet, I've got some Philips
samples here. I have heard that there are at least TEAC drives with a
firmware upgrade option to support cd-mrw, and I'm sure that pretty soon
all new burners are going to have this feature. Running the mtr tool
will tell you if your drive supports cd-mrw or not.

Any file system will work, but using UDF is recommended. Make sure to
remember to include UDF rw support :-). Incidentally, 2.4.19-pre4 has a
bug that prevents UDF from being built with read-write support. Patch is
included for that and sent to Marcelo separately. Recommended format
options:

# mkudffs --media-type=cdrw -b 2048 /dev/hdc
start=0, blocks=16, type=RESERVED 
start=16, blocks=3, type=VRS 
start=19, blocks=237, type=USPACE 
start=256, blocks=1, type=ANCHOR 
start=257, blocks=31, type=USPACE 
start=288, blocks=32, type=PVDS 
start=320, blocks=32, type=LVID 
start=352, blocks=32, type=STABLE 
start=384, blocks=1024, type=SSPACE 
start=1408, blocks=256608, type=PSPACE 
start=258016, blocks=31, type=USPACE 
start=258047, blocks=1, type=ANCHOR 
start=258048, blocks=160, type=USPACE 
start=258208, blocks=32, type=STABLE 
start=258240, blocks=32, type=RVDS 
start=258272, blocks=31, type=USPACE 
start=258303, blocks=1, type=ANCHOR 

This is the first release. Works for me, YMMV.

Patch your 2.4.19-pre4 kernel and give it a spin. Note that only ide-cd
supports Mt Rainier right now. The bulk of the support is in the uniform
layer, so adding SCSI CD-ROM support is going to be a breeze. I'm not
quite done shoving code around between ide-cd and cdrom, so that's why I
didn't bother adding the SCSI bits just yet.

-- 
Jens Axboe

[2. text/plain; cd-mrw-1]...

[3. text/plain; mtr.c]...