if (rc)
return rc;
- if (val < 0 || val > INT_MAX)
- return -ERANGE;
- if (val > OST_MAX_PRECREATE)
+ if (val && (val < OST_MIN_PRECREATE ||
+ val > OST_MAX_PRECREATE))
return -ERANGE;
if (osp->opd_pre_create_count > val)
osp->opd_pre_create_count = val;
+ /* Can be 0 after setting max_create_count to 0 */
+ if (osp->opd_pre_create_count == 0 && val != 0)
+ osp->opd_pre_create_count = OST_MIN_PRECREATE;
+
osp->opd_pre_max_create_count = val;
return count;
__s64 val;
int rc;
- if (osp == NULL)
+ if (osp == NULL || osp->opd_pre == NULL)
return -EINVAL;
rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
__s64 val;
int rc;
- if (osp == NULL)
+ if (osp == NULL || osp->opd_pre == NULL)
return -EINVAL;
rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');