+ rc = read_file(real_path, oldbuf, sizeof(oldbuf));
+ /* Only set new parameter if different from the old one. */
+ if (rc != 0 || strcmp(oldbuf, buf) == 0) {
+ /* No MAX_SECTORS_KB_PATH isn't necessary an
+ * error for some device. */
+ goto subdevs;
+ }
+
+ newval = strtoull(buf, &end, 0);
+ if (newval == 0 || newval == ULLONG_MAX || end == buf)
+ goto subdevs;
+
+ /* 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 (newval > 16 * 1024) {
+ newval = 16 * 1024;
+ snprintf(buf, sizeof(buf), "%llu", newval);
+ }
+
+ oldval = strtoull(oldbuf, &end, 0);
+ /* Don't shrink the current limit. */
+ if (oldval != ULLONG_MAX && newval <= oldval)
+ goto subdevs;
+