xfs
[Top] [All Lists]

Re: TAKE - Move XFS out of the interrupt disabling game

To: Steve Lord <lord@xxxxxxx>
Subject: Re: TAKE - Move XFS out of the interrupt disabling game
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 24 May 2002 10:39:37 +0100
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <200205231900.g4NJ0Fn06774@jen.americas.sgi.com>; from lord@sgi.com on Thu, May 23, 2002 at 02:00:15PM -0500
References: <200205231900.g4NJ0Fn06774@jen.americas.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
On Thu, May 23, 2002 at 02:00:15PM -0500, Steve Lord wrote:
> linux/fs/xfs/linux/xfs_vfs.c - 1.26
>       - replace mp_mutex_spinlock with mutex_spinlock

But both mp_mutex_spinlock and mutex_spinlock aren't right here!
All other vfslock accesses are using linux native, interrupt-disabling
spinlock functions.  With the old code this was just an inconsistency,
but now we sometimes disable interrupts, sometimes not.

This small patch makes it using the same linux primitives the other
functions use, but I think it should be save to move to the simple
spinlock functions everywhere:


Index: fs/xfs/linux/xfs_vfs.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/linux/xfs_vfs.c,v
retrieving revision 1.26
diff -u -u -r1.26 xfs_vfs.c
--- fs/xfs/linux/xfs_vfs.c      2002/05/23 18:57:09     1.26
+++ fs/xfs/linux/xfs_vfs.c      2002/05/24 09:25:05
@@ -366,7 +366,9 @@
 void
 vfs_setflag(vfs_t *vfsp, unsigned long f)
 {
-       unsigned long s = mutex_spinlock(&vfslock);
+       unsigned long s;
+
+       spin_lock_irqsave(&vfslock, s);
        vfsp->vfs_flag |= f;
-       mutex_spinunlock(&vfslock, s);
+       spin_unlock_irqrestore(&vfslock, s);
 }

> linux/fs/xfs/support/mutex.h - 1.5
>       - remobe mp_mutex_spinlock, make mutex_spinlock be spin_lock

That makes the mp_mutex_spinlock comment here even more wrong then it
previously was:  we do not only no more have mp_mutex_spinlock nor
is mp_mutex_spinlock/mutex_spinlock ever used in xfs_rw.c nor does
XFS mess with interrupt state anymore..

Remove it and make the declarations of mutex_spinlock/mutex_spinunlock
more consistant.

Index: fs/xfs/support/mutex.h
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/support/mutex.h,v
retrieving revision 1.5
diff -u -u -r1.5 mutex.h
--- fs/xfs/support/mutex.h      2002/05/23 18:57:09     1.5
+++ fs/xfs/support/mutex.h      2002/05/24 09:25:05
@@ -66,23 +66,17 @@
 #define mutex_unlock(lock)             _mutex_unlock(lock)
 #define mutex_destroy(lock)            _mutex_destroy(lock)
 
-/*
- * mp_mutex_spinlock is used in xfs_rw.c during an interrupt thread so it
- * must be irq safe. This happens when a write finishes and we queue
- * a request to xfsc to update the unwritten extent flag.
- * There may be other places.
- *
- * mutex_spinlock is also called extensively by interrupt threads.
- *
- */
-
-static __inline__ unsigned long mutex_spinlock(spinlock_t *l)
+static inline unsigned long mutex_spinlock(spinlock_t *lock)
 {
-       spin_lock(l);
+       spin_lock(lock);
        return 0;
 }
 
-#define mutex_spinunlock(lockp,flags)          spin_unlock(lockp)
+/*ARGSUSED*/
+static inline void mutex_spinunlock(spinlock_t *lock, unsigned long s)
+{
+       spin_unlock(lock);
+}
 
 
 /*

> linux/fs/xfs/pagebuf/page_buf_internal.h - 1.6
>       - no changes

Hmm..


Apropos mutex_spinlock:  What is the exact use of this locking primitive?
The name suggests that it is used in IRIX to spin on a mutex_t on
contention, but that means it's argument is already very different on
Linux.  Given that fact I wonder why it is still kept for the few user.


<Prev in Thread] Current Thread [Next in Thread>