svn commit: r326998 - head/sys/fs/tmpfs
John Baldwin
jhb at FreeBSD.org
Tue Dec 19 20:19:09 UTC 2017
Author: jhb
Date: Tue Dec 19 20:19:07 2017
New Revision: 326998
URL: https://svnweb.freebsd.org/changeset/base/326998
Log:
Update tmpfs link count handling for ino64.
Add a new TMPFS_LINK_MAX to use in place of LINK_MAX for link overflow
checks and pathconf() reporting. Rather than storing a full 64-bit
link count, just use a plain int and use INT_MAX as TMPFS_LINK_MAX.
Discussed with: bde
Reviewed by: kib (part of a larger patch)
Sponsored by: Chelsio Communications
Modified:
head/sys/fs/tmpfs/tmpfs.h
head/sys/fs/tmpfs/tmpfs_subr.c
head/sys/fs/tmpfs/tmpfs_vnops.c
Modified: head/sys/fs/tmpfs/tmpfs.h
==============================================================================
--- head/sys/fs/tmpfs/tmpfs.h Tue Dec 19 20:17:07 2017 (r326997)
+++ head/sys/fs/tmpfs/tmpfs.h Tue Dec 19 20:19:07 2017 (r326998)
@@ -188,8 +188,8 @@ struct tmpfs_node {
uid_t tn_uid; /* (v) */
gid_t tn_gid; /* (v) */
mode_t tn_mode; /* (v) */
+ int tn_links; /* (v) */
u_long tn_flags; /* (v) */
- nlink_t tn_links; /* (v) */
struct timespec tn_atime; /* (vi) */
struct timespec tn_mtime; /* (vi) */
struct timespec tn_ctime; /* (vi) */
@@ -296,6 +296,8 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
#define tn_link tn_spec.tn_link
#define tn_reg tn_spec.tn_reg
#define tn_fifo tn_spec.tn_fifo
+
+#define TMPFS_LINK_MAX INT_MAX
#define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock)
#define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock)
Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c Tue Dec 19 20:17:07 2017 (r326997)
+++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Dec 19 20:19:07 2017 (r326998)
@@ -739,8 +739,8 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp
if (vap->va_type == VDIR) {
/* Ensure that we do not overflow the maximum number of links
* imposed by the system. */
- MPASS(dnode->tn_links <= LINK_MAX);
- if (dnode->tn_links == LINK_MAX) {
+ MPASS(dnode->tn_links <= TMPFS_LINK_MAX);
+ if (dnode->tn_links == TMPFS_LINK_MAX) {
return (EMLINK);
}
Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Dec 19 20:17:07 2017 (r326997)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Dec 19 20:19:07 2017 (r326998)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/dirent.h>
#include <sys/fcntl.h>
+#include <sys/limits.h>
#include <sys/lockf.h>
#include <sys/lock.h>
#include <sys/mount.h>
@@ -618,8 +619,8 @@ tmpfs_link(struct vop_link_args *v)
/* Ensure that we do not overflow the maximum number of links imposed
* by the system. */
- MPASS(node->tn_links <= LINK_MAX);
- if (node->tn_links == LINK_MAX) {
+ MPASS(node->tn_links <= TMPFS_LINK_MAX);
+ if (node->tn_links == TMPFS_LINK_MAX) {
error = EMLINK;
goto out;
}
@@ -1349,7 +1350,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
switch (name) {
case _PC_LINK_MAX:
- *retval = LINK_MAX;
+ *retval = TMPFS_LINK_MAX;
break;
case _PC_NAME_MAX:
More information about the svn-src-all
mailing list