Whamcloud - gitweb
LU-3196 tests: several test fixes about DNE tests
[fs/lustre-release.git] / lustre / obdclass / dt_object.c
index 51305b5..6389e03 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);
@@ -834,7 +850,7 @@ EXPORT_SYMBOL(dt_index_walk);
  * \retval appropriate error otherwise.
  */
 int dt_index_read(const struct lu_env *env, struct dt_device *dev,
-                  struct idx_info *ii, const struct lu_rdpg *rdpg)
+                 struct idx_info *ii, const struct lu_rdpg *rdpg)
 {
        const struct dt_index_features  *feat;
        struct dt_object                *obj;
@@ -846,15 +862,15 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
        if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
                RETURN(-EFAULT);
 
-       if (fid_seq(&ii->ii_fid) < FID_SEQ_SPECIAL)
-               /* block access to local files */
-               RETURN(-EPERM);
-
        if (fid_seq(&ii->ii_fid) >= FID_SEQ_NORMAL)
                /* we don't support directory transfer via OBD_IDX_READ for the
                 * time being */
                RETURN(-EOPNOTSUPP);
 
+       if (!fid_is_quota(&ii->ii_fid))
+               /* block access to all local files except quota files */
+               RETURN(-EPERM);
+
        /* lookup index object subject to the transfer */
        obj = dt_locate(env, dev, &ii->ii_fid);
        if (IS_ERR(obj))