Whamcloud - gitweb
b=20433 decrease the usage of memory on clients.
[fs/lustre-release.git] / lustre / mdc / mdc_locks.c
index b8f69e9..3a9db8b 100644 (file)
@@ -144,6 +144,27 @@ int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
         return 0;
 }
 
+/* find any ldlm lock of the inode in mdc
+ * return 0    not find
+ *        1    find one
+ *      < 0    error */
+int mdc_find_cbdata(struct obd_export *exp, struct ll_fid *fid,
+                    ldlm_iterator_t it, void *data)
+{
+        struct ldlm_res_id res_id;
+        int rc = 0;
+        ENTRY;
+
+        fid_build_reg_res_name((struct lu_fid*)fid, &res_id);
+        rc = ldlm_resource_iterate(class_exp2obd(exp)->obd_namespace, &res_id,
+                                   it, data);
+        if (rc == LDLM_ITER_STOP)
+                RETURN(1);
+        else if (rc == LDLM_ITER_CONTINUE)
+                RETURN(0);
+        RETURN(rc);
+}
+
 static inline void mdc_clear_replay_flag(struct ptlrpc_request *req, int rc)
 {
         /* Don't hold error requests for replay. */