Whamcloud - gitweb
LU-7861 osp: replace the hot spinlock with atomic trackers
[fs/lustre-release.git] / lustre / osp / osp_precreate.c
index 30f3164..e341faf 100644 (file)
@@ -973,8 +973,9 @@ void osp_pre_update_status(struct osp_device *d, int rc)
                                       msfs->os_bfree, used, msfs->os_bavail,
                                       d->opd_pre_status, rc);
                        CDEBUG(D_INFO,
-                              "non-committed changes: %lu, in progress: %u\n",
-                              d->opd_syn_changes, d->opd_syn_rpc_in_progress);
+                              "non-committed changes: %u, in progress: %u\n",
+                              atomic_read(&d->opd_syn_changes),
+                              atomic_read(&d->opd_syn_rpc_in_progress));
                } else if (old == -ENOSPC) {
                        d->opd_pre_status = 0;
                        spin_lock(&d->opd_pre_lock);
@@ -1243,7 +1244,8 @@ static int osp_precreate_ready_condition(const struct lu_env *env,
                return 1;
 
        /* ready if OST reported no space and no destroys in progress */
-       if (d->opd_syn_changes + d->opd_syn_rpc_in_progress == 0 &&
+       if (atomic_read(&d->opd_syn_changes) +
+           atomic_read(&d->opd_syn_rpc_in_progress) == 0 &&
            d->opd_pre_status == -ENOSPC)
                return 1;
 
@@ -1268,11 +1270,12 @@ static int osp_precreate_timeout_condition(void *data)
        struct osp_device *d = data;
 
        CDEBUG(D_HA, "%s: slow creates, last="DFID", next="DFID", "
-             "reserved="LPU64", syn_changes=%lu, "
+             "reserved="LPU64", syn_changes=%u, "
              "syn_rpc_in_progress=%d, status=%d\n",
              d->opd_obd->obd_name, PFID(&d->opd_pre_last_created_fid),
              PFID(&d->opd_pre_used_fid), d->opd_pre_reserved,
-             d->opd_syn_changes, d->opd_syn_rpc_in_progress,
+             atomic_read(&d->opd_syn_changes),
+             atomic_read(&d->opd_syn_rpc_in_progress),
              d->opd_pre_status);
 
        return 1;
@@ -1361,16 +1364,16 @@ int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d)
                 * wait till that is done - some space might be released
                 */
                if (unlikely(rc == -ENOSPC)) {
-                       if (d->opd_syn_changes) {
+                       if (atomic_read(&d->opd_syn_changes)) {
                                /* force local commit to release space */
                                dt_commit_async(env, d->opd_storage);
                        }
-                       if (d->opd_syn_rpc_in_progress) {
+                       if (atomic_read(&d->opd_syn_rpc_in_progress)) {
                                /* just wait till destroys are done */
                                /* see l_wait_even() few lines below */
                        }
-                       if (d->opd_syn_changes +
-                           d->opd_syn_rpc_in_progress == 0) {
+                       if (atomic_read(&d->opd_syn_changes) +
+                           atomic_read(&d->opd_syn_rpc_in_progress) == 0) {
                                /* no hope for free space */
                                break;
                        }