public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Andrew Morton <akpm@digeo.com>
Cc: hch@lst.de, linux-kernel@vger.kernel.org
Subject: Re: [RFC] how to fix is_local_disk()?
Date: Sun, 4 May 2003 01:00:14 -0700	[thread overview]
Message-ID: <20030504010014.67352345.akpm@digeo.com> (raw)
In-Reply-To: <20030504003021.077e8819.akpm@digeo.com>

Andrew Morton <akpm@digeo.com> wrote:
>
> Christoph Hellwig <hch@lst.de> wrote:
> >
> > In drivers/char/sysrq.c we have this nice piece of code:
> > 
> 
> Suggest you chainsaw the whole lot and simply do a wakeup_bdflush(0) from
> interrupt context.
> 

Actually, that's a bit slack because it won't run journal commits and such. 
The below should do the trick.

But we still need superblock walking code to do the remount-ro thing. 
Another superblock-iterator which calls do_remount_sb()?


 fs/buffer.c        |   16 +++++++++++++---
 include/linux/fs.h |    1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff -puN fs/buffer.c~emergency_sync fs/buffer.c
--- 25/fs/buffer.c~emergency_sync	2003-05-04 00:46:15.000000000 -0700
+++ 25-akpm/fs/buffer.c	2003-05-04 00:48:54.000000000 -0700
@@ -244,18 +244,28 @@ int fsync_bdev(struct block_device *bdev
  * sync everything.  Start out by waking pdflush, because that writes back
  * all queues in parallel.
  */
-asmlinkage long sys_sync(void)
+static void do_sync(unsigned long wait)
 {
 	wakeup_bdflush(0);
 	sync_inodes(0);		/* All mappings, inodes and their blockdevs */
 	DQUOT_SYNC(NULL);
 	sync_supers();		/* Write the superblocks */
 	sync_filesystems(0);	/* Start syncing the filesystems */
-	sync_filesystems(1);	/* Waitingly sync the filesystems */
-	sync_inodes(1);		/* Mappings, inodes and blockdevs, again. */
+	sync_filesystems(wait);	/* Waitingly sync the filesystems */
+	sync_inodes(wait);	/* Mappings, inodes and blockdevs, again. */
+}
+
+asmlinkage long sys_sync(void)
+{
+	do_sync(1);
 	return 0;
 }
 
+void emergency_sync(void)
+{
+	pdflush_operation(do_sync, 0);
+}
+
 /*
  * Generic function to fsync a file.
  *
diff -puN include/linux/fs.h~emergency_sync include/linux/fs.h
--- 25/include/linux/fs.h~emergency_sync	2003-05-04 00:46:21.000000000 -0700
+++ 25-akpm/include/linux/fs.h	2003-05-04 00:47:01.000000000 -0700
@@ -1113,6 +1113,7 @@ extern int filemap_flush(struct address_
 extern int filemap_fdatawait(struct address_space *);
 extern void sync_supers(void);
 extern void sync_filesystems(int wait);
+extern void emergency_sync(void);
 extern sector_t bmap(struct inode *, sector_t);
 extern int setattr_mask(unsigned int);
 extern int notify_change(struct dentry *, struct iattr *);

_



  parent reply	other threads:[~2003-05-04  7:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-04  7:00 [RFC] how to fix is_local_disk()? Christoph Hellwig
2003-05-04  7:30 ` Andrew Morton
2003-05-04  7:53   ` Christoph Hellwig
2003-05-04  8:00   ` Andrew Morton [this message]
2003-05-04 17:10     ` Christoph Hellwig
2003-05-04 21:05       ` Andrew Morton
2003-05-05  7:41         ` viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030504010014.67352345.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox