public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Patch for file fs/partitions/check.c
       [not found] <UTC200102202301.AAA209334.aeb@vlet.cwi.nl>
@ 2001-02-22  0:54 ` Alex Davis
  0 siblings, 0 replies; only message in thread
From: Alex Davis @ 2001-02-22  0:54 UTC (permalink / raw)
  To: aeb, linux-kernel

Andries.Brouwer@cwi.nl wrote:
> 
> > Are you the person I send the patch to?
> 
> Send it to aeb@cwi.nl and to linux-kernel@vger.kernel.org .
> 
> Andries

Here's my patch to perform a media-change check and, if necessary,
a disk revalidate whenever /proc/partitions is accessed.

--- check.c.save	Wed Feb 21 17:50:54 2001
+++ check.c	Wed Feb 21 19:49:20 2001
@@ -9,6 +9,10 @@
  *  contained.
  *
  *  Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl}
+ *
+ *  Alex Davis <letmein@erols.com>
+ *	Added code to keep /proc/partitions in sync with
+ *  removable media.
  */
 
 #include <linux/config.h>
@@ -242,11 +246,25 @@
 int get_partition_list(char *page, char **start, off_t offset, int
count)
 {
 	struct gendisk *dsk;
+	kdev_t dev;
 	int len;
 
 	len = sprintf(page, "major minor  #blocks  name\n\n");
 	for (dsk = gendisk_head; dsk; dsk = dsk->next) {
 		int n;
+		int i;
+
+		if ( dsk->fops->check_media_change &&
+			 dsk->fops->revalidate ) {
+			for ( i = 0; i < dsk->nr_real; ++i ) {
+				dev = MKDEV(dsk->major, i << dsk->minor_shift);
+				if ( dsk->flags[i] & GENHD_FL_REMOVABLE &&
+					 dsk->fops->check_media_change(dev) ) {
+//printk(KERN_INFO "revalidating drive %d:%d\n", dsk->major, i);
+					dsk->fops->revalidate(dev);
+				}
+			}
+		}
 
 		for (n = 0; n < (dsk->nr_real << dsk->minor_shift); n++)
 			if (dsk->part[n].nr_sects) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-22  0:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <UTC200102202301.AAA209334.aeb@vlet.cwi.nl>
2001-02-22  0:54 ` Patch for file fs/partitions/check.c Alex Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox