int tgt_brw_read(struct tgt_session_info *tsi);
int tgt_brw_write(struct tgt_session_info *tsi);
int tgt_hpreq_handler(struct ptlrpc_request *req);
+void tgt_register_lfsck_in_notify_local(int (*notify)(const struct lu_env *,
+ struct dt_device *,
+ struct lfsck_req_local *,
+ struct thandle *));
void tgt_register_lfsck_in_notify(int (*notify)(const struct lu_env *,
struct dt_device *,
- struct lfsck_request *,
- struct thandle *));
+ struct lfsck_request *));
void tgt_register_lfsck_query(int (*query)(const struct lu_env *,
struct dt_device *,
struct lfsck_request *,
dst->f_ver = __be32_to_cpu(fid_ver(src));
}
+static inline void filter_fid_cpu_to_le(struct filter_fid *dst,
+ const struct filter_fid *src, int size)
+{
+ fid_cpu_to_le(&dst->ff_parent, &src->ff_parent);
+
+ /* XXX: Add more if filter_fid is enlarged in the future. */
+}
+
+static inline void filter_fid_le_to_cpu(struct filter_fid *dst,
+ const struct filter_fid *src, int size)
+{
+ fid_le_to_cpu(&dst->ff_parent, &src->ff_parent);
+
+ /* XXX: Add more if filter_fid is enlarged in the future. */
+}
+
static inline bool fid_is_sane(const struct lu_fid *fid)
{
return fid && ((fid_seq(fid) >= FID_SEQ_START && !fid_ver(fid)) ||
union {
__u32 lr_speed;
__u32 lr_status;
- __u32 lr_type;
};
__u16 lr_version;
__u16 lr_active;
LE_START = 5,
LE_STOP = 6,
LE_QUERY = 7,
- LE_FID_ACCESSED = 8,
+ /* LE_FID_ACCESSED = 8, moved to lfsck_events_local */
LE_PEER_EXIT = 9,
LE_CONDITIONAL_DESTROY = 10,
LE_PAIRS_VERIFY = 11,
#include <libcfs/libcfs.h>
#include <lustre/lustre_fid.h>
-#include <lustre/lustre_idl.h>
static inline __u64 lmm_oi_id(const struct ost_id *oi)
{
LPVS_INCONSISTENT_TOFIX = 2,
};
+enum lfsck_events_local {
+ LEL_FID_ACCESSED = 1,
+ LEL_PAIRS_VERIFY_LOCAL = 2,
+};
+
+struct lfsck_req_local {
+ __u32 lrl_event;
+ __u32 lrl_status;
+ __u16 lrl_active;
+ __u16 lrl_padding0;
+ __u32 lrl_padding1;
+ struct lu_fid lrl_fid;
+ struct lu_fid lrl_fid2;
+ struct lu_fid lrl_fid3;
+};
+
typedef int (*lfsck_out_notify)(const struct lu_env *env, void *data,
enum lfsck_events event);
struct lfsck_start_param *lsp);
int lfsck_stop(const struct lu_env *env, struct dt_device *key,
struct lfsck_stop *stop);
+int lfsck_in_notify_local(const struct lu_env *env, struct dt_device *key,
+ struct lfsck_req_local *lrl, struct thandle *th);
int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
- struct lfsck_request *lr, struct thandle *th);
+ struct lfsck_request *lr);
int lfsck_query(const struct lu_env *env, struct dt_device *key,
struct lfsck_request *req, struct lfsck_reply *rep,
struct lfsck_query *que);
int lfsck_dump(struct seq_file *m, struct dt_device *key, enum lfsck_type type);
-static inline void lfsck_pack_rfa(struct lfsck_request *lr,
+static inline void lfsck_pack_rfa(struct lfsck_req_local *lrl,
const struct lu_fid *fid,
- __u32 event, __u16 com)
+ enum lfsck_events_local event, __u16 com)
{
- memset(lr, 0, sizeof(*lr));
- lr->lr_fid = *fid;
- lr->lr_event = event;
- lr->lr_active = com;
+ memset(lrl, 0, sizeof(*lrl));
+ lrl->lrl_fid = *fid;
+ lrl->lrl_event = event;
+ lrl->lrl_active = com;
}
static inline bool lovea_slot_is_dummy(const struct lov_ost_data_v1 *obj)
void (*lfsck_quit)(const struct lu_env *env,
struct lfsck_component *com);
+ int (*lfsck_in_notify_local)(const struct lu_env *env,
+ struct lfsck_component *com,
+ struct lfsck_req_local *lrl,
+ struct thandle *th);
+
int (*lfsck_in_notify)(const struct lu_env *env,
struct lfsck_component *com,
- struct lfsck_request *lr,
- struct thandle *th);
+ struct lfsck_request *lr);
int (*lfsck_query)(const struct lu_env *env,
struct lfsck_component *com,
static int lfsck_layout_slave_repair_pfid(const struct lu_env *env,
struct lfsck_component *com,
- struct lfsck_request *lr)
+ struct lfsck_req_local *lrl)
{
struct dt_object *obj;
int rc = 0;
ENTRY;
- obj = lfsck_object_find_bottom(env, com->lc_lfsck, &lr->lr_fid);
+ obj = lfsck_object_find_bottom(env, com->lc_lfsck, &lrl->lrl_fid);
if (IS_ERR(obj))
GOTO(log, rc = PTR_ERR(obj));
lfsck_is_dead_obj(obj)))
GOTO(unlock, rc = 0);
- rc = __lfsck_layout_update_pfid(env, obj, &lr->lr_fid2,
- lr->lr_fid2.f_ver);
+ rc = __lfsck_layout_update_pfid(env, obj, &lrl->lrl_fid2,
+ lrl->lrl_fid2.f_ver);
GOTO(unlock, rc);
log:
CDEBUG(D_LFSCK, "%s: layout LFSCK slave repaired pfid for "DFID
", parent "DFID": rc = %d\n", lfsck_lfsck2name(com->lc_lfsck),
- PFID(&lr->lr_fid), PFID(&lr->lr_fid2), rc);
+ PFID(&lrl->lrl_fid), PFID(&lrl->lrl_fid2), rc);
return rc;
}
static int lfsck_layout_master_in_notify(const struct lu_env *env,
struct lfsck_component *com,
- struct lfsck_request *lr,
- struct thandle *th)
+ struct lfsck_request *lr)
{
struct lfsck_instance *lfsck = com->lc_lfsck;
struct lfsck_layout *lo = com->lc_file_ram;
RETURN(0);
}
-static int lfsck_layout_slave_in_notify(const struct lu_env *env,
- struct lfsck_component *com,
- struct lfsck_request *lr,
- struct thandle *th)
+static int lfsck_layout_slave_in_notify_local(const struct lu_env *env,
+ struct lfsck_component *com,
+ struct lfsck_req_local *lrl,
+ struct thandle *th)
{
- struct lfsck_instance *lfsck = com->lc_lfsck;
- struct lfsck_layout_slave_data *llsd = com->lc_data;
- struct lfsck_layout_slave_target *llst;
- int rc;
ENTRY;
- switch (lr->lr_event) {
- case LE_FID_ACCESSED:
- lfsck_rbtree_update_bitmap(env, com, &lr->lr_fid, true);
+ switch (lrl->lrl_event) {
+ case LEL_FID_ACCESSED:
+ lfsck_rbtree_update_bitmap(env, com, &lrl->lrl_fid, true);
RETURN(0);
- case LE_CONDITIONAL_DESTROY:
- rc = lfsck_layout_slave_conditional_destroy(env, com, lr);
- RETURN(rc);
- case LE_PAIRS_VERIFY: {
- lr->lr_status = LPVS_INIT;
+ case LEL_PAIRS_VERIFY_LOCAL: {
+ int rc;
+
+ lrl->lrl_status = LPVS_INIT;
/* Firstly, if the MDT-object which is claimed via OST-object
* local stored PFID xattr recognizes the OST-object, then it
* must be that the client given PFID is wrong. */
- rc = lfsck_layout_slave_check_pairs(env, com, &lr->lr_fid,
- &lr->lr_fid3);
+ rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
+ &lrl->lrl_fid3);
if (rc <= 0)
RETURN(0);
- lr->lr_status = LPVS_INCONSISTENT;
+ lrl->lrl_status = LPVS_INCONSISTENT;
/* The OST-object local stored PFID xattr is stale. We need to
* check whether the MDT-object that is claimed via the client
* given PFID information recognizes the OST-object or not. If
* matches, then need to update the OST-object's PFID xattr. */
- rc = lfsck_layout_slave_check_pairs(env, com, &lr->lr_fid,
- &lr->lr_fid2);
+ rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
+ &lrl->lrl_fid2);
/* For rc < 0 case:
* We are not sure whether the client given PFID information
* is correct or not, do nothing to avoid improper fixing.
* The client given PFID information is also invalid, we can
* NOT fix the OST-object inconsistency.
*/
- if (rc != 0)
- RETURN(rc);
-
- lr->lr_status = LPVS_INCONSISTENT_TOFIX;
- rc = lfsck_layout_slave_repair_pfid(env, com, lr);
+ if (!rc) {
+ lrl->lrl_status = LPVS_INCONSISTENT_TOFIX;
+ rc = lfsck_layout_slave_repair_pfid(env, com, lrl);
+ }
RETURN(rc);
}
+ default:
+ break;
+ }
+
+ RETURN(-EOPNOTSUPP);
+}
+
+static int lfsck_layout_slave_in_notify(const struct lu_env *env,
+ struct lfsck_component *com,
+ struct lfsck_request *lr)
+{
+ struct lfsck_instance *lfsck = com->lc_lfsck;
+ struct lfsck_layout_slave_data *llsd = com->lc_data;
+ struct lfsck_layout_slave_target *llst;
+ int rc;
+ ENTRY;
+
+ switch (lr->lr_event) {
+ case LE_CONDITIONAL_DESTROY:
+ rc = lfsck_layout_slave_conditional_destroy(env, com, lr);
+ RETURN(rc);
case LE_PHASE1_DONE: {
if (lr->lr_flags2 & LF_INCOMPLETE) {
struct lfsck_layout *lo = com->lc_file_ram;
.lfsck_double_scan = lfsck_layout_slave_double_scan,
.lfsck_data_release = lfsck_layout_slave_data_release,
.lfsck_quit = lfsck_layout_slave_quit,
+ .lfsck_in_notify_local = lfsck_layout_slave_in_notify_local,
.lfsck_in_notify = lfsck_layout_slave_in_notify,
.lfsck_query = lfsck_layout_query,
.lfsck_join = lfsck_layout_slave_join,
}
EXPORT_SYMBOL(lfsck_stop);
+int lfsck_in_notify_local(const struct lu_env *env, struct dt_device *key,
+ struct lfsck_req_local *lrl, struct thandle *th)
+{
+ struct lfsck_instance *lfsck;
+ struct lfsck_component *com;
+ int rc = -EOPNOTSUPP;
+ ENTRY;
+
+ lfsck = lfsck_instance_find(key, true, false);
+ if (unlikely(!lfsck))
+ RETURN(-ENXIO);
+
+ com = lfsck_component_find(lfsck, lrl->lrl_active);
+ if (likely(com && com->lc_ops->lfsck_in_notify_local)) {
+ rc = com->lc_ops->lfsck_in_notify_local(env, com, lrl, th);
+ lfsck_component_put(env, com);
+ }
+
+ lfsck_instance_put(env, lfsck);
+
+ RETURN(rc);
+}
+EXPORT_SYMBOL(lfsck_in_notify_local);
+
int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
- struct lfsck_request *lr, struct thandle *th)
+ struct lfsck_request *lr)
{
int rc = -EOPNOTSUPP;
ENTRY;
}
case LE_PHASE1_DONE:
case LE_PHASE2_DONE:
- case LE_FID_ACCESSED:
case LE_PEER_EXIT:
case LE_CONDITIONAL_DESTROY:
case LE_SET_LMV_MASTER:
RETURN(-ENXIO);
com = lfsck_component_find(lfsck, lr->lr_active);
- if (likely(com != NULL)) {
- rc = com->lc_ops->lfsck_in_notify(env, com, lr, th);
+ if (likely(com)) {
+ rc = com->lc_ops->lfsck_in_notify(env, com, lr);
lfsck_component_put(env, com);
}
INIT_LIST_HEAD(&lfsck_mdt_orphan_list);
lfsck_key_init_generic(&lfsck_thread_key, NULL);
rc = lu_context_key_register(&lfsck_thread_key);
- if (rc == 0) {
+ if (!rc) {
+ tgt_register_lfsck_in_notify_local(lfsck_in_notify_local);
tgt_register_lfsck_in_notify(lfsck_in_notify);
tgt_register_lfsck_query(lfsck_query);
}
static int lfsck_namespace_in_notify(const struct lu_env *env,
struct lfsck_component *com,
- struct lfsck_request *lr,
- struct thandle *th)
+ struct lfsck_request *lr)
{
- struct lfsck_instance *lfsck = com->lc_lfsck;
- struct lfsck_namespace *ns = com->lc_file_ram;
- struct lfsck_assistant_data *lad = com->lc_data;
- struct lfsck_tgt_descs *ltds = &lfsck->li_mdt_descs;
- struct lfsck_tgt_desc *ltd;
- int rc = 0;
- bool fail = false;
+ struct lfsck_instance *lfsck = com->lc_lfsck;
+ struct lfsck_namespace *ns = com->lc_file_ram;
+ struct lfsck_assistant_data *lad = com->lc_data;
+ struct lfsck_tgt_descs *ltds = &lfsck->li_mdt_descs;
+ struct lfsck_tgt_desc *ltd;
+ int rc = 0;
+ bool fail = false;
ENTRY;
switch (lr->lr_event) {
struct linkea_data mti_link_data;
struct md_op_spec mti_spec;
struct dt_insert_rec mti_dt_rec;
- struct lfsck_request mti_lr;
+ struct lfsck_req_local mti_lrl;
struct lu_seq_range mti_range;
};
return rc;
ofd->ofd_lfsck_verify_pfid = !!val;
+ if (!ofd->ofd_lfsck_verify_pfid) {
+ ofd->ofd_inconsistency_self_detected = 0;
+ ofd->ofd_inconsistency_self_repaired = 0;
+ }
return count;
}
struct ofd_object {
struct lu_object_header ofo_header;
struct dt_object ofo_obj;
- struct lu_fid ofo_pfid;
+ struct filter_fid ofo_ff;
unsigned int ofo_pfid_checking:1,
ofo_pfid_verified:1;
};
unsigned long fti_used;
struct ost_lvb fti_lvb;
union {
- struct lfsck_request fti_lr;
+ struct lfsck_req_local fti_lrl;
struct obd_connect_data fti_ocd;
};
};
struct ofd_inconsistency_item {
struct list_head oii_list;
struct ofd_object *oii_obj;
- struct lu_fid oii_pfid;
+ struct filter_fid oii_ff;
};
/**
* \param[in] env execution environment
* \param[in] ofd OFD device
* \param[in] oii object-related local data
- * \param[in] lr LFSCK request data
+ * \param[in] lrl LFSCK request data
*/
static void ofd_inconsistency_verify_one(const struct lu_env *env,
struct ofd_device *ofd,
struct ofd_inconsistency_item *oii,
- struct lfsck_request *lr)
+ struct lfsck_req_local *lrl)
{
- struct ofd_object *fo = oii->oii_obj;
- struct lu_fid *pfid = &fo->ofo_pfid;
- int rc;
+ struct ofd_object *fo = oii->oii_obj;
+ struct filter_fid *client_ff = &oii->oii_ff;
+ struct filter_fid *local_ff = &fo->ofo_ff;
+ int rc;
LASSERT(fo->ofo_pfid_checking);
LASSERT(!fo->ofo_pfid_verified);
- lr->lr_fid = fo->ofo_header.loh_fid; /* OST-object itself FID. */
- lr->lr_fid2 = oii->oii_pfid; /* client given PFID. */
- lr->lr_fid3 = *pfid; /* OST local stored PFID. */
+ lrl->lrl_fid = fo->ofo_header.loh_fid; /* OST-object itself FID. */
+ lrl->lrl_fid2 = client_ff->ff_parent; /* client given PFID. */
+ lrl->lrl_fid3 = local_ff->ff_parent; /* OST local stored PFID. */
- rc = lfsck_in_notify(env, ofd->ofd_osd, lr, NULL);
+ rc = lfsck_in_notify_local(env, ofd->ofd_osd, lrl, NULL);
ofd_write_lock(env, fo);
- switch (lr->lr_status) {
+ switch (lrl->lrl_status) {
case LPVS_INIT:
LASSERT(rc <= 0);
"PFID xattr for "DFID", the client given PFID "
DFID", OST local stored PFID "DFID": rc = %d\n",
ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
- PFID(&oii->oii_pfid), PFID(pfid), rc);
+ PFID(&client_ff->ff_parent),
+ PFID(&local_ff->ff_parent), rc);
else
fo->ofo_pfid_verified = 1;
break;
"PFID for "DFID", the client given PFID "DFID
", local stored PFID "DFID": rc = %d\n",
ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
- PFID(&oii->oii_pfid), PFID(pfid), rc);
+ PFID(&client_ff->ff_parent),
+ PFID(&local_ff->ff_parent), rc);
else
CDEBUG(D_LFSCK, "%s: both the client given PFID and "
"the OST local stored PFID are stale for the "
"OST-object "DFID", client given PFID is "DFID
", local stored PFID is "DFID"\n",
ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
- PFID(&oii->oii_pfid), PFID(pfid));
+ PFID(&client_ff->ff_parent),
+ PFID(&local_ff->ff_parent));
break;
case LPVS_INCONSISTENT_TOFIX:
ofd->ofd_inconsistency_self_detected++;
"for "DFID", with the client given PFID "DFID
", the old stored PFID "DFID"\n",
ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
- PFID(&oii->oii_pfid), PFID(pfid));
+ PFID(&client_ff->ff_parent),
+ PFID(&local_ff->ff_parent));
} else if (rc < 0) {
CDEBUG(D_LFSCK, "%s: fail to fix the OST PFID xattr "
"for "DFID", client given PFID "DFID", local "
"stored PFID "DFID": rc = %d\n",
ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
- PFID(&oii->oii_pfid), PFID(pfid), rc);
+ PFID(&client_ff->ff_parent),
+ PFID(&local_ff->ff_parent), rc);
}
- *pfid = oii->oii_pfid;
+ local_ff->ff_parent = client_ff->ff_parent;
fo->ofo_pfid_verified = 1;
break;
default:
*/
static int ofd_inconsistency_verification_main(void *args)
{
- struct lu_env env;
- struct ofd_device *ofd = args;
- struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread;
+ struct lu_env env;
+ struct ofd_device *ofd = args;
+ struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread;
struct ofd_inconsistency_item *oii;
- struct lfsck_request *lr = NULL;
- struct l_wait_info lwi = { 0 };
- int rc;
+ struct lfsck_req_local *lrl = NULL;
+ struct l_wait_info lwi = { 0 };
+ int rc;
ENTRY;
rc = lu_env_init(&env, LCT_DT_THREAD);
spin_lock(&ofd->ofd_inconsistency_lock);
- thread_set_flags(thread, rc != 0 ? SVC_STOPPED : SVC_RUNNING);
+ thread_set_flags(thread, rc ? SVC_STOPPED : SVC_RUNNING);
wake_up_all(&thread->t_ctl_waitq);
spin_unlock(&ofd->ofd_inconsistency_lock);
- if (rc != 0)
+ if (rc)
RETURN(rc);
- OBD_ALLOC_PTR(lr);
- if (unlikely(lr == NULL))
+ OBD_ALLOC_PTR(lrl);
+ if (unlikely(!lrl))
GOTO(out_unlocked, rc = -ENOMEM);
- lr->lr_event = LE_PAIRS_VERIFY;
- lr->lr_active = LFSCK_TYPE_LAYOUT;
+ lrl->lrl_event = LEL_PAIRS_VERIFY_LOCAL;
+ lrl->lrl_active = LFSCK_TYPE_LAYOUT;
spin_lock(&ofd->ofd_inconsistency_lock);
while (1) {
oii_list);
list_del_init(&oii->oii_list);
spin_unlock(&ofd->ofd_inconsistency_lock);
- ofd_inconsistency_verify_one(&env, ofd, oii, lr);
+ ofd_inconsistency_verify_one(&env, ofd, oii, lrl);
spin_lock(&ofd->ofd_inconsistency_lock);
}
spin_lock(&ofd->ofd_inconsistency_lock);
}
- OBD_FREE_PTR(lr);
+ OBD_FREE_PTR(lrl);
GOTO(out, rc = 0);
static void ofd_add_inconsistency_item(const struct lu_env *env,
struct ofd_object *fo, struct obdo *oa)
{
- struct ofd_device *ofd = ofd_obj2dev(fo);
- struct ofd_inconsistency_item *oii;
- bool wakeup = false;
+ struct ofd_device *ofd = ofd_obj2dev(fo);
+ struct ofd_inconsistency_item *oii;
+ struct filter_fid *ff;
+ bool wakeup = false;
OBD_ALLOC_PTR(oii);
if (oii == NULL)
INIT_LIST_HEAD(&oii->oii_list);
lu_object_get(&fo->ofo_obj.do_lu);
oii->oii_obj = fo;
- oii->oii_pfid.f_seq = oa->o_parent_seq;
- oii->oii_pfid.f_oid = oa->o_parent_oid;
- oii->oii_pfid.f_stripe_idx = oa->o_stripe_idx;
+ ff = &oii->oii_ff;
+ ff->ff_parent.f_seq = oa->o_parent_seq;
+ ff->ff_parent.f_oid = oa->o_parent_oid;
+ ff->ff_parent.f_stripe_idx = oa->o_stripe_idx;
spin_lock(&ofd->ofd_inconsistency_lock);
if (fo->ofo_pfid_checking || fo->ofo_pfid_verified) {
int ofd_verify_ff(const struct lu_env *env, struct ofd_object *fo,
struct obdo *oa)
{
- struct lu_fid *pfid = &fo->ofo_pfid;
- int rc = 0;
+ struct lu_fid *pfid = &fo->ofo_ff.ff_parent;
+ int rc = 0;
ENTRY;
if (fid_is_sane(pfid)) {
rc = dt_xattr_set(env, dt_obj, &info->fti_buf, XATTR_NAME_FID,
0, th);
- if (rc == 0) {
- ofd_obj->ofo_pfid.f_seq = le64_to_cpu(ff->ff_parent.f_seq);
- ofd_obj->ofo_pfid.f_oid = le32_to_cpu(ff->ff_parent.f_oid);
- /* Currently, the filter_fid::ff_parent::f_ver is not
- * the real parent MDT-object's FID::f_ver, instead it
- * is the OST-object index in its parent MDT-object's
- * layout EA. */
- ofd_obj->ofo_pfid.f_stripe_idx =
- le32_to_cpu(ff->ff_parent.f_stripe_idx);
- }
+ if (!rc)
+ filter_fid_le_to_cpu(&ofd_obj->ofo_ff, ff, sizeof(*ff));
}
GOTO(out_tx, rc);
* Get FID of parent MDT object.
*
* This function reads extended attribute XATTR_NAME_FID of OFD object which
- * contains the MDT parent object FID and saves it in ofd_object::ofo_pfid.
+ * contains the MDT parent object FID and saves it in ofd_object::ofo_ff.
*
* The filter_fid::ff_parent::f_ver field currently holds
* the OST-object index in the parent MDT-object's layout EA,
*/
int ofd_object_ff_load(const struct lu_env *env, struct ofd_object *fo)
{
- struct ofd_thread_info *info = ofd_info(env);
- struct filter_fid_old *ff = &info->fti_mds_fid_old;
- struct lu_buf *buf = &info->fti_buf;
- struct lu_fid *pfid = &fo->ofo_pfid;
- int rc = 0;
+ struct ofd_thread_info *info = ofd_info(env);
+ struct filter_fid *ff = &fo->ofo_ff;
+ struct lu_buf *buf = &info->fti_buf;
+ int rc = 0;
- if (fid_is_sane(pfid))
+ if (fid_is_sane(&ff->ff_parent))
return 0;
buf->lb_buf = ff;
if (rc < 0)
return rc;
- if (rc < sizeof(struct lu_fid)) {
- fid_zero(pfid);
+ if (unlikely(rc < sizeof(struct lu_fid))) {
+ fid_zero(&ff->ff_parent);
return -ENODATA;
}
- pfid->f_seq = le64_to_cpu(ff->ff_parent.f_seq);
- pfid->f_oid = le32_to_cpu(ff->ff_parent.f_oid);
- pfid->f_stripe_idx = le32_to_cpu(ff->ff_parent.f_stripe_idx);
+ filter_fid_le_to_cpu(ff, ff, rc);
return 0;
}
/* Only the new created objects need to be recorded. */
if (ofd->ofd_osd->dd_record_fid_accessed) {
- struct lfsck_request *lr = &ofd_info(env)->fti_lr;
+ struct lfsck_req_local *lrl = &ofd_info(env)->fti_lrl;
- lfsck_pack_rfa(lr, lu_object_fid(&fo->ofo_obj.do_lu),
- LE_FID_ACCESSED,
- LFSCK_TYPE_LAYOUT);
- lfsck_in_notify(env, ofd->ofd_osd, lr, NULL);
+ lfsck_pack_rfa(lrl, lu_object_fid(&fo->ofo_obj.do_lu),
+ LEL_FID_ACCESSED, LFSCK_TYPE_LAYOUT);
+ lfsck_in_notify_local(env, ofd->ofd_osd, lrl, NULL);
}
if (likely(!ofd_object_exists(fo) &&
if (ff_needed) {
rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
XATTR_NAME_FID, 0, th);
- if (rc == 0) {
- fo->ofo_pfid.f_seq = le64_to_cpu(ff->ff_parent.f_seq);
- fo->ofo_pfid.f_oid = le32_to_cpu(ff->ff_parent.f_oid);
- /* Currently, the filter_fid::ff_parent::f_ver is not
- * the real parent MDT-object's FID::f_ver, instead it
- * is the OST-object index in its parent MDT-object's
- * layout EA. */
- fo->ofo_pfid.f_stripe_idx =
- le32_to_cpu(ff->ff_parent.f_stripe_idx);
- }
+ if (!rc)
+ filter_fid_le_to_cpu(&fo->ofo_ff, ff, sizeof(*ff));
}
GOTO(stop, rc);
if (ff_needed) {
rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
XATTR_NAME_FID, 0, th);
- if (rc == 0) {
- fo->ofo_pfid.f_seq = le64_to_cpu(ff->ff_parent.f_seq);
- fo->ofo_pfid.f_oid = le32_to_cpu(ff->ff_parent.f_oid);
- /* Currently, the filter_fid::ff_parent::f_ver is not
- * the real parent MDT-object's FID::f_ver, instead it
- * is the OST-object index in its parent MDT-object's
- * layout EA. */
- fo->ofo_pfid.f_stripe_idx =
- le32_to_cpu(ff->ff_parent.f_stripe_idx);
- }
+ if (!rc)
+ filter_fid_le_to_cpu(&fo->ofo_ff, ff, sizeof(*ff));
}
GOTO(stop, rc);
(long long)LE_STOP);
LASSERTF(LE_QUERY == 7, "found %lld\n",
(long long)LE_QUERY);
- LASSERTF(LE_FID_ACCESSED == 8, "found %lld\n",
- (long long)LE_FID_ACCESSED);
LASSERTF(LE_PEER_EXIT == 9, "found %lld\n",
(long long)LE_PEER_EXIT);
LASSERTF(LE_CONDITIONAL_DESTROY == 10, "found %lld\n",
GOTO(out, rc = PTR_ERR(dt_obj));
if (dt->dd_record_fid_accessed) {
- lfsck_pack_rfa(&tti->tti_lr,
+ struct lfsck_req_local *lrl = &tti->tti_lrl;
+
+ lfsck_pack_rfa(lrl,
lu_object_fid(&dt_obj->do_lu),
- LE_FID_ACCESSED,
+ LEL_FID_ACCESSED,
LFSCK_TYPE_LAYOUT);
- tgt_lfsck_in_notify(env, dt, &tti->tti_lr,
- NULL);
+ tgt_lfsck_in_notify_local(env, dt, lrl, NULL);
}
tti->tti_u.update.tti_dt_object = dt_obj;
};
EXPORT_SYMBOL(tgt_sec_ctx_handlers);
+int (*tgt_lfsck_in_notify_local)(const struct lu_env *env,
+ struct dt_device *key,
+ struct lfsck_req_local *lrl,
+ struct thandle *th) = NULL;
+
+void tgt_register_lfsck_in_notify_local(int (*notify)(const struct lu_env *,
+ struct dt_device *,
+ struct lfsck_req_local *,
+ struct thandle *))
+{
+ tgt_lfsck_in_notify_local = notify;
+}
+EXPORT_SYMBOL(tgt_register_lfsck_in_notify_local);
+
int (*tgt_lfsck_in_notify)(const struct lu_env *env,
struct dt_device *key,
- struct lfsck_request *lr,
- struct thandle *th) = NULL;
+ struct lfsck_request *lr) = NULL;
void tgt_register_lfsck_in_notify(int (*notify)(const struct lu_env *,
struct dt_device *,
- struct lfsck_request *,
- struct thandle *))
+ struct lfsck_request *))
{
tgt_lfsck_in_notify = notify;
}
if (lr == NULL)
RETURN(-EPROTO);
- rc = tgt_lfsck_in_notify(env, key, lr, NULL);
+ rc = tgt_lfsck_in_notify(env, key, lr);
RETURN(rc);
}
#include <lustre_req_layout.h>
#include <lustre_sec.h>
-extern int (*tgt_lfsck_in_notify)(const struct lu_env *env,
- struct dt_device *key,
- struct lfsck_request *lr,
- struct thandle *th);
+extern int (*tgt_lfsck_in_notify_local)(const struct lu_env *env,
+ struct dt_device *key,
+ struct lfsck_req_local *lrl,
+ struct thandle *th);
/**
* Common data shared by tg-level handlers. This is allocated per-thread to
* reduce stack consumption.
struct l_wait_info tti_wait_info;
} update;
} tti_u;
- struct lfsck_request tti_lr;
+ struct lfsck_req_local tti_lrl;
struct dt_insert_rec tti_rec;
};
CHECK_VALUE(LE_START);
CHECK_VALUE(LE_STOP);
CHECK_VALUE(LE_QUERY);
- CHECK_VALUE(LE_FID_ACCESSED);
CHECK_VALUE(LE_PEER_EXIT);
CHECK_VALUE(LE_CONDITIONAL_DESTROY);
CHECK_VALUE(LE_PAIRS_VERIFY);
(long long)LE_STOP);
LASSERTF(LE_QUERY == 7, "found %lld\n",
(long long)LE_QUERY);
- LASSERTF(LE_FID_ACCESSED == 8, "found %lld\n",
- (long long)LE_FID_ACCESSED);
LASSERTF(LE_PEER_EXIT == 9, "found %lld\n",
(long long)LE_PEER_EXIT);
LASSERTF(LE_CONDITIONAL_DESTROY == 10, "found %lld\n",