Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/tmpfs tmpfs_statvfs: hold accounting lock, since tmpf...
details: https://anonhg.NetBSD.org/src/rev/7a9ad7b5a55a
branches: trunk
changeset: 755869:7a9ad7b5a55a
user: rmind <rmind%NetBSD.org@localhost>
date: Sat Jun 26 03:38:14 2010 +0000
description:
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.
diffstat:
sys/fs/tmpfs/tmpfs_vfsops.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r 7e571cd47014 -r 7a9ad7b5a55a sys/fs/tmpfs/tmpfs_vfsops.c
--- a/sys/fs/tmpfs/tmpfs_vfsops.c Sat Jun 26 01:48:57 2010 +0000
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c Sat Jun 26 03:38:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_vfsops.c,v 1.45 2010/06/22 18:32:08 rmind Exp $ */
+/* $NetBSD: tmpfs_vfsops.c,v 1.46 2010/06/26 03:38:14 rmind Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.45 2010/06/22 18:32:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.46 2010/06/26 03:38:14 rmind Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -325,23 +325,27 @@
static int
tmpfs_statvfs(struct mount *mp, struct statvfs *sbp)
{
+ struct tmpfs_mount *tmp;
fsfilcnt_t freenodes;
- struct tmpfs_mount *tmp;
+ size_t avail;
tmp = VFS_TO_TMPFS(mp);
sbp->f_iosize = sbp->f_frsize = sbp->f_bsize = PAGE_SIZE;
+ mutex_enter(&tmp->tm_acc_lock);
+ avail = tmpfs_pages_avail(tmp);
sbp->f_blocks = (tmpfs_bytes_max(tmp) >> PAGE_SHIFT);
- sbp->f_bavail = sbp->f_bfree = tmpfs_pages_avail(tmp);
+ sbp->f_bavail = sbp->f_bfree = avail;
sbp->f_bresvd = 0;
freenodes = MIN(tmp->tm_nodes_max - tmp->tm_nodes_cnt,
- tmpfs_pages_avail(tmp) * PAGE_SIZE / sizeof(struct tmpfs_node));
+ avail * PAGE_SIZE / sizeof(struct tmpfs_node));
sbp->f_files = tmp->tm_nodes_cnt + freenodes;
sbp->f_favail = sbp->f_ffree = freenodes;
sbp->f_fresvd = 0;
+ mutex_exit(&tmp->tm_acc_lock);
copy_statvfs_info(sbp, mp);
Home |
Main Index |
Thread Index |
Old Index