Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/udf Rework simplistic UBC flushing. Recent changes to...



details:   https://anonhg.NetBSD.org/src/rev/4c5c49bb45e7
branches:  trunk
changeset: 747439:4c5c49bb45e7
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Sep 14 21:10:44 2009 +0000

description:
Rework simplistic UBC flushing. Recent changes to genfs made the old flush
system generate heaps of odd allocations since the end of write request was
overwritten by the start of the second resulting in another relocation.

Also added a full flush of the file on a VOP_CLOSE(). This automatically
flushes file tails to disc.

diffstat:

 sys/fs/udf/udf_vnops.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (60 lines):

diff -r accc1897a049 -r 4c5c49bb45e7 sys/fs/udf/udf_vnops.c
--- a/sys/fs/udf/udf_vnops.c    Mon Sep 14 20:54:34 2009 +0000
+++ b/sys/fs/udf/udf_vnops.c    Mon Sep 14 21:10:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.54 2009/07/30 12:13:51 reinoud Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.55 2009/09/14 21:10:44 reinoud 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.54 2009/07/30 12:13:51 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.55 2009/09/14 21:10:44 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -364,16 +364,14 @@
                 * flush what we just wrote if necessary.
                 * XXXUBC simplistic async flushing.
                 *
-                * this one works on page sizes. Directories are excluded
-                * since its file data that we want to purge.
+                * Directories are excluded since its file data that we want
+                * to purge.
                 */
                if (!async && (vp->v_type != VDIR) &&
-                 (uio->uio_offset - old_offset >= PAGE_SIZE)) {
+                 (old_offset >> 16 != uio->uio_offset >> 16)) {
                        mutex_enter(&vp->v_interlock);
-                       error = VOP_PUTPAGES(vp,
-                               ptoa(atop(old_offset)),
-                               ptoa(atop(uio->uio_offset + PAGE_SIZE-1)),
-                               PGO_CLEANIT);
+                       error = VOP_PUTPAGES(vp, (old_offset >> 16) << 16,
+                           (uio->uio_offset >> 16) << 16, PGO_CLEANIT);
                        old_offset = uio->uio_offset;
                }
        }
@@ -1297,10 +1295,19 @@
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
        struct udf_node *udf_node = VTOI(vp);
+       int async = vp->v_mount->mnt_flag & MNT_ASYNC;
+       int error;
 
        DPRINTF(CALL, ("udf_close called\n"));
        udf_node = udf_node;    /* shut up gcc */
 
+       if (!async && (vp->v_type != VDIR)) {
+               mutex_enter(&vp->v_interlock);
+               error = VOP_PUTPAGES(vp, 0, 0, PGO_CLEANIT);
+               if (error)
+                       return error;
+       }
+
        mutex_enter(&vp->v_interlock);
                if (vp->v_usecount > 1)
                        udf_itimes(udf_node, NULL, NULL, NULL);



Home | Main Index | Thread Index | Old Index