Details : Separate lu_site stats printing code into a separate function
that can be reused on a client.
+Severity : minor
+Bugzilla : 16450
+Description: Constify instances of struct {lu,dt,md}_device_operations.
+Details : Constify instances of struct {lu,dt,md}_device_operations.
+
--------------------------------------------------------------------------------
2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com>
.o_owner = THIS_MODULE
};
-static struct lu_device_operations cmm_lu_ops;
+static const struct lu_device_operations cmm_lu_ops;
static inline int lu_device_is_cmm(struct lu_device *d)
{
RETURN(rc);
}
-static struct md_device_operations cmm_md_ops = {
+static const struct md_device_operations cmm_md_ops = {
.mdo_statfs = cmm_statfs,
.mdo_root_get = cmm_root_get,
.mdo_maxsize_get = cmm_maxsize_get,
RETURN(rc);
}
-static struct lu_device_operations cmm_lu_ops = {
+static const struct lu_device_operations cmm_lu_ops = {
.ldo_object_alloc = cmm_object_alloc,
.ldo_process_config = cmm_process_config,
.ldo_recovery_complete = cmm_recovery_complete
CMM_INITIALIZED = 1 << 0
};
-static inline struct md_device_operations *cmm_child_ops(struct cmm_device *d)
+static inline const struct md_device_operations *
+cmm_child_ops(struct cmm_device *d)
{
- return (d->cmm_child->md_ops);
+ return d->cmm_child->md_ops;
}
static inline struct cmm_device *md2cmm_dev(struct md_device *m)
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,
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 = {
+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
RETURN(rc);
}
-static struct md_object_operations cml_mo_ops = {
+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,
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,
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);
+ return (*p)(env, cookie, "[remote]");
}
-static struct lu_object_operations cmr_obj_ops = {
+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
return -EFAULT;
}
-static struct md_object_operations cmr_mo_ops = {
+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,
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,
#include "cmm_internal.h"
#include "mdc_internal.h"
-static struct lu_device_operations mdc_lu_ops;
+static const struct lu_device_operations mdc_lu_ops;
static inline int lu_device_is_mdc(struct lu_device *ld)
{
ld->ld_ops == &mdc_lu_ops);
}
-static struct md_device_operations mdc_md_ops = { 0 };
+static const struct md_device_operations mdc_md_ops = { 0 };
static int mdc_obd_update(struct obd_device *host,
struct obd_device *watched,
RETURN(rc);
}
-static struct lu_device_operations mdc_lu_ops = {
+static const struct lu_device_operations mdc_lu_ops = {
.ldo_object_alloc = mdc_object_alloc,
.ldo_process_config = mdc_process_config
};
#include "cmm_internal.h"
#include "mdc_internal.h"
-static struct md_object_operations mdc_mo_ops;
-static struct md_dir_operations mdc_dir_ops;
-static struct lu_object_operations mdc_obj_ops;
+static const struct md_object_operations mdc_mo_ops;
+static const struct md_dir_operations mdc_dir_ops;
+static const struct lu_object_operations mdc_obj_ops;
extern struct lu_context_key mdc_thread_key;
}
#endif
-static struct md_object_operations mdc_mo_ops = {
+static const struct md_object_operations mdc_mo_ops = {
.moo_attr_get = mdc_attr_get,
.moo_attr_set = mdc_attr_set,
.moo_object_create = mdc_object_create,
RETURN(rc);
}
-static struct md_dir_operations mdc_dir_ops = {
+static const struct md_dir_operations mdc_dir_ops = {
.mdo_is_subdir = mdc_is_subdir,
.mdo_rename_tgt = mdc_rename_tgt
};
struct dt_device {
struct lu_device dd_lu_dev;
- struct dt_device_operations *dd_ops;
+ const struct dt_device_operations *dd_ops;
- /*
+ /**
* List of dt_txn_callback (see below). This is not protected in any
* way, because callbacks are supposed to be added/deleted only during
* single-threaded start-up shut-down procedures.
struct dt_object {
struct lu_object do_lu;
- struct dt_object_operations *do_ops;
- struct dt_body_operations *do_body_ops;
- struct dt_index_operations *do_index_ops;
+ const struct dt_object_operations *do_ops;
+ const struct dt_body_operations *do_body_ops;
+ const struct dt_index_operations *do_index_ops;
};
int dt_object_init(struct dt_object *obj,
/*
* Operations for this object.
*/
- struct lu_object_operations *lo_ops;
+ const struct lu_object_operations *lo_ops;
/*
* Linkage into list of all layers.
*/
return &o->lo_header->loh_fid;
}
-/*
+/**
* return device operations vector for this object
*/
-static inline struct lu_device_operations *
+static const inline struct lu_device_operations *
lu_object_ops(const struct lu_object *o)
{
return o->lo_dev->ld_ops;
}
-/*
+/**
* Given a compound object, find its slice, corresponding to the device type
- * @dtype.
+ * \a dtype.
*/
struct lu_object *lu_object_locate(struct lu_object_header *h,
- struct lu_device_type *dtype);
+ const struct lu_device_type *dtype);
struct lu_cdebug_print_info {
int lpi_subsys;
struct md_device {
struct lu_device md_lu_dev;
- struct md_device_operations *md_ops;
+ const struct md_device_operations *md_ops;
struct md_upcall md_upcall;
};
#include "mdd_internal.h"
-struct md_device_operations mdd_ops;
+const struct md_device_operations mdd_ops;
static const char *mdd_root_dir_name = "root";
static int mdd_device_init(const struct lu_env *env, struct lu_device *d,
RETURN(rc);
}
-struct lu_device_operations mdd_lu_ops = {
+const struct lu_device_operations mdd_lu_ops = {
.ldo_object_alloc = mdd_object_alloc,
.ldo_process_config = mdd_process_config,
.ldo_recovery_complete = mdd_recovery_complete
/* type constructor/destructor: mdd_type_init, mdd_type_fini */
LU_TYPE_INIT_FINI(mdd, &mdd_thread_key, &mdd_ucred_key, &mdd_capainfo_key);
-struct md_device_operations mdd_ops = {
+const struct md_device_operations mdd_ops = {
.mdo_statfs = mdd_statfs,
.mdo_root_get = mdd_root_get,
.mdo_maxsize_get = mdd_maxsize_get,
.ldto_init = mdd_type_init,
.ldto_fini = mdd_type_fini,
+ .ldto_start = mdd_type_start,
+ .ldto_stop = mdd_type_stop,
+
.ldto_device_alloc = mdd_device_alloc,
.ldto_device_free = mdd_device_free,
return rc;
}
-struct md_dir_operations mdd_dir_ops = {
+const struct md_dir_operations mdd_dir_ops = {
.mdo_is_subdir = mdd_is_subdir,
.mdo_lookup = mdd_lookup,
.mdo_create = mdd_create,
int mdd_get_flags(const struct lu_env *env, struct mdd_object *obj);
-extern struct md_dir_operations mdd_dir_ops;
-extern struct md_object_operations mdd_obj_ops;
+extern const struct md_dir_operations mdd_dir_ops;
+extern const struct md_object_operations mdd_obj_ops;
/* mdd_trans.c */
void mdd_txn_param_build(const struct lu_env *env, struct mdd_device *mdd,
/* mdd_object.c */
int accmode(const struct lu_env *env, struct lu_attr *la, int flags);
extern struct lu_context_key mdd_thread_key;
-extern struct lu_device_operations mdd_lu_ops;
+extern const struct lu_device_operations mdd_lu_ops;
struct mdd_object *mdd_object_find(const struct lu_env *env,
struct mdd_device *d,
return container_of0(mdo, struct mdd_object, mod_obj);
}
-static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d)
+static inline const struct dt_device_operations *
+mdd_child_ops(struct mdd_device *d)
{
return d->mdd_child->dd_ops;
}
#include "mdd_internal.h"
-static struct lu_object_operations mdd_lu_obj_ops;
+static const struct lu_object_operations mdd_lu_obj_ops;
int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
struct lu_attr *la, struct lustre_capa *capa)
}
}
-static struct lu_object_operations mdd_lu_obj_ops = {
+static const struct lu_object_operations mdd_lu_obj_ops = {
.loo_object_init = mdd_object_init,
.loo_object_start = mdd_object_start,
.loo_object_free = mdd_object_free,
- .loo_object_print = mdd_object_print,
.loo_object_delete = mdd_object_delete
};
}
static int mdd_dir_page_build(const struct lu_env *env, int first,
- void *area, int nob, struct dt_it_ops *iops,
+ void *area, int nob, const struct dt_it_ops *iops,
struct dt_it *it, __u64 *start, __u64 *end,
struct lu_dirent **last)
{
{
struct dt_it *it;
struct dt_object *next = mdd_object_child(obj);
- struct dt_it_ops *iops;
+ const struct dt_it_ops *iops;
struct page *pg;
struct lu_dirent *last = NULL;
int i;
return next->do_ops->do_object_sync(env, next);
}
-struct md_object_operations mdd_obj_ops = {
+const struct md_object_operations mdd_obj_ops = {
.moo_permission = mdd_permission,
.moo_attr_get = mdd_attr_get,
.moo_attr_set = mdd_attr_set,
{
struct dt_object *dt_obj = mdd->mdd_orphans;
struct dt_it *it;
- struct dt_it_ops *iops;
+ const struct dt_it_ops *iops;
struct orph_key *key = orph_key_empty(env, 0);
int result;
ENTRY;
static int mdt_regular_handle(struct ptlrpc_request *req);
static int mdt_unpack_req_pack_rep(struct mdt_thread_info *info, __u32 flags);
-static struct lu_object_operations mdt_obj_ops;
+static const struct lu_object_operations mdt_obj_ops;
int mdt_get_disposition(struct ldlm_reply *rep, int flag)
{
return rc;
}
-static struct lu_device_operations mdt_lu_ops;
+static const struct lu_device_operations mdt_lu_ops;
static int lu_device_is_mdt(struct lu_device *d)
{
EXIT;
}
-static int mdt_object_print(const struct lu_env *env, void *cookie,
- lu_printer_t p, const struct lu_object *o)
-{
- return (*p)(env, cookie, LUSTRE_MDT_NAME"-object@%p", o);
-}
-
-static struct lu_device_operations mdt_lu_ops = {
+static const struct lu_device_operations mdt_lu_ops = {
.ldo_object_alloc = mdt_object_alloc,
.ldo_process_config = mdt_process_config
};
-static struct lu_object_operations mdt_obj_ops = {
+static const struct lu_object_operations mdt_obj_ops = {
.loo_object_init = mdt_object_init,
- .loo_object_free = mdt_object_free,
- .loo_object_print = mdt_object_print
+ .loo_object_free = mdt_object_free
};
/* mds_connect_internal */
txi->txi_cb_count++;
}
-static inline struct md_device_operations *mdt_child_ops(struct mdt_device * m)
+static inline const struct md_device_operations *
+mdt_child_ops(struct mdt_device * m)
{
LASSERT(m->mdt_child);
return m->mdt_child->md_ops;
struct txn_param *p);
static journal_t *osd_journal (const struct osd_device *dev);
-static struct lu_device_type_operations osd_device_type_ops;
+static const struct lu_device_type_operations osd_device_type_ops;
static struct lu_device_type osd_device_type;
-static struct lu_object_operations osd_lu_obj_ops;
+static const struct lu_object_operations osd_lu_obj_ops;
static struct obd_ops osd_obd_device_ops;
-static struct lu_device_operations osd_lu_ops;
+static const struct lu_device_operations osd_lu_ops;
static struct lu_context_key osd_key;
-static struct dt_object_operations osd_obj_ops;
-static struct dt_body_operations osd_body_ops;
-static struct dt_index_operations osd_index_ops;
-static struct dt_index_operations osd_index_compat_ops;
+static const struct dt_object_operations osd_obj_ops;
+static const struct dt_body_operations osd_body_ops;
+static const struct dt_index_operations osd_index_ops;
+static const struct dt_index_operations osd_index_compat_ops;
struct osd_thandle {
struct thandle ot_super;
return osd_dto_credits[op];
}
-static struct dt_device_operations osd_dt_ops = {
+static const struct dt_device_operations osd_dt_ops = {
.dt_root_get = osd_root_get,
.dt_statfs = osd_statfs,
.dt_trans_start = osd_trans_start,
RETURN(rc);
}
-static struct dt_object_operations osd_obj_ops = {
+static const struct dt_object_operations osd_obj_ops = {
.do_read_lock = osd_object_read_lock,
.do_write_lock = osd_object_write_lock,
.do_read_unlock = osd_object_read_unlock,
return result;
}
-static struct dt_body_operations osd_body_ops = {
+static const struct dt_body_operations osd_body_ops = {
.dbo_read = osd_read,
.dbo_write = osd_write
};
return iam_it_load(&it->oi_it, hash);
}
-static struct dt_index_operations osd_index_ops = {
+static const struct dt_index_operations osd_index_ops = {
.dio_lookup = osd_index_lookup,
.dio_insert = osd_index_insert,
.dio_delete = osd_index_delete,
return osd_invariant(osd_obj(l));
}
-static struct lu_object_operations osd_lu_obj_ops = {
+static const struct lu_object_operations osd_lu_obj_ops = {
.loo_object_init = osd_object_init,
.loo_object_delete = osd_object_delete,
.loo_object_release = osd_object_release,
.loo_object_invariant = osd_object_invariant
};
-static struct lu_device_operations osd_lu_ops = {
+static const struct lu_device_operations osd_lu_ops = {
.ldo_object_alloc = osd_object_alloc,
.ldo_process_config = osd_process_config,
.ldo_recovery_complete = osd_recovery_complete
};
-static struct lu_device_type_operations osd_device_type_ops = {
+static const struct lu_device_type_operations osd_device_type_ops = {
.ldto_init = osd_type_init,
.ldto_fini = osd_type_fini,
+ .ldto_start = osd_type_start,
+ .ldto_stop = osd_type_stop,
+
.ldto_device_alloc = osd_device_alloc,
.ldto_device_free = osd_device_free,