Whamcloud - gitweb
LU-2844 mdd: mdt prepare failure should not oops
[fs/lustre-release.git] / lustre / obdclass / dt_object.c
index 51305b5..55b2be3 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) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -49,7 +49,7 @@
 /* fid_be_to_cpu() */
 #include <lustre_fid.h>
 
-#include <lquota.h>
+#include <lustre_quota.h>
 
 /* context key constructor/destructor: dt_global_key_init, dt_global_key_fini */
 LU_KEY_INIT(dt_global, struct dt_thread_info);
@@ -286,10 +286,9 @@ int dt_path_parser(const struct lu_env *env,
         return rc;
 }
 
-static struct dt_object *dt_store_resolve(const struct lu_env *env,
-                                          struct dt_device *dt,
-                                          const char *path,
-                                          struct lu_fid *fid)
+struct dt_object *
+dt_store_resolve(const struct lu_env *env, struct dt_device *dt,
+                const char *path, struct lu_fid *fid)
 {
        struct dt_thread_info *info = dt_info(env);
        struct dt_find_hint   *dfh = &info->dti_dfh;
@@ -320,6 +319,7 @@ static struct dt_object *dt_store_resolve(const struct lu_env *env,
         }
         return obj;
 }
+EXPORT_SYMBOL(dt_store_resolve);
 
 static struct dt_object *dt_reg_open(const struct lu_env *env,
                                      struct dt_device *dt,
@@ -564,6 +564,17 @@ EXPORT_SYMBOL(dt_directory_features);
 const struct dt_index_features dt_otable_features;
 EXPORT_SYMBOL(dt_otable_features);
 
+/* lfsck */
+const struct dt_index_features dt_lfsck_features = {
+       .dif_flags              = DT_IND_UPDATE,
+       .dif_keysize_min        = sizeof(struct lu_fid),
+       .dif_keysize_max        = sizeof(struct lu_fid),
+       .dif_recsize_min        = sizeof(__u8),
+       .dif_recsize_max        = sizeof(__u8),
+       .dif_ptrsize            = 4
+};
+EXPORT_SYMBOL(dt_lfsck_features);
+
 /* accounting indexes */
 const struct dt_index_features dt_acct_features = {
        .dif_flags              = DT_IND_UPDATE,
@@ -675,6 +686,11 @@ static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
                hash = iops->store(env, it);
                ii->ii_hash_end = hash;
 
+               if (OBD_FAIL_CHECK(OBD_FAIL_OBD_IDX_READ_BREAK)) {
+                       if (lip->lip_nr != 0)
+                               GOTO(out, rc = 0);
+               }
+
                if (nob < size) {
                        if (lip->lip_nr == 0)
                                GOTO(out, rc = -EINVAL);