Whamcloud - gitweb
LU-1267 lfsck: framework (3) for MDT-OST consistency
[fs/lustre-release.git] / lustre / osp / osp_object.c
index 3c59035..f474f43 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -41,9 +41,6 @@
  * Author: Mikhail Pershin <mike.tappro@intel.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include "osp_internal.h"
@@ -241,18 +238,19 @@ static int osp_object_create(const struct lu_env *env, struct dt_object *dt,
 
        memcpy(fid, lu_object_fid(&dt->do_lu), sizeof(*fid));
 
-       LASSERTF(fid_is_sane(fid), "fid for osp_obj %p is insane"DFID"!\n",
-                osp_obj, PFID(fid));
+       LASSERTF(fid_is_sane(fid), "fid for osp_object %p is insane"DFID"!\n",
+                o, PFID(fid));
 
        if (!o->opo_reserved) {
                /* special case, id was assigned outside of transaction
                 * see comments in osp_declare_attr_set */
+               LASSERT(d->opd_pre != NULL);
                spin_lock(&d->opd_pre_lock);
                osp_update_last_fid(d, fid);
                spin_unlock(&d->opd_pre_lock);
        }
 
-       CDEBUG(D_INODE, "fid for osp_obj %p is "DFID"!\n", osp_obj, PFID(fid));
+       CDEBUG(D_INODE, "fid for osp_object %p is "DFID"\n", o, PFID(fid));
 
        /* If the precreate ends, it means it will be ready to rollover to
         * the new sequence soon, all the creation should be synchronized,
@@ -270,10 +268,13 @@ static int osp_object_create(const struct lu_env *env, struct dt_object *dt,
 
        /* we might have lost precreated objects */
        if (unlikely(d->opd_gap_count) > 0) {
+               LASSERT(d->opd_pre != NULL);
                spin_lock(&d->opd_pre_lock);
                if (d->opd_gap_count > 0) {
                        int count = d->opd_gap_count;
-                       osi->osi_oi.oi_id = fid_oid(&d->opd_gap_start_fid);
+
+                       ostid_set_id(&osi->osi_oi,
+                                    fid_oid(&d->opd_gap_start_fid));
                        d->opd_gap_count = 0;
                        spin_unlock(&d->opd_pre_lock);
 
@@ -370,7 +371,6 @@ static int osp_object_init(const struct lu_env *env, struct lu_object *o,
 
                po->opo_obj.do_ops = &osp_md_obj_ops;
                o->lo_header->loh_attr |= LOHA_REMOTE;
-               po->opo_obj.do_lock_ops = &osp_md_lock_ops;
                rc = po->opo_obj.do_ops->do_attr_get(env, lu2dt_obj(o),
                                                     la, NULL);
                if (rc == 0)
@@ -404,6 +404,7 @@ static void osp_object_release(const struct lu_env *env, struct lu_object *o)
         * this may require lu_object_put() in LOD
         */
        if (unlikely(po->opo_reserved)) {
+               LASSERT(d->opd_pre != NULL);
                LASSERT(d->opd_pre_reserved > 0);
                spin_lock(&d->opd_pre_lock);
                d->opd_pre_reserved--;
@@ -412,6 +413,14 @@ static void osp_object_release(const struct lu_env *env, struct lu_object *o)
                /* not needed in cache any more */
                set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
        }
+
+       if (is_ost_obj(o))
+               /* XXX: Currently, NOT cache OST-object on MDT because:
+                *      1. it is not often accessed on MDT.
+                *      2. avoid up layer (such as LFSCK) to load too many
+                *         once-used OST-objects. */
+               set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
+
        EXIT;
 }