Whamcloud - gitweb
Mass conversion of all copyright messages to Oracle.
[fs/lustre-release.git] / lustre / cmm / cmm_object.c
index bb5fd76..191cf3e 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -160,7 +160,7 @@ static void cml_object_free(const struct lu_env *env,
 }
 
 static int cml_object_init(const struct lu_env *env, struct lu_object *lo,
-                           const struct lu_object_conf *_)
+                           const struct lu_object_conf *unused)
 {
         struct cmm_device *cd = lu2cmm_dev(lo->lo_dev);
         struct lu_device  *c_dev;
@@ -346,7 +346,7 @@ static int cml_capa_get(const struct lu_env *env, struct md_object *mo,
 }
 
 static int cml_path(const struct lu_env *env, struct md_object *mo,
-                    char *path, int pathlen, __u64 recno, int *linkno)
+                    char *path, int pathlen, __u64 *recno, int *linkno)
 {
         int rc;
         ENTRY;
@@ -362,6 +362,18 @@ static int cml_object_sync(const struct lu_env *env, struct md_object *mo)
         RETURN(rc);
 }
 
+static dt_obj_version_t cml_version_get(const struct lu_env *env,
+                                        struct md_object *mo)
+{
+        return mo_version_get(env, md_object_next(mo));
+}
+
+static void cml_version_set(const struct lu_env *env, struct md_object *mo,
+                            dt_obj_version_t version)
+{
+        return mo_version_set(env, md_object_next(mo), version);
+}
+
 static const struct md_object_operations cml_mo_ops = {
         .moo_permission    = cml_permission,
         .moo_attr_get      = cml_attr_get,
@@ -379,6 +391,8 @@ static const struct md_object_operations cml_mo_ops = {
         .moo_readlink      = cml_readlink,
         .moo_capa_get      = cml_capa_get,
         .moo_object_sync   = cml_object_sync,
+        .moo_version_get   = cml_version_get,
+        .moo_version_set   = cml_version_set,
         .moo_path          = cml_path,
 };
 
@@ -787,14 +801,14 @@ static struct lu_device *cmr_child_dev(struct cmm_device *d, __u32 num)
         struct lu_device *next = NULL;
         struct mdc_device *mdc;
 
-        spin_lock(&d->cmm_tgt_guard);
-        list_for_each_entry(mdc, &d->cmm_targets, mc_linkage) {
+        cfs_spin_lock(&d->cmm_tgt_guard);
+        cfs_list_for_each_entry(mdc, &d->cmm_targets, mc_linkage) {
                 if (mdc->mc_num == num) {
                         next = mdc2lu_dev(mdc);
                         break;
                 }
         }
-        spin_unlock(&d->cmm_tgt_guard);
+        cfs_spin_unlock(&d->cmm_tgt_guard);
         return next;
 }
 
@@ -808,7 +822,7 @@ static void cmr_object_free(const struct lu_env *env,
 }
 
 static int cmr_object_init(const struct lu_env *env, struct lu_object *lo,
-                           const struct lu_object_conf *_)
+                           const struct lu_object_conf *unused)
 {
         struct cmm_device *cd = lu2cmm_dev(lo->lo_dev);
         struct lu_device  *c_dev;
@@ -837,7 +851,8 @@ static int cmr_object_init(const struct lu_env *env, struct lu_object *lo,
 static int cmr_object_print(const struct lu_env *env, void *cookie,
                             lu_printer_t p, const struct lu_object *lo)
 {
-        return (*p)(env, cookie, "[remote]");
+        const struct cmr_object *cro = lu2cmr_obj((struct lu_object *)lo);
+        return (*p)(env, cookie, "[remote](mds_num=%d)", cro->cmo_num);
 }
 
 static const struct lu_object_operations cmr_obj_ops = {
@@ -942,7 +957,7 @@ static int cmr_capa_get(const struct lu_env *env, struct md_object *mo,
 }
 
 static int cmr_path(const struct lu_env *env, struct md_object *obj,
-                    char *path, int pathlen, __u64 recno, int *linkno)
+                    char *path, int pathlen, __u64 *recno, int *linkno)
 {
         return -EREMOTE;
 }
@@ -952,6 +967,20 @@ static int cmr_object_sync(const struct lu_env *env, struct md_object *mo)
         return -EFAULT;
 }
 
+static dt_obj_version_t cmr_version_get(const struct lu_env *env,
+                                        struct md_object *mo)
+{
+        /* Don't check remote object version */
+        return 0;
+}
+
+static void cmr_version_set(const struct lu_env *env, struct md_object *mo,
+                            dt_obj_version_t version)
+{
+        /* No need to update remote object version here, it is done as a part
+         * of reintegration of partial operation on the remote server */
+}
+
 static const struct md_object_operations cmr_mo_ops = {
         .moo_permission    = cmr_permission,
         .moo_attr_get      = cmr_attr_get,
@@ -969,6 +998,8 @@ static const struct md_object_operations cmr_mo_ops = {
         .moo_readlink      = cmr_readlink,
         .moo_capa_get      = cmr_capa_get,
         .moo_object_sync   = cmr_object_sync,
+        .moo_version_get   = cmr_version_get,
+        .moo_version_set   = cmr_version_set,
         .moo_path          = cmr_path,
 };