cdrom: Random writing support for BD-RE media
authorGeorgios Toptsidis <gtoptsid@gmail.com>
Fri, 25 Sep 2015 07:50:08 +0000 (10:50 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 21:40:13 +0000 (21:40 +0000)
commit742c7795ea2854f36215d4a328608c17085bdff1
tree356bb9ebc9a974f078460da18ae43ff449ffd717
parent28aa0aafcdb7c908682765ab6def7c8febda04f3
cdrom: Random writing support for BD-RE media

commit f7e7868b4743f1cc5e59e6e0ddd3ccf9cfe53a1b upstream.

Recently, i bought a blu-ray writer and noticed that while cdrecord
worked perfectly, random writing didn't work on rewritable bd-re media.
For example, dd if=/dev/zero of=/dev/sr0 bs=32768 count=2 gave the usual
"read-only file system" message.

After checking if the problem lies with my burner or firmware, i grep-ed
the kernel source for EROFS. One of the results was in the cdrom driver.

I tried to follow the function chain and ended in the cdrom_is_dvd_rw
function where writing is permitted only for DVD-RAM and DVD+RW media.
I added a new case label for 0x43 which is the profile name of BD-RE
and now it works correctly for BD-RE too.

Maybe there is a better way of implementing this, like a new function
checking for blu-ray support and called from cdrom_open_write like
it happens for mrw and dvdram media, but adding the case label worked.

Thank you for your time.

Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/cdrom/cdrom.c