Nearly all of
struct cl_io_operations
struct cl_lock_operations
struct iam_operations
struct iam_leaf_operations
struct llog_operations
struct lquota_entry_operations
struct md_dir_operations
are now const. The one exception is changelog_orig_logops.
Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I91dc9528b62a77f6bcedc80d6066a74a8eeaa3fa
Reviewed-on: https://review.whamcloud.com/39400
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
18 files changed:
/* llog_obd.c */
int llog_setup(const struct lu_env *env, struct obd_device *obd,
struct obd_llog_group *olg, int index,
/* llog_obd.c */
int llog_setup(const struct lu_env *env, struct obd_device *obd,
struct obd_llog_group *olg, int index,
- struct obd_device *disk_obd, struct llog_operations *op);
+ struct obd_device *disk_obd, const struct llog_operations *op);
int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt);
int llog_cleanup(const struct lu_env *env, struct llog_ctxt *);
int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt);
int llog_cleanup(const struct lu_env *env, struct llog_ctxt *);
int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
} u;
char *lgh_name;
void *private_data;
} u;
char *lgh_name;
void *private_data;
- struct llog_operations *lgh_logops;
+ const struct llog_operations *lgh_logops;
refcount_t lgh_refcount;
int lgh_max_size;
refcount_t lgh_refcount;
int lgh_max_size;
-extern struct llog_operations llog_osd_ops;
-extern struct llog_operations llog_common_cat_ops;
+extern const struct llog_operations llog_osd_ops;
+extern const struct llog_operations llog_common_cat_ops;
int llog_osd_get_cat_list(const struct lu_env *env, struct dt_device *d,
int idx, int count, struct llog_catid *idarray,
const struct lu_fid *fid);
int llog_osd_get_cat_list(const struct lu_env *env, struct dt_device *d,
int idx, int count, struct llog_catid *idarray,
const struct lu_fid *fid);
#define LLOG_CTXT_FLAG_NORMAL_FID 0x00000004
struct llog_ctxt {
#define LLOG_CTXT_FLAG_NORMAL_FID 0x00000004
struct llog_ctxt {
- int loc_idx; /* my index the obd array of ctxt's */
- struct obd_device *loc_obd; /* points back to the containing obd*/
- struct obd_llog_group *loc_olg; /* group containing that ctxt */
- struct obd_export *loc_exp; /* parent "disk" export (e.g. MDS) */
- struct obd_import *loc_imp; /* to use in RPC's: can be backward
- pointing import */
- struct llog_operations *loc_logops;
- struct llog_handle *loc_handle;
+ int loc_idx; /* my index the obd array of ctxt's */
+ struct obd_device *loc_obd; /* points back to the containing obd*/
+ struct obd_llog_group *loc_olg; /* group containing that ctxt */
+ struct obd_export *loc_exp; /* parent "disk" export (e.g. MDS) */
+ struct obd_import *loc_imp; /* to use in RPC's: can be backward
+ * pointing import */
+ const struct llog_operations *loc_logops;
+ struct llog_handle *loc_handle;
struct mutex loc_mutex; /* protect loc_imp */
struct mutex loc_mutex; /* protect loc_imp */
- atomic_t loc_refcount;
- long loc_flags; /* flags, see above defines */
+ atomic_t loc_refcount;
+ long loc_flags; /* flags, see above defines */
struct dt_object *loc_dir;
struct local_oid_storage *loc_los_nameless;
struct local_oid_storage *loc_los_named;
struct dt_object *loc_dir;
struct local_oid_storage *loc_los_nameless;
struct local_oid_storage *loc_los_named;
#define LLOG_DEL_PLAIN 0x0003
static inline int llog_obd2ops(struct llog_ctxt *ctxt,
#define LLOG_DEL_PLAIN 0x0003
static inline int llog_obd2ops(struct llog_ctxt *ctxt,
- struct llog_operations **lop)
+ const struct llog_operations **lop)
- if (ctxt == NULL)
- return -ENOTCONN;
+ if (ctxt == NULL)
+ return -ENOTCONN;
- *lop = ctxt->loc_logops;
- if (*lop == NULL)
- return -EOPNOTSUPP;
+ *lop = ctxt->loc_logops;
+ if (*lop == NULL)
+ return -EOPNOTSUPP;
}
static inline int llog_handle2ops(struct llog_handle *loghandle,
}
static inline int llog_handle2ops(struct llog_handle *loghandle,
- struct llog_operations **lop)
+ const struct llog_operations **lop)
{
if (loghandle == NULL || loghandle->lgh_logops == NULL)
return -EINVAL;
{
if (loghandle == NULL || loghandle->lgh_logops == NULL)
return -EINVAL;
static inline int llog_data_len(int len)
{
static inline int llog_data_len(int len)
{
- return cfs_size_round(len);
+ return cfs_size_round(len);
}
static inline int llog_get_size(struct llog_handle *loghandle)
}
static inline int llog_get_size(struct llog_handle *loghandle)
int next_idx, __u64 *cur_offset, void *buf,
int len)
{
int next_idx, __u64 *cur_offset, void *buf,
int len)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
struct llog_handle *loghandle,
int prev_idx, void *buf, int len)
{
struct llog_handle *loghandle,
int prev_idx, void *buf, int len)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
struct llog_logid *logid, struct llog_gen *gen,
struct obd_uuid *uuid)
{
struct llog_logid *logid, struct llog_gen *gen,
struct obd_uuid *uuid)
{
- struct llog_operations *lop;
- int rc;
+ const struct llog_operations *lop;
+ int rc;
int llog_origin_handle_read_header(struct ptlrpc_request *req);
/* ptlrpc/llog_client.c */
int llog_origin_handle_read_header(struct ptlrpc_request *req);
/* ptlrpc/llog_client.c */
-extern struct llog_operations llog_client_ops;
+extern const struct llog_operations llog_client_ops;
-static struct cl_io_operations mdc_io_ops = {
+static const struct cl_io_operations mdc_io_ops = {
.op = {
[CIT_READ] = {
.cio_iter_init = osc_io_rw_iter_init,
.op = {
[CIT_READ] = {
.cio_iter_init = osc_io_rw_iter_init,
-static struct md_dir_operations mdd_obf_dir_ops = {
+static const struct md_dir_operations mdd_obf_dir_ops = {
.mdo_lookup = obf_lookup,
.mdo_create = mdd_obf_create,
.mdo_rename = mdd_dummy_rename,
.mdo_lookup = obf_lookup,
.mdo_create = mdd_obf_create,
.mdo_rename = mdd_dummy_rename,
.mdo_unlink = mdd_dummy_unlink
};
.mdo_unlink = mdd_dummy_unlink
};
-static struct md_dir_operations mdd_lpf_dir_ops = {
+static const struct md_dir_operations mdd_lpf_dir_ops = {
.mdo_lookup = mdd_lookup,
.mdo_create = mdd_dummy_create,
.mdo_rename = mdd_dummy_rename,
.mdo_lookup = mdd_lookup,
.mdo_create = mdd_dummy_create,
.mdo_rename = mdd_dummy_rename,
int rc = 0;
if (refcount_dec_and_test(&loghandle->lgh_refcount)) {
int rc = 0;
if (refcount_dec_and_test(&loghandle->lgh_refcount)) {
- struct llog_operations *lop;
+ const struct llog_operations *lop;
rc = llog_handle2ops(loghandle, &lop);
if (!rc) {
rc = llog_handle2ops(loghandle, &lop);
if (!rc) {
struct llog_handle *handle,
struct thandle *th)
{
struct llog_handle *handle,
struct thandle *th)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int llog_trans_destroy(const struct lu_env *env, struct llog_handle *handle,
struct thandle *th)
{
int llog_trans_destroy(const struct lu_env *env, struct llog_handle *handle,
struct thandle *th)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int llog_destroy(const struct lu_env *env, struct llog_handle *handle)
{
int llog_destroy(const struct lu_env *env, struct llog_handle *handle)
{
- struct llog_operations *lop;
- struct dt_device *dt;
- struct thandle *th;
+ const struct llog_operations *lop;
+ struct dt_device *dt;
+ struct thandle *th;
int llog_read_header(const struct lu_env *env, struct llog_handle *handle,
const struct obd_uuid *uuid)
{
int llog_read_header(const struct lu_env *env, struct llog_handle *handle,
const struct obd_uuid *uuid)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
*/
int llog_exist(struct llog_handle *loghandle)
{
*/
int llog_exist(struct llog_handle *loghandle)
{
- struct llog_operations *lop;
- int rc;
+ const struct llog_operations *lop;
+ int rc;
struct llog_handle *loghandle, struct thandle *th)
{
const struct cred *old_cred;
struct llog_handle *loghandle, struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
struct thandle *th)
{
const struct cred *old_cred;
struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
struct thandle *th)
{
const struct cred *old_cred;
struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int idx, struct thandle *th)
{
const struct cred *old_cred;
int idx, struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int llog_setup(const struct lu_env *env, struct obd_device *obd,
struct obd_llog_group *olg, int index,
int llog_setup(const struct lu_env *env, struct obd_device *obd,
struct obd_llog_group *olg, int index,
- struct obd_device *disk_obd, struct llog_operations *op)
+ struct obd_device *disk_obd, const struct llog_operations *op)
{
struct llog_ctxt *ctxt;
int rc = 0;
{
struct llog_ctxt *ctxt;
int rc = 0;
-struct llog_operations llog_osd_ops = {
+const struct llog_operations llog_osd_ops = {
.lop_next_block = llog_osd_next_block,
.lop_prev_block = llog_osd_prev_block,
.lop_read_header = llog_osd_read_header,
.lop_next_block = llog_osd_next_block,
.lop_prev_block = llog_osd_prev_block,
.lop_read_header = llog_osd_read_header,
};
EXPORT_SYMBOL(llog_osd_ops);
};
EXPORT_SYMBOL(llog_osd_ops);
-struct llog_operations llog_common_cat_ops = {
+const struct llog_operations llog_common_cat_ops = {
.lop_next_block = llog_osd_next_block,
.lop_prev_block = llog_osd_prev_block,
.lop_read_header = llog_osd_read_header,
.lop_next_block = llog_osd_next_block,
.lop_prev_block = llog_osd_prev_block,
.lop_read_header = llog_osd_read_header,
OBD_SLAB_FREE_PTR(ecl, echo_lock_kmem);
}
OBD_SLAB_FREE_PTR(ecl, echo_lock_kmem);
}
-static struct cl_lock_operations echo_lock_ops = {
- .clo_fini = echo_lock_fini,
+static const struct cl_lock_operations echo_lock_ops = {
+ .clo_fini = echo_lock_fini,
* Parameters, describing a flavor of iam container.
*/
struct iam_descr {
* Parameters, describing a flavor of iam container.
*/
struct iam_descr {
- /*
- * Size of a key in this container, in bytes.
- */
- size_t id_key_size;
- /*
- * Size of a key in index nodes, in bytes.
- */
- size_t id_ikey_size;
- /*
- * Size of a pointer to the next level (stored in index nodes), in
- * bytes.
- */
- size_t id_ptr_size;
- /*
- * Size of a record (stored in leaf nodes), in bytes.
- */
- size_t id_rec_size;
- /*
- * Size of unused (by iam) space at the beginning of every non-root
- * node, in bytes. Used for compatibility with ldiskfs.
- */
- size_t id_node_gap;
- /*
- * Size of unused (by iam) space at the beginning of root node, in
- * bytes. Used for compatibility with ldiskfs.
- */
- size_t id_root_gap;
+ /*
+ * Size of a key in this container, in bytes.
+ */
+ size_t id_key_size;
+ /*
+ * Size of a key in index nodes, in bytes.
+ */
+ size_t id_ikey_size;
+ /*
+ * Size of a pointer to the next level (stored in index nodes), in
+ * bytes.
+ */
+ size_t id_ptr_size;
+ /*
+ * Size of a record (stored in leaf nodes), in bytes.
+ */
+ size_t id_rec_size;
+ /*
+ * Size of unused (by iam) space at the beginning of every non-root
+ * node, in bytes. Used for compatibility with ldiskfs.
+ */
+ size_t id_node_gap;
+ /*
+ * Size of unused (by iam) space at the beginning of root node, in
+ * bytes. Used for compatibility with ldiskfs.
+ */
+ size_t id_root_gap;
- struct iam_operations *id_ops;
- struct iam_leaf_operations *id_leaf_ops;
+ const struct iam_operations *id_ops;
+ const struct iam_leaf_operations *id_leaf_ops;
return iam_leaf_container(leaf)->ic_descr;
}
return iam_leaf_container(leaf)->ic_descr;
}
-static inline struct iam_leaf_operations *
+static inline const struct iam_leaf_operations *
iam_leaf_ops(const struct iam_leaf *leaf)
{
iam_leaf_ops(const struct iam_leaf *leaf)
{
- return iam_leaf_descr(leaf)->id_leaf_ops;
+ return iam_leaf_descr(leaf)->id_leaf_ops;
}
static inline void iam_reccpy(const struct iam_leaf *leaf,
}
static inline void iam_reccpy(const struct iam_leaf *leaf,
struct iam_path *iam_leaf_path(const struct iam_leaf *leaf);
struct iam_container *iam_leaf_container(const struct iam_leaf *leaf);
struct iam_descr *iam_leaf_descr(const struct iam_leaf *leaf);
struct iam_path *iam_leaf_path(const struct iam_leaf *leaf);
struct iam_container *iam_leaf_container(const struct iam_leaf *leaf);
struct iam_descr *iam_leaf_descr(const struct iam_leaf *leaf);
-struct iam_leaf_operations *iam_leaf_ops(const struct iam_leaf *leaf);
+const struct iam_leaf_operations *iam_leaf_ops(const struct iam_leaf *leaf);
int iam_node_read(struct iam_container *c, iam_ptr_t ptr,
int iam_node_read(struct iam_container *c, iam_ptr_t ptr,
return lentry_count_get(leaf) == 0;
}
return lentry_count_get(leaf) == 0;
}
-static struct iam_leaf_operations iam_lfix_leaf_ops = {
+static const struct iam_leaf_operations iam_lfix_leaf_ops = {
.init = iam_lfix_init,
.init_new = iam_lfix_init_new,
.fini = iam_lfix_fini,
.init = iam_lfix_init,
.init_new = iam_lfix_init_new,
.fini = iam_lfix_fini,
return iam_ipd_alloc(area, c->ic_descr->id_ikey_size);
}
return iam_ipd_alloc(area, c->ic_descr->id_ikey_size);
}
-static struct iam_operations iam_lfix_ops = {
+static const struct iam_operations iam_lfix_ops = {
.id_root_ptr = iam_lfix_root_ptr,
.id_node_read = iam_node_read,
.id_node_init = iam_lfix_node_init,
.id_root_ptr = iam_lfix_root_ptr,
.id_node_read = iam_node_read,
.id_node_init = iam_lfix_node_init,
return h_used(n_head(leaf)) == sizeof(struct lvar_leaf_header);
}
return h_used(n_head(leaf)) == sizeof(struct lvar_leaf_header);
}
-static struct iam_leaf_operations lvar_leaf_ops = {
+static const struct iam_leaf_operations lvar_leaf_ops = {
.init = lvar_init,
.init_new = lvar_init_new,
.fini = lvar_fini,
.init = lvar_init,
.init_new = lvar_init_new,
.fini = lvar_fini,
-static struct iam_operations lvar_ops = {
+static const struct iam_operations lvar_ops = {
.id_root_ptr = lvar_root_ptr,
.id_node_read = iam_node_read,
.id_node_init = lvar_node_init,
.id_root_ptr = lvar_root_ptr,
.id_node_read = iam_node_read,
.id_node_init = lvar_node_init,
-struct llog_operations llog_client_ops = {
+const struct llog_operations llog_client_ops = {
.lop_next_block = llog_client_next_block,
.lop_prev_block = llog_client_prev_block,
.lop_read_header = llog_client_read_header,
.lop_next_block = llog_client_next_block,
.lop_prev_block = llog_client_prev_block,
.lop_read_header = llog_client_read_header,
*/
struct lquota_site *lquota_site_alloc(const struct lu_env *env, void *parent,
bool is_master, short qtype,
*/
struct lquota_site *lquota_site_alloc(const struct lu_env *env, void *parent,
bool is_master, short qtype,
- struct lquota_entry_operations *ops)
+ const struct lquota_entry_operations *ops)
{
struct lquota_site *site;
char hashname[15];
{
struct lquota_site *site;
char hashname[15];
/* Vector of operations which can be done on lquota entry belonging to
* this quota site */
/* Vector of operations which can be done on lquota entry belonging to
* this quota site */
- struct lquota_entry_operations *lqs_ops;
+ const struct lquota_entry_operations *lqs_ops;
/* Backpointer to parent structure, either QMT pool info for master or
* QSD for slave */
/* Backpointer to parent structure, either QMT pool info for master or
* QSD for slave */
/* lquota_entry.c */
/* site create/destroy */
/* lquota_entry.c */
/* site create/destroy */
-struct lquota_site *lquota_site_alloc(const struct lu_env *, void *, bool,
- short, struct lquota_entry_operations *);
+struct lquota_site *lquota_site_alloc(const struct lu_env *env, void *parent,
+ bool master, short qtype,
+ const struct lquota_entry_operations *op);
void lquota_site_free(const struct lu_env *, struct lquota_site *);
/* quota entry operations */
#define lqe_locate(env, site, id) lqe_locate_find(env, site, id, false)
void lquota_site_free(const struct lu_env *, struct lquota_site *);
/* quota entry operations */
#define lqe_locate(env, site, id) lqe_locate_find(env, site, id, false)
/*
* Vector of quota entry operations supported on the master
*/
/*
* Vector of quota entry operations supported on the master
*/
-struct lquota_entry_operations qmt_lqe_ops = {
+const struct lquota_entry_operations qmt_lqe_ops = {
.lqe_init = qmt_lqe_init,
.lqe_read = qmt_lqe_read,
.lqe_debug = qmt_lqe_debug,
.lqe_init = qmt_lqe_init,
.lqe_read = qmt_lqe_read,
.lqe_debug = qmt_lqe_debug,
unsigned int qmt_sarr_count(struct qmt_pool_info *qpi);
/* qmt_entry.c */
unsigned int qmt_sarr_count(struct qmt_pool_info *qpi);
/* qmt_entry.c */
-extern struct lquota_entry_operations qmt_lqe_ops;
+extern const struct lquota_entry_operations qmt_lqe_ops;
int qmt_lqe_set_default(const struct lu_env *env, struct qmt_pool_info *pool,
struct lquota_entry *lqe, bool create_record);
struct thandle *qmt_trans_start_with_slv(const struct lu_env *,
int qmt_lqe_set_default(const struct lu_env *env, struct qmt_pool_info *pool,
struct lquota_entry *lqe, bool create_record);
struct thandle *qmt_trans_start_with_slv(const struct lu_env *,
/*
* Vector of quota entry operations supported on the slave
*/
/*
* Vector of quota entry operations supported on the slave
*/
-struct lquota_entry_operations qsd_lqe_ops = {
+const struct lquota_entry_operations qsd_lqe_ops = {
.lqe_init = qsd_lqe_init,
.lqe_read = qsd_lqe_read,
.lqe_debug = qsd_lqe_debug,
.lqe_init = qsd_lqe_init,
.lqe_read = qsd_lqe_read,
.lqe_debug = qsd_lqe_debug,
-extern struct lquota_entry_operations qsd_lqe_ops;
+extern const struct lquota_entry_operations qsd_lqe_ops;
int qsd_refresh_usage(const struct lu_env *, struct lquota_entry *);
int qsd_update_index(const struct lu_env *, struct qsd_qtype_info *,
union lquota_id *, bool, __u64, void *);
int qsd_refresh_usage(const struct lu_env *, struct lquota_entry *);
int qsd_update_index(const struct lu_env *, struct qsd_qtype_info *,
union lquota_id *, bool, __u64, void *);