Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Disallow threshold-initiated cache flush when di...
details: https://anonhg.NetBSD.org/src/rev/8d639f24fef6
branches: trunk
changeset: 471808:8d639f24fef6
user: perseant <perseant%NetBSD.org@localhost>
date: Mon Apr 12 00:36:47 1999 +0000
description:
Disallow threshold-initiated cache flush when dirops are active. Also, make
SET_ENDOP use lfs_check instead of inlining most of it.
diffstat:
sys/ufs/lfs/lfs_bio.c | 18 ++++++++++++++----
sys/ufs/lfs/lfs_vnops.c | 29 ++++++++++++-----------------
2 files changed, 26 insertions(+), 21 deletions(-)
diffs (150 lines):
diff -r 5c37224b471b -r 8d639f24fef6 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c Mon Apr 12 00:30:08 1999 +0000
+++ b/sys/ufs/lfs/lfs_bio.c Mon Apr 12 00:36:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_bio.c,v 1.9 1999/03/25 22:26:52 perseant Exp $ */
+/* $NetBSD: lfs_bio.c,v 1.10 1999/04/12 00:36:47 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -341,7 +341,8 @@
int flags;
{
int error;
-
+ struct lfs *fs;
+
error = 0;
if (incore(vp, blkno))
return (0);
@@ -351,10 +352,19 @@
if (VTOI(vp)->i_number == LFS_IFILE_INUM)
return 0;
+ /* If dirops are active, can't flush. Wait for SET_ENDOP */
+ fs = VTOI(vp)->i_lfs;
+ if (fs->lfs_dirops)
+ return 0;
+
if (locked_queue_count > LFS_MAX_BUFS
- || locked_queue_bytes > LFS_MAX_BYTES)
+ || locked_queue_bytes > LFS_MAX_BYTES
+ || fs->lfs_dirvcount > LFS_MAXDIROP)
{
- lfs_flush(VTOI(vp)->i_lfs, flags);
+ ++fs->lfs_writer;
+ lfs_flush(fs, flags);
+ if(--fs->lfs_writer==0)
+ wakeup(&fs->lfs_dirops);
}
while (locked_queue_count > LFS_WAIT_BUFS
|| locked_queue_bytes > LFS_WAIT_BYTES)
diff -r 5c37224b471b -r 8d639f24fef6 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c Mon Apr 12 00:30:08 1999 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c Mon Apr 12 00:36:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.25 1999/03/29 21:54:26 perseant Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.26 1999/04/12 00:36:47 perseant Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -313,16 +313,11 @@
return 0;
}
-#define SET_ENDOP(fs,str) { \
+#define SET_ENDOP(fs,vp,str) { \
--(fs)->lfs_dirops; \
if (!(fs)->lfs_dirops) { \
wakeup(&(fs)->lfs_writer); \
- if ((fs)->lfs_dirvcount > LFS_MAXDIROP) { \
- ++(fs)->lfs_writer; \
- lfs_flush((fs),0); \
- if(--(fs)->lfs_writer==0) \
- wakeup(&(fs)->lfs_dirops); \
- } \
+ lfs_check((vp),LFS_UNUSED_LBN,0); \
} \
}
@@ -362,7 +357,7 @@
MARK_VNODE(ap->a_dvp);
ret = ufs_symlink(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,*(ap->a_vpp)); /* XXX KS */
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"symilnk");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"symilnk");
return (ret);
}
@@ -383,7 +378,7 @@
MARK_VNODE(ap->a_dvp);
ret = ufs_mknod(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,*(ap->a_vpp)); /* XXX KS */
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"mknod");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"mknod");
return (ret);
}
@@ -404,7 +399,7 @@
MARK_VNODE(ap->a_dvp);
ret = ufs_create(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,*(ap->a_vpp)); /* XXX KS */
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"create");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"create");
return (ret);
}
@@ -423,7 +418,7 @@
return ret;
MARK_VNODE(ap->a_dvp);
ret = ufs_whiteout(ap);
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"whiteout");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"whiteout");
return (ret);
}
@@ -444,7 +439,7 @@
MARK_VNODE(ap->a_dvp);
ret = ufs_mkdir(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,*(ap->a_vpp)); /* XXX KS */
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"mkdir");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"mkdir");
return (ret);
}
@@ -464,7 +459,7 @@
MARK_VNODE(ap->a_vp);
ret = ufs_remove(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,ap->a_vp);
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"remove");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"remove");
return (ret);
}
@@ -486,7 +481,7 @@
MARK_VNODE(ap->a_vp);
ret = ufs_rmdir(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,ap->a_vp);
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"rmdir");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"rmdir");
return (ret);
}
@@ -505,7 +500,7 @@
return ret;
MARK_VNODE(ap->a_dvp);
ret = ufs_link(ap);
- SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,"link");
+ SET_ENDOP(VTOI(ap->a_dvp)->i_lfs,ap->a_dvp,"link");
return (ret);
}
@@ -530,7 +525,7 @@
ret = ufs_rename(ap);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,ap->a_fvp);
MAYBE_INACTIVE(VTOI(ap->a_dvp)->i_lfs,ap->a_tvp);
- SET_ENDOP(VTOI(ap->a_fdvp)->i_lfs,"rename");
+ SET_ENDOP(VTOI(ap->a_fdvp)->i_lfs,ap->a_fdvp,"rename");
return (ret);
}
Home |
Main Index |
Thread Index |
Old Index