Skip to contentSkip to conversation

buffer.c lock_kernel() -- removal

PATCH Craig Christophel 2 participants 2 messages Jan 10, 2002 – Jan 13, 2002 VFS

lore
Share & tools
lore
#0 lore raw

Included is a patch against buffer.c that removes the lock_kernel()/unlock_kernel() pairs in the few functions that they exist.

This is for 2.5>2.5.2-pre10.

I beleive that I checked all of the member functions for locking schematics
but if you can prove me wrong -- go for it. The only issue I can see would
be if DQUOT_SYNC() didn't do a lock_kernel() inside itself; but it does so that is taken care of (utilizing BKL only if dquot is compiled in). Well after all of that, here is the patch for review.

Craig.

Index: linux/fs/buffer.c

fs/buffer.c renamed from fs/buffer.c:1.3 +0 -8
diff -u linux/fs/buffer.c:1.3 linux/fs/buffer.c:1.4
@@ -322,14 +322,12 @@
 	kdev_t dev = sb->s_dev;
 	sync_buffers(dev, 0);
 
-	lock_kernel();
 	sync_inodes_sb(sb);
 	DQUOT_SYNC(sb);
 	lock_super(sb);
 	if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
 		sb->s_op->write_super(sb);
 	unlock_super(sb);
-	unlock_kernel();
 
 	return sync_buffers(dev, 1);
 }
@@ -345,7 +343,6 @@
 {
 	sync_buffers(dev, 0);
 
-	lock_kernel();
 	sync_inodes(dev);
 	if (!kdev_none(dev)) {
 		struct super_block *sb = get_super(dev);
@@ -356,7 +353,6 @@
 	} else
 			DQUOT_SYNC(NULL);
 	sync_supers(dev);
-	unlock_kernel();
 
 	return sync_buffers(dev, 1);
 }
@@ -387,7 +383,6 @@
 	kdev_t dev;
 	int ret;
 
-	lock_kernel();
 	/* sync the inode to buffers */
 	write_inode_now(inode, 0);
 
@@ -401,7 +396,6 @@
 	/* .. finally sync the buffers to disk */
 	dev = inode->i_dev;
 	ret = sync_buffers(dev, 1);
-	unlock_kernel();
 	return ret;
 }
 
@@ -2559,10 +2553,8 @@
 
 static int sync_old_buffers(void)
 {
-	lock_kernel();
 	sync_unlocked_inodes();
 	sync_supers(NODEV);
-	unlock_kernel();
 
 	for (;;) {
 		struct buffer_head *bh;
#1 lore raw
Quoted 7 lines · Craig Christophel

Included is a patch against buffer.c that removes the lock_kernel()/unlock_kernel() pairs in the few functions that they exist.

This is for 2.5>2.5.2-pre10.

I beleive that I checked all of the member functions for locking schematics
but if you can prove me wrong -- go for it. The only issue I can see would

... and in the very first chunk we have

fs/buffer.c line 332

Quoted 8 lines
fs/buffer.c renamed from fs/buffer.c:1.3 +0 -2
-	lock_kernel();
 	sync_inodes_sb(sb);
 	DQUOT_SYNC(sb);
 	lock_super(sb);
 	if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
 		sb->s_op->write_super(sb);
 	unlock_super(sb);
-	unlock_kernel();

i.e. method that used to have BKL loses it. Unless you are willing to post the results of audit for all filesystems - sorry, no go.