pages_number = MiB_TO_PAGES(max_dirty_mb);
if (pages_number >= MiB_TO_PAGES(OSC_MAX_DIRTY_MB_MAX) ||
- pages_number > totalram_pages / 4) /* 1/4 of RAM */
+ pages_number > cfs_totalram_pages() / 4) /* 1/4 of RAM */
return -ERANGE;
spin_lock(&cli->cl_loi_list_lock);
int i;
DECLARE_CKSUM_NAME;
char kernbuf[10];
+ int rc = -EINVAL;
- if (obd == NULL)
- return 0;
+ if (obd == NULL)
+ return 0;
- if (count > sizeof(kernbuf) - 1)
- return -EINVAL;
+ if (count > sizeof(kernbuf) - 1)
+ return -EINVAL;
if (copy_from_user(kernbuf, buffer, count))
- return -EFAULT;
- if (count > 0 && kernbuf[count - 1] == '\n')
- kernbuf[count - 1] = '\0';
- else
- kernbuf[count] = '\0';
-
- for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
- if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
- continue;
- if (!strcmp(kernbuf, cksum_name[i])) {
- obd->u.cli.cl_cksum_type = 1 << i;
- return count;
- }
- }
- return -EINVAL;
+ return -EFAULT;
+
+ if (count > 0 && kernbuf[count - 1] == '\n')
+ kernbuf[count - 1] = '\0';
+ else
+ kernbuf[count] = '\0';
+
+ for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
+ if (strcmp(kernbuf, cksum_name[i]) == 0) {
+ obd->u.cli.cl_preferred_cksum_type = BIT(i);
+ if (obd->u.cli.cl_supp_cksum_types & BIT(i)) {
+ obd->u.cli.cl_cksum_type = BIT(i);
+ rc = count;
+ } else {
+ rc = -ENOTSUPP;
+ }
+ break;
+ }
+ }
+ return rc;
}
LPROC_SEQ_FOPS(osc_checksum_type);
int osc_tunables_init(struct obd_device *obd)
{
-#if defined(CONFIG_PROC_FS) && defined(HAVE_SERVER_SUPPORT)
- struct obd_type *type;
-#endif
int rc;
obd->obd_vars = lprocfs_osc_obd_vars;
-#if defined(CONFIG_PROC_FS) && defined(HAVE_SERVER_SUPPORT)
- /* If this is true then both client (osc) and server (osp) are on the
- * same node. The osp layer if loaded first will register the osc proc
- * directory. In that case this obd_device will be attached its proc
- * tree to type->typ_procsym instead of obd->obd_type->typ_procroot.
- */
- type = class_search_type(LUSTRE_OSP_NAME);
- if (type && type->typ_procsym) {
- obd->obd_proc_entry = lprocfs_register(obd->obd_name,
- type->typ_procsym,
- obd->obd_vars, obd);
- if (IS_ERR(obd->obd_proc_entry)) {
- rc = PTR_ERR(obd->obd_proc_entry);
- CERROR("error %d setting up lprocfs for %s\n", rc,
- obd->obd_name);
- obd->obd_proc_entry = NULL;
- }
- }
-#endif
obd->obd_ktype.default_attrs = osc_attrs;
rc = lprocfs_obd_setup(obd, false);
if (rc)