char pool_spill_target[LOV_MAXPOOLNAME + 1];
bool pool_same_space; /* targets in pool balanced*/
time64_t pool_same_space_expire; /*uses ld_qos_maxage*/
+ struct dentry *pool_debugfs;
};
struct lod_device;
struct proc_dir_entry *lod_symlink;
struct dentry *lod_debugfs;
+ struct dentry *lod_pool_debugfs;
/* ROOT object, used to fetch FS default striping */
struct lod_object *lod_md_root;
void lod_spill_target_refresh(const struct lu_env *env, struct lod_device *lod,
struct pool_desc *pool);
struct pool_desc *lod_pool_find(struct lod_device *lod, char *poolname);
+int lod_tgt_weights_seq_show(struct seq_file *m, struct lod_device *lod,
+ struct lu_tgt_pool *tgts, bool mdt);
+int lod_tgt_weights_seq_write(struct seq_file *m, const char __user *buf,
+ size_t count, struct lod_device *lod,
+ struct lu_tgt_pool *tgts, bool is_mdt);
extern struct lprocfs_vars lprocfs_lod_spill_vars[];
#endif
rcu_read_unlock();
return pool;
}
+
+static int lod_ost_pool_weights_seq_show(struct seq_file *m, void *data)
+{
+ struct pool_desc *pool = m->private;
+ struct lod_device *lod = lu2lod_dev(pool->pool_lobd->obd_lu_dev);
+
+ return lod_tgt_weights_seq_show(m, lod, &pool->pool_obds, false);
+}
+
+static ssize_t
+lod_ost_pool_weights_seq_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct pool_desc *pool = m->private;
+ struct lod_device *lod = lu2lod_dev(pool->pool_lobd->obd_lu_dev);
+
+ return lod_tgt_weights_seq_write(m, buf, count, lod, &pool->pool_obds,
+ false);
+}
+LDEBUGFS_SEQ_FOPS(lod_ost_pool_weights);
+
+static struct ldebugfs_vars ldebugfs_lod_pool_vars[] = {
+ { .name = "qos_ost_weights",
+ .fops = &lod_ost_pool_weights_fops,
+ .proc_mode = 0444 },
+ { 0 }
+};
+
/**
* Allocate a new pool for the specified device.
*
GOTO(out_err, rc);
}
+ new_pool->pool_debugfs = debugfs_create_dir(poolname,
+ lod->lod_pool_debugfs);
+ ldebugfs_add_vars(new_pool->pool_debugfs, ldebugfs_lod_pool_vars,
+ new_pool);
+
CDEBUG(D_CONFIG, LOV_POOLNAMEF" is pool #%d\n",
poolname, lod->lod_pool_count);
if (!pool)
RETURN(-ENOENT);
+ debugfs_remove_recursive(pool->pool_debugfs);
+
if (pool->pool_proc_entry != NULL) {
CDEBUG(D_INFO, "proc entry %p\n", pool->pool_proc_entry);
lprocfs_remove(&pool->pool_proc_entry);
KOBJ_ATTRIBUTE_GROUPS(lod); /* creates lod_groups from lod_attrs */
+int lod_tgt_weights_seq_show(struct seq_file *m, struct lod_device *lod,
+ struct lu_tgt_pool *tgts, bool is_mdt)
+{
+ int i;
+
+ if (!tgts->op_count)
+ return 0;
+
+ down_read(&tgts->op_rw_sem);
+ for (i = 0; i < tgts->op_count; i++) {
+ u32 *op_array = tgts->op_array;
+ struct lod_tgt_desc *tgt = is_mdt ? MDT_TGT(lod, op_array[i]) :
+ OST_TGT(lod, op_array[i]);
+ struct lu_svr_qos *svr = tgt->ltd_qos.ltq_svr;
+
+ seq_printf(m, "- { %s: %d, tgt_weight: %llu, tgt_penalty: %llu, tgt_penalty_per_obj: %llu, tgt_avail: %llu, tgt_last_used: %llu, svr_nid: %s, svr_bavail: %llu, svr_iavail: %llu, svr_penalty: %llu, svr_penalty_per_obj: %llu, svr_last_used: %llu }\n",
+ is_mdt ? "mdt_idx" : "ost_idx", tgt->ltd_index,
+ tgt->ltd_qos.ltq_weight,
+ tgt->ltd_qos.ltq_penalty,
+ tgt->ltd_qos.ltq_penalty_per_obj,
+ tgt->ltd_qos.ltq_avail, tgt->ltd_qos.ltq_used,
+ svr->lsq_uuid.uuid, svr->lsq_bavail, svr->lsq_iavail,
+ svr->lsq_penalty, svr->lsq_penalty_per_obj,
+ svr->lsq_used);
+ }
+ up_read(&tgts->op_rw_sem);
+
+ return 0;
+}
+
+int lod_tgt_weights_seq_write(struct seq_file *m, const char __user *buf,
+ size_t count, struct lod_device *lod,
+ struct lu_tgt_pool *tgts, bool is_mdt)
+{
+ int i;
+
+ if (!tgts->op_count)
+ return count;
+
+ down_read(&tgts->op_rw_sem);
+ down_write(&lod->lod_ost_descs.ltd_qos.lq_rw_sem);
+ for (i = 0; i < tgts->op_count; i++) {
+ u32 *op_array = tgts->op_array;
+ struct lod_tgt_desc *tgt = is_mdt ? MDT_TGT(lod, op_array[i]) :
+ OST_TGT(lod, op_array[i]);
+
+ tgt->ltd_qos.ltq_weight = 0;
+ tgt->ltd_qos.ltq_penalty = 0;
+ tgt->ltd_qos.ltq_svr->lsq_penalty = 0;
+ }
+ set_bit(LQ_DIRTY, &lod->lod_ost_descs.ltd_qos.lq_flags);
+ up_write(&lod->lod_ost_descs.ltd_qos.lq_rw_sem);
+ up_read(&tgts->op_rw_sem);
+
+ return count;
+}
+
+static int lod_mdt_weights_seq_show(struct seq_file *m, void *data)
+{
+ struct lod_device *lod = m->private;
+ struct lu_tgt_pool *tgts = &lod->lod_mdt_descs.ltd_tgt_pool;
+
+ return lod_tgt_weights_seq_show(m, lod, tgts, true);
+}
+
+static ssize_t
+lod_mdt_weights_seq_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *off)
+{
+
+ struct seq_file *m = file->private_data;
+ struct lod_device *lod = m->private;
+ struct lu_tgt_pool *tgts = &lod->lod_mdt_descs.ltd_tgt_pool;
+
+ return lod_tgt_weights_seq_write(m, buf, count, lod, tgts, true);
+}
+LDEBUGFS_SEQ_FOPS(lod_mdt_weights);
+
+static int lod_ost_weights_seq_show(struct seq_file *m, void *data)
+{
+ struct lod_device *lod = m->private;
+ struct lu_tgt_pool *tgts = &lod->lod_ost_descs.ltd_tgt_pool;
+
+ return lod_tgt_weights_seq_show(m, lod, tgts, false);
+}
+
+static ssize_t
+lod_ost_weights_seq_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct lod_device *lod = m->private;
+ struct lu_tgt_pool *tgts = &lod->lod_ost_descs.ltd_tgt_pool;
+
+ return lod_tgt_weights_seq_write(m, buf, count, lod, tgts, false);
+}
+LDEBUGFS_SEQ_FOPS(lod_ost_weights);
+
+static struct ldebugfs_vars ldebugfs_lod_vars[] = {
+ { .name = "qos_mdt_weights",
+ .fops = &lod_mdt_weights_fops,
+ .proc_mode = 0444 },
+ { .name = "qos_ost_weights",
+ .fops = &lod_ost_weights_fops,
+ .proc_mode = 0444 },
+ { 0 }
+};
+
/**
* Initialize procfs entries for LOD.
*
obd->obd_debugfs_entry = debugfs_create_dir(obd->obd_name,
obd->obd_type->typ_debugfs_entry);
+
+ ldebugfs_add_vars(obd->obd_debugfs_entry, ldebugfs_lod_vars, lod);
+
lod->lod_debugfs = ldebugfs_add_symlink(obd->obd_name, "lov",
"../lod/%s", obd->obd_name);
if (!lod->lod_debugfs)
CERROR("%s: failed to create LOV debugfs symlink\n",
obd->obd_name);
+ lod->lod_pool_debugfs = debugfs_create_dir("pool",
+ obd->obd_debugfs_entry);
+
type = container_of(lov, struct obd_type, typ_kobj);
if (!type->typ_procroot)
RETURN(0);
kobject_put(lov);
}
+ debugfs_remove_recursive(lod->lod_pool_debugfs);
debugfs_remove_recursive(lod->lod_debugfs);
+ debugfs_remove_recursive(obd->obd_debugfs_entry);
if (obd->obd_proc_entry) {
lprocfs_remove(&obd->obd_proc_entry);