Whamcloud - gitweb
LU-1333 hsm: Add hsm_release feature.
[fs/lustre-release.git] / lustre / lod / lod_dev.c
index 4a672dc..69e2ae2 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright  2009 Sun Microsystems, Inc. All rights reserved
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  *
  */
 /*
  * Author: Mikhail Pershin <mike.pershin@intel.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <obd_class.h>
+#include <md_object.h>
 #include <lustre_fid.h>
 #include <lustre_param.h>
 #include <lustre_update.h>
  * \param lod LOD to be lookup at.
  * \param fid FID of object to find MDT/OST.
  * \param tgt MDT/OST index to return.
- * \param flags indidcate the FID is on MDS or OST.
+ * \param type indidcate the FID is on MDS or OST.
  **/
 int lod_fld_lookup(const struct lu_env *env, struct lod_device *lod,
-                  const struct lu_fid *fid, __u32 *tgt, int flags)
+                  const struct lu_fid *fid, __u32 *tgt, int type)
 {
-       struct lu_seq_range     range;
+       struct lu_seq_range     range = { 0 };
        struct lu_server_fld    *server_fld;
        int rc = 0;
        ENTRY;
@@ -72,20 +70,17 @@ int lod_fld_lookup(const struct lu_env *env, struct lod_device *lod,
                RETURN(rc);
        }
 
-       if (!lod->lod_initialized || !fid_is_norm(fid)) {
+       if (!lod->lod_initialized || (!fid_seq_in_fldb(fid_seq(fid)))) {
                LASSERT(lu_site2seq(lod2lu_dev(lod)->ld_site) != NULL);
                *tgt = lu_site2seq(lod2lu_dev(lod)->ld_site)->ss_node_id;
                RETURN(rc);
        }
 
        server_fld = lu_site2seq(lod2lu_dev(lod)->ld_site)->ss_server_fld;
-       range.lsr_flags = flags;
+       fld_range_set_type(&range, type);
        rc = fld_server_lookup(env, server_fld, fid_seq(fid), &range);
-       if (rc) {
-               CERROR("%s: Can't find tgt by seq "LPX64", rc %d\n",
-                      lod2obd(lod)->obd_name, fid_seq(fid), rc);
+       if (rc)
                RETURN(rc);
-       }
 
        *tgt = range.lsr_index;
 
@@ -100,7 +95,7 @@ extern struct lu_object_operations lod_lu_robj_ops;
 extern struct dt_object_operations lod_obj_ops;
 
 /* Slab for OSD object allocation */
-cfs_mem_cache_t *lod_object_kmem;
+struct kmem_cache *lod_object_kmem;
 
 static struct lu_kmem_descr lod_caches[] = {
        {
@@ -127,7 +122,7 @@ struct lu_object *lod_object_alloc(const struct lu_env *env,
        int                     rc = 0;
        ENTRY;
 
-       OBD_SLAB_ALLOC_PTR_GFP(lod_obj, lod_object_kmem, CFS_ALLOC_IO);
+       OBD_SLAB_ALLOC_PTR_GFP(lod_obj, lod_object_kmem, __GFP_IO);
        if (lod_obj == NULL)
                RETURN(ERR_PTR(-ENOMEM));
 
@@ -405,11 +400,15 @@ static int lod_process_config(const struct lu_env *env,
                GOTO(out, rc);
        }
        case LCFG_CLEANUP:
+       case LCFG_PRE_CLEANUP: {
                lu_dev_del_linkage(dev->ld_site, dev);
                lod_cleanup_desc_tgts(env, lod, &lod->lod_mdt_descs, lcfg);
                lod_cleanup_desc_tgts(env, lod, &lod->lod_ost_descs, lcfg);
 
                lod_seq_fini_cli(lod);
+
+               if (lcfg->lcfg_command == LCFG_PRE_CLEANUP)
+                       break;
                /*
                 * do cleanup on underlying storage only when
                 * all OSPs are cleaned up, as they use that OSD as well
@@ -424,7 +423,7 @@ static int lod_process_config(const struct lu_env *env,
                if (rc)
                        CERROR("error in disconnect from storage: %d\n", rc);
                break;
-
+       }
        default:
               CERROR("%s: unknown command %u\n", lod2obd(lod)->obd_name,
                      lcfg->lcfg_command);