struct ldlm_namespace;
+enum {
+ LUSTRE_RES_ID_SEQ_OFF = 0,
+ LUSTRE_RES_ID_OID_OFF = 1,
+ LUSTRE_RES_ID_VER_OFF = 2,
+ LUSTRE_RES_ID_HSH_OFF = 3
+};
+
/*
* Build (DLM) resource name from fid.
*/
struct ldlm_res_id *name)
{
memset(name, 0, sizeof *name);
- name->name[0] = fid_seq(f);
- name->name[1] = fid_oid(f);
- name->name[2] = fid_ver(f);
- name->name[3] = 0ull;
+ name->name[LUSTRE_RES_ID_SEQ_OFF] = fid_seq(f);
+ name->name[LUSTRE_RES_ID_OID_OFF] = fid_oid(f);
+ name->name[LUSTRE_RES_ID_VER_OFF] = fid_ver(f);
return name;
}
struct ldlm_res_id *name)
{
fid_build_reg_res_name(f, name);
- name->name[3] = hash;
+ name->name[LUSTRE_RES_ID_HSH_OFF] = hash;
return name;
}
LASSERT(!lu_fid_eq(mdo2fid(p1), lf));
pfid = &mdd_env_info(env)->mti_fid;
- /* Do not lookup ".." in root, they do not exist there. */
+ /* Check for root first. */
if (lu_fid_eq(mdo2fid(p1), &mdd->mdd_root_fid))
RETURN(0);
MDD_RN_TGTSRC
};
-static int mdd_rename_order(const struct lu_env *env, struct mdd_device *mdd,
+static int mdd_rename_order(const struct lu_env *env,
+ struct mdd_device *mdd,
struct mdd_object *src_pobj,
struct mdd_object *tgt_pobj)
{
#include <obd_class.h>
#include <lustre_ver.h>
#include <obd_support.h>
-
+#include <lustre_fid.h>
#include "mdd_internal.h"
const char orph_index_name[] = "orphans";
lh->mlh_reg_mode = lm;
lh->mlh_type = MDT_PDO_LOCK;
lh->mlh_pdo_hash = (name != NULL && namelen > 0 ?
- full_name_hash(name, namelen) : 0);
+ full_name_hash(name, namelen - 1) : 0);
}
#ifdef CONFIG_PDIROPS
if (lh->mlh_type == MDT_PDO_LOCK && lh->mlh_pdo_hash != 0) {
lh->mlh_pdo_mode = mdt_lock_pdo_mode(info, o, lh->mlh_reg_mode);
if (lh->mlh_pdo_mode != LCK_MINMODE) {
+ /*
+ * Do not use LDLM_FL_LOCAL_ONLY for paralell lock, it
+ * is never going to be sent to client and we do not
+ * want it slowed down due to possible cancels.
+ */
policy->l_inodebits.bits = MDS_INODELOCK_UPDATE;
rc = mdt_fid_lock(ns, &lh->mlh_pdo_lh, lh->mlh_pdo_mode,
policy, res_id, LDLM_FL_ATOMIC_CB);
RETURN(rc);
}
- fid_build_pdo_res_name(mdt_object_fid(o), lh->mlh_pdo_hash,
- res_id);
+ /*
+ * Finish rs_id initializing by name hash marking patr of
+ * directory which is taking modification.
+ */
+ res_id->name[LUSTRE_RES_ID_HSH_OFF] = lh->mlh_pdo_hash;
}
#endif
policy->l_inodebits.bits = ibits;
+
+ /*
+ * Use LDLM_FL_LOCAL_ONLY for this lock. We do not know yet if it is
+ * going to be sent to client. If it is - mdt_intent_policy() path will
+ * fix it up and turns FL_LOCAL flag off.
+ */
rc = mdt_fid_lock(ns, &lh->mlh_reg_lh, lh->mlh_reg_mode, policy,
res_id, LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB);
#ifdef CONFIG_PDIROPS
*end = hash;
CDEBUG(D_INFO, "%p %p %d "DFID": %#8.8x (%d) \"%*.*s\"\n",
name, ent, nob, PFID(fid), hash, len, len, len, name);
+
if (nob >= recsize) {
fid_be_to_cpu(&ent->lde_fid, fid);
fid_cpu_to_le(&ent->lde_fid, &ent->lde_fid);