Whamcloud - gitweb
ldlm and its users: do not pass struct ldlm_res_id by value, pass a pointer instead...
authornikita <nikita>
Mon, 30 Oct 2006 17:36:13 +0000 (17:36 +0000)
committernikita <nikita>
Mon, 30 Oct 2006 17:36:13 +0000 (17:36 +0000)
23 files changed:
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_internal.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/ldlm/ldlm_resource.c
lustre/liblustre/super.c
lustre/llite/file.c
lustre/mdc/mdc_locks.c
lustre/mds/handler.c
lustre/mds/mds_internal.h
lustre/mds/mds_open.c
lustre/mds/mds_reint.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_reint.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_handler.c
lustre/obdecho/echo.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_io.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c

index bbfd4d5..d21943c 100644 (file)
@@ -320,7 +320,7 @@ struct ldlm_lock {
         /* for ldlm_add_ast_work_item() */
         struct list_head      l_bl_ast;
         struct list_head      l_cp_ast;
-        struct ldlm_lock     *l_blocking_lock; 
+        struct ldlm_lock     *l_blocking_lock;
         int                   l_bl_ast_run;
 };
 
@@ -410,7 +410,7 @@ int ldlm_namespace_foreach_res(struct ldlm_namespace *ns,
                                ldlm_res_iterator_t iter, void *closure);
 
 int ldlm_replay_locks(struct obd_import *imp);
-void ldlm_resource_iterate(struct ldlm_namespace *, struct ldlm_res_id *,
+void ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *,
                            ldlm_iterator_t iter, void *data);
 
 
@@ -474,7 +474,8 @@ void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
-int ldlm_lock_match(struct ldlm_namespace *ns, int flags, struct ldlm_res_id *,
+int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
+                    const struct ldlm_res_id *,
                     ldlm_type_t type, ldlm_policy_data_t *, ldlm_mode_t mode,
                     struct lustre_handle *);
 struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
@@ -500,8 +501,8 @@ static inline void ldlm_proc_cleanup(void) {}
 /* resource.c - internal */
 struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
                                         struct ldlm_resource *parent,
-                                        struct ldlm_res_id, ldlm_type_t type,
-                                        int create);
+                                        const struct ldlm_res_id *,
+                                        ldlm_type_t type, int create);
 struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res);
 int ldlm_resource_putref(struct ldlm_resource *res);
 void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head,
@@ -512,7 +513,7 @@ void ldlm_dump_all_namespaces(int level);
 void ldlm_namespace_dump(int level, struct ldlm_namespace *);
 void ldlm_resource_dump(int level, struct ldlm_resource *);
 int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *,
-                              struct ldlm_res_id);
+                              const struct ldlm_res_id *);
 
 struct ldlm_callback_suite {
         ldlm_completion_callback lcs_completion;
@@ -527,8 +528,8 @@ int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp);
 int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data);
 int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
-                     struct ldlm_res_id res_id, 
-                     ldlm_type_t type, ldlm_policy_data_t *policy, 
+                     const struct ldlm_res_id *res_id,
+                     ldlm_type_t type, ldlm_policy_data_t *policy,
                      ldlm_mode_t mode, int *flags,
                      ldlm_blocking_callback blocking,
                      ldlm_completion_callback completion,
@@ -543,7 +544,8 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                           int *flags, void *lvb, __u32 lvb_len,
                           void *lvb_swabber, struct lustre_handle *lockh,
                           int rc);
-int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id res_id,
+int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
+                           const struct ldlm_res_id *res_id,
                            ldlm_type_t type, ldlm_policy_data_t *policy,
                            ldlm_mode_t mode, int *flags,
                            ldlm_blocking_callback blocking,
@@ -557,9 +559,10 @@ int ldlm_cli_convert(struct lustre_handle *, int new_mode, int *flags);
 int ldlm_handle_convert0(struct ptlrpc_request *req,
                          const struct ldlm_request *dlm_req);
 int ldlm_cli_cancel(struct lustre_handle *lockh);
-int ldlm_cli_cancel_unused(struct ldlm_namespace *, struct ldlm_res_id *,
+int ldlm_cli_cancel_unused(struct ldlm_namespace *, const struct ldlm_res_id *,
                            int flags, void *opaque);
-int ldlm_cli_join_lru(struct ldlm_namespace *, struct ldlm_res_id *, int join);
+int ldlm_cli_join_lru(struct ldlm_namespace *,
+                      const struct ldlm_res_id *, int join);
 
 /* mds/handler.c */
 /* This has to be here because recursive inclusion sucks. */
index 9bf73d4..f2ca88e 100644 (file)
@@ -334,7 +334,7 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
                 /* XXX - if ldlm_lock_new() can sleep we should
                  * release the ns_lock, allocate the new lock,
                  * and restart processing this lock. */
-                new2 = ldlm_lock_create(ns, NULL, res->lr_name, LDLM_FLOCK,
+                new2 = ldlm_lock_create(ns, NULL, &res->lr_name, LDLM_FLOCK,
                                         lock->l_granted_mode, NULL, NULL, NULL,
                                         NULL, 0);
                 if (!new2) {
@@ -380,7 +380,7 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
         if (*flags != LDLM_FL_WAIT_NOREPROC) {
                 if (first_enq) {
                         /* If this is an unlock, reprocess the waitq and
-                         * send completions ASTs for locks that can now be 
+                         * send completions ASTs for locks that can now be
                          * granted. The only problem with doing this
                          * reprocessing here is that the completion ASTs for
                          * newly granted locks will be sent before the unlock
@@ -492,7 +492,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data)
 
         LDLM_DEBUG(lock, "client-side enqueue waking up: rc = %d", rc);
         RETURN(rc);
+
 granted:
 
         LDLM_DEBUG(lock, "client-side enqueue granted");
index 6decf99..4a900d9 100644 (file)
@@ -20,7 +20,7 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
 struct ldlm_lock *
 ldlm_lock_create(struct ldlm_namespace *ns,
                  const struct lustre_handle *parent_lock_handle,
-                 const struct ldlm_res_id,
+                 const struct ldlm_res_id *,
                  ldlm_type_t type, ldlm_mode_t, ldlm_blocking_callback,
                  ldlm_completion_callback, ldlm_glimpse_callback, void *data,
                  __u32 lvb_len);
index a8bdffc..78f7474 100644 (file)
@@ -319,7 +319,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_lock *parent,
 }
 
 int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,
-                              struct ldlm_res_id new_resid)
+                              const struct ldlm_res_id *new_resid)
 {
         struct ldlm_resource *oldres = lock->l_resource;
         struct ldlm_resource *newres;
@@ -329,14 +329,14 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,
         LASSERT(ns->ns_client != 0);
 
         lock_res_and_lock(lock);
-        if (memcmp(&new_resid, &lock->l_resource->lr_name,
+        if (memcmp(new_resid, &lock->l_resource->lr_name,
                    sizeof(lock->l_resource->lr_name)) == 0) {
                 /* Nothing to do */
                 unlock_res_and_lock(lock);
                 RETURN(0);
         }
 
-        LASSERT(new_resid.name[0] != 0);
+        LASSERT(new_resid->name[0] != 0);
 
         /* This function assumes that the lock isn't on any lists */
         LASSERT(list_empty(&lock->l_res_link));
@@ -351,7 +351,7 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,
         }
 
         lock_res_and_lock(lock);
-        LASSERT(memcmp(&new_resid, &lock->l_resource->lr_name,
+        LASSERT(memcmp(new_resid, &lock->l_resource->lr_name,
                        sizeof(lock->l_resource->lr_name)) != 0);
         lock_res(newres);
         lock->l_resource = newres;
@@ -513,7 +513,7 @@ void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
         check_res_locked(lock->l_resource);
         if (new)
                 ldlm_add_bl_work_item(lock, new, work_list);
-        else 
+        else
                 ldlm_add_cp_work_item(lock, work_list);
         EXIT;
 }
@@ -764,7 +764,7 @@ void ldlm_lock_allow_match(struct ldlm_lock *lock)
  * sometime later.
  */
 int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
-                    struct ldlm_res_id *res_id, ldlm_type_t type,
+                    const struct ldlm_res_id *res_id, ldlm_type_t type,
                     ldlm_policy_data_t *policy, ldlm_mode_t mode,
                     struct lustre_handle *lockh)
 {
@@ -783,7 +783,7 @@ int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
                 mode = old_lock->l_req_mode;
         }
 
-        res = ldlm_resource_get(ns, NULL, *res_id, type, 0);
+        res = ldlm_resource_get(ns, NULL, res_id, type, 0);
         if (res == NULL) {
                 LASSERT(old_lock == NULL);
                 RETURN(0);
@@ -871,7 +871,7 @@ int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
 /* Returns a referenced lock */
 struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
                                    const struct lustre_handle *parent_lock_handle,
-                                   const struct ldlm_res_id res_id,
+                                   const struct ldlm_res_id *res_id,
                                    ldlm_type_t type,
                                    ldlm_mode_t mode,
                                    ldlm_blocking_callback blocking,
@@ -1095,7 +1095,7 @@ int ldlm_run_cp_ast_work(struct list_head *rpc_list)
          * will never call the local blocking_ast until we drop our
          * reader/writer reference, which we won't do until we get the
          * reply and finish enqueueing. */
-        
+
         list_for_each_safe(tmp, pos, rpc_list) {
                 struct ldlm_lock *lock =
                         list_entry(tmp, struct ldlm_lock, l_cp_ast);
@@ -1129,7 +1129,7 @@ void ldlm_reprocess_all_ns(struct ldlm_namespace *ns)
 {
         struct list_head *tmp;
         int i, rc;
-        
+
         if (ns == NULL)
                 return;
 
@@ -1211,7 +1211,7 @@ void ldlm_lock_cancel(struct ldlm_lock *lock)
 
         ldlm_del_waiting_lock(lock);
         lock_res_and_lock(lock);
-        
+
         res = lock->l_resource;
         ns = res->lr_namespace;
 
@@ -1226,7 +1226,7 @@ void ldlm_lock_cancel(struct ldlm_lock *lock)
 
         ldlm_resource_unlink_lock(lock);
         unlock_res_and_lock(lock);
-        
+
         ldlm_lock_destroy(lock);
 
         EXIT;
@@ -1364,7 +1364,7 @@ void ldlm_lock_dump(int level, struct ldlm_lock *lock, int pos)
                        libcfs_nid2str(imp->imp_connection->c_peer.nid),
                        lock->l_remote_handle.cookie);
         }
-        CDEBUG(level, "  Resource: %p ("LPU64"/"LPU64"/"LPU64")\n", 
+        CDEBUG(level, "  Resource: %p ("LPU64"/"LPU64"/"LPU64")\n",
                   lock->l_resource,
                   lock->l_resource->lr_name.name[0],
                   lock->l_resource->lr_name.name[1],
@@ -1450,7 +1450,7 @@ ldlm_lock_debug(cfs_debug_limit_state_t *cdls,
         switch (lock->l_resource->lr_type) {
         case LDLM_EXTENT:
                 cdebug(cdls, level, file, func, line,
-                       " ns: %s lock: %p/"LPX64" lrc: %d/%d,%d mode: %s/%s " 
+                       " ns: %s lock: %p/"LPX64" lrc: %d/%d,%d mode: %s/%s "
                        "res: "LPU64"/"LPU64" rrc: %d type: %s ["LPU64"->"LPU64
                        "] (req "LPU64"->"LPU64") flags: %x remote: "LPX64
                        " expref: %d pid: %u\n",
index 701bb67..9c2d7d4 100644 (file)
@@ -368,7 +368,7 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock)
 
 /*
  * Prolong the lock
- * 
+ *
  * Called with namespace lock held.
  */
 int ldlm_refresh_waiting_lock(struct ldlm_lock *lock)
@@ -804,7 +804,7 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
 
         /* The lock's callback data might be set in the policy function */
         lock = ldlm_lock_create(ns, &dlm_req->lock_handle2,
-                                dlm_req->lock_desc.l_resource.lr_name,
+                                &dlm_req->lock_desc.l_resource.lr_name,
                                 dlm_req->lock_desc.l_resource.lr_type,
                                 dlm_req->lock_desc.l_req_mode,
                                 cbs->lcs_blocking, cbs->lcs_completion,
@@ -1200,7 +1200,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
                    sizeof(lock->l_resource->lr_name)) != 0) {
                 unlock_res_and_lock(lock);
                 ldlm_lock_change_resource(ns, lock,
-                                         dlm_req->lock_desc.l_resource.lr_name);
+                                        &dlm_req->lock_desc.l_resource.lr_name);
                 LDLM_DEBUG(lock, "completion AST, new resource");
                 CERROR("change resource!\n");
                 lock_res_and_lock(lock);
index f72c236..5162f94 100644 (file)
@@ -223,7 +223,8 @@ int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp)
         return -ELDLM_NO_LOCK_DATA;
 }
 
-int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id res_id,
+int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
+                           const struct ldlm_res_id *res_id,
                            ldlm_type_t type, ldlm_policy_data_t *policy,
                            ldlm_mode_t mode, int *flags,
                            ldlm_blocking_callback blocking,
@@ -267,8 +268,6 @@ int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id res_id,
 
         if (policy != NULL)
                 *policy = lock->l_policy_data;
-        if ((*flags) & LDLM_FL_LOCK_CHANGED)
-                res_id = lock->l_resource->lr_name;
 
         LDLM_DEBUG_NOLOCK("client-side local enqueue handler END (lock %p)",
                           lock);
@@ -381,7 +380,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                 }
 
                 if (memcmp(reply->lock_desc.l_resource.lr_name.name,
-                          lock->l_resource->lr_name.name, 
+                          lock->l_resource->lr_name.name,
                           sizeof(struct ldlm_res_id))) {
                         CDEBUG(D_INFO, "remote intent success, locking "
                                         "(%ld,%ld,%ld) instead of "
@@ -394,7 +393,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                               (long)lock->l_resource->lr_name.name[2]);
 
                         ldlm_lock_change_resource(ns, lock,
-                                           reply->lock_desc.l_resource.lr_name);
+                                          &reply->lock_desc.l_resource.lr_name);
                         if (lock->l_resource == NULL) {
                                 LBUG();
                                 GOTO(cleanup, rc = -ENOMEM);
@@ -467,8 +466,8 @@ cleanup:
  * request was created in ldlm_cli_enqueue and it is the async request,
  * pass it to the caller in @reqp. */
 int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
-                     struct ldlm_res_id res_id, 
-                     ldlm_type_t type, ldlm_policy_data_t *policy, 
+                     const struct ldlm_res_id *res_id,
+                     ldlm_type_t type, ldlm_policy_data_t *policy,
                      ldlm_mode_t mode, int *flags,
                      ldlm_blocking_callback blocking,
                      ldlm_completion_callback completion,
@@ -880,8 +879,8 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync)
 }
 
 static int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
-                                           struct ldlm_res_id res_id, int flags,
-                                           void *opaque)
+                                           const struct ldlm_res_id *res_id,
+                                           int flags, void *opaque)
 {
         struct list_head *tmp, *next, list = CFS_LIST_HEAD_INIT(list);
         struct ldlm_resource *res;
@@ -891,7 +890,7 @@ static int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
         res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
         if (res == NULL) {
                 /* This is not a problem. */
-                CDEBUG(D_INFO, "No resource "LPU64"\n", res_id.name[0]);
+                CDEBUG(D_INFO, "No resource "LPU64"\n", res_id->name[0]);
                 RETURN(0);
         }
 
@@ -964,7 +963,8 @@ static inline int have_no_nsresource(struct ldlm_namespace *ns)
  * to notify the server.
  * If flags & LDLM_FL_WARN, print a warning if some locks are still in use. */
 int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
-                           struct ldlm_res_id *res_id, int flags, void *opaque)
+                           const struct ldlm_res_id *res_id,
+                           int flags, void *opaque)
 {
         int i;
         ENTRY;
@@ -973,7 +973,7 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
                 RETURN(ELDLM_OK);
 
         if (res_id)
-                RETURN(ldlm_cli_cancel_unused_resource(ns, *res_id, flags,
+                RETURN(ldlm_cli_cancel_unused_resource(ns, res_id, flags,
                                                        opaque));
 
         spin_lock(&ns->ns_hash_lock);
@@ -988,7 +988,7 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
                         ldlm_resource_getref(res);
                         spin_unlock(&ns->ns_hash_lock);
 
-                        rc = ldlm_cli_cancel_unused_resource(ns, res->lr_name,
+                        rc = ldlm_cli_cancel_unused_resource(ns, &res->lr_name,
                                                              flags, opaque);
 
                         if (rc)
@@ -1007,7 +1007,7 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
 
 /* join/split resource locks to/from lru list */
 int ldlm_cli_join_lru(struct ldlm_namespace *ns,
-                      struct ldlm_res_id *res_id, int join)
+                      const struct ldlm_res_id *res_id, int join)
 {
         struct ldlm_resource *res;
         struct ldlm_lock *lock, *n;
@@ -1016,7 +1016,7 @@ int ldlm_cli_join_lru(struct ldlm_namespace *ns,
 
         LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT);
 
-        res = ldlm_resource_get(ns, NULL, *res_id, LDLM_EXTENT, 0);
+        res = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
         if (res == NULL)
                 RETURN(count);
         LASSERT(res->lr_type == LDLM_EXTENT);
@@ -1152,7 +1152,8 @@ int ldlm_namespace_foreach_res(struct ldlm_namespace *ns,
 }
 
 /* non-blocking function to manipulate a lock whose cb_data is being put away.*/
-void ldlm_resource_iterate(struct ldlm_namespace *ns, struct ldlm_res_id *res_id,
+void ldlm_resource_iterate(struct ldlm_namespace *ns,
+                           const struct ldlm_res_id *res_id,
                            ldlm_iterator_t iter, void *data)
 {
         struct ldlm_resource *res;
@@ -1163,7 +1164,7 @@ void ldlm_resource_iterate(struct ldlm_namespace *ns, struct ldlm_res_id *res_id
                 LBUG();
         }
 
-        res = ldlm_resource_get(ns, NULL, *res_id, 0, 0);
+        res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
         if (res == NULL) {
                 EXIT;
                 return;
index 4d50aa8..2a23d5f 100644 (file)
@@ -290,10 +290,10 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
         int local_only = (flags & LDLM_FL_LOCAL_ONLY);
         ENTRY;
 
-        
+
         do {
                 struct ldlm_lock *lock = NULL;
+
                 /* first, we look for non-cleaned-yet lock
                  * all cleaned locks are marked by CLEANED flag */
                 lock_res(res);
@@ -307,7 +307,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
                         lock->l_flags |= LDLM_FL_CLEANED;
                         break;
                 }
-                
+
                 if (lock == NULL) {
                         unlock_res(res);
                         break;
@@ -459,13 +459,14 @@ int ldlm_namespace_free(struct ldlm_namespace *ns, int force)
         return ELDLM_OK;
 }
 
-static __u32 ldlm_hash_fn(struct ldlm_resource *parent, struct ldlm_res_id name)
+static __u32 ldlm_hash_fn(struct ldlm_resource *parent,
+                          const struct ldlm_res_id *name)
 {
         __u32 hash = 0;
         int i;
 
         for (i = 0; i < RES_NAME_SIZE; i++)
-                hash += name.name[i];
+                hash += name->name[i];
 
         hash += (__u32)((unsigned long)parent >> 4);
 
@@ -499,7 +500,8 @@ static struct ldlm_resource *ldlm_resource_new(void)
 
 /* must be called with hash lock held */
 static struct ldlm_resource *
-ldlm_resource_find(struct ldlm_namespace *ns, struct ldlm_res_id name, __u32 hash)
+ldlm_resource_find(struct ldlm_namespace *ns, const struct ldlm_res_id *name,
+                   __u32 hash)
 {
         struct list_head *bucket, *tmp;
         struct ldlm_resource *res;
@@ -509,7 +511,7 @@ ldlm_resource_find(struct ldlm_namespace *ns, struct ldlm_res_id name, __u32 has
 
         list_for_each(tmp, bucket) {
                 res = list_entry(tmp, struct ldlm_resource, lr_hash);
-                if (memcmp(&res->lr_name, &name, sizeof(res->lr_name)) == 0)
+                if (memcmp(&res->lr_name, name, sizeof(res->lr_name)) == 0)
                         return res;
         }
 
@@ -520,7 +522,7 @@ ldlm_resource_find(struct ldlm_namespace *ns, struct ldlm_res_id name, __u32 has
  * Returns: newly-allocated, referenced, unlocked resource */
 static struct ldlm_resource *
 ldlm_resource_add(struct ldlm_namespace *ns, struct ldlm_resource *parent,
-                  struct ldlm_res_id name, __u32 hash, ldlm_type_t type)
+                  const struct ldlm_res_id *name, __u32 hash, ldlm_type_t type)
 {
         struct list_head *bucket;
         struct ldlm_resource *res, *old_res;
@@ -533,7 +535,7 @@ ldlm_resource_add(struct ldlm_namespace *ns, struct ldlm_resource *parent,
         if (!res)
                 RETURN(NULL);
 
-        res->lr_name = name;
+        res->lr_name = *name;
         res->lr_namespace = ns;
         res->lr_type = type;
         res->lr_most_restr = LCK_NL;
@@ -574,7 +576,7 @@ ldlm_resource_add(struct ldlm_namespace *ns, struct ldlm_resource *parent,
                 rc = ns->ns_lvbo->lvbo_init(res);
                 if (rc)
                         CERROR("lvbo_init failed for resource "
-                              LPU64": rc %d\n", name.name[0], rc);
+                              LPU64": rc %d\n", name->name[0], rc);
                 /* we create resource with locked lr_lvb_sem */
                 up(&res->lr_lvb_sem);
         }
@@ -587,7 +589,7 @@ ldlm_resource_add(struct ldlm_namespace *ns, struct ldlm_resource *parent,
  * Returns: referenced, unlocked ldlm_resource or NULL */
 struct ldlm_resource *
 ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
-                  struct ldlm_res_id name, ldlm_type_t type, int create)
+                  const struct ldlm_res_id *name, ldlm_type_t type, int create)
 {
         __u32 hash = ldlm_hash_fn(parent, name);
         struct ldlm_resource *res = NULL;
@@ -595,7 +597,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
 
         LASSERT(ns != NULL);
         LASSERT(ns->ns_hash != NULL);
-        LASSERT(name.name[0] != 0);
+        LASSERT(name->name[0] != 0);
 
         spin_lock(&ns->ns_hash_lock);
         res = ldlm_resource_find(ns, name, hash);
@@ -801,7 +803,7 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns)
                 lock_res(res);
                 ldlm_resource_dump(level, res);
                 unlock_res(res);
-                
+
                 spin_lock(&ns->ns_hash_lock);
                 tmp = tmp->next;
                 ldlm_resource_putref_locked(res);
index 45bf9fb..2c41d10 100644 (file)
@@ -152,10 +152,10 @@ void llu_update_inode(struct inode *inode, struct mdt_body *body,
         if (body->valid & OBD_MD_FLATIME &&
             body->atime > LTIME_S(st->st_atime))
                 LTIME_S(st->st_atime) = body->atime;
-        
+
         /* mtime is always updated with ctime, but can be set in past.
            As write and utime(2) may happen within 1 second, and utime's
-           mtime has a priority over write's one, so take mtime from mds 
+           mtime has a priority over write's one, so take mtime from mds
            for the same ctimes. */
         if (body->valid & OBD_MD_FLCTIME &&
             body->ctime >= LTIME_S(st->st_ctime)) {
@@ -623,7 +623,7 @@ int llu_md_setattr(struct inode *inode, struct md_op_data *op_data)
         struct ptlrpc_request *request = NULL;
         int rc;
         ENTRY;
-        
+
         llu_prep_md_op_data(op_data, inode, NULL, NULL, 0, 0);
         rc = md_setattr(sbi->ll_md_exp, op_data, NULL, 0, NULL, 0, &request);
 
@@ -661,7 +661,7 @@ static int llu_setattr_done_writing(struct inode *inode,
         struct intnl_stat *st = llu_i2stat(inode);
         int rc = 0;
         ENTRY;
-        
+
         LASSERT(op_data != NULL);
         if (!S_ISREG(st->st_mode))
                 RETURN(0);
@@ -733,12 +733,12 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                 attr->ia_valid |= ATTR_MTIME_SET;
         }
         if ((attr->ia_valid & ATTR_CTIME) && !(attr->ia_valid & ATTR_MTIME)) {
-                /* To avoid stale mtime on mds, obtain it from ost and send 
+                /* To avoid stale mtime on mds, obtain it from ost and send
                    to mds. */
                 rc = llu_glimpse_size(inode);
-                if (rc) 
+                if (rc)
                         RETURN(rc);
-                
+
                 attr->ia_valid |= ATTR_MTIME_SET | ATTR_MTIME;
                 attr->ia_mtime = inode->i_stbuf.st_mtime;
         }
@@ -791,7 +791,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                         }
                 }
 
-                
+
                 /* Won't invoke llu_vmtruncate(), as we already cleared
                  * ATTR_SIZE */
                 inode_setattr(inode, attr);
@@ -845,7 +845,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                         if (!rc)
                                 rc = err;
                 }
-                
+
                 if (op_data.ioepoch)
                         rc = llu_setattr_done_writing(inode, &op_data);
         } else if (ia_valid & (ATTR_MTIME | ATTR_MTIME_SET)) {
@@ -1449,9 +1449,9 @@ static int llu_file_flock(struct inode *ino,
                "start="LPU64", end="LPU64"\n", st->st_ino, flock.l_flock.pid,
                flags, mode, flock.l_flock.start, flock.l_flock.end);
 
-        rc = ldlm_cli_enqueue(llu_i2mdcexp(ino), NULL, res_id, 
-                              LDLM_FLOCK, &flock, mode, &flags, NULL, 
-                              ldlm_flock_completion_ast, NULL, 
+        rc = ldlm_cli_enqueue(llu_i2mdcexp(ino), NULL, &res_id,
+                              LDLM_FLOCK, &flock, mode, &flags, NULL,
+                              ldlm_flock_completion_ast, NULL,
                               file_lock, NULL, 0, NULL, &lockh, 0);
         RETURN(rc);
 }
@@ -1693,7 +1693,7 @@ static int llu_put_grouplock(struct inode *inode, unsigned long arg)
 
 static int llu_lov_dir_setstripe(struct inode *ino, unsigned long arg)
 {
-        struct llu_sb_info *sbi = llu_i2sbi(ino); 
+        struct llu_sb_info *sbi = llu_i2sbi(ino);
         struct ptlrpc_request *request = NULL;
         struct md_op_data op_data;
         struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
@@ -1731,7 +1731,7 @@ static int llu_lov_dir_setstripe(struct inode *ino, unsigned long arg)
 static int llu_lov_setstripe_ea_info(struct inode *ino, int flags,
                                      struct lov_user_md *lum, int lum_size)
 {
-        struct llu_sb_info *sbi = llu_i2sbi(ino); 
+        struct llu_sb_info *sbi = llu_i2sbi(ino);
         struct llu_inode_info *lli = llu_i2info(ino);
         struct llu_inode_info *lli2 = NULL;
         struct lov_stripe_md *lsm;
@@ -1753,7 +1753,7 @@ static int llu_lov_setstripe_ea_info(struct inode *ino, int flags,
         OBD_ALLOC(lli2, sizeof(struct llu_inode_info));
         if (!lli2)
                 return -ENOMEM;
-        
+
         memcpy(lli2, lli, sizeof(struct llu_inode_info));
         lli2->lli_open_count = 0;
         lli2->lli_it = NULL;
@@ -1769,38 +1769,38 @@ static int llu_lov_setstripe_ea_info(struct inode *ino, int flags,
                         llu_md_blocking_ast, NULL, LDLM_FL_INTENT_ONLY);
         if (rc)
                 GOTO(out, rc);
-        
+
         req = oit.d.lustre.it_data;
         rc = it_open_error(DISP_IT_EXECD, &oit);
         if (rc) {
                 req->rq_replay = 0;
                 GOTO(out, rc);
         }
-        
+
         rc = it_open_error(DISP_OPEN_OPEN, &oit);
         if (rc) {
                 req->rq_replay = 0;
                 GOTO(out, rc);
         }
-        
+
         rc = md_get_lustre_md(sbi->ll_md_exp, req,
                               1, sbi->ll_dt_exp, sbi->ll_md_exp, &md);
         if (rc)
                 GOTO(out, rc);
-        
+
         llu_update_inode(ino, md.body, md.lsm);
         lli->lli_smd = lli2->lli_smd;
         lli2->lli_smd = NULL;
 
         llu_local_open(lli2, &oit);
-       
+
         /* release intent */
         if (lustre_handle_is_used(&lockh))
                 ldlm_lock_decref(&lockh, LCK_CR);
 
         ptlrpc_req_finished(req);
         req = NULL;
-        
+
         rc = llu_file_release(ino);
  out:
         ino->i_private = lli;
@@ -1835,8 +1835,8 @@ static int llu_lov_setstripe(struct inode *ino, unsigned long arg)
                 return llu_lov_file_setstripe(ino, arg);
         if (S_ISDIR(st->st_mode))
                 return llu_lov_dir_setstripe(ino, arg);
-        
-        return -EINVAL; 
+
+        return -EINVAL;
 }
 
 static int llu_lov_getstripe(struct inode *ino, unsigned long arg)
index b877ecc..d315248 100644 (file)
@@ -68,13 +68,13 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,
                              struct obd_client_handle *och)
 {
         ENTRY;
-        
+
         op_data->attr.ia_valid = ATTR_MODE | ATTR_ATIME_SET |
                                  ATTR_MTIME_SET | ATTR_CTIME_SET;
 
         if (!(och->och_flags & FMODE_WRITE))
                 goto out;
-        
+
         if (!S_ISREG(inode->i_mode))
                 op_data->attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS;
         else
@@ -98,9 +98,9 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
 
         obd = class_exp2obd(ll_i2mdexp(inode));
         if (obd == NULL) {
-                /* 
-                 * XXX: in case of LMV, is this correct to access 
-                 * ->exp_handle? 
+                /*
+                 * XXX: in case of LMV, is this correct to access
+                 * ->exp_handle?
                  */
                 CERROR("Invalid MDC connection handle "LPX64"\n",
                        ll_i2mdexp(inode)->exp_handle.h_cookie);
@@ -120,8 +120,8 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
                 GOTO(out, rc = -ENOMEM);
 
         ll_prepare_close(inode, op_data, och);
-        epoch_close = (och->och_flags & FMODE_WRITE) && 
-                      ((op_data->flags & MF_EPOCH_CLOSE) || 
+        epoch_close = (och->och_flags & FMODE_WRITE) &&
+                      ((op_data->flags & MF_EPOCH_CLOSE) ||
                        !S_ISREG(inode->i_mode));
         rc = md_close(md_exp, op_data, och, &req);
 
@@ -129,7 +129,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
         if (rc == -EAGAIN) {
                 /* This close must have closed the epoch. */
                 LASSERT(epoch_close);
-                /* MDS has instructed us to obtain Size-on-MDS attribute from 
+                /* MDS has instructed us to obtain Size-on-MDS attribute from
                  * OSTs and send setattr to back to MDS. */
                 rc = ll_sizeonmds_update(inode, &och->och_fh);
                 if (rc) {
@@ -141,7 +141,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
                 CERROR("inode %lu mdc close failed: rc = %d\n",
                        inode->i_ino, rc);
         }
-        
+
         if (!epoch_close && (och->och_flags & FMODE_WRITE))
                 ll_queue_done_writing(inode, LLIF_DONE_WRITING);
 
@@ -194,7 +194,7 @@ int ll_md_real_close(struct inode *inode, int flags)
 
         if (och) { /* There might be a race and somebody have freed this och
                       already */
-                rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, 
+                rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
                                                inode, och);
                 /* Do not free @och is it is waiting for DONE_WRITING. */
                 if (och->och_fh.cookie == DEAD_HANDLE_MAGIC)
@@ -255,7 +255,7 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                 CERROR("Releasing a file %p with negative dentry %p. Name %s",
                        file, file->f_dentry, file->f_dentry->d_name.name);
         }
-        
+
         LUSTRE_FPRIVATE(file) = NULL;
         ll_file_data_put(fd);
         ll_capa_close(inode);
@@ -326,7 +326,7 @@ static int ll_intent_file_open(struct file *file, void *lmm,
          * parameters. No need for the open lock */
         if (!lmm && !lmmsize)
                 itp->it_flags |= MDS_OPEN_LOCK;
-        
+
         op_data  = ll_prep_md_op_data(NULL, parent->d_inode, NULL, name, len,
                                       O_RDWR);
         if (op_data == NULL)
@@ -393,18 +393,18 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
                 rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, lli, it, och);
                 if (rc)
                         RETURN(rc);
-                
+
                 body = lustre_msg_buf(req->rq_repmsg,
                                       DLM_REPLY_REC_OFF, sizeof(*body));
 
-                if ((it->it_flags & FMODE_WRITE) && 
+                if ((it->it_flags & FMODE_WRITE) &&
                     (body->valid & OBD_MD_FLSIZE))
                 {
                         CDEBUG(D_INODE, "Epoch "LPU64" opened on "DFID"\n",
                                lli->lli_ioepoch, PFID(&lli->lli_fid));
                 }
         }
-        
+
         LUSTRE_FPRIVATE(file) = fd;
         ll_readahead_init(inode, &fd->fd_ras);
         fd->fd_omode = it->it_flags;
@@ -477,7 +477,7 @@ int ll_file_open(struct inode *inode, struct file *file)
                  * first before coming here, so if we got here, we either came
                  * from NFS or all access checks ar eok, so it is safe to set
                  * this flag in any case (XXX - race with chmod?)
-                 */ 
+                 */
                 oit.it_flags |= MDS_OPEN_OWNEROVERRIDE;
 
                 /* We do not want O_EXCL here, presumably we opened the file
@@ -540,7 +540,7 @@ int ll_file_open(struct inode *inode, struct file *file)
                 req = it->d.lustre.it_data;
 
                 /* md_intent_lock() didn't get a request ref if there was an
-                 * open error, so don't do cleanup on the request here 
+                 * open error, so don't do cleanup on the request here
                  * (bug 3430) */
                 /* XXX (green): Should not we bail out on any error here, not
                  * just open error? */
@@ -813,9 +813,9 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm,
                 l_flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
                 /* check to see if another DLM lock covers this page b=2765 */
                 rc2 = ldlm_lock_match(lock->l_resource->lr_namespace,
-                                      l_flags, &lock->l_resource->lr_name, 
+                                      l_flags, &lock->l_resource->lr_name,
                                       LDLM_EXTENT, &tmpex, LCK_PR | LCK_PW, &lockh);
-                
+
                 if (rc2 <= 0 && page->mapping != NULL) {
                         struct ll_async_page *llap = llap_cast_private(page);
                         // checking again to account for writeback's lock_page()
@@ -1045,14 +1045,14 @@ int ll_local_size(struct inode *inode)
 
         if (lli->lli_smd->lsm_stripe_count == 0)
                 RETURN(0);
-        
+
         rc = obd_match(sbi->ll_dt_exp, lli->lli_smd, LDLM_EXTENT,
                        &policy, LCK_PR | LCK_PW, &flags, inode, &lockh);
         if (rc < 0)
                 RETURN(rc);
         else if (rc == 0)
                 RETURN(-ENODATA);
-        
+
         ll_merge_lvb(inode);
         obd_cancel(sbi->ll_dt_exp, lli->lli_smd, LCK_PR | LCK_PW, &lockh);
         RETURN(0);
@@ -1066,9 +1066,9 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
         struct obd_info oinfo = { { { 0 } } };
         struct ost_lvb lvb;
         int rc;
-        
+
         ENTRY;
-        
+
         einfo.ei_type = LDLM_EXTENT;
         einfo.ei_mode = LCK_PR;
         einfo.ei_flags = LDLM_FL_HAS_INTENT;
@@ -1089,7 +1089,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
                        "returning -EIO\n", rc);
                 RETURN(rc > 0 ? -EIO : rc);
         }
-        
+
         lov_stripe_lock(lsm);
         memset(&lvb, 0, sizeof(lvb));
         obd_merge_lvb(sbi->ll_dt_exp, lsm, &lvb, 0);
@@ -1099,7 +1099,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
         st->st_atime = lvb.lvb_atime;
         st->st_ctime = lvb.lvb_ctime;
         lov_stripe_unlock(lsm);
-        
+
         RETURN(rc);
 }
 
@@ -1117,7 +1117,7 @@ int ll_glimpse_size(struct inode *inode, int ast_flags)
 
         if (lli->lli_flags & LLIF_MDS_SIZE_LOCK)
                 RETURN(0);
-        
+
         CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", inode->i_ino);
 
         if (!lli->lli_smd) {
@@ -1153,7 +1153,7 @@ int ll_glimpse_size(struct inode *inode, int ast_flags)
         }
 
         ll_merge_lvb(inode);
-        
+
         CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
                inode->i_size, inode->i_blocks);
 
@@ -1321,7 +1321,7 @@ repeat:
         } else {
                 end = *ppos + count - 1;
         }
-       
+
         node = ll_node_from_inode(inode, *ppos, end, LCK_PR);
         tree.lt_fd = LUSTRE_FPRIVATE(file);
         rc = ll_tree_lock(&tree, node, buf, count,
@@ -2336,8 +2336,8 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
                "start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
                flags, mode, flock.l_flock.start, flock.l_flock.end);
 
-        rc = ldlm_cli_enqueue(sbi->ll_md_exp, NULL, res_id, 
-                              LDLM_FLOCK, &flock, mode, &flags, NULL, 
+        rc = ldlm_cli_enqueue(sbi->ll_md_exp, NULL, &res_id,
+                              LDLM_FLOCK, &flock, mode, &flags, NULL,
                               ldlm_flock_completion_ast, NULL, file_lock,
                               NULL, 0, NULL, &lockh, 0);
         RETURN(rc);
@@ -2358,7 +2358,7 @@ int ll_have_md_lock(struct inode *inode, __u64 bits)
         CDEBUG(D_INFO, "trying to match res "DFID"\n", PFID(fid));
 
         flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
-        if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy, 
+        if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy,
                           LCK_CR|LCK_CW|LCK_PR, &lockh)) {
                 RETURN(1);
         }
@@ -2431,7 +2431,7 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
                         rc = ll_inode_revalidate_fini(inode, rc);
                         GOTO (out, rc);
                 }
-                
+
                 rc = ll_revalidate_it_finish(req, DLM_REPLY_REC_OFF, &oit, dentry);
                 if (rc != 0) {
                         ll_intent_release(&oit);
@@ -2458,8 +2458,8 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
 
                 if (S_ISREG(inode->i_mode)) {
                         rc = ll_get_max_mdsize(sbi, &ealen);
-                        if (rc) 
-                                RETURN(rc); 
+                        if (rc)
+                                RETURN(rc);
                         valid |= OBD_MD_FLEASIZE | OBD_MD_FLMODEASIZE;
                 }
                 oc = ll_mdscapa_get(inode);
@@ -2476,9 +2476,9 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
                 if (rc)
                         GOTO(out, rc);
         }
-        
+
         /* if object not yet allocated, don't validate size */
-        if (ll_i2info(inode)->lli_smd == NULL) 
+        if (ll_i2info(inode)->lli_smd == NULL)
                 GOTO(out, rc = 0);
 
         /* ll_glimpse_size will prefer locally cached writes if they extend
index 3c7af50..5d955cb 100644 (file)
@@ -39,6 +39,8 @@
 #include <linux/lustre_acl.h>
 #include <obd_class.h>
 #include <lustre_dlm.h>
+/* fid_res_name_eq() */
+#include <lustre_fid.h>
 #include <lprocfs_status.h>
 #include "mdc_internal.h"
 
@@ -418,7 +420,7 @@ int mdc_enqueue(struct obd_export *exp,
           * rpcs in flight counter */
         mdc_get_rpc_lock(obddev->u.cli.cl_rpc_lock, it);
         mdc_enter_request(&obddev->u.cli);
-        rc = ldlm_cli_enqueue(exp, &req, res_id, lock_type, &policy,
+        rc = ldlm_cli_enqueue(exp, &req, &res_id, lock_type, &policy,
                               lock_mode, &flags, cb_blocking, cb_completion,
                               NULL, cb_data, NULL, 0, NULL, lockh, 0);
         mdc_exit_request(&obddev->u.cli);
index 3a7be50..a5e092d 100644 (file)
@@ -185,7 +185,7 @@ struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
 
         res_id.name[0] = de->d_inode->i_ino;
         res_id.name[1] = de->d_inode->i_generation;
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id,
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id,
                                     LDLM_IBITS, &policy, lock_mode, &flags,
                                     ldlm_blocking_ast, ldlm_completion_ast,
                                     NULL, NULL, 0, NULL, lockh);
index fd63280..921ba4b 100644 (file)
@@ -122,12 +122,13 @@ static inline void mds_inode_unset_orphan(struct inode *inode)
 }
 
 /* mds/mds_reint.c */
-int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
+int res_gt(const struct ldlm_res_id *res1, const struct ldlm_res_id *res2,
            ldlm_policy_data_t *p1, ldlm_policy_data_t *p2);
-int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
+int enqueue_ordered_locks(struct obd_device *obd,
+                          const struct ldlm_res_id *p1_res_id,
                           struct lustre_handle *p1_lockh, int p1_lock_mode,
                           ldlm_policy_data_t *p1_policy,
-                          struct ldlm_res_id *p2_res_id,
+                          const struct ldlm_res_id *p2_res_id,
                           struct lustre_handle *p2_lockh, int p2_lock_mode,
                           ldlm_policy_data_t *p2_policy);
 void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error);
@@ -176,7 +177,7 @@ int mds_cleanup_pending(struct obd_device *obd);
 
 
 /* mds/mds_log.c */
-int mds_llog_init(struct obd_device *obd, struct obd_llogs *llogs, 
+int mds_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
                   struct obd_device *tgt, int count,
                   struct llog_catid *logid, struct obd_uuid *uuid);
 int mds_llog_finish(struct obd_device *obd, int count);
@@ -188,7 +189,7 @@ int mds_lov_write_objids(struct obd_device *obd);
 int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid);
 void mds_lov_update_objids(struct obd_device *obd, obd_id *ids);
 int mds_lov_set_nextid(struct obd_device *obd);
-int mds_lov_start_synchronize(struct obd_device *obd, 
+int mds_lov_start_synchronize(struct obd_device *obd,
                               struct obd_device *watched,
                               void *data, int nonblock);
 int mds_post_mds_lovconf(struct obd_device *obd);
@@ -212,7 +213,7 @@ int mds_close(struct ptlrpc_request *req, int offset);
 int mds_done_writing(struct ptlrpc_request *req, int offset);
 
 /*mds/mds_join.c*/
-int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, 
+int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req,
                   struct dentry *dchild, struct lustre_handle *lockh);
 
 /* mds/mds_fs.c */
index 5f1ab2c..400182e 100644 (file)
@@ -409,7 +409,7 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset,
                         if (rc)
                                 GOTO(out_oa, rc);
                 }
-                rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa, 
+                rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa,
                                 &oinfo.oi_md, &oti);
                 if (rc) {
                         int level = D_ERROR;
@@ -436,8 +436,8 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset,
         }
         if (inode->i_size) {
                 oinfo.oi_oa->o_size = inode->i_size;
-                obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE | 
-                                OBD_MD_FLATIME | OBD_MD_FLMTIME | 
+                obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE |
+                                OBD_MD_FLATIME | OBD_MD_FLMTIME |
                                 OBD_MD_FLCTIME | OBD_MD_FLSIZE);
 
                 /* pack lustre id to OST */
@@ -844,7 +844,7 @@ int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
         if (child_lockh == NULL)
                 child_lockh = &lockh;
 
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
                                     LDLM_PLAIN, NULL, LCK_EX, &lock_flags,
                                     ldlm_blocking_ast, ldlm_completion_ast,
                                     NULL, NULL, 0, NULL, child_lockh);
@@ -1138,16 +1138,16 @@ found_child:
         else
                 child_mode = LCK_CR;
 
-        if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) && 
+        if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) &&
              (rec->ur_flags & MDS_OPEN_LOCK)) {
                 /* In case of replay we do not get a lock assuming that the
                    caller has it already */
                 child_res_id.name[0] = dchild->d_inode->i_ino;
                 child_res_id.name[1] = dchild->d_inode->i_generation;
 
-                rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
-                                            LDLM_IBITS, &policy, child_mode, 
-                                            &lock_flags, ldlm_blocking_ast, 
+                rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
+                                            LDLM_IBITS, &policy, child_mode,
+                                            &lock_flags, ldlm_blocking_ast,
                                             ldlm_completion_ast, NULL, NULL,
                                             0, NULL, child_lockh);
                 if (rc != ELDLM_OK)
index 61584ee..474d29b 100644 (file)
@@ -448,7 +448,7 @@ int mds_osc_setattr_async(struct obd_device *obd, __u32 uid, __u32 gid,
         oinfo.oi_oa->o_gid = gid;
         oinfo.oi_oa->o_id = oinfo.oi_md->lsm_object_id;
         oinfo.oi_oa->o_gr = oinfo.oi_md->lsm_object_gr;
-        oinfo.oi_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP | 
+        oinfo.oi_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
                                 OBD_MD_FLUID | OBD_MD_FLGID;
         if (logcookies) {
                 oinfo.oi_oa->o_valid |= OBD_MD_FLCOOKIE;
@@ -496,7 +496,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         int lmm_size = 0, need_lock = 1, cookie_size = 0;
         int rc = 0, cleanup_phase = 0, err, locked = 0;
         unsigned int qcids[MAXQUOTAS] = { 0, 0 };
-        unsigned int qpids[MAXQUOTAS] = { rec->ur_iattr.ia_uid, 
+        unsigned int qpids[MAXQUOTAS] = { rec->ur_iattr.ia_uid,
                                           rec->ur_iattr.ia_gid };
         ENTRY;
 
@@ -671,7 +671,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         err = mds_finish_transno(mds, inode, handle, req, rc, 0);
         /* do mds to ost setattr if needed */
         if (!rc && !err && lmm_size)
-                mds_osc_setattr_async(obd, inode->i_ino, inode->i_generation, lmm, 
+                mds_osc_setattr_async(obd, inode->i_ino, inode->i_generation, lmm,
                                       lmm_size, logcookies, rec->ur_fid1->id,
                                       rec->ur_fid1->generation, NULL);
 
@@ -983,7 +983,7 @@ cleanup:
         return 0;
 }
 
-int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
+int res_gt(const struct ldlm_res_id *res1, const struct ldlm_res_id *res2,
            ldlm_policy_data_t *p1, ldlm_policy_data_t *p2)
 {
         int i;
@@ -1014,14 +1014,15 @@ int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
  *
  * One or two locks are taken in numerical order.  A res_id->name[0] of 0 means
  * no lock is taken for that res_id.  Must be at least one non-zero res_id. */
-int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
+int enqueue_ordered_locks(struct obd_device *obd,
+                          const struct ldlm_res_id *p1_res_id,
                           struct lustre_handle *p1_lockh, int p1_lock_mode,
                           ldlm_policy_data_t *p1_policy,
-                          struct ldlm_res_id *p2_res_id,
+                          const struct ldlm_res_id *p2_res_id,
                           struct lustre_handle *p2_lockh, int p2_lock_mode,
                           ldlm_policy_data_t *p2_policy)
 {
-        struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id };
+        const struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id };
         struct lustre_handle *handles[2] = { p1_lockh, p2_lockh };
         int lock_modes[2] = { p1_lock_mode, p2_lock_mode };
         ldlm_policy_data_t *policies[2] = {p1_policy, p2_policy};
@@ -1048,10 +1049,10 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
                res_id[0]->name[0], res_id[1]->name[0]);
 
         flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, *res_id[0],
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id[0],
                                     LDLM_IBITS, policies[0], lock_modes[0],
-                                    &flags, ldlm_blocking_ast, 
-                                    ldlm_completion_ast, NULL, NULL, 0, 
+                                    &flags, ldlm_blocking_ast,
+                                    ldlm_completion_ast, NULL, NULL, 0,
                                     NULL, handles[0]);
         if (rc != ELDLM_OK)
                 RETURN(-EIO);
@@ -1063,9 +1064,9 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
                 ldlm_lock_addref(handles[1], lock_modes[1]);
         } else if (res_id[1]->name[0] != 0) {
                 flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
-                rc = ldlm_cli_enqueue_local(obd->obd_namespace, *res_id[1],
+                rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id[1],
                                             LDLM_IBITS, policies[1],
-                                            lock_modes[1], &flags, 
+                                            lock_modes[1], &flags,
                                             ldlm_blocking_ast,
                                             ldlm_completion_ast, NULL, NULL,
                                             0, NULL, handles[1]);
@@ -1079,14 +1080,15 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
         RETURN(0);
 }
 
-static inline int res_eq(struct ldlm_res_id *res1, struct ldlm_res_id *res2)
+static inline int res_eq(const struct ldlm_res_id *res1,
+                         const struct ldlm_res_id *res2)
 {
         return !memcmp(res1, res2, sizeof(*res1));
 }
 
 static inline void
-try_to_aggregate_locks(struct ldlm_res_id *res1, ldlm_policy_data_t *p1,
-                        struct ldlm_res_id *res2, ldlm_policy_data_t *p2)
+try_to_aggregate_locks(const struct ldlm_res_id *res1, ldlm_policy_data_t *p1,
+                       const struct ldlm_res_id *res2, ldlm_policy_data_t *p2)
 {
         if (!res_eq(res1, res2))
                 return;
@@ -1095,21 +1097,22 @@ try_to_aggregate_locks(struct ldlm_res_id *res1, ldlm_policy_data_t *p1,
         p1->l_inodebits.bits |= p2->l_inodebits.bits;
 }
 
-int enqueue_4ordered_locks(struct obd_device *obd,struct ldlm_res_id *p1_res_id,
+int enqueue_4ordered_locks(struct obd_device *obd,
+                           const struct ldlm_res_id *p1_res_id,
                            struct lustre_handle *p1_lockh, int p1_lock_mode,
                            ldlm_policy_data_t *p1_policy,
-                           struct ldlm_res_id *p2_res_id,
+                           const struct ldlm_res_id *p2_res_id,
                            struct lustre_handle *p2_lockh, int p2_lock_mode,
                            ldlm_policy_data_t *p2_policy,
-                           struct ldlm_res_id *c1_res_id,
+                           const struct ldlm_res_id *c1_res_id,
                            struct lustre_handle *c1_lockh, int c1_lock_mode,
                            ldlm_policy_data_t *c1_policy,
-                           struct ldlm_res_id *c2_res_id,
+                           const struct ldlm_res_id *c2_res_id,
                            struct lustre_handle *c2_lockh, int c2_lock_mode,
                            ldlm_policy_data_t *c2_policy)
 {
-        struct ldlm_res_id *res_id[5] = { p1_res_id, p2_res_id,
-                                          c1_res_id, c2_res_id };
+        const struct ldlm_res_id *res_id[5] = { p1_res_id, p2_res_id,
+                                                c1_res_id, c2_res_id };
         struct lustre_handle *dlm_handles[5] = { p1_lockh, p2_lockh,
                                                  c1_lockh, c2_lockh };
         int lock_modes[5] = { p1_lock_mode, p2_lock_mode,
@@ -1174,11 +1177,11 @@ int enqueue_4ordered_locks(struct obd_device *obd,struct ldlm_res_id *p1_res_id,
                                 try_to_aggregate_locks(res_id[i], policies[i],
                                                        res_id[i+1], policies[i+1]);
                         rc = ldlm_cli_enqueue_local(obd->obd_namespace,
-                                                    *res_id[i], LDLM_IBITS,
+                                                    res_id[i], LDLM_IBITS,
                                                     policies[i], lock_modes[i],
                                                     &flags, ldlm_blocking_ast,
-                                                    ldlm_completion_ast, NULL, 
-                                                    NULL, 0, NULL, 
+                                                    ldlm_completion_ast, NULL,
+                                                    NULL, 0, NULL,
                                                     dlm_handles[i]);
                         if (rc != ELDLM_OK)
                                 GOTO(out_err, rc = -EIO);
@@ -1207,7 +1210,7 @@ out_err:
  * Returns 1 if the child changed and we need to re-lock (no locks held).
  * Returns -ve error with a valid dchild (no locks held). */
 static int mds_verify_child(struct obd_device *obd,
-                            struct ldlm_res_id *parent_res_id,
+                            const struct ldlm_res_id *parent_res_id,
                             struct lustre_handle *parent_lockh,
                             struct dentry *dparent, int parent_mode,
                             struct ldlm_res_id *child_res_id,
@@ -1215,7 +1218,7 @@ static int mds_verify_child(struct obd_device *obd,
                             struct dentry **dchildp, int child_mode,
                             ldlm_policy_data_t *child_policy,
                             const char *name, int namelen,
-                            struct ldlm_res_id *maxres)
+                            const struct ldlm_res_id *maxres)
 {
         struct dentry *vchild, *dchild = *dchildp;
         int rc = 0, cleanup_phase = 2; /* parent, child locks */
@@ -1264,11 +1267,11 @@ static int mds_verify_child(struct obd_device *obd,
                         GOTO(cleanup, rc = 1);
                 }
 
-                rc = ldlm_cli_enqueue_local(obd->obd_namespace, *child_res_id, 
-                                            LDLM_IBITS, child_policy, 
-                                            child_mode, &flags, 
-                                            ldlm_blocking_ast, 
-                                            ldlm_completion_ast, NULL, 
+                rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
+                                            LDLM_IBITS, child_policy,
+                                            child_mode, &flags,
+                                            ldlm_blocking_ast,
+                                            ldlm_completion_ast, NULL,
                                             NULL, 0, NULL, child_lockh);
                 if (rc != ELDLM_OK)
                         GOTO(cleanup, rc = -EIO);
@@ -1353,7 +1356,7 @@ int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
         child_res_id.name[1] = inode->i_generation;
 
         /* If we want a LCK_CR for a directory, and this directory has not been
-           changed for some time, we return not only a LOOKUP lock, but also an 
+           changed for some time, we return not only a LOOKUP lock, but also an
            UPDATE lock to have negative dentry starts working for this dir.
            Also we apply same logic to non-directories. If the file is rarely
            changed - we return both locks and this might save us RPC on
@@ -1518,10 +1521,10 @@ void mds_shrink_reply(struct obd_device *obd, struct ptlrpc_request *req,
 
         CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", md_size,
                cookie_size);
+
         lustre_shrink_reply(req, md_off, md_size, 1);
-        
-        lustre_shrink_reply(req, md_off + (md_size > 0), cookie_size, 0); 
+
+        lustre_shrink_reply(req, md_off + (md_size > 0), cookie_size, 0);
 }
 
 static int mds_reint_unlink(struct mds_update_record *rec, int offset,
@@ -2126,7 +2129,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset,
                   rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
                   rec->ur_fid2->id, rec->ur_fid2->generation, rec->ur_tgt);
         lprocfs_counter_incr(obd->obd_stats, LPROC_MDS_RENAME);
-        
+
         MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
 
         rc = mds_get_parents_children_locked(obd, mds, rec->ur_fid1, &de_srcdir,
index fb5ef98..8c2baca 100644 (file)
@@ -358,8 +358,10 @@ struct mdt_thread_info {
 
         struct lu_fid              mti_tmp_fid1;
         struct lu_fid              mti_tmp_fid2;
-        ldlm_policy_data_t         mti_policy;    /* for mdt_object_lock()   */
-        struct ldlm_res_id         mti_res_id;    /* for mdt_object_lock()   */
+        ldlm_policy_data_t         mti_policy;    /* for mdt_object_lock() and
+                                                   * mdt_rename_lock() */
+        struct ldlm_res_id         mti_res_id;    /* for mdt_object_lock() and
+                                                     mdt_rename_lock()   */
         union {
                 struct obd_uuid    uuid[2];       /* for mdt_seq_init_cli()  */
                 char               ns_name[48];   /* for mdt_init0()         */
@@ -662,7 +664,7 @@ static inline int mdt_fid_lock(struct ldlm_namespace *ns,
                                struct lustre_handle *lh,
                                ldlm_mode_t mode,
                                ldlm_policy_data_t *policy,
-                               struct ldlm_res_id *res_id,
+                               const struct ldlm_res_id *res_id,
                                int flags)
 {
         int rc;
@@ -670,7 +672,7 @@ static inline int mdt_fid_lock(struct ldlm_namespace *ns,
         LASSERT(ns != NULL);
         LASSERT(lh != NULL);
 
-        rc = ldlm_cli_enqueue_local(ns, *res_id, LDLM_IBITS, policy,
+        rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
                                     mode, &flags, ldlm_blocking_ast,
                                     ldlm_completion_ast, NULL, NULL,
                                     0, NULL, lh);
index aa97bab..06cc96e 100644 (file)
@@ -96,7 +96,7 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
         int rc;
         ENTRY;
 
-        DEBUG_REQ(D_INODE, mdt_info_req(info), "partial create "DFID"\n", 
+        DEBUG_REQ(D_INODE, mdt_info_req(info), "partial create "DFID"\n",
                            PFID(info->mti_rr.rr_fid2));
 
         repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
@@ -112,7 +112,7 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
                 if (mdt_object_exists(o) == 1) {
                         rc = mo_attr_get(info->mti_env, next, ma);
                 } else {
-                        rc = mo_object_create(info->mti_env, next, 
+                        rc = mo_object_create(info->mti_env, next,
                                               &info->mti_spec, ma);
                 }
                 if (rc == 0) {
@@ -359,7 +359,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info,
         parent_lh = &info->mti_lh[MDT_LH_PARENT];
         mdt_lock_pdo_init(parent_lh, LCK_PW, rr->rr_name,
                           rr->rr_namelen);
-        
+
         mp = mdt_object_find_lock(info, rr->rr_fid1, parent_lh,
                                   MDS_INODELOCK_UPDATE);
         if (IS_ERR(mp))
@@ -382,7 +382,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info,
         if (rr->rr_name[0] == 0) {
                 /* remote partial operation
                  * It is possible that replay can happen on parent MDS
-                 * and this operation will be repeated. 
+                 * and this operation will be repeated.
                  * Therefore the object absense is allowed case
                  * and nothing should be done
                  */
@@ -586,36 +586,39 @@ out:
 static int mdt_rename_lock(struct mdt_thread_info *info,
                            struct lustre_handle *lh)
 {
-        ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
-        struct ldlm_namespace *ns = info->mti_mdt->mdt_namespace;
-        struct ldlm_res_id res_id;
-        struct lu_site *ls;
+        struct ldlm_namespace *ns     = info->mti_mdt->mdt_namespace;
+        ldlm_policy_data_t    *policy = &info->mti_policy;
+        struct ldlm_res_id    *res_id = &info->mti_res_id;
+        struct lu_site        *ls;
         int rc;
         ENTRY;
 
         ls = info->mti_mdt->mdt_md_dev.md_lu_dev.ld_site;
-        fid_build_reg_res_name(&LUSTRE_BFL_FID, &res_id);
+        fid_build_reg_res_name(&LUSTRE_BFL_FID, res_id);
+
+        memset(policy, 0, sizeof *policy);
+        policy->l_inodebits.bits = MDS_INODELOCK_UPDATE;
 
         if (ls->ls_control_exp == NULL) {
                 int flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
-                
+
                 /*
                  * Current node is controller, that is mdt0, where we should
                  * take BFL lock.
                  */
-                rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, &policy,
+                rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
                                             LCK_EX, &flags, ldlm_blocking_ast,
                                             ldlm_completion_ast, NULL, NULL, 0,
                                             NULL, lh);
         } else {
                 int flags = 0;
-                
+
                 /*
                  * This is the case mdt0 is remote node, issue DLM lock like
                  * other clients.
                  */
                 rc = ldlm_cli_enqueue(ls->ls_control_exp, NULL, res_id,
-                                      LDLM_IBITS, &policy, LCK_EX, &flags,
+                                      LDLM_IBITS, policy, LCK_EX, &flags,
                                       ldlm_blocking_ast, ldlm_completion_ast,
                                       NULL, NULL, NULL, 0, NULL, lh, 0);
         }
@@ -800,7 +803,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 
         mdt_set_capainfo(info, 2, old_fid, BYPASS_CAPA);
         mdt_set_capainfo(info, 3, new_fid, BYPASS_CAPA);
-        
+
         /* Check if @dst is subdir of @src. */
         rc = mdt_rename_sanity(info, old_fid);
         if (rc)
index b1abd04..3f2c166 100644 (file)
@@ -69,7 +69,7 @@ int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id)
         memcpy(&resname, logname, len);
 
         memset(res_id, 0, sizeof(*res_id));
-        
+
         /* Always use the same endianness for the resid */
         res_id->name[0] = cpu_to_le64(resname);
         CDEBUG(D_MGC, "log %s to resid "LPX64"/"LPX64" (%.8s)\n", logname,
@@ -94,7 +94,7 @@ static int config_log_get(struct config_llog_data *cld)
         RETURN(0);
 }
 
-/* Drop a reference to a config log.  When no longer referenced, 
+/* Drop a reference to a config log.  When no longer referenced,
    we can free the config log data */
 static void config_log_put(struct config_llog_data *cld)
 {
@@ -114,7 +114,7 @@ static void config_log_put(struct config_llog_data *cld)
 }
 
 /* Find a config log by name */
-static struct config_llog_data *config_log_find(char *logname, 
+static struct config_llog_data *config_log_find(char *logname,
                                                 struct config_llog_instance *cfg)
 {
         struct list_head *tmp;
@@ -179,10 +179,10 @@ static int config_log_add(char *logname, struct config_llog_instance *cfg,
         cld->cld_cfg.cfg_flags = 0;
         cld->cld_cfg.cfg_sb = sb;
         atomic_set(&cld->cld_refcount, 1);
-        
+
         /* Keep the mgc around until we are done */
         cld->cld_mgcexp = class_export_get(lsi->lsi_mgc->obd_self_export);
-        
+
         if (cfg->cfg_instance != NULL) {
                 OBD_ALLOC(cld->cld_cfg.cfg_instance,
                           strlen(cfg->cfg_instance) + 1);
@@ -344,7 +344,7 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
         ENTRY;
 
         switch (stage) {
-        case OBD_CLEANUP_EARLY: 
+        case OBD_CLEANUP_EARLY:
                 break;
         case OBD_CLEANUP_EXPORTS:
                 break;
@@ -366,10 +366,10 @@ static int mgc_cleanup(struct obd_device *obd)
         ENTRY;
 
         LASSERT(cli->cl_mgc_vfsmnt == NULL);
-        
-        /* COMPAT_146 - old config logs may have added profiles we don't 
+
+        /* COMPAT_146 - old config logs may have added profiles we don't
            know about */
-        if (obd->obd_type->typ_refcnt <= 1) 
+        if (obd->obd_type->typ_refcnt <= 1)
                 /* Only for the last mgc */
                 class_del_profiles();
 
@@ -447,7 +447,7 @@ static int mgc_async_requeue(void *data)
            it's needed. */
         /* Unsafe - we don't know that the lsi hasn't been destroyed */
         server_register_target(cld->cld_cfg.cfg_sb);
-#endif 
+#endif
 
         rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
 out:
@@ -553,8 +553,8 @@ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
         /* We need a callback for every lockholder, so don't try to
            ldlm_lock_match (see rev 1.1.2.11.2.47) */
 
-        rc = ldlm_cli_enqueue(exp, NULL, cld->cld_resid,
-                              type, NULL, mode, flags, 
+        rc = ldlm_cli_enqueue(exp, NULL, &cld->cld_resid,
+                              type, NULL, mode, flags,
                               mgc_blocking_ast, ldlm_completion_ast, NULL,
                               data, NULL, 0, NULL, lockh, 0);
 
@@ -650,7 +650,7 @@ static int mgc_target_register(struct obd_export *exp,
                 RETURN(-ENOMEM);
 
         req_mti = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, sizeof(*req_mti));
-        if (!req_mti) 
+        if (!req_mti)
                 RETURN(-ENOMEM);
         memcpy(req_mti, mti, sizeof(*req_mti));
 
@@ -675,7 +675,7 @@ static int mgc_target_register(struct obd_export *exp,
 }
 
 int mgc_set_info_async(struct obd_export *exp, obd_count keylen,
-                       void *key, obd_count vallen, void *val, 
+                       void *key, obd_count vallen, void *val,
                        struct ptlrpc_request_set *set)
 {
         struct obd_import *imp = class_exp2cliimp(exp);
@@ -698,12 +698,12 @@ int mgc_set_info_async(struct obd_export *exp, obd_count keylen,
                         RETURN(-EINVAL);
                 value = *(int *)val;
                 imp->imp_initial_recov_bk = value > 0;
-                /* Even after the initial connection, give up all comms if 
+                /* Even after the initial connection, give up all comms if
                    nobody answers the first time. */
                 imp->imp_recon_bk = 1;
-                CDEBUG(D_MGC, "InitRecov %s %d/%d:d%d:i%d:r%d:or%d:%s\n", 
+                CDEBUG(D_MGC, "InitRecov %s %d/%d:d%d:i%d:r%d:or%d:%s\n",
                        imp->imp_obd->obd_name, value, imp->imp_initial_recov,
-                       imp->imp_deactive, imp->imp_invalid, 
+                       imp->imp_deactive, imp->imp_invalid,
                        imp->imp_replayable, imp->imp_obd->obd_replayable,
                        ptlrpc_import_state_name(imp->imp_state));
                 /* Resurrect if we previously died */
@@ -766,18 +766,18 @@ static int mgc_import_event(struct obd_device *obd,
         CDEBUG(D_MGC, "import event %#x\n", event);
 
         switch (event) {
-        case IMP_EVENT_DISCON: 
+        case IMP_EVENT_DISCON:
                 /* MGC imports should not wait for recovery */
                 ptlrpc_invalidate_import(imp);
                 break;
-        case IMP_EVENT_INACTIVE: 
+        case IMP_EVENT_INACTIVE:
                 break;
         case IMP_EVENT_INVALIDATE: {
                 struct ldlm_namespace *ns = obd->obd_namespace;
                 ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
                 break;
         }
-        case IMP_EVENT_ACTIVE: 
+        case IMP_EVENT_ACTIVE:
         case IMP_EVENT_OCD:
                 break;
         default:
@@ -787,8 +787,8 @@ static int mgc_import_event(struct obd_device *obd,
         RETURN(rc);
 }
 
-static int mgc_llog_init(struct obd_device *obd, struct obd_llogs *llogs, 
-                         struct obd_device *tgt, int count, 
+static int mgc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+                         struct obd_device *tgt, int count,
                          struct llog_catid *logid, struct obd_uuid *uuid)
 {
         struct llog_ctxt *ctxt;
@@ -1042,7 +1042,7 @@ static int mgc_process_config(struct obd_device *obd, obd_count len, void *buf)
                 break;
         }
         case LCFG_LOV_DEL_OBD:
-                /* Remove target from the fs? */  
+                /* Remove target from the fs? */
                 /* FIXME */
                 CERROR("lov_del_obd unimplemented\n");
                 rc = -ENOSYS;
@@ -1072,7 +1072,7 @@ static int mgc_process_config(struct obd_device *obd, obd_count len, void *buf)
                 /* FIXME only set this for old logs!  Right now this forces
                    us to always skip the "inside markers" check */
                 cld->cld_cfg.cfg_flags |= CFG_F_COMPAT146;
-                
+
                 rc = mgc_process_log(obd, cld);
                 config_log_put(cld);
 
@@ -1118,7 +1118,7 @@ struct obd_ops mgc_obd_ops = {
 
 int __init mgc_init(void)
 {
-        return class_register_type(&mgc_obd_ops, NULL, NULL, 
+        return class_register_type(&mgc_obd_ops, NULL, NULL,
                                    LUSTRE_MGC_NAME, NULL);
 }
 
index 9af4807..48492bc 100644 (file)
@@ -296,7 +296,7 @@ static int mgs_get_cfg_lock(struct obd_device *obd, char *fsname,
 
         rc = mgc_logname2resid(fsname, &res_id);
         if (!rc)
-                rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id,
+                rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id,
                                             LDLM_PLAIN, NULL, LCK_EX,
                                             &flags, ldlm_blocking_ast,
                                             ldlm_completion_ast, NULL,
index 9dcf202..72e3582 100644 (file)
@@ -472,7 +472,7 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 RETURN(-ENOMEM);
         }
 
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id, LDLM_PLAIN,
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
                                     NULL, LCK_NL, &lock_flags, NULL,
                                     ldlm_completion_ast, NULL, NULL,
                                     0, NULL, &obd->u.echo.eo_nl_lock);
index 1c33a4a..fb8c1f8 100644 (file)
@@ -1409,7 +1409,7 @@ static int filter_prepare_destroy(struct obd_device *obd, obd_id objid,
         ENTRY;
         /* Tell the clients that the object is gone now and that they should
          * throw away any cached pages. */
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id, LDLM_EXTENT,
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_EXTENT,
                                     &policy, LCK_PW, &flags, ldlm_blocking_ast,
                                     ldlm_completion_ast, NULL, NULL, 0, NULL,
                                     &lockh);
@@ -2965,7 +2965,7 @@ int filter_setattr(struct obd_export *exp, struct obd_info *oinfo,
                 GOTO(out_unlock, rc);
 
         res = ldlm_resource_get(exp->exp_obd->obd_namespace, NULL,
-                                res_id, LDLM_EXTENT, 0);
+                                &res_id, LDLM_EXTENT, 0);
 
         if (res != NULL) {
                 ns_lvbo = res->lr_namespace->ns_lvbo;
index 62f75a8..0743433 100644 (file)
@@ -734,7 +734,7 @@ static int filter_commitrw_read(struct obd_export *exp, struct obdo *oa,
          * and we should update the lvb so that other glimpses will also
          * get the updated value. bug 5972 */
         if (oa && ns && ns->ns_lvbo && ns->ns_lvbo->lvbo_update) {
-                resource = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
+                resource = ldlm_resource_get(ns, NULL, &res_id, LDLM_EXTENT, 0);
 
                 if (resource != NULL) {
                         ns->ns_lvbo->lvbo_update(resource, NULL, 0, 1);
index 8404c52..5c1355f 100644 (file)
@@ -280,7 +280,7 @@ static int osc_setattr(struct obd_export *exp, struct obd_info *oinfo,
         int rc, size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) };
         ENTRY;
 
-        LASSERT(!(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP) || 
+        LASSERT(!(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP) ||
                                         oinfo->oi_oa->o_gr > 0);
         size[REQ_REC_OFF + 1] = oinfo->oi_capa ? sizeof(struct lustre_capa) : 0;
         req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OST_VERSION,
@@ -743,7 +743,7 @@ static void handle_short_read(int nob_read, obd_count page_count,
 
                 if (pga[i]->count > nob_read) {
                         /* EOF inside this page */
-                        ptr = cfs_kmap(pga[i]->pg) + 
+                        ptr = cfs_kmap(pga[i]->pg) +
                                 (pga[i]->off & ~CFS_PAGE_MASK);
                         memset(ptr + nob_read, 0, pga[i]->count - nob_read);
                         cfs_kunmap(pga[i]->pg);
@@ -2684,7 +2684,7 @@ static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
 
                 /* We already have a lock, and it's referenced */
                 oinfo->oi_cb_up(oinfo, ELDLM_OK);
-                
+
                 /* For async requests, decref the lock. */
                 if (einfo->ei_rqset)
                         ldlm_lock_decref(oinfo->oi_lockh, einfo->ei_mode);
@@ -2736,7 +2736,7 @@ static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
                         RETURN(-ENOMEM);
 
                 size[DLM_LOCKREPLY_OFF] = sizeof(*rep);
-                size[DLM_REPLY_REC_OFF] = 
+                size[DLM_REPLY_REC_OFF] =
                         sizeof(oinfo->oi_md->lsm_oinfo->loi_lvb);
                 ptlrpc_req_set_repsize(req, 3, size);
         }
@@ -2744,7 +2744,7 @@ static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
         /* users of osc_enqueue() can pass this flag for ldlm_lock_match() */
         einfo->ei_flags &= ~LDLM_FL_BLOCK_GRANTED;
 
-        rc = ldlm_cli_enqueue(exp, &req, res_id, einfo->ei_type,
+        rc = ldlm_cli_enqueue(exp, &req, &res_id, einfo->ei_type,
                               &oinfo->oi_policy, einfo->ei_mode,
                               &einfo->ei_flags, einfo->ei_cb_bl,
                               einfo->ei_cb_cp, einfo->ei_cb_gl,
@@ -2785,7 +2785,7 @@ static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm,
         struct obd_device *obd = exp->exp_obd;
         int rc;
         ENTRY;
-        
+
         res_id.name[0] = lsm->lsm_object_id;
         res_id.name[2] = lsm->lsm_object_gr;
 
@@ -2848,7 +2848,7 @@ static int osc_cancel_unused(struct obd_export *exp,
                 resp = &res_id;
         }
 
-        return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags, 
+        return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags,
                                       opaque);
 }
 
@@ -3262,8 +3262,8 @@ static struct llog_operations osc_size_repl_logops = {
 };
 
 static struct llog_operations osc_mds_ost_orig_logops;
-static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs, 
-                         struct obd_device *tgt, int count, 
+static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+                         struct obd_device *tgt, int count,
                          struct llog_catid *catid, struct obd_uuid *uuid)
 {
         int rc;
@@ -3288,11 +3288,11 @@ static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
 
         rc = llog_setup(obd, llogs, LLOG_SIZE_REPL_CTXT, tgt, count, NULL,
                         &osc_size_repl_logops);
-        if (rc) 
+        if (rc)
                 CERROR("failed LLOG_SIZE_REPL_CTXT\n");
 out:
         if (rc) {
-                CERROR("osc '%s' tgt '%s' cnt %d catid %p rc=%d\n", 
+                CERROR("osc '%s' tgt '%s' cnt %d catid %p rc=%d\n",
                        obd->obd_name, tgt->obd_name, count, catid, rc);
                 CERROR("logid "LPX64":0x%x\n",
                        catid->lci_logid.lgl_oid, catid->lci_logid.lgl_ogen);
index 57ead88..fa047cc 100644 (file)
@@ -141,7 +141,7 @@ static int ost_statfs(struct ptlrpc_request *req)
 
         osfs = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*osfs));
 
-        req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, 
+        req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
                                     cfs_time_current_64() - HZ);
         if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC))
                 osfs->os_bfree = osfs->os_bavail = 64;
@@ -219,7 +219,7 @@ static int ost_punch_lock_get(struct obd_export *exp, struct obdo *oa,
         else
                 policy.l_extent.end = finis | ~CFS_PAGE_MASK;
 
-        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, res_id, 
+        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
                                       LDLM_EXTENT, &policy, LCK_PW, &flags,
                                       ldlm_blocking_ast, ldlm_completion_ast,
                                       ldlm_glimpse_ast, NULL, 0, NULL, lh));
@@ -542,7 +542,7 @@ static int ost_brw_lock_get(int mode, struct obd_export *exp,
         policy.l_extent.end   = (nb[nrbufs - 1].offset +
                                  nb[nrbufs - 1].len - 1) | ~CFS_PAGE_MASK;
 
-        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, res_id, 
+        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
                                       LDLM_EXTENT, &policy, mode, &flags,
                                       ldlm_blocking_ast, ldlm_completion_ast,
                                       ldlm_glimpse_ast, NULL, 0, NULL, lh));
@@ -609,7 +609,7 @@ static int ost_prolong_locks_iter(struct ldlm_lock *lock, void *data)
 static void ost_prolong_locks(struct obd_export *exp, struct obd_ioobj *obj,
                               struct niobuf_remote *nb, ldlm_mode_t mode)
 {
-        struct ldlm_res_id res_id = { .name = { obj->ioo_id, 0, 
+        struct ldlm_res_id res_id = { .name = { obj->ioo_id, 0,
                                                 obj->ioo_gr, 0} };
         int nrbufs = obj->ioo_bufcnt;
         struct ost_prolong_data opd;