]> git.neil.brown.name Git - history.git/commitdiff
[XFS] Add xfs_rotorstep sysctl for controlling placement of extents for
authorGeoffrey Wehrman <gwehrman@sgi.com>
Mon, 13 Dec 2004 23:11:21 +0000 (10:11 +1100)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 13 Dec 2004 23:11:21 +0000 (10:11 +1100)
new files by the inode32 allocator.

SGI-PV: 912624
SGI-Modid: xfs-linux:xfs-kern:181032a
Signed-off-by: Geoffrey Wehrman <gwehrman@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
fs/xfs/linux-2.6/xfs_globals.c
fs/xfs/linux-2.6/xfs_linux.h
fs/xfs/linux-2.6/xfs_sysctl.c
fs/xfs/linux-2.6/xfs_sysctl.h
fs/xfs/xfs_alloc.c

index b9c4bbf4e32d32927833ee02b89aaf36267b6476..a6da5b4fd240e9b951d9cb108b70322cf0d20ffd 100644 (file)
@@ -64,6 +64,7 @@ xfs_param_t xfs_params = {
        .xfs_buf_timer  = {     100/2,          1*100,          30*100  },
        .xfs_buf_age    = {     1*100,          15*100,         7200*100},
        .inherit_nosym  = {     0,              0,              1       },
+       .rotorstep      = {     1,              1,              255     },
 };
 
 /*
index bbf4ef4707734c7b58fee5c8867b7916548751c9..5c05be63bf7338c34124a5f370cd4743119074ab 100644 (file)
@@ -142,6 +142,7 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
 #define xfs_buf_timer_centisecs        xfs_params.xfs_buf_timer.val
 #define xfs_buf_age_centisecs  xfs_params.xfs_buf_age.val
 #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val
+#define xfs_rotorstep          xfs_params.rotorstep.val
 
 #define current_cpu()          smp_processor_id()
 #define current_pid()          (current->pid)
index c2452965734eccd4242d4ff642e05ac68637619f..0dc010356f4dd4fad46ee960ef027a1e941ec208 100644 (file)
@@ -134,6 +134,11 @@ STATIC ctl_table xfs_table[] = {
        &sysctl_intvec, NULL,
        &xfs_params.inherit_nosym.min, &xfs_params.inherit_nosym.max},
 
+       {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
+       sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+       &sysctl_intvec, NULL, 
+       &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
+
        /* please keep this the last entry */
 #ifdef CONFIG_PROC_FS
        {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
index 5ff61bb56e1daa77c54061b031b6aad761cd4374..a39a95020a58cc480d04fc190b83ade1ac9f6bd6 100644 (file)
@@ -60,6 +60,7 @@ typedef struct xfs_param {
        xfs_sysctl_val_t xfs_buf_timer; /* Interval between xfsbufd wakeups. */
        xfs_sysctl_val_t xfs_buf_age;   /* Metadata buffer age before flush. */
        xfs_sysctl_val_t inherit_nosym; /* Inherit the "nosymlinks" flag. */
+       xfs_sysctl_val_t rotorstep;     /* inode32 AG rotoring control knob */
 } xfs_param_t;
 
 /*
@@ -97,6 +98,7 @@ enum {
        XFS_BUF_AGE = 17,
        /* XFS_IO_BYPASS = 18 */
        XFS_INHERIT_NOSYM = 19,
+       XFS_ROTORSTEP = 20,
 };
 
 extern xfs_param_t     xfs_params;
index 02337c2a4caad00985cb2d1dde9950acf267b992..fa8799d55fb7826595633b26fc0c1150becdff65 100644 (file)
@@ -2247,6 +2247,7 @@ xfs_alloc_vextent(
        xfs_alloctype_t type;   /* input allocation type */
        int             bump_rotor = 0;
        int             no_min = 0;
+       xfs_agnumber_t  rotorstep = xfs_rotorstep; /* inode32 agf stepper */
 
        mp = args->mp;
        type = args->otype = args->type;
@@ -2310,7 +2311,9 @@ xfs_alloc_vextent(
                 */
                if ((args->userdata  == XFS_ALLOC_INITIAL_USER_DATA) &&
                    (mp->m_flags & XFS_MOUNT_32BITINODES)) {
-                       args->fsbno = XFS_AGB_TO_FSB(mp, mp->m_agfrotor, 0);
+                       args->fsbno = XFS_AGB_TO_FSB(mp,
+                                       ((mp->m_agfrotor / rotorstep) %
+                                       mp->m_sb.sb_agcount), 0);
                        bump_rotor = 1;
                }
                args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno);
@@ -2326,7 +2329,8 @@ xfs_alloc_vextent(
                        /*
                         * Start with the last place we left off.
                         */
-                       args->agno = sagno = mp->m_agfrotor;
+                       args->agno = sagno = (mp->m_agfrotor / rotorstep) %
+                                       mp->m_sb.sb_agcount;
                        args->type = XFS_ALLOCTYPE_THIS_AG;
                        flags = XFS_ALLOC_FLAG_TRYLOCK;
                } else if (type == XFS_ALLOCTYPE_FIRST_AG) {
@@ -2400,8 +2404,14 @@ xfs_alloc_vextent(
                        }
                }
                up_read(&mp->m_peraglock);
-               if (bump_rotor || (type == XFS_ALLOCTYPE_ANY_AG))
-                       mp->m_agfrotor = (args->agno + 1) % mp->m_sb.sb_agcount;
+               if (bump_rotor || (type == XFS_ALLOCTYPE_ANY_AG)) {
+                       if (args->agno == sagno)
+                               mp->m_agfrotor = (mp->m_agfrotor + 1) %
+                                       (mp->m_sb.sb_agcount * rotorstep);
+                       else
+                               mp->m_agfrotor = (args->agno * rotorstep + 1) %
+                                       (mp->m_sb.sb_agcount * rotorstep);
+               }
                break;
        default:
                ASSERT(0);