* GPL HEADER END
*/
/*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
atomic_read(&pool->qpi_ref),
pool->qpi_least_qunit);
- for (type = 0; type < MAXQUOTAS; type++)
+ for (type = 0; type < LL_MAXQUOTAS; type++)
seq_printf(m, " %s:\n"
" #slv: %d\n"
" #lqe: %d\n",
}
LPROC_SEQ_FOPS_RO(qpi_state);
+static int qpi_soft_least_qunit_seq_show(struct seq_file *m, void *data)
+{
+ struct qmt_pool_info *pool = m->private;
+ LASSERT(pool != NULL);
+
+ seq_printf(m, "%lu\n", pool->qpi_soft_least_qunit);
+ return 0;
+}
+
+static ssize_t
+qpi_soft_least_qunit_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
+{
+ struct qmt_pool_info *pool;
+ int qunit, rc;
+ s64 least_qunit;
+
+ pool = ((struct seq_file *)file->private_data)->private;
+ LASSERT(pool != NULL);
+
+ /* Not tuneable for inode limit */
+ if (pool->qpi_key >> 16 != LQUOTA_RES_DT)
+ return -EINVAL;
+
+ rc = lprocfs_str_to_s64(buffer, count, &least_qunit);
+ if (rc)
+ return rc;
+
+ /* Miminal qpi_soft_least_qunit */
+ qunit = pool->qpi_least_qunit << 2;
+ /* The value must be power of miminal qpi_soft_least_qunit, see
+ * how the qunit is adjusted in qmt_adjust_qunit(). */
+ while (qunit > 0 && qunit < least_qunit)
+ qunit <<= 2;
+ if (qunit <= 0)
+ qunit = INT_MAX & ~3;
+
+ pool->qpi_soft_least_qunit = qunit;
+ return count;
+}
+LPROC_SEQ_FOPS(qpi_soft_least_qunit);
+
static struct lprocfs_vars lprocfs_quota_qpi_vars[] = {
{ .name = "info",
.fops = &qpi_state_fops },
+ { .name = "soft_least_qunit",
+ .fops = &qpi_soft_least_qunit_fops },
{ NULL }
};
/* set up least qunit size to use for this pool */
pool->qpi_least_qunit = LQUOTA_LEAST_QUNIT(pool_type);
+ if (pool_type == LQUOTA_RES_DT)
+ pool->qpi_soft_least_qunit = pool->qpi_least_qunit << 2;
+ else
+ pool->qpi_soft_least_qunit = pool->qpi_least_qunit;
/* create pool proc directory */
sprintf(qti->qti_buf, "%s-0x%x", RES_NAME(pool_type), pool_id);
/* release per-quota type site used to manage quota entries as well as
* references to global index files */
- for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
/* release lqe storing grace time */
if (pool->qpi_grace_lqe[qtype] != NULL)
lqe_putref(pool->qpi_grace_lqe[qtype]);
RETURN(PTR_ERR(obj));
pool->qpi_root = obj;
- for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
/* Generating FID of global index in charge of storing
* settings for this quota type */
lquota_generate_fid(&qti->qti_fid, pool_id, pool_type,