]> git.neil.brown.name Git - history.git/commitdiff
Cleanup xfs and pagebuf sysctl code, use posix initializers to avoid
authorStephen Lord <lord@jen.americas.sgi.com>
Wed, 9 Jul 2003 06:40:23 +0000 (01:40 -0500)
committerStephen Lord <lord@sgi.com>
Wed, 9 Jul 2003 06:40:23 +0000 (01:40 -0500)
confusion in the future over which constants apply to which initializers.

Documentation/filesystems/xfs.txt
fs/xfs/linux/xfs_globals.c
fs/xfs/linux/xfs_linux.h
fs/xfs/linux/xfs_super.c
fs/xfs/linux/xfs_sysctl.c
fs/xfs/linux/xfs_sysctl.h
fs/xfs/pagebuf/page_buf.c
fs/xfs/pagebuf/page_buf_internal.h
fs/xfs/xfs_vfsops.c

index 33538b8704f74b0a4c74fad25684684a59e1db12..947a56bd63322fcdcadb9fde2be8b804646f41eb 100644 (file)
@@ -14,8 +14,8 @@ for further details.  This implementation is on-disk compatible
 with the IRIX version of XFS.
 
 
-Options
-=======
+Mount Options
+=============
 
 When mounting an XFS filesystem, the following options are accepted.
 
@@ -107,3 +107,66 @@ When mounting an XFS filesystem, the following options are accepted.
         Don't check for double mounted file systems using the file system uuid.
         This is useful to mount LVM snapshot volumes.
 
+sysctls
+=======
+
+The following sysctls are available for the XFS filesystem:
+
+  fs.xfs.stats_clear           (Min: 0  Default: 0  Max: 1)
+       Setting this to "1" clears accumulated XFS statistics 
+       in /proc/fs/xfs/stat.  It then immediately reset to "0".
+       
+  fs.xfs.sync_interval         (Min: HZ  Default: 30*HZ  Max: 60*HZ)
+       The interval at which the xfssyncd thread for xfs filesystems
+       flushes metadata out to disk. This thread will flush log
+       activity out, and do some processing on unlinked inodes
+
+  fs.xfs.error_level           (Min: 0  Default: 3  Max: 11)
+       A volume knob for error reporting when internal errors occur.
+       This will generate detailed messages & backtraces for filesystem
+       shutdowns, for example.  Current threshold values are:
+
+               XFS_ERRLEVEL_OFF:       0
+               XFS_ERRLEVEL_LOW:       1
+               XFS_ERRLEVEL_HIGH:      5
+
+  fs.xfs.panic_mask            (Min: 0  Default: 0  Max: 127)
+       Causes certain error conditions to call BUG(). Value is a bitmask; 
+       AND together the tags which represent errors which should cause panics:
+       
+               XFS_NO_PTAG                     0LL
+               XFS_PTAG_IFLUSH                 0x0000000000000001LL
+               XFS_PTAG_LOGRES                 0x0000000000000002LL
+               XFS_PTAG_AILDELETE              0x0000000000000004LL
+               XFS_PTAG_ERROR_REPORT           0x0000000000000008LL
+               XFS_PTAG_SHUTDOWN_CORRUPT       0x0000000000000010LL
+               XFS_PTAG_SHUTDOWN_IOERROR       0x0000000000000020LL
+               XFS_PTAG_SHUTDOWN_LOGERROR      0x0000000000000040LL
+
+       This option is intended for debugging only.             
+
+  fs.xfs.irix_symlink_mode     (Min: 0  Default: 0  Max: 1)
+       Controls whether symlinks are created with mode 0777 (default)
+       or whether their mode is affected by the umask (irix mode).
+
+  fs.xfs.irix_sgid_inherit     (Min: 0  Default: 0  Max: 1)
+       Controls files created in SGID directories.
+       If the group ID of the new file does not match the effective group
+       ID or one of the supplementary group IDs of the parent dir, the 
+       ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl 
+       is set.
+
+  fs.xfs.restrict_chown                (Min: 0  Default: 1  Max: 1)
+       Controls whether unprivileged users can use chown to "give away"
+       a file to another user.
+
+  vm.pagebuf.stats_clear       (Min: 0  Default: 0  Max: 1)
+       Setting this to "1" clears accumulated pagebuf statistics 
+       in /proc/fs/pagebuf/stat.  It then immediately reset to "0".
+       
+  vm.pagebuf.flush_age         (Min: 1*HZ  Default: 15*HZ  Max: 300*HZ)
+       The age at which dirty metadata buffers are flushed to disk
+
+  vm.pagebuf.flush_int         (Min: HZ/2  Default: HZ  Max: 30*HZ)
+       The interval at which the list of dirty metadata buffers is
+       scanned.
index a8ea382c9674f6c8ab8413f899babd00f2868cba..8370a0564a29084f17d75f020cbefdd7bde92345 100644 (file)
@@ -38,6 +38,7 @@
 #include "xfs.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_bit.h"
+#include "xfs_rw.h"
 
 /*
  * System memory size - used to scale certain data structures in XFS.
@@ -48,7 +49,18 @@ unsigned long xfs_physmem;
  * Tunable XFS parameters.  xfs_params is required even when CONFIG_SYSCTL=n,
  * other XFS code uses these values.
  */
-xfs_param_t xfs_params = { 0, 1, 0, 0, 3, 30 * HZ, 0 };
+
+xfs_param_t xfs_params = {
+                       /*      MIN     DFLT    MAX     */
+       restrict_chown: {       0,      1,      1       },
+       sgid_inherit:   {       0,      0,      1       },
+       symlink_mode:   {       0,      0,      1       },
+       panic_mask:     {       0,      0,      127     },
+       error_level:    {       0,      3,      11      },
+       sync_interval:  {       HZ,     30*HZ,  60*HZ   },
+       stats_clear:    {       0,      0,      1       },
+
+};
 
 /*
  * Global system credential structure.
index 1387dc68f47794fee2f39e19e4b470da9e8775eb..fe259b0c32f11bc5854d24b0c175de4ed66171f1 100644 (file)
@@ -87,11 +87,15 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
        bh->b_end_io = linvfs_unwritten_done;
 }
 
-#define restricted_chown       xfs_params.restrict_chown
-#define irix_sgid_inherit      xfs_params.sgid_inherit
-#define irix_symlink_mode      xfs_params.symlink_mode
-#define xfs_panic_mask         xfs_params.panic_mask
-#define xfs_error_level                xfs_params.error_level
+#define xfs_refcache_size      xfs_params.refcache_size.val
+#define xfs_refcache_purge_count xfs_params.refcache_purge.val
+#define restricted_chown       xfs_params.restrict_chown.val
+#define irix_sgid_inherit      xfs_params.sgid_inherit.val
+#define irix_symlink_mode      xfs_params.symlink_mode.val
+#define xfs_panic_mask         xfs_params.panic_mask.val
+#define xfs_error_level                xfs_params.error_level.val
+#define xfs_syncd_interval     xfs_params.sync_interval.val
+#define xfs_stats_clear                xfs_params.stats_clear.val
 
 #define NBPP           PAGE_SIZE
 #define DPPSHFT                (PAGE_SHIFT - 9)
index 6131d4585d125411b394a5775691f9d9388613e8..2c83b2b5dc0fca079e1821eaa8e1398259834acb 100644 (file)
@@ -401,7 +401,7 @@ syncd(void *arg)
 
        for (;;) {
                set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(xfs_params.sync_interval);
+               schedule_timeout(xfs_syncd_interval);
                /* swsusp */
                if (current->flags & PF_FREEZE)
                        refrigerator(PF_IOTHREAD);
index 745a6f04e40913bc5a460c644db647f446721ddb..34041998ba39071ab7b46f242f36a59eaad861f3 100644 (file)
@@ -36,9 +36,6 @@
 #include <linux/proc_fs.h>
 
 
-STATIC ulong xfs_min[XFS_PARAM] = { 0, 0, 0, 0,   0, HZ, 0 };
-STATIC ulong xfs_max[XFS_PARAM] = { 1, 1, 1, 127, 3, HZ * 60, 1 };
-
 static struct ctl_table_header *xfs_table_header;
 
 
@@ -62,7 +59,7 @@ xfs_stats_clear_proc_handler(
                vn_active = xfsstats.vn_active;
                memset(&xfsstats, 0, sizeof(xfsstats));
                xfsstats.vn_active = vn_active;
-               xfs_params.stats_clear = 0;
+               xfs_stats_clear = 0;
        }
 
        return ret;
@@ -70,35 +67,42 @@ xfs_stats_clear_proc_handler(
 #endif /* CONFIG_PROC_FS */
 
 STATIC ctl_table xfs_table[] = {
-       {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown,
+       {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[0], &xfs_max[0]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
 
-       {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit,
+       {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[1], &xfs_max[1]},
+       &sysctl_intvec, NULL,
+       &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
 
-       {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode,
+       {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[2], &xfs_max[2]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
 
-       {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask,
+       {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[3], &xfs_max[3]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
 
-       {XFS_ERRLEVEL, "error_level", &xfs_params.error_level,
+       {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[4], &xfs_max[4]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.error_level.min, &xfs_params.error_level.max},
 
-       {XFS_SYNC_INTERVAL, "sync_interval", &xfs_params.sync_interval,
+       {XFS_SYNC_INTERVAL, "sync_interval", &xfs_params.sync_interval.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &xfs_min[5], &xfs_max[5]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.sync_interval.min, &xfs_params.sync_interval.max},
 
        /* please keep this the last entry */
 #ifdef CONFIG_PROC_FS
-       {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear,
+       {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
        sizeof(ulong), 0644, NULL, &xfs_stats_clear_proc_handler,
-       &sysctl_intvec, NULL, &xfs_min[6], &xfs_max[6]},
+       &sysctl_intvec, NULL, 
+       &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
 #endif /* CONFIG_PROC_FS */
 
        {0}
index 1fa2bd0ff38c0869bfd17b84d7c24b2583e5a7eb..45bc8a0a8f42b3714415b5b957b7476b0959dda0 100644 (file)
  * Tunable xfs parameters
  */
 
-#define XFS_PARAM      (sizeof(struct xfs_param) / sizeof(ulong))
+typedef struct xfs_sysctl_val {
+       ulong min;
+       ulong val;
+       ulong max;
+} xfs_sysctl_val_t;
 
 typedef struct xfs_param {
-       ulong   restrict_chown; /* Root/non-root can give away files.    */
-       ulong   sgid_inherit;   /* Inherit ISGID bit if process' GID is  */
-                               /*  not a member of the parent dir GID.  */
-       ulong   symlink_mode;   /* Symlink creat mode affected by umask. */
-       ulong   panic_mask;     /* bitmask to specify panics on errors.  */
-       ulong   error_level;    /* Degree of reporting for internal probs*/
-       ulong   sync_interval;  /* time between sync calls               */
-       ulong   stats_clear;    /* Reset all XFS statistics to zero.     */
+       xfs_sysctl_val_t restrict_chown;/* Root/non-root can give away files.*/
+       xfs_sysctl_val_t sgid_inherit;  /* Inherit ISGID bit if process' GID 
+                                        * is not a member of the parent dir
+                                        * GID */
+       xfs_sysctl_val_t symlink_mode;  /* Link creat mode affected by umask */
+       xfs_sysctl_val_t panic_mask;    /* bitmask to cause panic on errors. */
+       xfs_sysctl_val_t error_level;   /* Degree of reporting for problems  */
+       xfs_sysctl_val_t sync_interval; /* time between sync calls           */
+       xfs_sysctl_val_t stats_clear;   /* Reset all XFS statistics to zero. */
 } xfs_param_t;
 
 /*
index a94cca589b0e7976d9b82fa3ce11296f8eafa467..3b9245eab5417af1e74d2b32966f96474ac3fc57 100644 (file)
@@ -92,7 +92,7 @@ pb_trace_func(
        int             j;
        unsigned long   flags;
 
-       if (!pb_params.p_un.debug) return;
+       if (!pb_params.debug.val) return;
 
        if (ra == NULL) ra = (void *)__builtin_return_address(0);
 
@@ -129,10 +129,13 @@ STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
  * /proc/sys/vm/pagebuf
  */
 
-unsigned long pagebuf_min[P_PARAM] = {  HZ/2,   1*HZ, 0, 0 };
-unsigned long pagebuf_max[P_PARAM] = { HZ*30, HZ*300, 1, 1 };
-
-pagebuf_param_t pb_params = {{ HZ, 15 * HZ, 0, 0 }};
+pagebuf_param_t pb_params = {
+                       /*      MIN     DFLT    MAX     */
+       flush_interval: {       HZ/2,   HZ,     30*HZ   },
+       age_buffer:     {       1*HZ,   15*HZ,  300*HZ  },
+       stats_clear:    {       0,      0,      1       },
+       debug:          {       0,      0,      1       },
+};
 
 /*
  * Pagebuf statistics variables
@@ -1556,7 +1559,7 @@ pagebuf_delwri_queue(
        }
 
        list_add_tail(&pb->pb_list, &pbd_delwrite_queue);
-       pb->pb_flushtime = jiffies + pb_params.p_un.age_buffer;
+       pb->pb_flushtime = jiffies + pb_params.age_buffer.val;
        spin_unlock(&pbd_delwrite_lock);
 
        if (unlock && (pb->pb_flags & _PBF_LOCKABLE)) {
@@ -1621,7 +1624,7 @@ pagebuf_daemon(
 
                if (pbd_active == 1) {
                        mod_timer(&pb_daemon_timer,
-                                 jiffies + pb_params.p_un.flush_interval);
+                                 jiffies + pb_params.flush_interval.val);
                        interruptible_sleep_on(&pbd_waitq);
                }
 
@@ -1824,7 +1827,7 @@ pb_stats_clear_handler(
        if (!ret && write && *valp) {
                printk("XFS Clearing pbstats\n");
                memset(&pbstats, 0, sizeof(pbstats));
-               pb_params.p_un.stats_clear = 0;
+               pb_params.stats_clear.val = 0;
        }
 
        return ret;
@@ -1833,22 +1836,26 @@ pb_stats_clear_handler(
 STATIC struct ctl_table_header *pagebuf_table_header;
 
 STATIC ctl_table pagebuf_table[] = {
-       {PB_FLUSH_INT, "flush_int", &pb_params.data[0],
+       {PB_FLUSH_INT, "flush_int", &pb_params.flush_interval.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_ms_jiffies_minmax,
-       &sysctl_intvec, NULL, &pagebuf_min[0], &pagebuf_max[0]},
+       &sysctl_intvec, NULL,
+       &pb_params.flush_interval.min, &pb_params.flush_interval.max},
 
-       {PB_FLUSH_AGE, "flush_age", &pb_params.data[1],
+       {PB_FLUSH_AGE, "flush_age", &pb_params.age_buffer.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_ms_jiffies_minmax,
-       &sysctl_intvec, NULL, &pagebuf_min[1], &pagebuf_max[1]},
+       &sysctl_intvec, NULL, 
+       &pb_params.age_buffer.min, &pb_params.age_buffer.max},
 
-       {PB_STATS_CLEAR, "stats_clear", &pb_params.data[2],
+       {PB_STATS_CLEAR, "stats_clear", &pb_params.stats_clear.val,
        sizeof(ulong), 0644, NULL, &pb_stats_clear_handler,
-       &sysctl_intvec, NULL, &pagebuf_min[2], &pagebuf_max[2]},
+       &sysctl_intvec, NULL, 
+       &pb_params.stats_clear.min, &pb_params.stats_clear.max},
 
 #ifdef PAGEBUF_TRACE
-       {PB_DEBUG, "debug", &pb_params.data[3],
+       {PB_DEBUG, "debug", &pb_params.debug.val,
        sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
-       &sysctl_intvec, NULL, &pagebuf_min[3], &pagebuf_max[3]},
+       &sysctl_intvec, NULL, 
+       &pb_params.debug.min, &pb_params.debug.max},
 #endif
        {0}
 };
index b751d3ed055cb9e50d0c648bc2df9c48ea42ca38..bec3d234018bb451fa6c9a36d3dda9b8e0f3c5af 100644 (file)
@@ -85,18 +85,19 @@ struct pagebuf_trace_buf {
  * Tunable pagebuf parameters
  */
 
-#define P_PARAM        4
-
-typedef union pagebuf_param {
-       struct {
-               ulong   flush_interval; /* interval between runs of the
+typedef struct pb_sysctl_val {
+       ulong min;
+       ulong val;
+       ulong max;
+} pb_sysctl_val_t;
+
+typedef struct pagebuf_param {
+       pb_sysctl_val_t flush_interval; /* interval between runs of the
                                         * delwri flush daemon.  */
-               ulong   age_buffer;     /* time for buffer to age before
+       pb_sysctl_val_t age_buffer;     /* time for buffer to age before
                                         * we flush it.  */
-               ulong   debug;          /* debug tracing on or off */
-               ulong   stats_clear;    /* clear the pagebuf stats */
-       } p_un;
-       ulong data[P_PARAM];
+       pb_sysctl_val_t stats_clear;    /* clear the pagebuf stats */
+       pb_sysctl_val_t debug;          /* debug tracing on or off */
 } pagebuf_param_t;
 
 enum {
index 240a53e1ee49ac05244b059f69c08152d8006f82..515fef85f416803467738900b81217ec5c0133b7 100644 (file)
@@ -96,9 +96,6 @@ xfs_init(void)
 #endif /* DEBUG */
 #ifdef XFS_DABUF_DEBUG
        extern lock_t           xfs_dabuf_global_lock;
-#endif
-
-#ifdef XFS_DABUF_DEBUG
        spinlock_init(&xfs_dabuf_global_lock, "xfsda");
 #endif