Print this page
    
re #13613 rb4516 Tunables needs volatile keyword
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/sys/fs/ufs_quota.h
          +++ new/usr/src/uts/common/sys/fs/ufs_quota.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License, Version 1.0 only
   6    6   * (the "License").  You may not use this file except in compliance
   7    7   * with the License.
   8    8   *
   9    9   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10   10   * or http://www.opensolaris.org/os/licensing.
  11   11   * See the License for the specific language governing permissions
  12   12   * and limitations under the License.
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  
    | 
      ↓ open down ↓ | 
    15 lines elided | 
    
      ↑ open up ↑ | 
  
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 1999 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
       26 +/*
       27 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       28 + */
  26   29  
  27   30  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   31  /*        All Rights Reserved   */
  29   32  
  30   33  /*
  31   34   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   35   * The Regents of the University of California
  33   36   * All Rights Reserved
  34   37   *
  35   38   * University Acknowledgment- Portions of this document are derived from
  36   39   * software developed by the University of California, Berkeley, and its
  37   40   * contributors.
  38   41   */
  39   42  
  40   43  #ifndef _SYS_FS_UFS_QUOTA_H
  41   44  #define _SYS_FS_UFS_QUOTA_H
  42   45  
  43   46  #ifdef  __cplusplus
  44   47  extern "C" {
  45   48  #endif
  46   49  
  47   50  /*
  48   51   * Lock order for the quota sub-system:
  49   52   *
  50   53   *  vfs_dqrwlock > ip.i_contents > dq_cachelock > dquot.dq_lock > dq_freelock
  51   54   *  vfs_dqrwlock > ip.i_contents > dq_cachelock >                 dq_freelock
  52   55   *  vfs_dqrwlock > ip.i_contents >                dquot.dq_lock > dq_freelock
  53   56   *  vfs_dqrwlock > ip.i_contents >                                dq_freelock
  54   57   *  vfs_dqrwlock > ip.i_contents > dq_cachelock > dquot.dq_lock > qip.i_contents
  55   58   */
  56   59  
  57   60  /*
  58   61   * The following constants define the default amount of time given a user
  59   62   * before the soft limits are treated as hard limits (usually resulting
  60   63   * in an allocation failure). These may be  modified by the quotactl
  61   64   * system call with the Q_SETQLIM or Q_SETQUOTA commands.
  62   65   */
  63   66  
  64   67  #define DQ_FTIMELIMIT   (7 * 24*60*60)          /* 1 week */
  65   68  #define DQ_BTIMELIMIT   (7 * 24*60*60)          /* 1 week */
  66   69  
  67   70  /*
  68   71   * The dqblk structure defines the format of the disk quota file
  69   72   * (as it appears on disk) - the file is an array of these structures
  70   73   * indexed by user number.  The setquota sys call establishes the inode
  71   74   * for each quota file (a pointer is retained in the mount structure).
  72   75   */
  73   76  
  74   77  struct dqblk {
  75   78          uint32_t  dqb_bhardlimit; /* absolute limit on disk blks alloc */
  76   79          uint32_t  dqb_bsoftlimit; /* preferred limit on disk blks */
  77   80          uint32_t  dqb_curblocks;  /* current block count */
  78   81          uint32_t  dqb_fhardlimit; /* maximum # allocated files + 1 */
  79   82          uint32_t  dqb_fsoftlimit; /* preferred file limit */
  80   83          uint32_t  dqb_curfiles;   /* current # allocated files */
  81   84          uint32_t  dqb_btimelimit; /* time limit for excessive disk use */
  82   85          uint32_t  dqb_ftimelimit; /* time limit for excessive files */
  83   86  };
  84   87  
  85   88  #define dqoff(UID)      (((offset_t)(UID) * sizeof (struct dqblk)))
  86   89  
  87   90  /*
  88   91   * The dquot structure records disk usage for a user on a filesystem.
  89   92   * There is one allocated for each quota that exists on any filesystem
  90   93   * for the current user. A cache is kept of recently used entries.
  91   94   * Active inodes have a pointer to the dquot associated with them.
  92   95   */
  93   96  struct  dquot {
  94   97          struct dquot *dq_forw, *dq_back; /* hash list, MUST be first entry */
  95   98          struct dquot *dq_freef, *dq_freeb; /* free list */
  96   99          short   dq_flags;
  97  100  #define DQ_ERROR        0x01            /* An error occurred reading dq */
  98  101  #define DQ_MOD          0x04            /* this quota modified since read */
  99  102  #define DQ_BLKS         0x10            /* has been warned about blk limit */
 100  103  #define DQ_FILES        0x20            /* has been warned about file limit */
 101  104  #define DQ_TRANS        0x40            /* logging ufs operation started */
 102  105          ulong_t dq_cnt;                 /* count of active references */
 103  106          uid_t   dq_uid;                 /* user this applies to */
 104  107          struct ufsvfs *dq_ufsvfsp;      /* filesystem this relates to */
 105  108          offset_t dq_mof;                /* master disk offset of quota record */
 106  109          struct dqblk dq_dqb;            /* actual usage & quotas */
 107  110  #ifdef _KERNEL
 108  111          kmutex_t        dq_lock;        /* per dq structure lock */
 109  112  #endif /* _KERNEL */
 110  113  };
 111  114  
 112  115  #define dq_bhardlimit   dq_dqb.dqb_bhardlimit
 113  116  #define dq_bsoftlimit   dq_dqb.dqb_bsoftlimit
 114  117  #define dq_curblocks    dq_dqb.dqb_curblocks
 115  118  #define dq_fhardlimit   dq_dqb.dqb_fhardlimit
 116  119  #define dq_fsoftlimit   dq_dqb.dqb_fsoftlimit
 117  120  #define dq_curfiles     dq_dqb.dqb_curfiles
 118  121  #define dq_btimelimit   dq_dqb.dqb_btimelimit
 119  122  #define dq_ftimelimit   dq_dqb.dqb_ftimelimit
 120  123  
 121  124  /*
 122  125   * flags for vfs_qflags in ufsvfs struct
 123  126   */
 124  127  #define MQ_ENABLED      0x01            /* quotas are enabled */
 125  128  
 126  129  #if defined(_KERNEL)
 127  130  
 128  131  /*
 129  132   * dquot chach hash chain headers
 130  133   */
 131  134  #define NDQHASH         64                      /* smallish power of two */
 132  135  #define DQHASH(uid, mp) \
  
    | 
      ↓ open down ↓ | 
    97 lines elided | 
    
      ↑ open up ↑ | 
  
 133  136          (((uintptr_t)(mp) + (unsigned)(uid)) & (NDQHASH-1))
 134  137  
 135  138  struct  dqhead {
 136  139          struct  dquot   *dqh_forw;      /* MUST be first */
 137  140          struct  dquot   *dqh_back;      /* MUST be second */
 138  141  };
 139  142  
 140  143  extern struct dqhead dqhead[NDQHASH];
 141  144  
 142  145  extern struct dquot *dquot, *dquotNDQUOT;
 143      -extern int ndquot;
      146 +extern volatile int ndquot;
 144  147  extern krwlock_t dq_rwlock;             /* quota sub-system init lock */
 145  148  extern int quotas_initialized;          /* quota sub-system init flag */
 146  149  
 147  150  extern void qtinit();
 148  151  extern void qtinit2();
 149  152  extern struct dquot *getinoquota(struct inode *);
 150  153  extern int chkdq(struct inode *ip, long, int, struct cred *, char **errp,
 151  154                  size_t *lenp);
 152  155  extern int chkiq(struct ufsvfs *, int, struct inode *, uid_t, int,
 153  156                  struct cred *, char **errp, size_t *lenp);
 154  157  extern void dqrele(struct dquot *);
 155  158  extern int closedq(struct ufsvfs *, struct cred *);
 156  159  extern int qsync(struct ufsvfs *);
 157  160  
 158  161  extern int getdiskquota(uid_t, struct ufsvfs *, int, struct dquot **);
 159  162  extern void dqput(struct dquot *);
 160  163  extern void dqupdate(struct dquot *);
 161  164  extern void dqinval(struct dquot *);
 162  165  extern void invalidatedq(struct ufsvfs *);
 163  166  
 164  167  extern int quotactl(struct vnode *, intptr_t, int flag, struct cred *);
 165  168  
 166  169  #endif  /* _KERNEL */
 167  170  
 168  171  /*
 169  172   * Definitions for the 'quotactl' system call.
 170  173   */
 171  174  #define Q_QUOTAON       1       /* turn quotas on */
 172  175  #define Q_QUOTAOFF      2       /* turn quotas off */
 173  176  #define Q_SETQUOTA      3       /* set disk limits & usage */
 174  177  #define Q_GETQUOTA      4       /* get disk limits & usage */
 175  178  #define Q_SETQLIM       5       /* set disk limits only */
 176  179  #define Q_SYNC          6       /* update disk copy of quota usages */
 177  180  #define Q_ALLSYNC       7       /* update disk copy of quota usages for all */
 178  181  
 179  182  #ifdef _SYSCALL32
 180  183  /* ILP32 compatible structure for LP64 kernel. */
 181  184  struct quotctl32 {
 182  185          int             op;
 183  186          uid_t           uid;
 184  187          uint32_t        addr;
 185  188  };
 186  189  #endif /* SYSCALL32 */
 187  190  
 188  191  struct quotctl {
 189  192          int     op;
 190  193          uid_t   uid;
 191  194          caddr_t addr;
 192  195  };
 193  196  
 194  197  #define Q_QUOTACTL      0x00030189      /* ioctl command for quotactl */
 195  198  
 196  199  #ifdef  __cplusplus
 197  200  }
 198  201  #endif
 199  202  
 200  203  #endif  /* _SYS_FS_UFS_QUOTA_H */
  
    | 
      ↓ open down ↓ | 
    47 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX