Whamcloud - gitweb
LU-12854 nodemap: allow boolean value for audit_mode
[fs/lustre-release.git] / lustre / mdc / mdc_dev.c
index 036dc92..69d1f07 100644 (file)
@@ -172,8 +172,8 @@ again:
 /**
  * Check if page @page is covered by an extra lock or discard it.
  */
-static int mdc_check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
-                                   struct osc_page *ops, void *cbdata)
+static bool mdc_check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
+                                    struct osc_page *ops, void *cbdata)
 {
        struct osc_thread_info *info = osc_env_info(env);
        struct osc_object *osc = cbdata;
@@ -200,7 +200,7 @@ static int mdc_check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
        }
 
        info->oti_next_index = index + 1;
-       return CLP_GANG_OKAY;
+       return true;
 }
 
 /**
@@ -219,7 +219,6 @@ static int mdc_lock_discard_pages(const struct lu_env *env,
        struct osc_thread_info *info = osc_env_info(env);
        struct cl_io *io = &info->oti_io;
        osc_page_gang_cbt cb;
-       int res;
        int result;
 
        ENTRY;
@@ -232,15 +231,9 @@ static int mdc_lock_discard_pages(const struct lu_env *env,
 
        cb = discard ? osc_discard_cb : mdc_check_and_discard_cb;
        info->oti_fn_index = info->oti_next_index = start;
-       do {
-               res = osc_page_gang_lookup(env, io, osc, info->oti_next_index,
-                                          end, cb, (void *)osc);
-               if (info->oti_next_index > end)
-                       break;
 
-               if (res == CLP_GANG_RESCHED)
-                       cond_resched();
-       } while (res != CLP_GANG_OKAY);
+       osc_page_gang_lookup(env, io, osc, info->oti_next_index,
+                            end, cb, (void *)osc);
 out:
        cl_io_fini(env, io);
        RETURN(result);
@@ -323,7 +316,6 @@ static int mdc_dlm_blocking_ast0(const struct lu_env *env,
 
        if (dlmlock->l_ast_data != NULL) {
                obj = osc2cl(dlmlock->l_ast_data);
-               dlmlock->l_ast_data = NULL;
                cl_object_get(obj);
        }
        unlock_res_and_lock(dlmlock);
@@ -341,6 +333,7 @@ static int mdc_dlm_blocking_ast0(const struct lu_env *env,
                 */
                /* losing a lock, update kms */
                lock_res_and_lock(dlmlock);
+               dlmlock->l_ast_data = NULL;
                cl_object_attr_lock(obj);
                attr->cat_kms = 0;
                cl_object_attr_update(env, obj, attr, CAT_KMS);
@@ -700,7 +693,7 @@ int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
        enum ldlm_mode mode;
        bool glimpse = *flags & LDLM_FL_HAS_INTENT;
        __u64 match_flags = *flags;
-       struct list_head cancels = LIST_HEAD_INIT(cancels);
+       LIST_HEAD(cancels);
        int rc, count;
 
        ENTRY;
@@ -1122,8 +1115,8 @@ static int mdc_io_read_ahead(const struct lu_env *env,
                ldlm_lock_decref(&lockh, dlmlock->l_req_mode);
        }
 
-       ra->cra_rpc_size = osc_cli(osc)->cl_max_pages_per_rpc;
-       ra->cra_end = CL_PAGE_EOF;
+       ra->cra_rpc_pages = osc_cli(osc)->cl_max_pages_per_rpc;
+       ra->cra_end_idx = CL_PAGE_EOF;
        ra->cra_release = osc_read_ahead_release;
        ra->cra_cbdata = dlmlock;