Whamcloud - gitweb
LU-11605 osp: max_create_count and create_count changes
[fs/lustre-release.git] / lustre / osp / lproc_osp.c
index 98ec193..75b7f07 100644 (file)
@@ -415,14 +415,17 @@ static ssize_t max_create_count_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       if (val < 0 || val > INT_MAX)
-               return -ERANGE;
-       if (val > OST_MAX_PRECREATE)
+       if (val && (val < OST_MIN_PRECREATE ||
+                   val > OST_MAX_PRECREATE))
                return -ERANGE;
 
        if (osp->opd_pre_create_count > val)
                osp->opd_pre_create_count = val;
 
+       /* Can be 0 after setting max_create_count to 0 */
+       if (osp->opd_pre_create_count == 0 && val != 0)
+               osp->opd_pre_create_count = OST_MIN_PRECREATE;
+
        osp->opd_pre_max_create_count = val;
 
        return count;
@@ -763,10 +766,32 @@ ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RO_ATTR(ping);
 
+ssize_t osp_conn_uuid_show(struct kobject *kobj, struct attribute *attr,
+                          char *buf)
+{
+       struct dt_device *dt = container_of(kobj, struct dt_device,
+                                           dd_kobj);
+       struct lu_device *lu = dt2lu_dev(dt);
+       struct obd_device *obd = lu->ld_obd;
+       struct ptlrpc_connection *conn;
+       ssize_t count;
+
+       LPROCFS_CLIMP_CHECK(obd);
+       conn = obd->u.cli.cl_import->imp_connection;
+       if (conn && obd->u.cli.cl_import)
+               count = sprintf(buf, "%s\n", conn->c_remote_uuid.uuid);
+       else
+               count = sprintf(buf, "%s\n", "<none>");
+
+       LPROCFS_CLIMP_EXIT(obd);
+       return count;
+}
+
+LUSTRE_ATTR(ost_conn_uuid, 0444, osp_conn_uuid_show, NULL);
+LUSTRE_ATTR(mdt_conn_uuid, 0444, osp_conn_uuid_show, NULL);
+
 LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, connect_flags);
 LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, server_uuid);
-LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
-
 LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, timeouts);
 
 LPROC_SEQ_FOPS_RW_TYPE(osp, import);
@@ -813,7 +838,7 @@ osp_reserved_mb_high_seq_write(struct file *file, const char __user *buffer,
        __s64                   val;
        int                     rc;
 
-       if (osp == NULL)
+       if (osp == NULL || osp->opd_pre == NULL)
                return -EINVAL;
 
        rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
@@ -874,7 +899,7 @@ osp_reserved_mb_low_seq_write(struct file *file, const char __user *buffer,
        __s64                   val;
        int                     rc;
 
-       if (osp == NULL)
+       if (osp == NULL || osp->opd_pre == NULL)
                return -EINVAL;
 
        rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
@@ -916,8 +941,6 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
          .fops =       &osp_connect_flags_fops         },
        { .name =       "ost_server_uuid",
          .fops =       &osp_server_uuid_fops           },
-       { .name =       "ost_conn_uuid",
-         .fops =       &osp_conn_uuid_fops             },
        { .name =       "timeouts",
          .fops =       &osp_timeouts_fops              },
        { .name =       "import",
@@ -936,8 +959,6 @@ static struct lprocfs_vars lprocfs_osp_md_vars[] = {
          .fops =       &osp_connect_flags_fops         },
        { .name =       "mdt_server_uuid",
          .fops =       &osp_server_uuid_fops           },
-       { .name =       "mdt_conn_uuid",
-         .fops =       &osp_conn_uuid_fops             },
        { .name =       "timeouts",
          .fops =       &osp_timeouts_fops              },
        { .name =       "import",
@@ -955,6 +976,7 @@ static struct attribute *osp_obd_attrs[] = {
        &lustre_attr_max_rpcs_in_flight.attr,
        &lustre_attr_max_rpcs_in_progress.attr,
        &lustre_attr_maxage.attr,
+       &lustre_attr_ost_conn_uuid.attr,
        &lustre_attr_ping.attr,
        &lustre_attr_prealloc_status.attr,
        &lustre_attr_prealloc_next_id.attr,
@@ -980,6 +1002,7 @@ static struct attribute *osp_md_attrs[] = {
        &lustre_attr_max_rpcs_in_flight.attr,
        &lustre_attr_max_rpcs_in_progress.attr,
        &lustre_attr_maxage.attr,
+       &lustre_attr_mdt_conn_uuid.attr,
        &lustre_attr_ping.attr,
        &lustre_attr_prealloc_status.attr,
        NULL,