Skip to contentSkip to conversation

pktcdvd driver module: added sysfs interface

PATCH New Thomas Maier 2 participants 4 messages Sep 24, 2006 – Oct 1, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pktcdvd driver module: added sysfs interface

Hello,

this is a patch for the packet writing module pktcdvd. The patch adds a sysfs and a debugfs interface, a Kconfig parameter to switch of the procfs interface off and a bio write queue congestion handling for the driver.

I got kernel out of memory errors (kernel 2.6.17) while using the pktcdvd driver writing on a DVDRAM.
When writing big files (>200MB), the drivers internal
bio write queue raised over 200000 entries and more,
since the underlying block driver was not able to process the write requests as fast as they were supplied to the pktcdvd driver. This seems to consume all available kernel memory leading
to kernel out of memory faults. (-> KDE crashed and other funny things happend ;)

Patched files:

drivers/block/pktcdvd.c
drivers/block/Kconfig
include/linux/pktcdvd.h
Documentation/cdrom/packet-writing.txt
Documentation/ABI/testing/sysfs-class-pktcdvd
Documentation/ABI/testing/debugfs-pktcdvd

I wrote a little shell script to control the pktcdvd driver using the sysfs interface.
See http://people.freenet.de/BalaGi#pktcdvd

MfG

Thomas Maier

------------------------------------------------------------------------

Documentation/ABI/testing/debugfs-pktcdvd +20 -0
diff -urpN linux-2.6.18/Documentation/ABI/testing/debugfs-pktcdvd pktcdvd-patch-2.6.18/Documentation/ABI/testing/debugfs-pktcdvd
@@ -0,0 +1,20 @@
+What:           /debug/pktcdvd[0-7]
+Date:           Sep. 2006
+KernelVersion:  2.6.19
+Contact:        Thomas Maier <[email protected]>
+Description:
+
+debugfs interface
+-----------------
+
+The pktcdvd module (packet writing driver) creates
+these files in debugfs:
+
+/debug/pktcdvd[0-7]/
+    info            (0444) Lots of human readable driver
+                           statistics and infos. Multiple lines!
+
+Example:
+-------
+
+cat /debug/pktcdvd3/info
Documentation/ABI/testing/sysfs-class-pktcdvd +78 -0

78 lines not on this page · raw message

Documentation/cdrom/packet-writing.txt +57 -2

76 lines not on this page · raw message

drivers/block/Kconfig +25 -5
diff -urpN linux-2.6.18/drivers/block/Kconfig pktcdvd-patch-2.6.18/drivers/block/Kconfig
@@ -428,17 +428,22 @@ config CDROM_PKTCDVD
  	tristate "Packet writing on CD/DVD media"
  	depends on !UML
  	help
-	  If you have a CDROM drive that supports packet writing, say Y to
-	  include preliminary support. It should work with any MMC/Mt Fuji
-	  compliant ATAPI or SCSI drive, which is just about any newer CD
-	  writer.
+	  If you have a CDROM/DVD drive that supports packet writing, say
+	  Y to include preliminary support. It should work with any
+	  MMC/Mt Fuji compliant ATAPI or SCSI drive, which is just about
+	  any newer DVD/CD writer.
 
-	  Currently only writing to CD-RW, DVD-RW and DVD+RW discs is possible.
+	  Currently only writing to CD-RW, DVD-RW, DVD+RW and DVDRAM discs
+	  is possible.
  	  DVD-RW disks must be in restricted overwrite mode.
 
  	  To compile this driver as a module, choose M here: the
  	  module will be called pktcdvd.
 
+	  For further information see the file
+
+	    Documentation/cdrom/packet-writing.txt
+	
  config CDROM_PKTCDVD_BUFFERS
  	int "Free buffers for data gathering"
  	depends on CDROM_PKTCDVD
@@ -458,6 +463,21 @@ config CDROM_PKTCDVD_WCACHE
  	  this option is dangerous unless the CD-RW media is known good, as we
  	  don't do deferred write error handling yet.
 
+config CDROM_PKTCDVD_PROCINTF
+	bool "Enable procfs interface"
+	depends on CDROM_PKTCDVD
+	default y
+	help
+	  Enable the proc filesystem interface for pktcdvd.
+	  The files can be found as:
+	
+	  /proc/driver/pktcdvd/pktcdvd<idx>
+	
+	  Also a misc device is added with a dynamic minor device id.
+	  See the entry in  /proc/misc  for the minor number.
+	  The misc pktcdvd driver supports ioctl calls, needed
+	  by the pktsetup tool found in udftools package.
+
  source "drivers/s390/block/Kconfig"
 
  config ATA_OVER_ETH
drivers/block/pktcdvd.c +1167 -493

2,076 lines not on this page · raw message

include/linux/pktcdvd.h +82 -31

160 lines not on this page · raw message

#1 lore raw

PATCH 1/1 pktcdvd driver module: added sysfs interface

Hello,

this is a patch for the packet writing module pktcdvd. The patch adds a sysfs and a debugfs interface, a Kconfig parameter to switch of the procfs interface off and a bio write queue congestion handling for the driver.

I got kernel out of memory errors (kernel 2.6.17) while using the pktcdvd driver writing on a DVDRAM.
When writing big files (>200MB), the drivers internal
bio write queue raised over 200000 entries and more,
since the underlying block driver was not able to process the write requests as fast as they were supplied to the pktcdvd driver. This seems to consume all available kernel memory leading
to kernel out of memory faults. (-> KDE crashed and other funny things happend ;)

Patched files:

drivers/block/pktcdvd.c
drivers/block/Kconfig
include/linux/pktcdvd.h
Documentation/cdrom/packet-writing.txt
Documentation/ABI/testing/sysfs-class-pktcdvd
Documentation/ABI/testing/debugfs-pktcdvd

I wrote a little shell script to control the pktcdvd driver using the sysfs interface.
See http://people.freenet.de/BalaGi#pktcdvd

MfG

Thomas Maier

------------------------------------------------------------------------

Documentation/ABI/testing/debugfs-pktcdvd +20 -0
diff -urpN linux-2.6.18/Documentation/ABI/testing/debugfs-pktcdvd pktcdvd-patch-2.6.18/Documentation/ABI/testing/debugfs-pktcdvd
@@ -0,0 +1,20 @@
+What:           /debug/pktcdvd[0-7]
+Date:           Sep. 2006
+KernelVersion:  2.6.19
+Contact:        Thomas Maier <[email protected]>
+Description:
+
+debugfs interface
+-----------------
+
+The pktcdvd module (packet writing driver) creates
+these files in debugfs:
+
+/debug/pktcdvd[0-7]/
+    info            (0444) Lots of human readable driver
+                           statistics and infos. Multiple lines!
+
+Example:
+-------
+
+cat /debug/pktcdvd3/info
Documentation/ABI/testing/sysfs-class-pktcdvd +78 -0

78 lines not on this page · raw message

Documentation/cdrom/packet-writing.txt +57 -2

76 lines not on this page · raw message

drivers/block/Kconfig +25 -5
diff -urpN linux-2.6.18/drivers/block/Kconfig pktcdvd-patch-2.6.18/drivers/block/Kconfig
@@ -428,17 +428,22 @@ config CDROM_PKTCDVD
  	tristate "Packet writing on CD/DVD media"
  	depends on !UML
  	help
-	  If you have a CDROM drive that supports packet writing, say Y to
-	  include preliminary support. It should work with any MMC/Mt Fuji
-	  compliant ATAPI or SCSI drive, which is just about any newer CD
-	  writer.
+	  If you have a CDROM/DVD drive that supports packet writing, say
+	  Y to include preliminary support. It should work with any
+	  MMC/Mt Fuji compliant ATAPI or SCSI drive, which is just about
+	  any newer DVD/CD writer.
 
-	  Currently only writing to CD-RW, DVD-RW and DVD+RW discs is possible.
+	  Currently only writing to CD-RW, DVD-RW, DVD+RW and DVDRAM discs
+	  is possible.
  	  DVD-RW disks must be in restricted overwrite mode.
 
  	  To compile this driver as a module, choose M here: the
  	  module will be called pktcdvd.
 
+	  For further information see the file
+
+	    Documentation/cdrom/packet-writing.txt
+	
  config CDROM_PKTCDVD_BUFFERS
  	int "Free buffers for data gathering"
  	depends on CDROM_PKTCDVD
@@ -458,6 +463,21 @@ config CDROM_PKTCDVD_WCACHE
  	  this option is dangerous unless the CD-RW media is known good, as we
  	  don't do deferred write error handling yet.
 
+config CDROM_PKTCDVD_PROCINTF
+	bool "Enable procfs interface"
+	depends on CDROM_PKTCDVD
+	default y
+	help
+	  Enable the proc filesystem interface for pktcdvd.
+	  The files can be found as:
+	
+	  /proc/driver/pktcdvd/pktcdvd<idx>
+	
+	  Also a misc device is added with a dynamic minor device id.
+	  See the entry in  /proc/misc  for the minor number.
+	  The misc pktcdvd driver supports ioctl calls, needed
+	  by the pktsetup tool found in udftools package.
+
  source "drivers/s390/block/Kconfig"
 
  config ATA_OVER_ETH
drivers/block/pktcdvd.c +1167 -493

2,076 lines not on this page · raw message

include/linux/pktcdvd.h +82 -31

160 lines not on this page · raw message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 4 lines · Thomas Maier

this is a patch for the packet writing module pktcdvd. The patch adds a sysfs and a debugfs interface, a Kconfig parameter to switch of the procfs interface off and a bio write queue congestion handling for the driver.

I think most of these changes are good. However, some comments:

* There are many logically independent parts in this change, so they should be in separate patches. For example:
- Introduce the DRIVER_NAME #define.
- Add sysfs support.
- Make procfs support optional.
- Implement congestion control.
- Move lots of functions around. (Is it needed at all?)

* You need to add Signed-off-by.

* You should CC Andrew Morton and not Linus. These changes should live in -mm for a while before going into the main tree.

* The patch is white space damaged. All lines that should start with a single space start with two spaces.

Signature · 2 lines
Peter Osterlund - [email protected]
http://web.telia.com/~u89404340
#3 lore raw

Hello,

Quoted 9 lines
Quoted 4 lines · Thomas Maier

this is a patch for the packet writing module pktcdvd. The patch adds a sysfs and a debugfs interface, a Kconfig parameter to switch of the procfs interface off and a bio write queue congestion handling for the driver.

I think most of these changes are good. However, some comments:

Quoted 7 lines

* There are many logically independent parts in this change, so they should be in separate patches. For example:
- Introduce the DRIVER_NAME #define.
- Add sysfs support.
- Make procfs support optional.
- Implement congestion control.
- Move lots of functions around. (Is it needed at all?)

Oh, this is ugly for coding, since all is in the same file. But i splitted the patch and will send all 4 parts again.

I moved the functions for grouping and better readability.

Quoted 1 line

* You need to add Signed-off-by.

Ok.

Quoted 2 lines

* You should CC Andrew Morton and not Linus. These changes should live in -mm for a while before going into the main tree.

Ok, but the changes should not be harmful and easy, i think ;)

Quoted 2 lines

* The patch is white space damaged. All lines that should start with a single space start with two spaces.

Ugly. Thanks for the hit, haven't noticed it.

Thanks

Thomas Maier