* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <lustre_eacl.h>
#include <md_object.h>
#include <dt_object.h>
-#include <lustre_fsfilt.h>
-#include <lustre/lustre_lfsck_user.h>
+#include <lustre_lfsck.h>
#include <lustre_fid.h>
#include <lustre_capa.h>
#include <lprocfs_status.h>
#include <lustre_log.h>
#include <lustre_linkea.h>
-#include "mdd_lfsck.h"
-
/* PDO lock is unnecessary for current MDT stack because operations
* are already protected by ldlm lock */
#define MDD_DISABLE_PDO_LOCK 1
struct mdd_object *mdd_obf;
};
-extern const char lfsck_bookmark_name[];
-extern const char lfsck_namespace_name[];
-
struct mdd_device {
struct md_device mdd_md_dev;
struct obd_export *mdd_child_exp;
unsigned long mdd_atime_diff;
struct mdd_object *mdd_dot_lustre;
struct mdd_dot_lustre_objs mdd_dot_lustre_objs;
- struct md_lfsck mdd_lfsck;
unsigned int mdd_sync_permission;
int mdd_connects;
struct local_oid_storage *mdd_los;
struct lu_dirent mti_ent;
char mti_key[NAME_MAX + 16];
struct obd_trans_info mti_oti;
- struct lu_buf mti_buf;
+ struct lu_buf mti_buf[4];
struct lu_buf mti_big_buf; /* biggish persistent buf */
struct lu_buf mti_link_buf; /* buf for link ea */
struct lu_name mti_name;
struct thandle *handle);
int mdd_changelog_store(const struct lu_env *env, struct mdd_device *mdd,
struct llog_changelog_rec *rec, struct thandle *th);
+int mdd_changelog_data_store(const struct lu_env *env, struct mdd_device *mdd,
+ enum changelog_rec_type type, int flags,
+ struct mdd_object *mdd_obj,
+ struct thandle *handle);
int mdd_changelog_ns_store(const struct lu_env *env, struct mdd_device *mdd,
enum changelog_rec_type type, unsigned flags,
struct mdd_object *target, struct mdd_object *parent,
int mdd_txn_start_cb(const struct lu_env *env, struct thandle *,
void *cookie);
-/* mdd_lfsck.c */
-int mdd_lfsck_set_speed(const struct lu_env *env, struct md_lfsck *lfsck,
- __u32 limit);
-int mdd_lfsck_start(const struct lu_env *env, struct md_lfsck *lfsck,
- struct lfsck_start *start);
-int mdd_lfsck_stop(const struct lu_env *env, struct md_lfsck *lfsck,
- bool pause);
-int mdd_lfsck_setup(const struct lu_env *env, struct mdd_device *mdd);
-void mdd_lfsck_cleanup(const struct lu_env *env, struct mdd_device *mdd);
-int mdd_lfsck_dump(const struct lu_env *env, struct md_lfsck *lfsck,
- __u16 type, char *buf, int len);
-
/* mdd_device.c */
struct lu_object *mdd_object_alloc(const struct lu_env *env,
const struct lu_object_header *hdr,
/* mdd_prepare.c */
int mdd_compat_fixes(const struct lu_env *env, struct mdd_device *mdd);
+/* inline functions */
static inline int lu_device_is_mdd(struct lu_device *d)
{
return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &mdd_lu_ops);
}
static inline struct lustre_capa *mdd_object_capa(const struct lu_env *env,
- const struct mdd_object *obj)
+ const struct mdd_object *obj)
{
- struct md_capainfo *ci = md_capainfo(env);
- const struct lu_fid *fid = mdo2fid(obj);
- int i;
+ struct lu_capainfo *lci = lu_capainfo_get(env);
+ const struct lu_fid *fid = mdo2fid(obj);
+ int i;
+
+ /* NB: in mdt_init0 */
+ if (lci == NULL)
+ return BYPASS_CAPA;
- /* NB: in mdt_init0 */
- if (!ci)
- return BYPASS_CAPA;
- for (i = 0; i < MD_CAPAINFO_MAX; i++)
- if (lu_fid_eq(&ci->mc_fid[i], fid))
- return ci->mc_capa[i];
- return NULL;
+ for (i = 0; i < LU_CAPAINFO_MAX; i++)
+ if (lu_fid_eq(&lci->lci_fid[i], fid))
+ return lci->lci_capa[i];
+ return NULL;
}
static inline void mdd_set_capainfo(const struct lu_env *env, int offset,
- const struct mdd_object *obj,
- struct lustre_capa *capa)
-{
- struct md_capainfo *ci = md_capainfo(env);
- const struct lu_fid *fid = mdo2fid(obj);
-
- LASSERT(offset >= 0 && offset < MD_CAPAINFO_MAX);
- /* NB: in mdt_init0 */
- if (!ci)
- return;
- ci->mc_fid[offset] = *fid;
- ci->mc_capa[offset] = capa;
+ const struct mdd_object *obj,
+ struct lustre_capa *capa)
+{
+ struct lu_capainfo *lci = lu_capainfo_get(env);
+ const struct lu_fid *fid = mdo2fid(obj);
+
+ LASSERT(offset >= 0 && offset < LU_CAPAINFO_MAX);
+ /* NB: in mdt_init0 */
+ if (lci == NULL)
+ return;
+
+ lci->lci_fid[offset] = *fid;
+ lci->lci_capa[offset] = capa;
}
static inline const char *mdd_obj_dev_name(const struct mdd_object *obj)