Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Remove the unlock/relock hack by using IO_EXT to...



details:   https://anonhg.NetBSD.org/src/rev/2890fb66a4a8
branches:  trunk
changeset: 971735:2890fb66a4a8
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 02 22:11:16 2020 +0000

description:
Remove the unlock/relock hack by using IO_EXT to indicate that we are already
holding the lock.

diffstat:

 sys/ufs/ffs/ffs_extattr.c |   8 ++------
 sys/ufs/ffs/ffs_inode.c   |  10 ++++++----
 2 files changed, 8 insertions(+), 10 deletions(-)

diffs (77 lines):

diff -r 41fcfd769a87 -r 2890fb66a4a8 sys/ufs/ffs/ffs_extattr.c
--- a/sys/ufs/ffs/ffs_extattr.c Sat May 02 19:46:58 2020 +0000
+++ b/sys/ufs/ffs/ffs_extattr.c Sat May 02 22:11:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_extattr.c,v 1.3 2020/04/20 18:10:10 christos Exp $ */
+/*     $NetBSD: ffs_extattr.c,v 1.4 2020/05/02 22:11:16 christos Exp $ */
 
 /*-
  * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause)
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.3 2020/04/20 18:10:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.4 2020/05/02 22:11:16 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -392,10 +392,8 @@
        }
        if (error) {
                if (ioflag & IO_UNIT) {
-                       genfs_node_unlock(vp);  // XXX: need our own lock
                        (void)ffs_truncate(vp, osize,
                            IO_EXT | (ioflag&IO_SYNC), ucred);
-                       genfs_node_wrlock(vp);
                        uio->uio_offset -= resid - uio->uio_resid;
                        uio->uio_resid = resid;
                }
@@ -561,9 +559,7 @@
                                ffs_unlock_ea(vp);
                                return error;
                        }
-                       genfs_node_unlock(vp);  // XXX: need our own lock
                        error = ffs_truncate(vp, 0, IO_EXT, cred);
-                       genfs_node_wrlock(vp);
                        UFS_WAPBL_END(vp->v_mount);
                }
                error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred);
diff -r 41fcfd769a87 -r 2890fb66a4a8 sys/ufs/ffs/ffs_inode.c
--- a/sys/ufs/ffs/ffs_inode.c   Sat May 02 19:46:58 2020 +0000
+++ b/sys/ufs/ffs/ffs_inode.c   Sat May 02 22:11:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_inode.c,v 1.128 2020/04/23 21:47:09 ad Exp $       */
+/*     $NetBSD: ffs_inode.c,v 1.129 2020/05/02 22:11:16 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.128 2020/04/23 21:47:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.129 2020/05/02 22:11:16 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -376,7 +376,8 @@
                }
        }
 
-       genfs_node_wrlock(ovp);
+       if (!(ioflag & IO_EXT))
+               genfs_node_wrlock(ovp);
        oip->i_size = length;
        DIP_ASSIGN(oip, size, length);
        uvm_vnp_setsize(ovp, length);
@@ -585,7 +586,8 @@
        oip->i_size = length;
        DIP_ASSIGN(oip, size, length);
        DIP_ADD(oip, blocks, -blocksreleased);
-       genfs_node_unlock(ovp);
+       if (!(ioflag & IO_EXT))
+               genfs_node_unlock(ovp);
        oip->i_flag |= IN_CHANGE;
        UFS_WAPBL_UPDATE(ovp, NULL, NULL, 0);
 #if defined(QUOTA) || defined(QUOTA2)



Home | Main Index | Thread Index | Old Index