Source-Changes-HG archive

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

[src/trunk]: src/sys/msdosfs Support async option by using delayed writes for...



details:   https://anonhg.NetBSD.org/src/rev/0a9ef966c204
branches:  trunk
changeset: 484170:0a9ef966c204
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Mar 27 09:44:45 2000 +0000

description:
Support async option by using delayed writes for metadata when mounted
with async. This increases the speed of my extract-archive test by about
20% on floppy, 10% on ZIP. "You've got the rope."

diffstat:

 sys/msdosfs/msdosfs_lookup.c |  25 +++++++++++++++++++------
 sys/msdosfs/msdosfs_vnops.c  |   7 +++++--
 2 files changed, 24 insertions(+), 8 deletions(-)

diffs (109 lines):

diff -r 8d657b996741 -r 0a9ef966c204 sys/msdosfs/msdosfs_lookup.c
--- a/sys/msdosfs/msdosfs_lookup.c      Mon Mar 27 09:41:36 2000 +0000
+++ b/sys/msdosfs/msdosfs_lookup.c      Mon Mar 27 09:44:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_lookup.c,v 1.48 2000/03/24 14:37:46 jdolecek Exp $     */
+/*     $NetBSD: msdosfs_lookup.c,v 1.49 2000/03/27 09:44:45 jdolecek Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -603,6 +603,7 @@
        struct buf *bp;
        daddr_t bn;
        int blsize, i;
+       int async = ddep->de_pmp->pm_mountp->mnt_flag & MNT_ASYNC;
 
 #ifdef MSDOSFS_DEBUG
        printf("createde(dep %p, ddep %p, depp %p, cnp %p)\n",
@@ -669,7 +670,9 @@
                                /* we should never get here if ddep is root
                                 * directory */
 
-                               if ((error = bwrite(bp)) != 0)
+                               if (async)
+                                       (void) bdwrite(bp);
+                               else if ((error = bwrite(bp)) != 0)
                                        goto rollback;
 
                                fndoffset -= sizeof(struct direntry);
@@ -697,7 +700,9 @@
                }
        }
 
-       if ((error = bwrite(bp)) != 0)
+       if (async)
+               bdwrite(bp);
+       else if ((error = bwrite(bp)) != 0)
                goto rollback;
 
        /*
@@ -745,7 +750,9 @@
                        /* we should never get here if ddep is root
                         * directory */
 
-                       if ((rberror = bwrite(bp)) != 0)
+                       if (async)
+                               bdwrite(bp);
+                       else if ((rberror = bwrite(bp)) != 0)
                                goto err_norollback;
 
                        fndoffset -= sizeof(struct direntry);
@@ -769,7 +776,10 @@
        }
 
        /* ignore any further error */
-       (void) bwrite(bp);
+       if (async)
+               (void) bdwrite(bp);
+       else
+               (void) bwrite(bp);
 
     err_norollback:
        return error;
@@ -1009,6 +1019,7 @@
        int blsize;
        struct msdosfsmount *pmp = pdep->de_pmp;
        u_long offset = pdep->de_fndoffset;
+       int async = pdep->de_pmp->pm_mountp->mnt_flag & MNT_ASYNC;
 
 #ifdef MSDOSFS_DEBUG
        printf("removede(): filename %s, dep %p, offset %08lx\n",
@@ -1053,7 +1064,9 @@
                            || ep->deAttributes != ATTR_WIN95)
                                break;
                }
-               if ((error = bwrite(bp)) != 0)
+               if (async)
+                       bdwrite(bp);
+               else if ((error = bwrite(bp)) != 0)
                        return error;
        } while (!(pmp->pm_flags & MSDOSFSMNT_NOWIN95)
            && !(offset & pmp->pm_crbomask)
diff -r 8d657b996741 -r 0a9ef966c204 sys/msdosfs/msdosfs_vnops.c
--- a/sys/msdosfs/msdosfs_vnops.c       Mon Mar 27 09:41:36 2000 +0000
+++ b/sys/msdosfs/msdosfs_vnops.c       Mon Mar 27 09:44:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.92 2000/03/13 23:52:42 soren Exp $ */
+/*     $NetBSD: msdosfs_vnops.c,v 1.93 2000/03/27 09:44:46 jdolecek Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -1258,6 +1258,7 @@
        struct msdosfsmount *pmp = pdep->de_pmp;
        struct buf *bp;
        struct timespec ts;
+       int async = pdep->de_pmp->pm_mountp->mnt_flag & MNT_ASYNC;
 
        /*
         * If this is the root directory and there is no space left we
@@ -1316,7 +1317,9 @@
                putushort(denp[1].deHighClust, pdep->de_StartCluster >> 16);
        }
 
-       if ((error = bwrite(bp)) != 0)
+       if (async)
+               bdwrite(bp);
+       else if ((error = bwrite(bp)) != 0)
                goto bad;
 
        /*



Home | Main Index | Thread Index | Old Index