patch-2.3.99-pre3 linux/drivers/char/sysrq.c

Next file: linux/drivers/char/tty_io.c
Previous file: linux/drivers/char/serial.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre2/linux/drivers/char/sysrq.c linux/drivers/char/sysrq.c
@@ -28,7 +28,7 @@
 extern void wakeup_bdflush(int);
 extern void reset_vc(unsigned int);
 extern int console_loglevel;
-extern struct vfsmount *vfsmntlist;
+extern struct list_head super_blocks;
 
 /* Machine specific power off function */
 void (*sysrq_power_off)(void) = NULL;
@@ -174,22 +174,16 @@
 	}
 }
 
-static void go_sync(kdev_t dev, int remount_flag)
+static void go_sync(struct super_block *sb, int remount_flag)
 {
 	printk(KERN_INFO "%sing device %s ... ",
 	       remount_flag ? "Remount" : "Sync",
-	       kdevname(dev));
+	       kdevname(sb->s_dev));
 
 	if (remount_flag) {				    /* Remount R/O */
-		struct super_block *sb = get_super(dev);
-		struct vfsmount *vfsmnt;
 		int ret, flags;
 		struct list_head *p;
 
-		if (!sb) {
-			printk("Superblock not found\n");
-			return;
-		}
 		if (sb->s_flags & MS_RDONLY) {
 			printk("R/O\n");
 			return;
@@ -204,7 +198,7 @@
 		}
 		file_list_unlock();
 		DQUOT_OFF(sb);
-		fsync_dev(dev);
+		fsync_dev(sb->s_dev);
 		flags = MS_RDONLY;
 		if (sb->s_op && sb->s_op->remount_fs) {
 			ret = sb->s_op->remount_fs(sb, &flags, NULL);
@@ -217,7 +211,7 @@
 		} else
 			printk("nothing to do\n");
 	} else {
-		fsync_dev(dev);				    /* Sync only */
+		fsync_dev(sb->s_dev);			    /* Sync only */
 		printk("OK\n");
 	}
 }
@@ -233,20 +227,24 @@
 
 void do_emergency_sync(void)
 {
-	struct vfsmount *mnt;
+	struct super_block *sb;
 	int remount_flag;
 
 	lock_kernel();
 	remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
 	emergency_sync_scheduled = 0;
 
-	for (mnt = vfsmntlist; mnt; mnt = mnt->mnt_next)
-		if (is_local_disk(mnt->mnt_dev))
-			go_sync(mnt->mnt_dev, remount_flag);
-
-	for (mnt = vfsmntlist; mnt; mnt = mnt->mnt_next)
-		if (!is_local_disk(mnt->mnt_dev) && MAJOR(mnt->mnt_dev))
-			go_sync(mnt->mnt_dev, remount_flag);
+	for (sb = sb_entry(super_blocks.next);
+	     sb != sb_entry(&super_blocks); 
+	     sb = sb_entry(sb->s_list.next))
+		if (is_local_disk(sb->s_dev))
+			go_sync(sb, remount_flag);
+
+	for (sb = sb_entry(super_blocks.next);
+	     sb != sb_entry(&super_blocks); 
+	     sb = sb_entry(sb->s_list.next))
+		if (!is_local_disk(sb->s_dev) && MAJOR(sb->s_dev))
+			go_sync(sb, remount_flag);
 
 	unlock_kernel();
 	printk(KERN_INFO "Done.\n");

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