Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 2020 12:13:21 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r357759 - stable/12/sys/fs/tmpfs
Message-ID:  <202002111213.01BCDLW9048979@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb 11 12:13:21 2020
New Revision: 357759
URL: https://svnweb.freebsd.org/changeset/base/357759

Log:
  MFC r357511:
  tmpfs_mount update: simplify, cache the value of VFS_TO_TMPFS() calculation.

Modified:
  stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
==============================================================================
--- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c	Tue Feb 11 12:05:59 2020	(r357758)
+++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c	Tue Feb 11 12:13:21 2020	(r357759)
@@ -344,6 +344,7 @@ tmpfs_mount(struct mount *mp)
 		/* Only support update mounts for certain options. */
 		if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
 			return (EOPNOTSUPP);
+		tmp = VFS_TO_TMPFS(mp);
 		if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) == 0) {
 			/*
 			 * On-the-fly resizing is not supported (yet). We still
@@ -352,17 +353,17 @@ tmpfs_mount(struct mount *mp)
 			 * parameter, say trying to change rw to ro or vice
 			 * versa, would cause vfs_filteropt() to bail.
 			 */
-			if (size_max != VFS_TO_TMPFS(mp)->tm_size_max)
+			if (size_max != tmp->tm_size_max)
 				return (EOPNOTSUPP);
 		}
 		if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
-		    !(VFS_TO_TMPFS(mp)->tm_ronly)) {
+		    !tmp->tm_ronly) {
 			/* RW -> RO */
 			return (tmpfs_rw_to_ro(mp));
 		} else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
-		    VFS_TO_TMPFS(mp)->tm_ronly) {
+		    tmp->tm_ronly) {
 			/* RO -> RW */
-			VFS_TO_TMPFS(mp)->tm_ronly = 0;
+			tmp->tm_ronly = 0;
 			MNT_ILOCK(mp);
 			mp->mnt_flag &= ~MNT_RDONLY;
 			MNT_IUNLOCK(mp);



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