Print this page
6198 Let's EOL cachefs


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.

  24  */
  25 
  26 #include <sys/types.h>
  27 #include <sys/errno.h>
  28 #include <sys/cpuvar.h>
  29 #include <sys/vfs.h>
  30 #include <sys/vnode.h>
  31 #include <sys/pathname.h>
  32 #include <sys/callb.h>
  33 #include <sys/fs/ufs_inode.h>
  34 #include <vm/anon.h>
  35 #include <sys/fs/swapnode.h>      /* for swapfs_minfree */
  36 #include <sys/kmem.h>
  37 #include <sys/cpr.h>
  38 #include <sys/conf.h>
  39 #include <sys/machclock.h>
  40 
  41 /*
  42  * CPR miscellaneous support routines
  43  */


1068 {
1069         char *fsname;
1070 
1071         fsname = vfssw[vfsp->vfs_fstype].vsw_name;
1072         return (strcmp(fsname, "ufs") == 0);
1073 }
1074 
1075 int
1076 cpr_is_zfs(struct vfs *vfsp)
1077 {
1078         char *fsname;
1079 
1080         fsname = vfssw[vfsp->vfs_fstype].vsw_name;
1081         return (strcmp(fsname, "zfs") == 0);
1082 }
1083 
1084 /*
1085  * This is a list of file systems that are allowed to be writeable when a
1086  * reusable statefile checkpoint is taken.  They must not have any state that
1087  * cannot be restored to consistency by simply rebooting using the checkpoint.
1088  * (In contrast to ufs, cachefs and pcfs which have disk state that could get
1089  * out of sync with the in-kernel data).
1090  */
1091 int
1092 cpr_reusable_mount_check(void)
1093 {
1094         struct vfs *vfsp;
1095         char *fsname;
1096         char **cpp;
1097         static char *cpr_writeok_fss[] = {
1098                 "autofs", "devfs", "fd", "lofs", "mntfs", "namefs", "nfs",
1099                 "proc", "tmpfs", "ctfs", "objfs", "dev", NULL
1100         };
1101 
1102         vfs_list_read_lock();
1103         vfsp = rootvfs;
1104         do {
1105                 if (vfsp->vfs_flag & VFS_RDONLY) {
1106                         vfsp = vfsp->vfs_next;
1107                         continue;
1108                 }




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  25  */
  26 
  27 #include <sys/types.h>
  28 #include <sys/errno.h>
  29 #include <sys/cpuvar.h>
  30 #include <sys/vfs.h>
  31 #include <sys/vnode.h>
  32 #include <sys/pathname.h>
  33 #include <sys/callb.h>
  34 #include <sys/fs/ufs_inode.h>
  35 #include <vm/anon.h>
  36 #include <sys/fs/swapnode.h>      /* for swapfs_minfree */
  37 #include <sys/kmem.h>
  38 #include <sys/cpr.h>
  39 #include <sys/conf.h>
  40 #include <sys/machclock.h>
  41 
  42 /*
  43  * CPR miscellaneous support routines
  44  */


1069 {
1070         char *fsname;
1071 
1072         fsname = vfssw[vfsp->vfs_fstype].vsw_name;
1073         return (strcmp(fsname, "ufs") == 0);
1074 }
1075 
1076 int
1077 cpr_is_zfs(struct vfs *vfsp)
1078 {
1079         char *fsname;
1080 
1081         fsname = vfssw[vfsp->vfs_fstype].vsw_name;
1082         return (strcmp(fsname, "zfs") == 0);
1083 }
1084 
1085 /*
1086  * This is a list of file systems that are allowed to be writeable when a
1087  * reusable statefile checkpoint is taken.  They must not have any state that
1088  * cannot be restored to consistency by simply rebooting using the checkpoint.
1089  * (In contrast to ufs and pcfs which have disk state that could get
1090  * out of sync with the in-kernel data).
1091  */
1092 int
1093 cpr_reusable_mount_check(void)
1094 {
1095         struct vfs *vfsp;
1096         char *fsname;
1097         char **cpp;
1098         static char *cpr_writeok_fss[] = {
1099                 "autofs", "devfs", "fd", "lofs", "mntfs", "namefs", "nfs",
1100                 "proc", "tmpfs", "ctfs", "objfs", "dev", NULL
1101         };
1102 
1103         vfs_list_read_lock();
1104         vfsp = rootvfs;
1105         do {
1106                 if (vfsp->vfs_flag & VFS_RDONLY) {
1107                         vfsp = vfsp->vfs_next;
1108                         continue;
1109                 }