Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/udf Move the removal of unlinked nodes from udf_inact...



details:   https://anonhg.NetBSD.org/src/rev/96605720dfd8
branches:  trunk
changeset: 807337:96605720dfd8
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Apr 06 08:38:25 2015 +0000

description:
Move the removal of unlinked nodes from udf_inactive() to udf_reclaim().

diffstat:

 sys/fs/udf/udf_vnops.c |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 4dca39c6b956 -r 96605720dfd8 sys/fs/udf/udf_vnops.c
--- a/sys/fs/udf/udf_vnops.c    Mon Apr 06 07:38:17 2015 +0000
+++ b/sys/fs/udf/udf_vnops.c    Mon Apr 06 08:38:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.99 2015/04/06 08:38:25 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.99 2015/04/06 08:38:25 hannken Exp $");
 #endif /* not lint */
 
 
@@ -97,9 +97,7 @@
        }
 
        /*
-        * Optionally flush metadata to disc. If the file has not been
-        * referenced anymore in a directory we ought to free up the resources
-        * on disc if applicable.
+        * Optionally flush metadata to disc.
         */
        if (udf_node->fe) {
                refcnt = udf_rw16(udf_node->fe->link_cnt);
@@ -116,10 +114,7 @@
 
        *ap->a_recycle = false;
        if ((refcnt == 0) && ((vp->v_vflag & VV_SYSTEM) == 0)) {
-               /* remove this file's allocation */
-               DPRINTF(NODE, ("udf_inactive deleting unlinked file\n"));
                *ap->a_recycle = true;
-               udf_delete_node(udf_node);
                VOP_UNLOCK(vp);
                return 0;
        }
@@ -144,6 +139,7 @@
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
        struct udf_node *udf_node = VTOI(vp);
+       int refcnt;
 
        DPRINTF(NODE, ("udf_reclaim called for node %p\n", udf_node));
        if (prtactive && vp->v_usecount > 1)
@@ -154,6 +150,23 @@
                return 0;
        }
 
+       /*
+        * If the file has not been referenced anymore in a directory
+        * we ought to free up the resources on disc if applicable.
+        */
+       if (udf_node->fe) {
+               refcnt = udf_rw16(udf_node->fe->link_cnt);
+       } else {
+               assert(udf_node->efe);
+               refcnt = udf_rw16(udf_node->efe->link_cnt);
+       }
+
+       if ((refcnt == 0) && ((vp->v_vflag & VV_SYSTEM) == 0)) {
+               /* remove this file's allocation */
+               DPRINTF(NODE, ("udf_inactive deleting unlinked file\n"));
+               udf_delete_node(udf_node);
+       }
+
        /* update note for closure */
        udf_update(vp, NULL, NULL, NULL, UPDATE_CLOSE);
 



Home | Main Index | Thread Index | Old Index