pktcdvd & udf bugfixes
Subsystems (2)
PATCH 1/1 pktcdvd & udf bugfixes
Attached is a patch to fix a few bugs in the pktcdvd driver and udf filesystem. Ben Collins said I should post it to the list and cc Jens Axboe as he works on this area. The patch is rather short, but fixes the following bugs:
1) The pktcdvd driver was using an 8 bit field to store the packet length obtained from the disc track info. This causes it to overflow packet length values of 128 sectors or more. I changed the field to 32 bits to fix this.
2) The pktcdvd driver defaulted to it's maximum allowed packet length when it detected a 0 in the track info field. I changed this to fail the operation and refuse to access the media. This seems more sane than attempting to access it with a value that almost certainly will not work.
3) The pktcdvd driver uses a compile time macro constant to define the maximum supported packet length. I changed this from 32 sectors to 128 sectors because that allows over 100 MB of additional usable space on a 700 MB cdrw, and increases throughput.
4) The UDF filesystem refused to update the file's uid and gid on the disk if the in memory inode's id matched the values in the uid= and gid= mount options. This was causing the owner to change from the desktop user to root when the volume was ejected and remounted. I changed this so that if the inode's id matches the mount option, it writes a -1 to disk, because when the filesystem reads a -1 from disk, it uses the mount option for the in memory inode. This allows you to use the uid/gid mount options in the way you would expect.
At some point I hope to find the time to refactor pktcdvd to properly allocate buffers of the length specified on the disc rather than the compile time maximum, but that will be a larger change and require more testing.
drivers/block/pktcdvd.c +1 -1
@@ -1639,7 +1639,7 @@ pd->settings.size =be32_to_cpu (ti.fixed_packet_size) <<2 ;if (pd->settings.size ==0 ) {printk ("pktcdvd: detected zero packet size!\n" ); - pd->settings.size =128 ; +return -ENXIO ; }if (pd->settings.size >PACKET_MAX_SECTORS ) {printk ("pktcdvd: packet size is too big\n" );
Only in linux-source-2.6.15.new/drivers/block: pktcdvd.c~
fs/udf/inode.c +2 -0
@@ -1342,9 +1342,11 @@if (inode->i_uid !=UDF_SB (inode->i_sb)->s_uid) fe->uid =cpu_to_le32 (inode->i_uid); +else fe->uid =cpu_to_le32 (-1 );if (inode->i_gid !=UDF_SB (inode->i_sb)->s_gid) fe->gid =cpu_to_le32 (inode->i_gid); +else fe->gid =cpu_to_le32 (-1 ); udfperms = ((inode->i_mode &S_IRWXO ) ) | ((inode->i_mode & S_IRWXG) << 2) |
include/linux/pktcdvd.h +2 -2
@@ -114,7 +114,7 @@struct packet_settings { -__u8 size;/* packet size in (512 byte) sectors */ +__u32 size;/* packet size in (512 byte) sectors */ __u8 fp;/* fixed packets */ __u8 link_loss;/* the rest is specified * as per Mt Fuji */
@@ -169,7 +169,7 @@#if (PAGE_SIZE %CD_FRAMESIZE ) !=0 #error "PAGE_SIZE must be a multiple of CD_FRAMESIZE"#endif -#define PACKET_MAX_SIZE 32 +#define PACKET_MAX_SIZE 128#define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE)#define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9)
Hi,
Quoted 4 lines · Phillip Susi
Attached is a patch to fix a few bugs in the pktcdvd driver and udf filesystem. Ben Collins said I should post it to the list and cc Jens Axboe as he works on this area. The patch is rather short, but fixes the following bugs:
Please read Documentation/SubmittingPatches. The pktcdvd and UDF fixes should be separate patches and you should cc the appropriate maintainers which you can find in the MAINTAINERS file. Thanks.
Pekka
Quoted 9 lines · Phillip Susi
Attached is a patch to fix a few bugs in the pktcdvd driver and udf filesystem. Ben Collins said I should post it to the list and cc Jens Axboe as he works on this area. The patch is rather short, but fixes the following bugs:
1) The pktcdvd driver was using an 8 bit field to store the packet length obtained from the disc track info. This causes it to overflow packet length values of 128 sectors or more. I changed the field to 32 bits to fix this.
The variable is unsigned, so it supports values up to 255, ie no need to change it.
Quoted 5 lines
2) The pktcdvd driver defaulted to it's maximum allowed packet length when it detected a 0 in the track info field. I changed this to fail the operation and refuse to access the media. This seems more sane than attempting to access it with a value that almost certainly will not work.
That code is very old, I think Jens wrote it. I assume it wasn't just for fun, but to be able to support drives with slightly broken/non-standard firmware.
Quoted 4 lines
3) The pktcdvd driver uses a compile time macro constant to define the maximum supported packet length. I changed this from 32 sectors to 128 sectors because that allows over 100 MB of additional usable space on a 700 MB cdrw, and increases throughput.
The current limit is 32 disc blocks, ie 64KB or 128 "linux sectors".
How do you make the packet size larger for a CDRW disc? Just changing the constant is not going to help unless you can also format a disc with larger packets.
Quoted 4 lines
At some point I hope to find the time to refactor pktcdvd to properly allocate buffers of the length specified on the disc rather than the compile time maximum, but that will be a larger change and require more testing.
Might be a good idea. On DVD discs the block size is only 32KB, so half of the allocated memory is unused.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 6 lines · Peter Osterlund
The variable is unsigned, so it supports values up to 255, ie no need to change it.
The packet length is read and left shifted by two before being stored in that variable to convert it from 2048 byte sectors to 512 byte sectors, thus a value of 128 overflowed and became zero. be32_to_cpu returns a 32 bit value so I figured it should be stored in a 32 bit variable, not an 8 bit one.
Quoted 6 lines
That code is very old, I think Jens wrote it. I assume it wasn't just for fun, but to be able to support drives with slightly broken/non-standard firmware.
Yes, I hope he can let me know if that is the case, but right now I do not see how that can be. As far as I know, that value is put there by the utility used to format the track, and _should_ be the correct length, never 0. In any case, if it is zero, then assuming the maximum supported size would cause errors if the actual packet size is larger than the maximum that the driver supports.
Quoted 8 lines
The current limit is 32 disc blocks, ie 64KB or 128 "linux sectors".
How do you make the packet size larger for a CDRW disc? Just changing the constant is not going to help unless you can also format a disc with larger packets.
I also have several patches to the udftools package, one of which documents ( in the man page ) the previously undocumented -z packet_size parameter to cdrwtool, and fixes the code so that it actually works with values other than 32.
The upstream project for udftools on sourceforge appears to be dead. I have sent email to the two original authors and had no reply, and the CVS repository has not been touched in over a year, and the mailing list is dead. I am not sure what I should do about that, but in the mean time, I am maintaining ubuntu specific patches and have been speaking to the debian package maintainer about merging them there as well.
Quoted 3 lines
Might be a good idea. On DVD discs the block size is only 32KB, so half of the allocated memory is unused.
Why is it only 32 KB on a dvd? What utility was used to format it like that? My cd/dvd-rw drive blew out the cd laser the other day, and I got the replacement last night with some dvd+rw media, so I guess I will start playing with that soon. From what I have read so far, dvd+rw media does not require pktcdvd to write to it, but its use can improve throughput.
Quoted 9 lines · Phillip Susi
Quoted 2 lines · Peter Osterlund
The variable is unsigned, so it supports values up to 255, ie no need to change it.
The packet length is read and left shifted by two before being stored in that variable to convert it from 2048 byte sectors to 512 byte sectors, thus a value of 128 overflowed and became zero.
be32_to_cpureturns a 32 bit value so I figured it should be stored in a 32 bit variable, not an 8 bit one.
OK, it makes sense if you can make packets larger than 64KB. I didn't know you could.
Quoted 9 lines
Quoted 4 lines
The current limit is 32 disc blocks, ie 64KB or 128 "linux sectors". How do you make the packet size larger for a CDRW disc? Just changing the constant is not going to help unless you can also format a disc with larger packets.
I also have several patches to the udftools package, one of which documents ( in the man page ) the previously undocumented -z
packet_sizeparameter to cdrwtool, and fixes the code so that it actually works with values other than 32.
OK, so it appears you can make packets bigger than 64KB. Can I please have those patches so I can test this myself.
Quoted 7 lines
The upstream project for udftools on sourceforge appears to be dead. I have sent email to the two original authors and had no reply, and the CVS repository has not been touched in over a year, and the mailing list is dead. I am not sure what I should do about that, but in the mean time, I am maintaining ubuntu specific patches and have been speaking to the debian package maintainer about merging them there as well.
I'm not sure either what to do if the project admin (Ben Fennema) is no longer online so he can transfer maintenance to someone else.
Quoted 5 lines
Quoted 2 lines
Might be a good idea. On DVD discs the block size is only 32KB, so half of the allocated memory is unused.
Why is it only 32 KB on a dvd? What utility was used to format it like that?
According to
http://fy.chalmers.se/~appro/linux/DVD+RW/
"... native DVD ECC blocksize, which is 32KB"
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 4 lines · Peter Osterlund
OK, so it appears you can make packets bigger than 64KB. Can I please have those patches so I can test this myself.
Sure, patches attached.
patch-6 is the one you are interested in for the different sizes, but I find the other two to be handy as well. patch-7 goes with the previous kernel udf patch I originally posted to fix permissions problems, and patch-8 adds a single parameter form to pktsetup for it to auto assign the new pktcdvd device and print it's minor number, rather than create a named devnode. This is to facilitate hald auto configuring cdrw drives for packet writing, and let udev handle the creation of the devnode.
Don't forget to apply the kernel patch so you can actually write to the disc when you format it with >64 KB packets.
This patch fixes several assumptions in cdrwtool about the packet size being 32 sectors which caused breakage when the -z option was used to change the packet size. Also documented the -z option in the cdrwtool man page.
- Phillip Susi <[email protected]>
cdrwtool/cdrwtool.h +1 -0
@@ -89,6 +89,7 @@unsigned int close_track;unsigned int close_session;struct udf_disc udf_disc; +int fd; };#ifndef be16_to_cpu
diff -ru udftools-1.0.0b3.orig/cdrwtool/defaults.c udftools-1.0.0b3/cdrwtool/defaults.c
cdrwtool/main.c +12 -10
@@ -41,14 +41,15 @@ {static char *buffer =NULL ;static int bufferlen =0 , lastpacket =-1 ; -int fd = *(int *)disc->write_data; +struct cdrw_disc *cdisc = (struct cdrw_disc *)disc->write_data; +int fd = cdisc->fd;int offset, packet;struct udf_desc *desc;struct udf_data *data;if (buffer ==NULL ) { - bufferlen = disc->blocksize *32 ; + bufferlen = disc->blocksize * cdisc->packet_size; buffer =calloc (bufferlen,1 ); }
@@ -56,7 +57,7 @@ {if (lastpacket !=-1 ) { -if (write_blocks (fd, buffer, lastpacket *32 ,32 ) <0 ) +if (write_blocks (fd, buffer, lastpacket * cdisc->packet_size, cdisc->packet_size) <0 )return -1 ; } }
@@ -65,21 +66,21 @@ desc = ext->head;while (desc !=NULL ) { - packet = (uint64_t )(ext->start + desc->offset) /32 ; + packet = (uint64_t )(ext->start + desc->offset) / cdisc->packet_size;if (lastpacket !=-1 && packet != lastpacket) { -if (write_blocks (fd, buffer, lastpacket *32 ,32 ) <0 ) +if (write_blocks (fd, buffer, lastpacket * cdisc->packet_size, cdisc->packet_size) <0 )return -1 ;memset (buffer,0x00 , bufferlen); } data = desc->data; - offset = ((uint64_t )(ext->start + desc->offset) - (packet *32 )) << disc->blocksize_bits; + offset = ((uint64_t )(ext->start + desc->offset) - (packet * cdisc->packet_size)) << disc->blocksize_bits;while (data !=NULL ) {if (data->length + offset > bufferlen) {memcpy (buffer + offset, data->buffer, bufferlen - offset); -if (write_blocks (fd, buffer, packet *32 ,32 ) <0 ) +if (write_blocks (fd, buffer, packet * cdisc->packet_size, cdisc->packet_size) <0 )return -1 ;memset (buffer,0x00 , bufferlen); lastpacket = ++ packet;
@@ -94,9 +95,9 @@ offset += data->length; } -if (offset == disc->blocksize *32 ) +if (offset == disc->blocksize * cdisc->packet_size) { -if (write_blocks (fd, buffer, packet *32 ,32 ) <0 ) +if (write_blocks (fd, buffer, packet * cdisc->packet_size, cdisc->packet_size) <0 )return -1 ;memset (buffer,0x00 , bufferlen); lastpacket =-1 ;
@@ -248,7 +249,8 @@return fd; } disc.udf_disc.write = write_func; - disc.udf_disc.write_data = &fd; + disc.fd = fd; + disc.udf_disc.write_data = &disc;if ((ret =cdrom_open_check (fd))) {
diff -ru udftools-1.0.0b3.orig/debian/changelog udftools-1.0.0b3/debian/changelog
doc/cdrwtool.1 +4 -0
@@ -127,6 +127,10 @@ variable and fixed packet sizes respectively. .IP "\fB\-o \fIoffset\fP" Set write offset. +.IP "\fB\-z \fIsize\fP" +Set packet length in sectors ( default = 32 ). Longer packets allow for +more usable space on the disc, but may slow down access to smaller files. +Switching from 32 to 128 on a 700 MB cdrw gives about 100 MB more usable space. .SH AUTHORS .nf
diff -ru udftools-1.0.0b3.orig/mkudffs/defaults.c udftools-1.0.0b3/mkudffs/defaults.c
This patch changes the default owning uid/gid for files created by cdrwtool and mkudffs ( basically the root and lost+found directories ) from 0 to -1. This allows the udf filesystem driver to obey the uid/gid mount options. When the FSD sees a -1, if the uid/gid mount options were specified, it replaces the -1 with those values.
I also patched the FSD ( not in this patch )
to write a -1 if the owner matches the mount option (previously it wrote a 0 instead, so files would spontaniously change ownership when unmounted/mounted to root if they were owned by the uid specified in the mount options ). This allows sane application of the mount options to allow a non root user, or even different users, possibly on different machines, to use the disc.
- Phillip Susi <[email protected]>
cdrwtool/defaults.c +4 -0
@@ -443,6 +443,8 @@ UDF_OS_ID_LINUX, }, }, + uid : -1, + gid : -1, }; struct extendedFileEntry default_efe =
@@ -476,4 +478,6 @@ UDF_OS_ID_LINUX, }, }, + uid : -1, + gid : -1, };
diff -ru udftools-1.0.0b3.orig/cdrwtool/main.c udftools-1.0.0b3/cdrwtool/main.c diff -ru udftools-1.0.0b3.orig/debian/changelog udftools-1.0.0b3/debian/changelog diff -ru udftools-1.0.0b3.orig/doc/cdrwtool.1 udftools-1.0.0b3/doc/cdrwtool.1
mkudffs/defaults.c +4 -0
@@ -450,6 +450,8 @@ UDF_OS_ID_LINUX, }, }, + uid : -1, + gid : -1, }; struct extendedFileEntry default_efe =
@@ -483,4 +485,6 @@ UDF_OS_ID_LINUX, }, }, + uid : -1, + gid : -1, };
This patch adds a new single parameter form to pktsetup. This new form takes only the name of the cdrom device to bind to, and will bind the next unused pktcdvd minor device to it, and print that device number to stdout.
- Phillip Susi <[email protected]>
doc/pktsetup.8 +23 -3
@@ -37,14 +37,32 @@ .B pktsetup .B \-d .I packet_device +.br +.B pktsetup +.I /dev/cdrom .ad b .SH DESCRIPTION -.B Pktsetup +.B \fBpktsetup\fP is used to associate packet devices with CD or DVD block devices, so that the packet device can then be mounted and potentially used as a read/write filesystem. This requires kernel support for the packet device, and the UDF filesystem. .PP +To old style to set up a device is: +.IP +\fBpktsetup \fI/dev/pktcdvd/pktcdvd0 /dev/cdrom\fP +.PP +This usage will create the devnode \fI/dev/pktcdvd/pktcdvd0\fP +and bind it to \fI/dev/cdrom\fP. +.PP +The new form is: +.IP +\fBpktsetup \fI/dev/cdrom\fP +.PP +This form will bind the next availible pkcdvd minor device to +\fI/dev/cdrom\fP and print the device number to stdout. No device +node will be created, that job is left up to udev. +.PP See /usr/share/doc/udftools/README.Debian for more information. .UE
@@ -55,7 +73,9 @@ .SH OPTIONS .IP "\fB\-d \fIpacket-device\fP" Delete the association between the specified \fIpacket-device\fP -and its block device. +and its block device. The device may either be of the form +\fI/dev/pktcdvd/pktcdvd0\fP or \fI252:0\fP. + .SH EXAMPLE The following commands provide an example of using the
@@ -74,7 +94,7 @@ .SH FILES .nf -/dev/pktcdvd0,/dev/pktcdvd1,... CD/DVD packet devices (block major=97) +/dev/pktcdvd0,/dev/pktcdvd1,... CD/DVD packet devices (block major=252) .fi .SH AUTHOR
pktsetup/pktsetup.c +18 -12
@@ -125,6 +125,8 @@printf (" pktsetup -d dev_name tear down device\n" );printf (" pktsetup -d major:minor tear down device\n" );printf (" pktsetup -s show device mappings\n" ); +printf ("And in this version:\n" ); +printf (" pktsetup /dev/cdrom setup device\n" );return 1 ; }
@@ -245,7 +247,7 @@ c.command =PKT_CTRL_CMD_SETUP ; c.dev = stat_buf.st_rdev; -if (remove_stale_dev_node (ctl_fd, pkt_device) !=0 ) { +if (pkt_device &&remove_stale_dev_node (ctl_fd, pkt_device) !=0 ) {fprintf (stderr,"Device node '%s' already in use\n" , pkt_device); goto out_close; }
@@ -253,7 +255,10 @@perror ("ioctl" ); goto out_close; } -mknod (pkt_dev_name (pkt_device),S_IFBLK |0640 , c.pkt_dev); +if ( pkt_device ) +mknod (pkt_dev_name (pkt_device),S_IFBLK |0640 , c.pkt_dev); +else +printf ("Assigned device number %d:%d\n" ,MAJOR (c.pkt_dev),MINOR (c.pkt_dev) ); }else {int major, minor, remove_node;
@@ -322,9 +327,6 @@char *pkt_device;char *device; -if (argc ==1 ) -return usage (); -while ((c =getopt (argc, argv,"ds?" )) !=EOF ) {switch (c) {case 'd' :
@@ -337,11 +339,15 @@return usage (); } } - pkt_device = argv[optind]; - device = argv[optind +1 ]; -if (strchr (pkt_device,'/' )) -setup_dev (pkt_device, device, rem); -else -setup_dev_chardev (pkt_device, device, rem); -return 0 ; +if ( argc ==2 ) +setup_dev_chardev (NULL , argv[1 ],0 ); +else { + pkt_device = argv[optind]; + device = argv[optind +1 ]; +if (strchr (pkt_device,'/' )) +setup_dev (pkt_device, device, rem); +else +setup_dev_chardev (pkt_device, device, rem); +return 0 ; + } }
Quoted 7 lines · Phillip Susi
Quoted 2 lines · Peter Osterlund
OK, so it appears you can make packets bigger than 64KB. Can I please have those patches so I can test this myself.
Sure, patches attached.
patch-6 is the one you are interested in for the different sizes
Thanks, it seems to work just fine. I have put the overflow and zero check changes in my kernel patch queue.
However, I want to wait with the increased max packet size until the memory allocation strategy has been changed to avoid wasting lots of memory in the common cases. I will go work on a patch to do that now.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Ahh, excellent. Also, is the memory currently non pagable? Is there a reason for that?
Quoted 26 lines · Peter Osterlund
Quoted 4 lines · Phillip Susi
Quoted 1 line · Peter Osterlund
OK, so it appears you can make packets bigger than 64KB. Can I please
Quoted 8 lines
Quoted 3 lines
have those patches so I can test this myself.
Sure, patches attached.
patch-6 is the one you are interested in for the different sizes
Thanks, it seems to work just fine. I have put the overflow and zero check changes in my kernel patch queue.
However, I want to wait with the increased max packet size until the memory allocation strategy has been changed to avoid wasting lots of memory in the common cases. I will go work on a patch to do that now.
Quoted 16 lines · Phillip Susi
Quoted 14 lines · Peter Osterlund
Quoted 8 lines · Phillip Susi
Quoted 4 lines · Peter Osterlund
OK, so it appears you can make packets bigger than 64KB. Can I please
have those patches so I can test this myself.
Sure, patches attached.
patch-6 is the one you are interested in for the different sizes
Thanks, it seems to work just fine. I have put the overflow and zero check changes in my kernel patch queue.
Quoted 6 lines
Quoted 4 lines
However, I want to wait with the increased max packet size until the memory allocation strategy has been changed to avoid wasting lots of memory in the common cases. I will go work on a patch to do that now.
Ahh, excellent. Also, is the memory currently non pagable? Is there a reason for that?
Yes the memory is non pagable. The linux kernel doesn't support pagable kernel memory, only user space memory can be swapped out.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Surely the kernel can allocate pagable memory if it chooses to? I think in the case of pktcdvd it would be best for the buffers to be pagable when initially allocated and filled, and only locked into memory when the bio is sent down to the cdrom driver. That way you could keep a fairly large number of buffers on larger ( 256 KB+ ) packets in memory for write combining, without placing undue burden on non paged pool.
Quoted 10 lines · Peter Osterlund
Quoted 4 lines
Ahh, excellent. Also, is the memory currently non pagable? Is there a reason for that?
Yes the memory is non pagable. The linux kernel doesn't support pagable kernel memory, only user space memory can be swapped out.
Quoted 8 lines · Peter Osterlund
Quoted 6 lines · Phillip Susi
Quoted 2 lines · Peter Osterlund
OK, so it appears you can make packets bigger than 64KB. Can I please have those patches so I can test this myself.
Sure, patches attached.
Quoted 8 lines
Quoted 1 line
patch-6 is the one you are interested in for the different sizes
Thanks, it seems to work just fine. I have put the overflow and zero check changes in my kernel patch queue.
However, I want to wait with the increased max packet size until the memory allocation strategy has been changed to avoid wasting lots of memory in the common cases. I will go work on a patch to do that now.
Here is the patch. It works as expected so far in my tests.
pktcdvd: Don't waste kernel memory.
From: Peter Osterlund <[email protected]>
Allocate memory for read-gathering at open time, when it is known just how much memory is needed. This avoids wasting kernel memory when the real packet size is smaller than the maximum packet size supported by the driver.
---
drivers/block/Kconfig | 4 ++-- drivers/block/pktcdvd.c | 53 +++++++++++++++++++++++++---------------------- include/linux/pktcdvd.h | 4 ++-- 3 files changed, 32 insertions(+), 29 deletions(-)
drivers/block/Kconfig +2 -2
@@ -433,8 +433,8 @@ config CDROM_PKTCDVD_BUFFERS This controls the maximum number of active concurrent packets. More concurrent packets can increase write performance, but also require more memory. Each concurrent packet will require approximately 64Kb - of non-swappable kernel memory, memory which will be allocated at - pktsetup time. + of non-swappable kernel memory, memory which will be allocated when + a disc is opened for writing. config CDROM_PKTCDVD_WCACHE bool "Enable write caching"
drivers/block/pktcdvd.c +28 -25
158 lines not on this page · raw message
include/linux/pktcdvd.h +2 -2
@@ -170,7 +170,7 @@ struct packet_iosched#error "PAGE_SIZE must be a multiple of CD_FRAMESIZE"#endif #define PACKET_MAX_SIZE 128 -#define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE) +#define FRAMES_PER_PAGE (PAGE_SIZE / CD_FRAMESIZE)#define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9)enum packet_data_state {
@@ -219,7 +219,7 @@ struct packet_dataatomic_t io_errors;/* Number of read/write errors during IO */ struct bio *r_bios[PACKET_MAX_SIZE ];/* bios to use during data gathering */ -struct page *pages[PAGES_PER_PACKET ]; +struct page *pages[PACKET_MAX_SIZE /FRAMES_PER_PAGE ];int cache_valid;/* If non-zero, the data for the zone defined */ /* by the sector variable is completely cached */
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 7 lines · Phillip Susi
Quoted 5 lines
Quoted 2 lines
Ahh, excellent. Also, is the memory currently non pagable? Is there a reason for that?
Yes the memory is non pagable. The linux kernel doesn't support pagable kernel memory, only user space memory can be swapped out.
Surely the kernel can allocate pagable memory if it chooses to?
No, not unless you make large changes in the VM subsystem.
But there is another issue here as well. Even if the kernel could allocate pagable memory, it would be non-trivial to use it in a block device driver. A block driver can be asked by the kernel to write out memory to disc *because* there is memory pressure in the system. If the block driver needs to make additional memory allocations before it can write data (for example, to page in swapped out memory), the system could deadlock.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
I get this:
drivers/block/pktcdvd.c:1992: error: label ‘out_unclaim’ used but not defined
Also the patch did not cleanly apply. It looks like you didn't get all of your changes into the diff. Unless you have some other patches that I don't? This is against 2.6.15 right?
Quoted 17 lines · Peter Osterlund
Here is the patch. It works as expected so far in my tests.
pktcdvd: Don't waste kernel memory.
From: Peter Osterlund <[email protected]>
Allocate memory for read-gathering at open time, when it is known just how much memory is needed. This avoids wasting kernel memory when the real packet size is smaller than the maximum packet size supported by the driver.
Signed-off-by Peter Osterlund <[email protected]>---
Quoted 8 lines · Phillip Susi
I get this:
drivers/block/pktcdvd.c:1992: error: label ‘out_unclaim’ used but not definedAlso the patch did not cleanly apply. It looks like you didn't get all of your changes into the diff. Unless you have some other patches that I don't? This is against 2.6.15 right?
I thought it would apply on top of your patch, but didn't actually check. Try this patch series instead:
http://web.telia.com/~u89404340/patches/packet/2.6/2.6.15-git11/
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Well, I got a kernel compiled with your patches, but have not been able to test it yet. Last week the red laser crapped out on my sony 710A dvd/rw drive, so I got a new 810A and when I go to format the cd-rw with cdrwtool, the drive fails the write command with sense code 00.04.04, and then fails any commands after that and won't eject the disc until I do a hdparm -w. I guess the firmware is defective and craps itself when you try to do a packet mode write ( updating didn't help ), so I'm returning this drive and ordering the nice sata plextor one instead.
Will let you know when I get the new drive if your patch works out well or not.
Quoted 19 lines · Peter Osterlund
Quoted 9 lines · Phillip Susi
I get this:
drivers/block/pktcdvd.c:1992: error: label ‘out_unclaim’ used but not definedAlso the patch did not cleanly apply. It looks like you didn't get all of your changes into the diff. Unless you have some other patches that I don't? This is against 2.6.15 right?
I thought it would apply on top of your patch, but didn't actually check. Try this patch series instead:
http://web.telia.com/~u89404340/patches/packet/2.6/2.6.15-git11/