xfs: restore speculative_cow_prealloc_lifetime sysctl
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Feb 2021 17:14:47 +0000 (09:14 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 24 Feb 2021 18:16:08 +0000 (10:16 -0800)
In commit 9669f51de5c0 I tried to get rid of the undocumented cow gc
lifetime knob.  The knob's function was never documented and it now
doesn't really have a function since eof and cow gc have been
consolidated.

Regrettably, xfs/231 relies on it and regresses on for-next.  I did not
succeed at getting far enough through fstests patch review for the fixup
to land in time.

Restore the sysctl knob, document what it did (does?), put it on the
deprecation schedule, and rip out a redundant function.

Fixes: 9669f51de5c0 ("xfs: consolidate the eofblocks and cowblocks workers")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Documentation/admin-guide/xfs.rst
fs/xfs/xfs_sysctl.c

index 6178153..5422407 100644 (file)
@@ -284,6 +284,9 @@ The following sysctls are available for the XFS filesystem:
        removes unused preallocation from clean inodes and releases
        the unused space back to the free pool.
 
+  fs.xfs.speculative_cow_prealloc_lifetime
+       This is an alias for speculative_prealloc_lifetime.
+
   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
@@ -356,12 +359,13 @@ The following sysctls are available for the XFS filesystem:
 Deprecated Sysctls
 ==================
 
-===========================     ================
-  Name                         Removal Schedule
-===========================     ================
-fs.xfs.irix_sgid_inherit        September 2025
-fs.xfs.irix_symlink_mode        September 2025
-===========================     ================
+===========================================     ================
+  Name                                          Removal Schedule
+===========================================     ================
+fs.xfs.irix_sgid_inherit                        September 2025
+fs.xfs.irix_symlink_mode                        September 2025
+fs.xfs.speculative_cow_prealloc_lifetime        September 2025
+===========================================     ================
 
 
 Removed Sysctls
index 145e06c..546a6cd 100644 (file)
@@ -51,7 +51,7 @@ xfs_panic_mask_proc_handler(
 #endif /* CONFIG_PROC_FS */
 
 STATIC int
-xfs_deprecate_irix_sgid_inherit_proc_handler(
+xfs_deprecated_dointvec_minmax(
        struct ctl_table        *ctl,
        int                     write,
        void                    *buffer,
@@ -59,24 +59,8 @@ xfs_deprecate_irix_sgid_inherit_proc_handler(
        loff_t                  *ppos)
 {
        if (write) {
-               printk_once(KERN_WARNING
-                               "XFS: " "%s sysctl option is deprecated.\n",
-                               ctl->procname);
-       }
-       return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
-}
-
-STATIC int
-xfs_deprecate_irix_symlink_mode_proc_handler(
-       struct ctl_table        *ctl,
-       int                     write,
-       void                    *buffer,
-       size_t                  *lenp,
-       loff_t                  *ppos)
-{
-       if (write) {
-               printk_once(KERN_WARNING
-                               "XFS: " "%s sysctl option is deprecated.\n",
+               printk_ratelimited(KERN_WARNING
+                               "XFS: %s sysctl option is deprecated.\n",
                                ctl->procname);
        }
        return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
@@ -88,7 +72,7 @@ static struct ctl_table xfs_table[] = {
                .data           = &xfs_params.sgid_inherit.val,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = xfs_deprecate_irix_sgid_inherit_proc_handler,
+               .proc_handler   = xfs_deprecated_dointvec_minmax,
                .extra1         = &xfs_params.sgid_inherit.min,
                .extra2         = &xfs_params.sgid_inherit.max
        },
@@ -97,7 +81,7 @@ static struct ctl_table xfs_table[] = {
                .data           = &xfs_params.symlink_mode.val,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = xfs_deprecate_irix_symlink_mode_proc_handler,
+               .proc_handler   = xfs_deprecated_dointvec_minmax,
                .extra1         = &xfs_params.symlink_mode.min,
                .extra2         = &xfs_params.symlink_mode.max
        },
@@ -201,6 +185,15 @@ static struct ctl_table xfs_table[] = {
                .extra1         = &xfs_params.blockgc_timer.min,
                .extra2         = &xfs_params.blockgc_timer.max,
        },
+       {
+               .procname       = "speculative_cow_prealloc_lifetime",
+               .data           = &xfs_params.blockgc_timer.val,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = xfs_deprecated_dointvec_minmax,
+               .extra1         = &xfs_params.blockgc_timer.min,
+               .extra2         = &xfs_params.blockgc_timer.max,
+       },
        /* please keep this the last entry */
 #ifdef CONFIG_PROC_FS
        {