Whamcloud - gitweb
LU-12029 utils: remove max_sectors_kb tuning 78/57278/4
authorLai Siyao <lai.siyao@whamcloud.com>
Wed, 4 Dec 2024 09:37:16 +0000 (04:37 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 2 Jan 2025 20:40:31 +0000 (20:40 +0000)
Remove max_sectors_kb tuning and make the mount option print a warning
message that it is ignored.

Remove conf-sanity test_125 which is to verify max_sectors_kb tuning.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I5d11310589f70716df98101c62fd459dafbfddca
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57278
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/mount.lustre.8
lustre/tests/conf-sanity.sh
lustre/utils/l_tunedisk.c
lustre/utils/libmount_utils_ldiskfs.c
lustre/utils/mount_lustre.c
lustre/utils/mount_utils.h

index 7a7c7da..80f5ddc 100644 (file)
@@ -285,22 +285,16 @@ Do not resume the former paused/crashed LFSCK automatically when mounting.
 .BI abort_recov
 Abort client recovery and start the target service immediately.
 .TP
-.BI md_stripe_cache_size
-Sets the stripe cache size for server side disk with a striped raid
-configuration.
-.TP
-.BI max_sectors_kb
-Automatically Sets the block device parameter of 'max_sectors_kb' for the
-MDT or OST target. When max_sectors_kb isn't specified, that parameter for
-block device will be set to same as it's own 'max_hw_sectors_kb' (up to a
-maximum of 16M), this is default behavior suited for most users. When
-max_sectors_kb is specified as zero, the old parameter value will be kept.
-When max_sectors_kb is specified as a positive number, the parameter will
-be set to this number arbitrarily.
+.BI md_stripe_cache_size= cache_size
+Sets the MD RAID 'stripe_cache_size' parameter to
+.I cache_size
+KiB for server OST or MDT block device with a striped RAID configuration.
 .TP
 .BI recovery_time_soft= timeout
-Allow 'timeout' seconds for clients to reconnect for recovery after a server
-crash. This timeout will be incrementally extended if it is about to expire
+Allow
+.I timeout
+seconds for clients to reconnect for recovery after a server
+crash.  This timeout will be incrementally extended if it is about to expire
 and the server is still handling new connections from recoverable clients.
 The default soft recovery timeout is set to 300 seconds (5 minutes).
 .TP
index e10ce86..50ec11a 100755 (executable)
@@ -10904,81 +10904,6 @@ check_slaves_max_sectors_kb()
        return $rc
 }
 
-test_125()
-{
-       local facet_list="mgs mds1 ost1"
-       combined_mgs_mds && facet_list="mgs ost1"
-
-       local facet
-       for facet in ${facet_list}; do
-               [[ $(facet_fstype ${facet}) != ldiskfs ]] &&
-                       skip "ldiskfs only test" &&
-                       return 0
-               ! is_blkdev ${facet} $(facet_device ${facet}) &&
-                       skip "requires all real devices" &&
-                       return 0
-       done
-
-       local rc=0
-       # We don't increase IO request size limit past 16MB. See comments in
-       # lustre/utils/libmount_utils_ldiskfs.c:tune_max_sectors_kb()
-       RQ_SIZE_LIMIT=$((16 * 1024))
-       local device old_max_sectors new_max_sectors max_hw_sectors
-       for facet in ${facet_list}; do
-               device=$(facet_device ${facet})
-               old_max_sectors=$(get_max_sectors_kb ${facet} ${device})
-               max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${device})
-
-               # The expected value after l_tunedisk is executed
-               new_max_sectors=$old_max_sectors
-               [[ ${new_max_sectors_kb} -gt ${RQ_SIZE_LIMIT} ]] &&
-                       new_max_sectors_kb=${RQ_SIZE_LIMIT}
-
-               # Ensure the current value of max_sectors_kb does not equal
-               # max_hw_sectors_kb, so we can tell whether l_tunedisk did
-               # anything
-               set_max_sectors_kb ${facet} ${device} $((new_max_sectors - 1))
-
-               # Value before l_tunedisk
-               local pre_max_sectors=$(get_max_sectors_kb ${facet} ${device})
-               if [[ ${pre_max_sectors} -ne $((new_max_sectors - 1)) ]]; then
-                       echo "unable to satsify test pre-condition:"
-                       echo "${pre_max_sectors} != $((new_max_sectors - 1))"
-                       ((rc++))
-                       continue
-               fi
-
-               echo "Before: ${facet} ${device} ${pre_max_sectors} ${max_hw_sectors}"
-
-               do_facet ${facet} "l_tunedisk ${device}"
-
-               # Value after l_tunedisk
-               local post_max_sectors=$(get_max_sectors_kb ${facet} ${device})
-
-               echo "After: ${facet} ${device} ${post_max_sectors} ${max_hw_sectors}"
-
-               if [[ ${facet} != ost1 ]]; then
-                       if [[ ${post_max_sectors} -ne ${pre_max_sectors} ]]; then
-                               echo "l_tunedisk modified max_sectors_kb of ${facet}"
-                               ((rc++))
-                       fi
-
-                       set_max_sectors_kb ${facet} ${device} ${old_max_sectors}
-               else
-                       if [[ ${post_max_sectors} -eq ${pre_max_sectors} ]]; then
-                               echo "l_tunedisk failed to modify max_sectors_kb of ${facet}"
-                               ((rc++))
-                       fi
-
-                       check_slaves_max_sectors_kb ${facet} ${device} ||
-                               ((rc++))
-               fi
-       done
-
-       return $rc
-}
-run_test 125 "check l_tunedisk only tunes OSTs and their slave devices"
-
 test_126() {
        [[ "$MDS1_VERSION" -ge $(version_code 2.13.52) ]] ||
                skip "Need MDS version at least 2.13.52"
index b02e1e8..50ee402 100644 (file)
@@ -41,9 +41,7 @@ char  *progname;
 
 int main(int argc, char *const argv[])
 {
-       struct mount_opts mop = {
-               .mo_max_sectors_kb = -1
-       };
+       struct mount_opts mop;
        struct lustre_disk_data *ldd = &mop.mo_ldd;
 
        char real_path[PATH_MAX] = {'\0'};
@@ -62,6 +60,7 @@ int main(int argc, char *const argv[])
        }
 
        /* device is last arg */
+       memset(&mop, 0, sizeof(mop));
        mop.mo_usource = argv[argc - 1];
 
        mop.mo_source = realpath(mop.mo_usource, real_path);
index dc40f43..70b267c 100644 (file)
@@ -78,7 +78,6 @@
 #include "mount_utils.h"
 
 #define MAX_HW_SECTORS_KB_PATH "queue/max_hw_sectors_kb"
-#define MAX_SECTORS_KB_PATH    "queue/max_sectors_kb"
 #define SCHEDULER_PATH         "queue/scheduler"
 #define STRIPE_CACHE_SIZE      "md/stripe_cache_size"
 
@@ -1060,77 +1059,6 @@ static int tune_md_stripe_cache_size(const char *sys_path,
        return 0;
 }
 
-static int tune_max_sectors_kb(const char *sys_path, struct mount_opts *mop)
-{
-       char path[PATH_MAX];
-       unsigned long max_hw_sectors_kb;
-       unsigned long old_max_sectors_kb;
-       unsigned long new_max_sectors_kb;
-       char buf[3 * sizeof(old_max_sectors_kb) + 2];
-       int rc;
-
-       if (mop->mo_max_sectors_kb >= 0) {
-               new_max_sectors_kb = mop->mo_max_sectors_kb;
-               goto have_new_max_sectors_kb;
-       }
-
-       snprintf(path, sizeof(path), "%s/%s", sys_path, MAX_HW_SECTORS_KB_PATH);
-       rc = read_file(path, buf, sizeof(buf));
-       if (rc != 0) {
-               /* No MAX_HW_SECTORS_KB_PATH isn't necessary an
-                * error for some devices. */
-               return 0;
-       }
-
-       max_hw_sectors_kb = strtoul(buf, NULL, 0);
-       if (max_hw_sectors_kb == 0 || max_hw_sectors_kb == ULLONG_MAX) {
-               /* No digits at all or something weird. */
-               return 0;
-       }
-
-       new_max_sectors_kb = max_hw_sectors_kb;
-
-       /* Don't increase IO request size limit past 16MB.  It is
-        * about PTLRPC_MAX_BRW_SIZE, but that isn't in a public
-        * header.  Note that even though the block layer allows
-        * larger values, setting max_sectors_kb = 32768 causes
-        * crashes (LU-6974). */
-       if (new_max_sectors_kb > 16 * 1024)
-               new_max_sectors_kb = 16 * 1024;
-
-have_new_max_sectors_kb:
-       snprintf(path, sizeof(path), "%s/%s", sys_path, MAX_SECTORS_KB_PATH);
-       rc = read_file(path, buf, sizeof(buf));
-       if (rc != 0) {
-               /* No MAX_SECTORS_KB_PATH isn't necessary an error for
-                * some devices. */
-               return 0;
-       }
-
-       old_max_sectors_kb = strtoul(buf, NULL, 0);
-       if (old_max_sectors_kb == 0 || old_max_sectors_kb == ULLONG_MAX) {
-               /* No digits at all or something weird. */
-               return 0;
-       }
-
-       if (new_max_sectors_kb <= old_max_sectors_kb)
-               return 0;
-
-       snprintf(buf, sizeof(buf), "%lu", new_max_sectors_kb);
-       rc = write_file(path, buf);
-       if (rc != 0) {
-               if (verbose)
-                       fprintf(stderr, "warning: cannot write '%s': %s\n",
-                               path, strerror(errno));
-               return rc;
-       }
-
-       fprintf(stderr, "%s: increased '%s' from %lu to %lu\n",
-               progname, path, old_max_sectors_kb, new_max_sectors_kb);
-
-       return 0;
-}
-
 static int tune_block_dev_scheduler(const char *sys_path, const char *new_sched)
 {
        char path[PATH_MAX];
@@ -1229,9 +1157,7 @@ static int tune_block_dev_slaves(const char *sys_path, struct mount_opts *mop)
        return rc;
 }
 
-/* This is to tune the kernel for good SCSI performance.
- * For that we set the value of /sys/block/{dev}/queue/max_sectors_kb
- * to the value of /sys/block/{dev}/queue/max_hw_sectors_kb */
+/* This is to tune the kernel for good SCSI performance. */
 static int tune_block_dev(const char *src, struct mount_opts *mop)
 {
        struct stat st;
@@ -1301,10 +1227,9 @@ have_whole_dev:
        if (major(st.st_rdev) == MD_MAJOR) {
                rc = tune_md_stripe_cache_size(real_sys_path, mop);
        } else {
-               /* Ignore errors from tune_max_sectors_kb() and
-                * tune_scheduler(). The worst that will happen is a block
-                * device with an "incorrect" scheduler. */
-               tune_max_sectors_kb(real_sys_path, mop);
+               /* Ignore errors from tune_scheduler(). The worst that will
+                * happen is a block device with an "incorrect" scheduler.
+                */
                tune_block_dev_scheduler(real_sys_path, DEFAULT_SCHEDULER);
 
                /* If device is multipath device then tune its slave
index 787d40a..a095940 100644 (file)
@@ -98,8 +98,6 @@ static void usage(FILE *out)
                "\t\tnomgs: only start target MDS/OSS, using existing MGS\n"
                "\t\tnoscrub: do NOT auto start OI scrub unless requested\n"
                "\t\tskip_lfsck: do NOT auto resume paused/crashed LFSCK\n"
-               "\t\tmax_sectors_kb=<size>: set device max_sectors_kb to size or leaves it untouched if size=0\n"
-               "\t\t\tIf not specified, device max_sectors_kb will be set to max_hw_sectors_kb\n"
                "\t\tmd_stripe_cache_size=<num>: set MD RAID device stripe cache size\n"
                "\t<cliopt>: one or more comma separated client options:\n"
                "\t\texclude=<ostname>[:<ostname>]: list of inactive OSTs (e.g. lustre-OST0001)\n"
@@ -280,7 +278,9 @@ static int parse_options(struct mount_opts *mop, char *orig_options,
                 * remove those mount options, see bug 22097.
                 */
                if (val && strncmp(arg, "max_sectors_kb", 14) == 0) {
-                       mop->mo_max_sectors_kb = atoi(val + 1);
+                       fprintf(stderr,
+                               "%s: max_sectors_kb is ignored\n",
+                               progname);
                } else if (val &&
                           strncmp(arg, "md_stripe_cache_size", 20) == 0) {
                        mop->mo_md_stripe_cache_size = atoi(val + 1);
@@ -659,7 +659,6 @@ static void set_defaults(struct mount_opts *mop)
        mop->mo_md_stripe_cache_size = 16384;
        mop->mo_orig_options = "";
        mop->mo_nosvc = 0;
-       mop->mo_max_sectors_kb = -1;
 }
 
 static int parse_opts(int argc, char *const argv[], struct mount_opts *mop)
index a1d2173..3487c77 100644 (file)
@@ -120,7 +120,6 @@ struct mount_opts {
        int      mo_have_mgsnid;
        int      mo_md_stripe_cache_size;
        int      mo_nosvc;
-       int      mo_max_sectors_kb;
 };
 
 #ifdef HAVE_SERVER_SUPPORT