Re: [RFC] how to fix is_local_disk()?

Andrew Morton (akpm@digeo.com)
Sun, 4 May 2003 01:00:14 -0700


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 *);

_

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