Whamcloud - gitweb
LU-14131 osd-ldiskfs: reduce credits for overwritting
[fs/lustre-release.git] / lustre / ptlrpc / nodemap_lproc.c
index 8167883..d3ab5fd 100644 (file)
@@ -286,7 +286,8 @@ nodemap_sepol_seq_write(struct file *file,
        char sepol[LUSTRE_NODEMAP_SEPOL_LENGTH + 1];
        int rc = 0;
 
-       CLASSERT(sizeof(sepol) == sizeof(((struct lu_nodemap *)0)->nm_sepol));
+       BUILD_BUG_ON(sizeof(sepol) !=
+                    sizeof(((struct lu_nodemap *)0)->nm_sepol));
 
        if (count > 0) {
                if (count >= sizeof(sepol))
@@ -636,6 +637,33 @@ static int nodemap_audit_mode_seq_show(struct seq_file *m, void *data)
        return 0;
 }
 
+/**
+ * Reads and prints the forbid_encryption flag for the given nodemap.
+ *
+ * \param      m               seq file in proc fs
+ * \param      data            unused
+ * \retval     0               success
+ */
+static int nodemap_forbid_encryption_seq_show(struct seq_file *m, void *data)
+{
+       struct lu_nodemap *nodemap;
+       int rc;
+
+       mutex_lock(&active_config_lock);
+       nodemap = nodemap_lookup(m->private);
+       mutex_unlock(&active_config_lock);
+       if (IS_ERR(nodemap)) {
+               rc = PTR_ERR(nodemap);
+               CERROR("cannot find nodemap '%s': rc = %d\n",
+                      (char *)m->private, rc);
+               return rc;
+       }
+
+       seq_printf(m, "%d\n", (int)nodemap->nmf_forbid_encryption);
+       nodemap_putref(nodemap);
+       return 0;
+}
+
 static struct lprocfs_vars lprocfs_nm_module_vars[] = {
        {
                .name           = "active",
@@ -654,6 +682,7 @@ LPROC_SEQ_FOPS_RO(nodemap_squash_gid);
 LPROC_SEQ_FOPS_RO(nodemap_deny_unknown);
 LPROC_SEQ_FOPS_RO(nodemap_map_mode);
 LPROC_SEQ_FOPS_RO(nodemap_audit_mode);
+LPROC_SEQ_FOPS_RO(nodemap_forbid_encryption);
 
 const struct file_operations nodemap_ranges_fops = {
        .open                   = nodemap_ranges_open,
@@ -702,6 +731,10 @@ static struct lprocfs_vars lprocfs_nodemap_vars[] = {
                .fops           = &nodemap_audit_mode_fops,
        },
        {
+               .name           = "forbid_encryption",
+               .fops           = &nodemap_forbid_encryption_fops,
+       },
+       {
                .name           = "squash_uid",
                .fops           = &nodemap_squash_uid_fops,
        },
@@ -772,6 +805,10 @@ static struct lprocfs_vars lprocfs_default_nodemap_vars[] = {
                .fops           = &nodemap_audit_mode_fops,
        },
        {
+               .name           = "forbid_encryption",
+               .fops           = &nodemap_forbid_encryption_fops,
+       },
+       {
                NULL
        }
 };