}
if (*mds > cm->cmm_tgt_count) {
- CERROR("Got invalid mdsno: "LPU64" (max: %u)\n",
+ CERROR("Got invalid mdsno: %x (max: %x)\n",
*mds, cm->cmm_tgt_count);
rc = -EINVAL;
} else {
- CDEBUG(D_INFO, "CMM: got MDS "LPU64" for sequence: "
- LPU64"\n", *mds, fid_seq(fid));
+ CDEBUG(D_INFO, "CMM: got MDS %x for sequence: "
+ LPX64"\n", *mds, fid_seq(fid));
}
RETURN (rc);
}
-static struct md_object_operations cml_mo_ops;
-static struct md_dir_operations cml_dir_ops;
-static struct lu_object_operations cml_obj_ops;
+static const struct md_object_operations cml_mo_ops;
+static const struct md_dir_operations cml_dir_ops;
+static const struct lu_object_operations cml_obj_ops;
-static struct md_object_operations cmr_mo_ops;
-static struct md_dir_operations cmr_dir_ops;
-static struct lu_object_operations cmr_obj_ops;
+static const struct md_object_operations cmr_mo_ops;
+static const struct md_dir_operations cmr_dir_ops;
+static const struct lu_object_operations cmr_obj_ops;
struct lu_object *cmm_object_alloc(const struct lu_env *env,
const struct lu_object_header *loh,
struct cml_object *clo;
OBD_ALLOC_PTR(clo);
- if (clo != NULL) {
- lo = &clo->cmm_obj.cmo_obj.mo_lu;
+ if (clo != NULL) {
+ lo = &clo->cmm_obj.cmo_obj.mo_lu;
lu_object_init(lo, NULL, ld);
clo->cmm_obj.cmo_obj.mo_ops = &cml_mo_ops;
clo->cmm_obj.cmo_obj.mo_dir_ops = &cml_dir_ops;
struct cmr_object *cro;
OBD_ALLOC_PTR(cro);
- if (cro != NULL) {
- lo = &cro->cmm_obj.cmo_obj.mo_lu;
+ if (cro != NULL) {
+ lo = &cro->cmm_obj.cmo_obj.mo_lu;
lu_object_init(lo, NULL, ld);
cro->cmm_obj.cmo_obj.mo_ops = &cmr_mo_ops;
cro->cmm_obj.cmo_obj.mo_dir_ops = &cmr_dir_ops;
OBD_FREE_PTR(clo);
}
-static int cml_object_init(const struct lu_env *env, struct lu_object *lo)
+static int cml_object_init(const struct lu_env *env, struct lu_object *lo,
+ const struct lu_object_conf *_)
{
struct cmm_device *cd = lu2cmm_dev(lo->lo_dev);
struct lu_device *c_dev;
static int cml_object_print(const struct lu_env *env, void *cookie,
lu_printer_t p, const struct lu_object *lo)
{
- return (*p)(env, cookie, LUSTRE_CMM_NAME"-local@%p", lo);
+ return (*p)(env, cookie, "[local]");
}
-static struct lu_object_operations cml_obj_ops = {
- .loo_object_init = cml_object_init,
- .loo_object_free = cml_object_free,
- .loo_object_print = cml_object_print
+static const struct lu_object_operations cml_obj_ops = {
+ .loo_object_init = cml_object_init,
+ .loo_object_free = cml_object_free,
+ .loo_object_print = cml_object_print
};
/* CMM local md_object operations */
RETURN(rc);
}
-static struct md_object_operations cml_mo_ops = {
+static int cml_path(const struct lu_env *env, struct md_object *mo,
+ char *path, int pathlen, __u64 *recno, int *linkno)
+{
+ int rc;
+ ENTRY;
+ rc = mo_path(env, md_object_next(mo), path, pathlen, recno, linkno);
+ RETURN(rc);
+}
+
+static int cml_object_sync(const struct lu_env *env, struct md_object *mo)
+{
+ int rc;
+ ENTRY;
+ rc = mo_object_sync(env, md_object_next(mo));
+ RETURN(rc);
+}
+
+static const struct md_object_operations cml_mo_ops = {
.moo_permission = cml_permission,
.moo_attr_get = cml_attr_get,
.moo_attr_set = cml_attr_set,
.moo_close = cml_close,
.moo_readpage = cml_readpage,
.moo_readlink = cml_readlink,
- .moo_capa_get = cml_capa_get
+ .moo_capa_get = cml_capa_get,
+ .moo_object_sync = cml_object_sync,
+ .moo_path = cml_path,
};
/* md_dir operations */
* Try to split @mo_p. If split is ok, -ERESTART is returned and
* current thread will not peoceed with create. Instead it sends
* -ERESTART to client to let it know that correct MDT should be
- * choosen.
+ * chosen.
*/
rc = cmm_split_dir(env, mo_p);
if (rc)
RETURN(rc);
}
-/* rename is split to local/remote by location of new parent dir */
-struct md_object *md_object_find(const struct lu_env *env,
- struct md_device *md,
- const struct lu_fid *f)
-{
- struct lu_object *o;
- struct md_object *m;
- ENTRY;
-
- o = lu_object_find(env, md2lu_dev(md)->ld_site, f);
- if (IS_ERR(o))
- m = (struct md_object *)o;
- else {
- o = lu_object_locate(o->lo_header, md2lu_dev(md)->ld_type);
- m = o ? lu2md(o) : NULL;
- }
- RETURN(m);
-}
-
static int cmm_mode_get(const struct lu_env *env, struct md_device *md,
const struct lu_fid *lf, struct md_attr *ma,
int *remote)
{
- struct md_object *mo_s = md_object_find(env, md, lf);
+ struct md_object *mo_s = md_object_find_slice(env, md, lf);
struct cmm_thread_info *cmi;
struct md_attr *tmp_ma;
int rc;
static int cmm_rename_ctime(const struct lu_env *env, struct md_device *md,
const struct lu_fid *lf, struct md_attr *ma)
{
- struct md_object *mo_s = md_object_find(env, md, lf);
+ struct md_object *mo_s = md_object_find_slice(env, md, lf);
int rc;
ENTRY;
/* XXX: mo_t is remote object and there is RPC to unlink it.
* before that, do local sanity check for rename first. */
if (!remote) {
- struct md_object *mo_s = md_object_find(env,
+ struct md_object *mo_s = md_object_find_slice(env,
md_obj2dev(mo_po), lf);
if (IS_ERR(mo_s))
RETURN(PTR_ERR(mo_s));
RETURN(rc);
}
-static struct md_dir_operations cml_dir_ops = {
+static const struct md_dir_operations cml_dir_ops = {
.mdo_is_subdir = cmm_is_subdir,
.mdo_lookup = cml_lookup,
.mdo_lock_mode = cml_lock_mode,
OBD_FREE_PTR(cro);
}
-static int cmr_object_init(const struct lu_env *env, struct lu_object *lo)
+static int cmr_object_init(const struct lu_env *env, struct lu_object *lo,
+ const struct lu_object_conf *_)
{
struct cmm_device *cd = lu2cmm_dev(lo->lo_dev);
struct lu_device *c_dev;
static int cmr_object_print(const struct lu_env *env, void *cookie,
lu_printer_t p, const struct lu_object *lo)
{
- return (*p)(env, cookie, LUSTRE_CMM_NAME"-remote@%p", lo);
+ const struct cmr_object *cro = lu2cmr_obj((struct lu_object *)lo);
+ return (*p)(env, cookie, "[remote](mds_num=%d)", cro->cmo_num);
}
-static struct lu_object_operations cmr_obj_ops = {
- .loo_object_init = cmr_object_init,
- .loo_object_free = cmr_object_free,
- .loo_object_print = cmr_object_print
+static const struct lu_object_operations cmr_obj_ops = {
+ .loo_object_init = cmr_object_init,
+ .loo_object_free = cmr_object_free,
+ .loo_object_print = cmr_object_print
};
/* CMM remote md_object operations. All are invalid */
return -EFAULT;
}
-static struct md_object_operations cmr_mo_ops = {
+static int cmr_path(const struct lu_env *env, struct md_object *obj,
+ char *path, int pathlen, __u64 *recno, int *linkno)
+{
+ return -EREMOTE;
+}
+
+static int cmr_object_sync(const struct lu_env *env, struct md_object *mo)
+{
+ return -EFAULT;
+}
+
+static const struct md_object_operations cmr_mo_ops = {
.moo_permission = cmr_permission,
.moo_attr_get = cmr_attr_get,
.moo_attr_set = cmr_attr_set,
.moo_close = cmr_close,
.moo_readpage = cmr_readpage,
.moo_readlink = cmr_readlink,
- .moo_capa_get = cmr_capa_get
+ .moo_capa_get = cmr_capa_get,
+ .moo_object_sync = cmr_object_sync,
+ .moo_path = cmr_path,
};
/* remote part of md_dir operations */
RETURN(rc);
}
-static struct md_dir_operations cmr_dir_ops = {
+static const struct md_dir_operations cmr_dir_ops = {
.mdo_is_subdir = cmm_is_subdir,
.mdo_lookup = cmr_lookup,
.mdo_lock_mode = cmr_lock_mode,
.mdo_link = cmr_link,
.mdo_unlink = cmr_unlink,
.mdo_rename = cmr_rename,
- .mdo_rename_tgt = cmr_rename_tgt,
+ .mdo_rename_tgt = cmr_rename_tgt
};