mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	akpm@osdl.org
Subject: Re: [PATCH] [0/18] Implement some low hanging BKL removal fruit in fs/*
Date: Mon, 28 Jan 2008 12:59:14 +1100	[thread overview]
Message-ID: <200801281259.15198.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20080127317.043953000@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

On Sunday 27 January 2008 13:17, Andi Kleen wrote:
> [Andrew: I believe this is -mm material for .25]
>
> - Convert some more file systems (generally those who don't use the BKL
> for anything except mount) to use unlocked_bkl.
> - Implement BKL less fasync (see patch for the rationale)
> This is currently a separate entry point, but since the number of fasync
> users in the tree is relatively small I hope the older entry point can
> be removed then in the not too far future
> [help from other people converting more fasync users to unlocked_fasync
> would be appreciated]
> - Implement BKL less remote_llseek
> - While I was at it I also added a few missing compat ioctl handlers
> - Fix a few comments
>
> This fixes a lot of relatively trivial BKL users in fs/*. The main
> remaining non legacy offenders are now locks.c, nfs/nfsd and reiserfs.
> I believe BKL removal for all of those is being worked on by other people.
> Also a lot of "legacy" file systems still use it, but converting those
> does not seem to be very pressing.

BTW. here is a patch I did a while back for minix. I know it isn't
a big deal, but the work is done so I guess I should send it along.

[-- Attachment #2: minix-no-bkl.patch --]
[-- Type: text/x-diff, Size: 4209 bytes --]

The minix filesystem uses bkl to protect access to metadata. Switch
to a per-superblock mutex.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/fs/minix/bitmap.c
===================================================================
--- linux-2.6.orig/fs/minix/bitmap.c
+++ linux-2.6/fs/minix/bitmap.c
@@ -69,11 +69,11 @@ void minix_free_block(struct inode *inod
 		return;
 	}
 	bh = sbi->s_zmap[zone];
-	lock_kernel();
+	mutex_lock(&sbi->s_mutex);
 	if (!minix_test_and_clear_bit(bit, bh->b_data))
 		printk("minix_free_block (%s:%lu): bit already cleared\n",
 		       sb->s_id, block);
-	unlock_kernel();
+	mutex_unlock(&sbi->s_mutex);
 	mark_buffer_dirty(bh);
 	return;
 }
@@ -88,18 +88,18 @@ int minix_new_block(struct inode * inode
 		struct buffer_head *bh = sbi->s_zmap[i];
 		int j;
 
-		lock_kernel();
+		mutex_lock(&sbi->s_mutex);
 		j = minix_find_first_zero_bit(bh->b_data, bits_per_zone);
 		if (j < bits_per_zone) {
 			minix_set_bit(j, bh->b_data);
-			unlock_kernel();
+			mutex_unlock(&sbi->s_mutex);
 			mark_buffer_dirty(bh);
 			j += i * bits_per_zone + sbi->s_firstdatazone-1;
 			if (j < sbi->s_firstdatazone || j >= sbi->s_nzones)
 				break;
 			return j;
 		}
-		unlock_kernel();
+		mutex_unlock(&sbi->s_mutex);
 	}
 	return 0;
 }
@@ -211,10 +211,10 @@ void minix_free_inode(struct inode * ino
 	minix_clear_inode(inode);	/* clear on-disk copy */
 
 	bh = sbi->s_imap[ino];
-	lock_kernel();
+	mutex_lock(&sbi->s_mutex);
 	if (!minix_test_and_clear_bit(bit, bh->b_data))
 		printk("minix_free_inode: bit %lu already cleared\n", bit);
-	unlock_kernel();
+	mutex_unlock(&sbi->s_mutex);
 	mark_buffer_dirty(bh);
  out:
 	clear_inode(inode);		/* clear in-memory copy */
@@ -237,7 +237,7 @@ struct inode * minix_new_inode(const str
 	j = bits_per_zone;
 	bh = NULL;
 	*error = -ENOSPC;
-	lock_kernel();
+	mutex_lock(&sbi->s_mutex);
 	for (i = 0; i < sbi->s_imap_blocks; i++) {
 		bh = sbi->s_imap[i];
 		j = minix_find_first_zero_bit(bh->b_data, bits_per_zone);
@@ -245,17 +245,17 @@ struct inode * minix_new_inode(const str
 			break;
 	}
 	if (!bh || j >= bits_per_zone) {
-		unlock_kernel();
+		mutex_unlock(&sbi->s_mutex);
 		iput(inode);
 		return NULL;
 	}
 	if (minix_test_and_set_bit(j, bh->b_data)) {	/* shouldn't happen */
-		unlock_kernel();
+		mutex_unlock(&sbi->s_mutex);
 		printk("minix_new_inode: bit already set\n");
 		iput(inode);
 		return NULL;
 	}
-	unlock_kernel();
+	mutex_unlock(&sbi->s_mutex);
 	mark_buffer_dirty(bh);
 	j += i * bits_per_zone;
 	if (!j || j > sbi->s_ninodes) {
Index: linux-2.6/fs/minix/dir.c
===================================================================
--- linux-2.6.orig/fs/minix/dir.c
+++ linux-2.6/fs/minix/dir.c
@@ -102,7 +102,7 @@ static int minix_readdir(struct file * f
 	char *name;
 	__u32 inumber;
 
-	lock_kernel();
+	mutex_lock(&sbi->s_mutex);
 
 	pos = (pos + chunk_size-1) & ~(chunk_size-1);
 	if (pos >= inode->i_size)
@@ -146,7 +146,7 @@ static int minix_readdir(struct file * f
 
 done:
 	filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
-	unlock_kernel();
+	mutex_unlock(&sbi->s_mutex);
 	return 0;
 }
 
Index: linux-2.6/fs/minix/inode.c
===================================================================
--- linux-2.6.orig/fs/minix/inode.c
+++ linux-2.6/fs/minix/inode.c
@@ -174,6 +174,7 @@ static int minix_fill_super(struct super
 	sbi->s_firstdatazone = ms->s_firstdatazone;
 	sbi->s_log_zone_size = ms->s_log_zone_size;
 	sbi->s_max_size = ms->s_max_size;
+	mutex_init(&sbi->s_mutex);
 	s->s_magic = ms->s_magic;
 	if (s->s_magic == MINIX_SUPER_MAGIC) {
 		sbi->s_version = MINIX_V1;
Index: linux-2.6/fs/minix/minix.h
===================================================================
--- linux-2.6.orig/fs/minix/minix.h
+++ linux-2.6/fs/minix/minix.h
@@ -1,6 +1,7 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/minix_fs.h>
+#include <linux/mutex.h>
 
 /*
  * change the define below to 0 if you want names > info->s_namelen chars to be
@@ -43,6 +44,8 @@ struct minix_sb_info {
 	struct minix_super_block * s_ms;
 	unsigned short s_mount_state;
 	unsigned short s_version;
+
+	struct mutex s_mutex;
 };
 
 extern struct inode *minix_iget(struct super_block *, unsigned long);

  parent reply	other threads:[~2008-01-28  1:59 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27  2:17 Andi Kleen
2008-01-27  2:17 ` [PATCH] [1/18] BKL-removal: Convert ext2 over to use unlocked_ioctl Andi Kleen
2008-01-27  2:17 ` [PATCH] [2/18] BKL-removal: Remove incorrect BKL comment in ext2 Andi Kleen
2008-01-27  2:17 ` [PATCH] [3/18] BKL-removal: Convert ext3 to use unlocked_ioctl Andi Kleen
2008-01-28  5:33   ` Andrew Morton
2008-01-28  6:02     ` Andi Kleen
2008-01-27  2:17 ` [PATCH] [4/18] ext3: Remove incorrect BKL comment Andi Kleen
2008-01-27  2:17 ` [PATCH] [5/18] BKL-removal: Remove incorrect comment refering to lock_kernel() from jbd/jbd2 Andi Kleen
2008-01-27  2:17 ` [PATCH] [6/18] BKL-removal: Convert ext4 to use unlocked_ioctl Andi Kleen
2008-01-27  2:17 ` [PATCH] [7/18] BKL-removal: Remove incorrect comments refering to BKL from ext4 Andi Kleen
2008-01-27  2:17 ` [PATCH] [8/18] BKL-removal: Remove BKL from remote_llseek Andi Kleen
2008-01-27 16:57   ` Steve French
2008-01-27 17:56     ` Trond Myklebust
2008-01-27 22:18       ` Steve French
2008-01-27 23:08         ` Trond Myklebust
2008-01-28  2:58           ` Andi Kleen
2008-01-28  4:13             ` Trond Myklebust
2008-01-28  4:38               ` Andi Kleen
2008-01-28  4:51                 ` Trond Myklebust
2008-01-28  5:13                 ` Andrew Morton
2008-01-28  8:17                   ` Andi Kleen
2008-01-28 18:33                     ` Steve French
2008-01-28 19:34                       ` Dave Kleikamp
2008-01-28 12:56                   ` Alan Cox
2008-01-28 13:27                     ` Andi Kleen
2008-01-28 13:38                       ` Alan Cox
2008-01-28 14:10                         ` Andi Kleen
2008-01-28 14:50                           ` Alan Cox
2008-01-28 15:13                           ` Diego Calleja
2008-01-28  2:44         ` Andi Kleen
2008-01-28  2:43     ` Andi Kleen
2008-01-27  2:17 ` [PATCH] [9/18] BKL-removal: Use unlocked_ioctl for jfs Andi Kleen
2008-01-27 23:05   ` Dave Kleikamp
2008-01-27  2:17 ` [PATCH] [10/18] BKL-removal: Implement a compat_ioctl handler for JFS Andi Kleen
2008-01-27 23:05   ` Dave Kleikamp
2008-01-27  2:17 ` [PATCH] [11/18] BKL-removal: Convert ocfs2 over to unlocked_ioctl Andi Kleen
2008-01-27  2:17 ` [PATCH] [12/18] BKL-removal: Convert CIFS " Andi Kleen
2008-01-27  2:17 ` [PATCH] [13/18] BKL-removal: Add compat_ioctl for cifs Andi Kleen
2008-01-27  2:17 ` [PATCH] [14/18] BKL-removal: Add unlocked_fasync Andi Kleen
2008-01-27  7:05   ` KOSAKI Motohiro
2008-01-27  2:17 ` [PATCH] [15/18] BKL-removal: Convert pipe over to unlocked_fasync Andi Kleen
2008-01-27  2:17 ` [PATCH] [16/18] BKL-removal: Convert socket fasync " Andi Kleen
2008-01-27  2:17 ` [PATCH] [17/18] BKL-removal: Convert fuse " Andi Kleen
2008-01-27  2:17 ` [PATCH] [18/18] BKL-removal: Convert bad_inode " Andi Kleen
2008-01-28  1:59 ` Nick Piggin [this message]
2008-01-28  3:15   ` [PATCH] [0/18] Implement some low hanging BKL removal fruit in fs/* Andi Kleen

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=200801281259.15198.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®