patch-2.3.43 linux/drivers/block/rd.c

Next file: linux/drivers/cdrom/mcd.c
Previous file: linux/drivers/block/raid0.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/drivers/block/rd.c linux/drivers/block/rd.c
@@ -270,7 +270,7 @@
 		}
 	}
 	if (rbh) {
- 		set_bit(BH_Protected, &rbh->b_state);
+		mark_buffer_protected(rbh);
 		brelse(rbh);
 	}
 
@@ -290,7 +290,10 @@
 	switch (cmd) {
 		case BLKFLSBUF:
 			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-			invalidate_buffers(inode->i_rdev);
+			/* special: we want to release the ramdisk memory,
+			   it's not like with the other blockdevices where
+			   this ioctl only flushes away the buffer cache. */
+			destroy_buffers(inode->i_rdev);
 			break;
 
          	case BLKGETSIZE:   /* Return device size */
@@ -338,17 +341,8 @@
 
 
 static struct file_operations initrd_fops = {
-	NULL,		/* lseek */
-	initrd_read,	/* read */
-	NULL,		/* write */
-	NULL,		/* readdir */
-	NULL,		/* poll */
-	NULL, 		/* ioctl */
-	NULL,		/* mmap */
-	NULL,		/* open */
-	NULL,		/* flush */
-	initrd_release,	/* release */
-	NULL		/* fsync */ 
+	read:		initrd_read,
+	release:	initrd_release,
 };
 
 #endif
@@ -391,7 +385,7 @@
 	int i;
 
 	for (i = 0 ; i < NUM_RAMDISKS; i++)
-		invalidate_buffers(MKDEV(MAJOR_NR, i));
+		destroy_buffers(MKDEV(MAJOR_NR, i));
 
 	unregister_blkdev( MAJOR_NR, "ramdisk" );
 	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)