Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Kill the IN_RENAME in-core inode flag in ufs and ext2fs.



details:   https://anonhg.NetBSD.org/src/rev/085a9cfe315d
branches:  trunk
changeset: 779593:085a9cfe315d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jun 04 20:13:47 2012 +0000

description:
Kill the IN_RENAME in-core inode flag in ufs and ext2fs.

Now that rename works we need not to wave this sort of voodoo at it.

ok dholland

diffstat:

 sys/ufs/ext2fs/ext2fs_rename.c |  19 ++-----------------
 sys/ufs/ufs/inode.h            |   4 ++--
 sys/ufs/ufs/ufs_rename.c       |  22 ++--------------------
 sys/ufs/ufs/ufs_vnops.c        |   8 ++------
 usr.sbin/pstat/pstat.c         |   5 ++---
 5 files changed, 10 insertions(+), 48 deletions(-)

diffs (187 lines):

diff -r c469665b4ec6 -r 085a9cfe315d sys/ufs/ext2fs/ext2fs_rename.c
--- a/sys/ufs/ext2fs/ext2fs_rename.c    Mon Jun 04 19:58:57 2012 +0000
+++ b/sys/ufs/ext2fs/ext2fs_rename.c    Mon Jun 04 20:13:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_rename.c,v 1.3 2012/06/04 19:45:59 riastradh Exp $      */
+/*     $NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.3 2012/06/04 19:45:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -309,24 +309,11 @@
        if ((nlink_t)VTOI(fvp)->i_e2fs_nlink >= LINK_MAX)
                return EMLINK;
 
-       /*
-        * XXX There is a pile of logic here to handle a voodoo flag
-        * IN_RENAME.  I think this is a vestige of days when the file
-        * system hackers didn't understand concurrency or race
-        * conditions; I believe it serves no useful function
-        * whatsoever.
-        */
-
        directory_p = (fvp->v_type == VDIR);
        KASSERT(directory_p == ((VTOI(fvp)->i_e2fs_mode & IFMT) == IFDIR));
        KASSERT((tvp == NULL) || (directory_p == (tvp->v_type == VDIR)));
        KASSERT((tvp == NULL) || (directory_p ==
                ((VTOI(tvp)->i_e2fs_mode & IFMT) == IFDIR)));
-       if (directory_p) {
-               if (VTOI(fvp)->i_flag & IN_RENAME)
-                       return EINVAL;
-               VTOI(fvp)->i_flag |= IN_RENAME;
-       }
 
        reparent_p = (fdvp != tdvp);
        KASSERT(reparent_p == (VTOI(fdvp)->i_number != VTOI(tdvp)->i_number));
@@ -516,8 +503,6 @@
        KASSERT(0 < VTOI(fvp)->i_e2fs_nlink);
        VTOI(fvp)->i_e2fs_nlink--;
        VTOI(fvp)->i_flag |= IN_CHANGE;
-       if (directory_p)
-               VTOI(fvp)->i_flag &=~ IN_RENAME;
        return error;
 }
 
diff -r c469665b4ec6 -r 085a9cfe315d sys/ufs/ufs/inode.h
--- a/sys/ufs/ufs/inode.h       Mon Jun 04 19:58:57 2012 +0000
+++ b/sys/ufs/ufs/inode.h       Mon Jun 04 20:13:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inode.h,v 1.60 2012/05/05 04:08:53 yamt Exp $  */
+/*     $NetBSD: inode.h,v 1.61 2012/06/04 20:13:47 riastradh Exp $     */
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -238,7 +238,7 @@
 #define        IN_MODIFY       0x2000          /* Modification time update request. */
 #define        IN_MODIFIED     0x0008          /* Inode has been modified. */
 #define        IN_ACCESSED     0x0010          /* Inode has been accessed. */
-#define        IN_RENAME       0x0020          /* Inode is being renamed. */
+/* #define     IN_UNUSED       0x0020          /* unused, was IN_RENAME */
 #define        IN_SHLOCK       0x0040          /* File has shared lock. */
 #define        IN_EXLOCK       0x0080          /* File has exclusive lock. */
 #define        IN_CLEANING     0x0100          /* LFS: file is being cleaned */
diff -r c469665b4ec6 -r 085a9cfe315d sys/ufs/ufs/ufs_rename.c
--- a/sys/ufs/ufs/ufs_rename.c  Mon Jun 04 19:58:57 2012 +0000
+++ b/sys/ufs/ufs/ufs_rename.c  Mon Jun 04 20:13:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_rename.c,v 1.4 2012/06/04 19:58:57 riastradh Exp $ */
+/*     $NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.4 2012/06/04 19:58:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -321,24 +321,11 @@
        if ((nlink_t)VTOI(fvp)->i_nlink >= LINK_MAX)
                return EMLINK;
 
-       /*
-        * XXX There is a pile of logic here to handle a voodoo flag
-        * IN_RENAME.  I think this is a vestige of days when the file
-        * system hackers didn't understand concurrency or race
-        * conditions; I believe it serves no useful function
-        * whatsoever.
-        */
-
        directory_p = (fvp->v_type == VDIR);
        KASSERT(directory_p == ((VTOI(fvp)->i_mode & IFMT) == IFDIR));
        KASSERT((tvp == NULL) || (directory_p == (tvp->v_type == VDIR)));
        KASSERT((tvp == NULL) || (directory_p ==
                ((VTOI(tvp)->i_mode & IFMT) == IFDIR)));
-       if (directory_p) {
-               if (VTOI(fvp)->i_flag & IN_RENAME)
-                       return EINVAL;
-               VTOI(fvp)->i_flag |= IN_RENAME;
-       }
 
        reparent_p = (fdvp != tdvp);
        KASSERT(reparent_p == (VTOI(fdvp)->i_number != VTOI(tdvp)->i_number));
@@ -562,8 +549,6 @@
        VTOI(fvp)->i_nlink--;
        DIP_ASSIGN(VTOI(fvp), nlink, VTOI(fvp)->i_nlink);
        VTOI(fvp)->i_flag |= IN_CHANGE;
-       if (directory_p)
-               VTOI(fvp)->i_flag &=~ IN_RENAME;
        UFS_WAPBL_UPDATE(fvp, NULL, NULL, 0);
 
 arghmybrainhurts:
@@ -571,9 +556,6 @@
 
 ihateyou:
        fstrans_done(mp);
-       /* XXX UFS kludge -- get rid of me with IN_RENAME!  */
-       if (directory_p)
-               VTOI(fvp)->i_flag &=~ IN_RENAME;
        return error;
 }
 
diff -r c469665b4ec6 -r 085a9cfe315d sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Mon Jun 04 19:58:57 2012 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Mon Jun 04 20:13:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.209 2012/05/09 00:21:18 riastradh Exp $        */
+/*     $NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.209 2012/05/09 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1173,10 +1173,6 @@
         * directory and thus be non-empty.)
         */
        error = 0;
-       if (ip->i_flag & IN_RENAME) {
-               error = EINVAL;
-               goto out;
-       }
        if (ip->i_nlink != 2 ||
            !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
                error = ENOTEMPTY;
diff -r c469665b4ec6 -r 085a9cfe315d usr.sbin/pstat/pstat.c
--- a/usr.sbin/pstat/pstat.c    Mon Jun 04 19:58:57 2012 +0000
+++ b/usr.sbin/pstat/pstat.c    Mon Jun 04 20:13:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pstat.c,v 1.118 2011/08/31 13:32:39 joerg Exp $        */
+/*     $NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $    */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)pstat.c    8.16 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: pstat.c,v 1.118 2011/08/31 13:32:39 joerg Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -453,7 +453,6 @@
        { IN_UPDATE,    'U' },
        { IN_MODIFIED,  'M' },
        { IN_ACCESSED,  'a' },
-       { IN_RENAME,    'R' },
        { IN_SHLOCK,    'S' },
        { IN_EXLOCK,    'E' },
        { IN_CLEANING,  'c' },



Home | Main Index | Thread Index | Old Index