Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Nov 2018 15:14:31 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340679 - head/sys/fs/tmpfs
Message-ID:  <201811201514.wAKFEVqP043123@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Tue Nov 20 15:14:30 2018
New Revision: 340679
URL: https://svnweb.freebsd.org/changeset/base/340679

Log:
  tmpfs: use unr64 for inode numbers
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vfsops.c

Modified: head/sys/fs/tmpfs/tmpfs.h
==============================================================================
--- head/sys/fs/tmpfs/tmpfs.h	Tue Nov 20 15:12:37 2018	(r340678)
+++ head/sys/fs/tmpfs/tmpfs.h	Tue Nov 20 15:14:30 2018	(r340679)
@@ -353,7 +353,7 @@ struct tmpfs_mount {
 	ino_t			tm_nodes_max;
 
 	/* unrhdr used to allocate inode numbers */
-	struct unrhdr *		tm_ino_unr;
+	struct unrhdr64		tm_ino_unr;
 
 	/* Number of nodes currently that are in use. */
 	ino_t			tm_nodes_inuse;

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c	Tue Nov 20 15:12:37 2018	(r340678)
+++ head/sys/fs/tmpfs/tmpfs_subr.c	Tue Nov 20 15:14:30 2018	(r340679)
@@ -230,7 +230,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount 
 	nnode->tn_uid = uid;
 	nnode->tn_gid = gid;
 	nnode->tn_mode = mode;
-	nnode->tn_id = alloc_unr(tmp->tm_ino_unr);
+	nnode->tn_id = alloc_unr64(&tmp->tm_ino_unr);
 	nnode->tn_refcount = 1;
 
 	/* Type-specific initialization. */
@@ -368,13 +368,6 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct
 		panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type);
 	}
 
-	/*
-	 * If we are unmounting there is no need for going through the overhead
-	 * of freeing the inodes from the unr individually, so free them all in
-	 * one go later.
-	 */
-	if (!detach)
-		free_unr(tmp->tm_ino_unr, node->tn_id);
 	uma_zfree(tmp->tm_node_pool, node);
 	TMPFS_LOCK(tmp);
 	tmpfs_free_tmp(tmp);

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vfsops.c	Tue Nov 20 15:12:37 2018	(r340678)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.c	Tue Nov 20 15:14:30 2018	(r340679)
@@ -231,7 +231,7 @@ tmpfs_mount(struct mount *mp)
 
 	tmp->tm_pages_max = pages;
 	tmp->tm_pages_used = 0;
-	tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock);
+	new_unrhdr64(&tmp->tm_ino_unr, 2);
 	tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent",
 	    sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL,
 	    UMA_ALIGN_PTR, 0);
@@ -248,7 +248,6 @@ tmpfs_mount(struct mount *mp)
 	if (error != 0 || root == NULL) {
 		uma_zdestroy(tmp->tm_node_pool);
 		uma_zdestroy(tmp->tm_dirent_pool);
-		delete_unrhdr(tmp->tm_ino_unr);
 		free(tmp, M_TMPFSMNT);
 		return (error);
 	}
@@ -343,8 +342,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp)
 
 	uma_zdestroy(tmp->tm_dirent_pool);
 	uma_zdestroy(tmp->tm_node_pool);
-	clear_unrhdr(tmp->tm_ino_unr);
-	delete_unrhdr(tmp->tm_ino_unr);
 
 	mtx_destroy(&tmp->tm_allnode_lock);
 	MPASS(tmp->tm_pages_used == 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811201514.wAKFEVqP043123>