#define OST_MAX_PRECREATE 20000
struct obd_ioobj {
- obd_id ioo_id;
- obd_seq ioo_seq;
- __u32 ioo_type;
- __u32 ioo_bufcnt;
+ struct ost_id ioo_oid;
+ __u32 ioo_type;
+ __u32 ioo_bufcnt;
};
+#define ioo_id ioo_oid.oi_id
+#define ioo_seq ioo_oid.oi_seq
+
extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
/* multiple of 8 bytes => can array */
return name;
}
+/**
+ * Build DLM resource name from object id & seq, which will be removed
+ * finally, when we replace ost_id with FID in data stack.
+ *
+ * To keep the compatibility, res[0] = oid, res[1] = seq
+ */
+static inline void ostid_build_res_name(struct ost_id *oid,
+ struct ldlm_res_id *name)
+{
+ memset(name, 0, sizeof *name);
+ name->name[LUSTRE_RES_ID_SEQ_OFF] = oid->oi_id;
+ name->name[LUSTRE_RES_ID_VER_OID_OFF] = oid->oi_seq;
+}
+
+static inline void ostid_res_name_to_id(struct ost_id *oid,
+ struct ldlm_res_id *name)
+{
+ oid->oi_id = name->name[LUSTRE_RES_ID_SEQ_OFF];
+ oid->oi_seq = name->name[LUSTRE_RES_ID_VER_OID_OFF];
+}
+
+/**
+ * Return true if the resource is for the object identified by this id & group.
+ */
+static inline int ostid_res_name_eq(struct ost_id *oid,
+ struct ldlm_res_id *name)
+{
+ return name->name[LUSTRE_RES_ID_SEQ_OFF] == oid->oi_id &&
+ name->name[LUSTRE_RES_ID_VER_OID_OFF] == oid->oi_seq;
+}
/**
* Flatten 128-bit FID values into a 64-bit value for use as an inode number.
__u64 lsm_maxbytes;
struct {
/* Public members. */
- __u64 lw_object_id; /* lov object id */
- __u64 lw_object_seq; /* lov object seq */
+ struct ost_id lw_object_oid; /* lov object id/seq */
/* LOV-private members start here -- only for use in lov/. */
__u32 lw_magic;
struct lov_oinfo *lsm_oinfo[0];
};
-#define lsm_object_id lsm_wire.lw_object_id
-#define lsm_object_seq lsm_wire.lw_object_seq
+#define lsm_object_oid lsm_wire.lw_object_oid
+#define lsm_object_id lsm_wire.lw_object_oid.oi_id
+#define lsm_object_seq lsm_wire.lw_object_oid.oi_seq
#define lsm_magic lsm_wire.lw_magic
#define lsm_layout_gen lsm_wire.lw_layout_gen
#define lsm_stripe_size lsm_wire.lw_stripe_size
#endif
#define POSTID LPU64":"LPU64
-/**
- * Build DLM resource name from object id & group for osc-ost extent lock.
- */
-static inline struct ldlm_res_id *osc_build_res_name(__u64 id, __u64 gr,
- struct ldlm_res_id *name)
-{
- memset(name, 0, sizeof *name);
- name->name[0] = id;
- name->name[1] = gr;
- return name;
-}
-
-/**
- * Return true if the resource is for the object identified by this id & group.
- */
-static inline int osc_res_name_eq(__u64 id, __u64 gr, struct ldlm_res_id *name)
-{
- return name->name[0] == id && name->name[1] == gr;
-}
#endif
#include <lclient.h> /* for cl_client_lru */
#include <lustre/ll_fiemap.h>
#include <lustre_log.h>
+#include <lustre_fid.h>
#include "lov_internal.h"
loi = lsm->lsm_oinfo[i];
if (!lov->lov_tgts[loi->loi_ost_idx])
continue;
- if (lov->lov_tgts[loi->loi_ost_idx]->ltd_exp ==
- data->lock->l_conn_export &&
- osc_res_name_eq(loi->loi_id, loi->loi_seq, res_id)) {
- *stripe = i;
- GOTO(out, rc = 0);
- }
+ if (lov->lov_tgts[loi->loi_ost_idx]->ltd_exp ==
+ data->lock->l_conn_export &&
+ ostid_res_name_eq(&loi->loi_oi, res_id)) {
+ *stripe = i;
+ GOTO(out, rc = 0);
+ }
}
LDLM_ERROR(data->lock, "lock on inode without such object");
dump_lsm(D_ERROR, lsm);
static inline void ofd_build_resid(const struct lu_fid *fid,
struct ldlm_res_id *resname)
{
+ struct ost_id oid;
+
if (fid_is_idif(fid)) {
- /* get id/seq like ostid_idif_pack() does */
- osc_build_res_name(fid_idif_id(fid_seq(fid), fid_oid(fid),
- fid_ver(fid)),
- FID_SEQ_OST_MDT0, resname);
+ oid.oi_id = fid_idif_id(fid_seq(fid), fid_oid(fid),
+ fid_ver(fid));
+ oid.oi_seq = FID_SEQ_OST_MDT0;
} else {
- /* In the future, where OSTs have FID sequences allocated. */
- fid_build_reg_res_name(fid, resname);
+ oid.oi_id = fid_oid(fid);
+ oid.oi_seq = fid_seq(fid);
}
+ ostid_build_res_name(&oid, resname);
}
static inline void ofd_fid_from_resid(struct lu_fid *fid,
const struct ldlm_res_id *name)
{
- /* if seq is FID_SEQ_OST_MDT0 then we have IDIF and resid was built
- * using osc_build_res_name function. */
- if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_VER_OID_OFF])) {
- struct ost_id ostid;
-
- ostid.oi_id = name->name[LUSTRE_RES_ID_SEQ_OFF];
- ostid.oi_seq = name->name[LUSTRE_RES_ID_VER_OID_OFF];
- fid_ostid_unpack(fid, &ostid, 0);
- } else {
- fid->f_seq = name->name[LUSTRE_RES_ID_SEQ_OFF];
- fid->f_oid = (__u32)name->name[LUSTRE_RES_ID_VER_OID_OFF];
- fid->f_ver = name->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32;
- }
+ /* To keep compatiblity, res[0] = oi_id, res[1] = oi_seq. */
+ struct ost_id ostid;
+
+ ostid.oi_id = name->name[LUSTRE_RES_ID_SEQ_OFF];
+ ostid.oi_seq = name->name[LUSTRE_RES_ID_VER_OID_OFF];
+ fid_ostid_unpack(fid, &ostid, 0);
}
static inline void ofd_oti2info(struct ofd_thread_info *info,
int osc_page_init(const struct lu_env *env, struct cl_object *obj,
struct cl_page *page, cfs_page_t *vmpage);
-void osc_lock_build_res(const struct lu_env *env, const struct osc_object *obj,
- struct ldlm_res_id *resname);
void osc_index2policy (ldlm_policy_data_t *policy, const struct cl_object *obj,
pgoff_t start, pgoff_t end);
int osc_lvb_print (const struct lu_env *env, void *cookie,
OBD_SLAB_FREE_PTR(ols, osc_lock_kmem);
}
-void osc_lock_build_res(const struct lu_env *env, const struct osc_object *obj,
- struct ldlm_res_id *resname)
-{
- const struct lu_fid *fid = lu_object_fid(&obj->oo_cl.co_lu);
- if (0) {
- /*
- * In the perfect world of the future, where ost servers talk
- * idif-fids...
- */
- fid_build_reg_res_name(fid, resname);
- } else {
- /*
- * In reality, where ost server expects ->lsm_object_id and
- * ->lsm_object_seq in rename.
- */
- osc_build_res_name(obj->oo_oinfo->loi_id, obj->oo_oinfo->loi_seq,
- resname);
- }
-}
-
static void osc_lock_build_policy(const struct lu_env *env,
const struct cl_lock *lock,
ldlm_policy_data_t *policy)
* ldlm_lock_match(LDLM_FL_LVB_READY) waits for
* LDLM_CP_CALLBACK.
*/
- osc_lock_build_res(env, obj, resname);
+ ostid_build_res_name(&obj->oo_oinfo->loi_oi, resname);
osc_lock_build_policy(env, lock, policy);
result = osc_enqueue_base(osc_export(obj), resname,
&ols->ols_flags, policy,
#include <lustre_log.h>
#include <lustre_debug.h>
#include <lustre_param.h>
+#include <lustre_fid.h>
#include "osc_internal.h"
#include "osc_cl_internal.h"
if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns))
RETURN(0);
- osc_build_res_name(oa->o_id, oa->o_seq, &res_id);
- res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
- if (res == NULL)
- RETURN(0);
+ ostid_build_res_name(&oa->o_oi, &res_id);
+ res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
+ if (res == NULL)
+ RETURN(0);
LDLM_RESOURCE_ADDREF(res);
count = ldlm_cancel_resource_local(res, cancels, NULL, mode,
struct ldlm_res_id res_id;
struct obd_device *obd = class_exp2obd(exp);
- osc_build_res_name(lsm->lsm_object_id, lsm->lsm_object_seq, &res_id);
+ ostid_build_res_name(&lsm->lsm_object_oid, &res_id);
ldlm_resource_iterate(obd->obd_namespace, &res_id, replace, data);
return 0;
}
struct obd_device *obd = class_exp2obd(exp);
int rc = 0;
- osc_build_res_name(lsm->lsm_object_id, lsm->lsm_object_seq, &res_id);
+ ostid_build_res_name(&lsm->lsm_object_oid, &res_id);
rc = ldlm_resource_iterate(obd->obd_namespace, &res_id, replace, data);
if (rc == LDLM_ITER_STOP)
return(1);
int rc;
ENTRY;
- osc_build_res_name(oinfo->oi_md->lsm_object_id,
- oinfo->oi_md->lsm_object_seq, &res_id);
-
+ ostid_build_res_name(&oinfo->oi_md->lsm_object_oid, &res_id);
rc = osc_enqueue_base(exp, &res_id, &oinfo->oi_flags, &oinfo->oi_policy,
&oinfo->oi_md->lsm_oinfo[0]->loi_lvb,
oinfo->oi_md->lsm_oinfo[0]->loi_kms_valid,
struct obd_device *obd = class_exp2obd(exp);
struct ldlm_res_id res_id, *resp = NULL;
- if (lsm != NULL) {
- resp = osc_build_res_name(lsm->lsm_object_id,
- lsm->lsm_object_seq, &res_id);
- }
+ if (lsm != NULL) {
+ ostid_build_res_name(&lsm->lsm_object_oid, &res_id);
+ resp = &res_id;
+ }
return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags, opaque);
}
#include <linux/init.h>
#include <lprocfs_status.h>
#include <libcfs/list.h>
+#include <lustre_quota.h>
+#include <lustre_fid.h>
#include "ost_internal.h"
#include <lustre_fid.h>
!(oa->o_flags & OBD_FL_SRVLOCK))
RETURN(0);
- osc_build_res_name(oa->o_id, oa->o_seq, &res_id);
+ ostid_build_res_name(&oa->o_oi, &res_id);
CDEBUG(D_INODE, "OST-side extent lock.\n");
policy.l_extent.start = start & CFS_PAGE_MASK;
int i;
ENTRY;
- osc_build_res_name(obj->ioo_id, obj->ioo_seq, &res_id);
+ ostid_build_res_name(&obj->ioo_oid, &res_id);
LASSERT(mode == LCK_PR || mode == LCK_PW);
LASSERT(!lustre_handle_is_used(lh));
OBD_FREE_PTR(oinfo);
GOTO(out_env, rc = -ENOMEM);
}
- oa->o_id = lock->l_resource->lr_name.name[0];
- oa->o_seq = lock->l_resource->lr_name.name[1];
+
+ ostid_res_name_to_id(&oa->o_oi, &lock->l_resource->lr_name);
oa->o_valid = OBD_MD_FLID|OBD_MD_FLGROUP;
oinfo->oi_oa = oa;
oinfo->oi_capa = BYPASS_CAPA;
nb += ioo->ioo_bufcnt - 1;
ext.end = nb->offset + nb->len - 1;
- LASSERT(lock->l_resource != NULL);
- if (!osc_res_name_eq(ioo->ioo_id, ioo->ioo_seq,
- &lock->l_resource->lr_name))
- RETURN(0);
+ LASSERT(lock->l_resource != NULL);
+ if (!ostid_res_name_eq(&ioo->ioo_oid, &lock->l_resource->lr_name))
+ RETURN(0);
mode = LCK_PW;
if (opc == OST_READ)
LASSERT(nb != NULL);
LASSERT(!(nb->flags & OBD_BRW_SRVLOCK));
- osc_build_res_name(ioo->ioo_id, ioo->ioo_seq, &opd.opd_resid);
+ ostid_build_res_name(&ioo->ioo_oid, &opd.opd_resid);
opd.opd_req = req;
mode = LCK_PW;
opd.opd_extent.end = OBD_OBJECT_EOF;
opd.opd_timeout = prolong_timeout(req);
- osc_build_res_name(oa->o_id, oa->o_seq, &opd.opd_resid);
+ ostid_build_res_name(&oa->o_oi, &opd.opd_resid);
CDEBUG(D_DLMTRACE,
"%s: refresh locks: "LPU64"/"LPU64" ("LPU64"->"LPU64")\n",