- struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
- char dummy[MAX_POLICY_STRING_SIZE + 1];
- int len = count;
- placement_policy_t policy;
- struct lmv_obd *lmv;
-
- if (copy_from_user(dummy, buffer, MAX_POLICY_STRING_SIZE))
- return -EFAULT;
-
- LASSERT(dev != NULL);
- lmv = &dev->u.lmv;
-
- if (len > MAX_POLICY_STRING_SIZE)
- len = MAX_POLICY_STRING_SIZE;
-
- if (dummy[len - 1] == '\n')
- len--;
- dummy[len] = '\0';
-
- policy = placement_name2policy(dummy, len);
- if (policy != PLACEMENT_INVAL_POLICY) {
- spin_lock(&lmv->lmv_lock);
- lmv->lmv_placement = policy;
- spin_unlock(&lmv->lmv_lock);
- } else {
- CERROR("Invalid placement policy \"%s\"!\n", dummy);
- return -EINVAL;
- }
- return count;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct lmv_obd *lmv = &obd->u.lmv;
+ unsigned int val;
+ int rc;
+
+ rc = kstrtouint(buffer, 0, &val);
+ if (rc)
+ return rc;
+
+ if (val > 100)
+ return -EINVAL;
+
+ lmv->lmv_qos.lq_prio_free = (val << 8) / 100;
+ set_bit(LQ_DIRTY, &lmv->lmv_qos.lq_flags);
+ set_bit(LQ_RESET, &lmv->lmv_qos.lq_flags);
+
+ return count;