Now that we have the sb writer count, we don't need to go looking at all of the individual open files. Signed-off-by: Dave Hansen <haveblue at us.ibm.com> --- lxc-dave/fs/file_table.c | 25 ------------------------- lxc-dave/fs/super.c | 1 - lxc-dave/include/linux/fs.h | 2 -- 3 files changed, 28 deletions(-) diff -puN fs/file_table.c~05-24-kill-open-files-traverse-on-remount-ro fs/file_table.c --- lxc/fs/file_table.c~05-24-kill-open-files-traverse-on-remount-ro 2006-12-11 14:22:00.000000000 -0800 +++ lxc-dave/fs/file_table.c 2006-12-11 14:22:00.000000000 -0800 @@ -293,31 +293,6 @@ void file_kill(struct file *file) } } -int fs_may_remount_ro(struct super_block *sb) -{ - struct list_head *p; - - /* Check that no files are currently opened for writing. */ - file_list_lock(); - list_for_each(p, &sb->s_files) { - struct file *file = list_entry(p, struct file, f_u.fu_list); - struct inode *inode = file->f_path.dentry->d_inode; - - /* File with pending delete? */ - if (inode->i_nlink == 0) - goto too_bad; - - /* Writeable file? */ - if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE)) - goto too_bad; - } - file_list_unlock(); - return 1; /* Tis' cool bro. */ -too_bad: - file_list_unlock(); - return 0; -} - void __init files_init(unsigned long mempages) { int n; diff -puN fs/super.c~05-24-kill-open-files-traverse-on-remount-ro fs/super.c --- lxc/fs/super.c~05-24-kill-open-files-traverse-on-remount-ro 2006-12-11 14:22:00.000000000 -0800 +++ lxc-dave/fs/super.c 2006-12-11 14:22:00.000000000 -0800 @@ -606,7 +606,6 @@ static void sb_mounts_clear_flag(struct static int sb_remount_ro(struct super_block *sb) { - return fs_may_remount_ro(sb); spin_lock(&sb->s_mnt_writers_lock); if (atomic_read(&sb->s_mnt_writers) > 0) { spin_unlock(&sb->s_mnt_writers_lock); diff -puN include/linux/fs.h~05-24-kill-open-files-traverse-on-remount-ro include/linux/fs.h --- lxc/include/linux/fs.h~05-24-kill-open-files-traverse-on-remount-ro 2006-12-11 14:22:00.000000000 -0800 +++ lxc-dave/include/linux/fs.h 2006-12-11 14:22:00.000000000 -0800 @@ -1609,8 +1609,6 @@ extern const struct file_operations read extern const struct file_operations write_fifo_fops; extern const struct file_operations rdwr_fifo_fops; -extern int fs_may_remount_ro(struct super_block *); - #ifdef CONFIG_BLOCK /* * return READ, READA, or WRITE _