]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fs/locks.c cleanup
authorMatthew Wilcox <willy@debian.org>
Wed, 12 Jun 2002 05:38:36 +0000 (22:38 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 12 Jun 2002 05:38:36 +0000 (22:38 -0700)
 - Inline locks_notify_blocked.
 - Remove a couple of now-bogus comments.
 - Remove the obsolete F_SHLCK and F_EXLCK cases.
 - Remove the last remaining reference to FL_BROKEN.

fs/locks.c
fs/nfs/file.c

index 4e0220993f8f74898ac636dee142b6ae1fb07fa0..c85a1d2630ca09f7a916a5fe7a6fa980a7411f85 100644 (file)
@@ -443,15 +443,6 @@ static void locks_insert_block(struct file_lock *blocker,
        list_add(&waiter->fl_link, &blocked_list);
 }
 
-static inline
-void locks_notify_blocked(struct file_lock *waiter)
-{
-       if (waiter->fl_notify)
-               waiter->fl_notify(waiter);
-       else
-               wake_up(&waiter->fl_wait);
-}
-
 /* Wake up processes blocked waiting for blocker.
  * If told to wait then schedule the processes until the block list
  * is empty, otherwise empty the block list ourselves.
@@ -459,12 +450,13 @@ void locks_notify_blocked(struct file_lock *waiter)
 static void locks_wake_up_blocks(struct file_lock *blocker)
 {
        while (!list_empty(&blocker->fl_block)) {
-               struct file_lock *waiter = list_entry(blocker->fl_block.next, struct file_lock, fl_block);
-               /* Remove waiter from the block list, because by the
-                * time it wakes up blocker won't exist any more.
-                */
+               struct file_lock *waiter = list_entry(blocker->fl_block.next,
+                               struct file_lock, fl_block);
                locks_delete_block(waiter);
-               locks_notify_blocked(waiter);
+               if (waiter->fl_notify)
+                       waiter->fl_notify(waiter);
+               else
+                       wake_up(&waiter->fl_wait);
        }
 }
 
@@ -1405,8 +1397,6 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock *l)
        if (copy_from_user(&flock, l, sizeof(flock)))
                goto out;
 
-       /* Get arguments and validate them ...
-        */
        inode = filp->f_dentry->d_inode;
 
        /* Don't allow mandatory locks on files that may be memory mapped
@@ -1438,23 +1428,6 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock *l)
                break;
        case F_UNLCK:
                break;
-       case F_SHLCK:
-       case F_EXLCK:
-#ifdef __sparc__
-/* warn a bit for now, but don't overdo it */
-{
-       static int count = 0;
-       if (!count) {
-               count=1;
-               printk(KERN_WARNING
-                      "fcntl_setlk() called by process %d (%s) with broken flock() emulation\n",
-                      current->pid, current->comm);
-       }
-}
-               if (!(filp->f_mode & 3))
-                       goto out;
-               break;
-#endif
        default:
                error = -EINVAL;
                goto out;
@@ -1543,8 +1516,6 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 *l)
        if (copy_from_user(&flock, l, sizeof(flock)))
                goto out;
 
-       /* Get arguments and validate them ...
-        */
        inode = filp->f_dentry->d_inode;
 
        /* Don't allow mandatory locks on files that may be memory mapped
@@ -1576,8 +1547,6 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 *l)
                break;
        case F_UNLCK:
                break;
-       case F_SHLCK:
-       case F_EXLCK:
        default:
                error = -EINVAL;
                goto out;
index ead763518c4a07f01220375a1c2271521c050c24..4382587ebcce6bdbf044769e04dbf39411a5f985 100644 (file)
@@ -272,7 +272,7 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
         * Not sure whether that would be unique, though, or whether
         * that would break in other places.
         */
-       if (!fl->fl_owner || (fl->fl_flags & (FL_POSIX|FL_BROKEN)) != FL_POSIX)
+       if (!fl->fl_owner || (fl->fl_flags & FL_POSIX) != FL_POSIX)
                return -ENOLCK;
 
        /*