Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/tmpfs Make tmpfs_node_t::tn_gen a 32-bit number, keep...
details: https://anonhg.NetBSD.org/src/rev/8ff64db6cf29
branches: trunk
changeset: 791434:8ff64db6cf29
user: rmind <rmind%NetBSD.org@localhost>
date: Mon Nov 18 01:39:34 2013 +0000
description:
Make tmpfs_node_t::tn_gen a 32-bit number, keep it in sync with tmpfs_fid_t.
Also, change tn_status to unsigned while here.
diffstat:
sys/fs/tmpfs/tmpfs.h | 10 +++++-----
sys/fs/tmpfs/tmpfs_subr.c | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
diffs (84 lines):
diff -r 1397d7789039 -r 8ff64db6cf29 sys/fs/tmpfs/tmpfs.h
--- a/sys/fs/tmpfs/tmpfs.h Mon Nov 18 01:36:49 2013 +0000
+++ b/sys/fs/tmpfs/tmpfs.h Mon Nov 18 01:39:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs.h,v 1.46 2013/11/08 15:44:23 rmind Exp $ */
+/* $NetBSD: tmpfs.h,v 1.47 2013/11/18 01:39:34 rmind Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -99,10 +99,10 @@
/* Inode identifier and generation number. */
ino_t tn_id;
- unsigned long tn_gen;
+ uint32_t tn_gen;
/* Inode status flags (for operations in delayed manner). */
- int tn_status;
+ unsigned tn_status;
/* The inode size. */
off_t tn_size;
@@ -195,8 +195,8 @@
* Bit indicating vnode reclamation.
* We abuse tmpfs_node_t::tn_gen for that.
*/
-#define TMPFS_NODE_GEN_MASK (~0UL >> 1)
-#define TMPFS_RECLAIMING_BIT (~TMPFS_NODE_GEN_MASK)
+#define TMPFS_RECLAIMING_BIT (1U << 31)
+#define TMPFS_NODE_GEN_MASK (TMPFS_RECLAIMING_BIT - 1)
#define TMPFS_NODE_RECLAIMING(node) \
(((node)->tn_gen & TMPFS_RECLAIMING_BIT) != 0)
diff -r 1397d7789039 -r 8ff64db6cf29 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Mon Nov 18 01:36:49 2013 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Mon Nov 18 01:39:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.87 2013/11/16 17:58:27 rmind Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $ */
/*
* Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.87 2013/11/16 17:58:27 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.88 2013/11/18 01:39:34 rmind Exp $");
#include <sys/param.h>
#include <sys/cprng.h>
@@ -127,7 +127,7 @@
* for applications that do not understand 64-bit ino_t.
*/
nnode->tn_id = (ino_t)((uintptr_t)nnode / sizeof(*nnode));
- nnode->tn_gen = TMPFS_NODE_GEN_MASK & (unsigned long)cprng_fast64();
+ nnode->tn_gen = TMPFS_NODE_GEN_MASK & cprng_fast32();
/* Generic initialization. */
nnode->tn_type = type;
@@ -272,7 +272,7 @@
again:
/* If there is already a vnode, try to reclaim it. */
if ((vp = node->tn_vnode) != NULL) {
- atomic_or_ulong(&node->tn_gen, TMPFS_RECLAIMING_BIT);
+ atomic_or_32(&node->tn_gen, TMPFS_RECLAIMING_BIT);
mutex_enter(vp->v_interlock);
mutex_exit(&node->tn_vlock);
error = vget(vp, LK_EXCLUSIVE);
@@ -280,12 +280,12 @@
mutex_enter(&node->tn_vlock);
goto again;
}
- atomic_and_ulong(&node->tn_gen, ~TMPFS_RECLAIMING_BIT);
+ atomic_and_32(&node->tn_gen, ~TMPFS_RECLAIMING_BIT);
*vpp = vp;
return error;
}
if (TMPFS_NODE_RECLAIMING(node)) {
- atomic_and_ulong(&node->tn_gen, ~TMPFS_RECLAIMING_BIT);
+ atomic_and_32(&node->tn_gen, ~TMPFS_RECLAIMING_BIT);
}
/*
Home |
Main Index |
Thread Index |
Old Index