From f6d5fc12de013642ffde8c43644814cccb09eea9 Mon Sep 17 00:00:00 2001
From: Anton Altaparmakov <aia21@cantab.net>
Date: Tue, 14 Sep 2004 16:30:26 +0100
Subject: [PATCH] NTFS: Fix scheduling latencies in ntfs_fill_super() by
 dropping the BKL       because the code itself is using the ntfs_lock
 semaphore which       provides safe locking.  (Ingo Molnar)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
---
 fs/ntfs/ChangeLog | 3 +++
 fs/ntfs/debug.c   | 2 +-
 fs/ntfs/super.c   | 5 +++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index fa6d6f48fc62..401a3c6fe150 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -25,6 +25,9 @@ ToDo/Notes:
 
 	- Remove vol->nr_mft_records as it was pretty meaningless and optimize
 	  the calculation of total/free inodes as used by statfs().
+	- Fix scheduling latencies in ntfs_fill_super() by dropping the BKL
+	  because the code itself is using the ntfs_lock semaphore which
+	  provides safe locking.  (Ingo Molnar)
 
 2.1.17 - Fix bugs in mount time error code paths and other updates.
 
diff --git a/fs/ntfs/debug.c b/fs/ntfs/debug.c
index 10038acc7f75..6723f18264a4 100644
--- a/fs/ntfs/debug.c
+++ b/fs/ntfs/debug.c
@@ -127,7 +127,7 @@ void __ntfs_debug (const char *file, int line, const char *function,
 	va_start(args, fmt);
 	vsnprintf(err_buf, sizeof(err_buf), fmt, args);
 	va_end(args);
-	printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s: %s\n",
+	printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s(): %s\n",
 		file, line, flen ? function : "", err_buf);
 	spin_unlock(&err_buf_lock);
 }
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index a4a05cc5e6a0..4c39039e3d4a 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -29,6 +29,7 @@
 #include <linux/buffer_head.h>
 #include <linux/vfs.h>
 #include <linux/moduleparam.h>
+#include <linux/smp_lock.h>
 
 #include "ntfs.h"
 #include "sysctl.h"
@@ -2291,6 +2292,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
 	vol->fmask = 0177;
 	vol->dmask = 0077;
 
+	unlock_kernel();
+
 	/* Important to get the mount options dealt with now. */
 	if (!parse_options(vol, (char*)opt))
 		goto err_out_now;
@@ -2427,6 +2430,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
 		}
 		up(&ntfs_lock);
 		sb->s_export_op = &ntfs_export_ops;
+		lock_kernel();
 		return 0;
 	}
 	ntfs_error(sb, "Failed to allocate root directory.");
@@ -2530,6 +2534,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
 	}
 	/* Errors at this stage are irrelevant. */
 err_out_now:
+	lock_kernel();
 	sb->s_fs_info = NULL;
 	kfree(vol);
 	ntfs_debug("Failed, returning -EINVAL.");
-- 
2.30.9