From c229aeaa9565f43a6da9acbaa1c213d9bfb6b865 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 19 May 2006 17:47:29 +0000 Subject: [PATCH] make lu_context const --- lustre/cmm/cmm_device.c | 18 ++++---- lustre/cmm/cmm_internal.h | 5 ++- lustre/cmm/cmm_object.c | 30 ++++++------- lustre/cmm/mdc_device.c | 22 +++++----- lustre/cmm/mdc_internal.h | 9 ++-- lustre/cmm/mdc_object.c | 18 ++++---- lustre/fid/fid_seq.c | 8 ++-- lustre/fld/fld_handle.c | 8 ++-- lustre/fld/fld_iam.c | 6 +-- lustre/fld/fld_internal.h | 6 +-- lustre/include/dt_object.h | 68 ++++++++++++++++------------ lustre/include/lu_object.h | 49 ++++++++++++--------- lustre/include/lustre_fid.h | 15 ++++--- lustre/include/lustre_net.h | 4 +- lustre/include/md_object.h | 52 ++++++++++++---------- lustre/mdd/mdd_handler.c | 99 ++++++++++++++++++++--------------------- lustre/mdt/mdt_handler.c | 53 +++++++++++----------- lustre/mdt/mdt_internal.h | 34 +++++++------- lustre/obdclass/dt_object.c | 6 +-- lustre/obdclass/lu_object.c | 19 ++++---- lustre/osd/osd_handler.c | 105 ++++++++++++++++++++++++-------------------- lustre/ptlrpc/service.c | 5 ++- 22 files changed, 340 insertions(+), 299 deletions(-) diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index e466501..e44aa43 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -54,7 +54,7 @@ static inline int lu_device_is_cmm(struct lu_device *d) return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &cmm_lu_ops); } -int cmm_root_get(struct lu_context *ctx, struct md_device *md, +int cmm_root_get(const struct lu_context *ctx, struct md_device *md, struct lu_fid *fid) { struct cmm_device *cmm_dev = md2cmm_dev(md); @@ -63,7 +63,7 @@ int cmm_root_get(struct lu_context *ctx, struct md_device *md, cmm_dev->cmm_child, fid); } -int cmm_config(struct lu_context *ctxt, struct md_device *md, +int cmm_config(const struct lu_context *ctxt, struct md_device *md, const char *name, void *buf, int size, int mode) { struct cmm_device *cmm_dev = md2cmm_dev(md); @@ -74,7 +74,7 @@ int cmm_config(struct lu_context *ctxt, struct md_device *md, RETURN(rc); } -int cmm_statfs(struct lu_context *ctxt, struct md_device *md, +int cmm_statfs(const struct lu_context *ctxt, struct md_device *md, struct kstatfs *sfs) { struct cmm_device *cmm_dev = md2cmm_dev(md); int rc; @@ -94,7 +94,7 @@ static struct md_device_operations cmm_md_ops = { extern struct lu_device_type mdc_device_type; /* add new MDC to the CMM, create MDC lu_device and connect it to mdc_obd */ -static int cmm_add_mdc(struct lu_context *ctx, +static int cmm_add_mdc(const struct lu_context *ctx, struct cmm_device * cm, struct lustre_cfg *cfg) { struct lu_device_type *ldt = &mdc_device_type; @@ -124,7 +124,7 @@ static int cmm_add_mdc(struct lu_context *ctx, } -static int cmm_process_config(struct lu_context *ctx, +static int cmm_process_config(const struct lu_context *ctx, struct lu_device *d, struct lustre_cfg *cfg) { struct cmm_device *m = lu2cmm_dev(d); @@ -157,7 +157,7 @@ static struct lu_device_operations cmm_lu_ops = { /* --- lu_device_type operations --- */ -struct lu_device *cmm_device_alloc(struct lu_context *ctx, +struct lu_device *cmm_device_alloc(const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *cfg) { @@ -180,7 +180,7 @@ struct lu_device *cmm_device_alloc(struct lu_context *ctx, return l; } -void cmm_device_free(struct lu_context *ctx, struct lu_device *d) +void cmm_device_free(const struct lu_context *ctx, struct lu_device *d) { struct cmm_device *m = lu2cmm_dev(d); @@ -199,7 +199,7 @@ void cmm_type_fini(struct lu_device_type *t) return; } -static int cmm_device_init(struct lu_context *ctx, +static int cmm_device_init(const struct lu_context *ctx, struct lu_device *d, struct lu_device *next) { struct cmm_device *m = lu2cmm_dev(d); @@ -214,7 +214,7 @@ static int cmm_device_init(struct lu_context *ctx, RETURN(err); } -static struct lu_device *cmm_device_fini(struct lu_context *ctx, +static struct lu_device *cmm_device_fini(const struct lu_context *ctx, struct lu_device *ld) { struct cmm_device *cm = lu2cmm_dev(ld); diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index 2f5d630..0d6a43f 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -93,8 +93,9 @@ static inline struct md_object *cmm2child_obj(struct cmm_object *o) } /* cmm_object.c */ -struct lu_object *cmm_object_alloc(struct lu_context *ctx, struct lu_device *); -void cmm_object_free(struct lu_context *ctx, struct lu_object *o); +struct lu_object *cmm_object_alloc(const struct lu_context *ctx, + struct lu_device *); +void cmm_object_free(const struct lu_context *ctx, struct lu_object *o); #endif /* __KERNEL__ */ #endif /* _CMM_INTERNAL_H */ diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index e734ee2..2b13cb9 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -67,7 +67,7 @@ static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num) RETURN(next); } -struct lu_object *cmm_object_alloc(struct lu_context *ctx, +struct lu_object *cmm_object_alloc(const struct lu_context *ctx, struct lu_device *ld) { struct cmm_object *co; @@ -87,14 +87,14 @@ struct lu_object *cmm_object_alloc(struct lu_context *ctx, RETURN(lo); } -void cmm_object_free(struct lu_context *ctx, struct lu_object *lo) +void cmm_object_free(const struct lu_context *ctx, struct lu_object *lo) { struct cmm_object *co = lu2cmm_obj(lo); lu_object_fini(lo); - OBD_FREE_PTR(co); + OBD_FREE_PTR(co); } -int cmm_object_init(struct lu_context *ctx, struct lu_object *lo) +int cmm_object_init(const struct lu_context *ctx, struct lu_object *lo) { struct cmm_device *cd = lu2cmm_dev(lo->lo_dev); struct lu_device *c_dev; @@ -125,12 +125,12 @@ int cmm_object_init(struct lu_context *ctx, struct lu_object *lo) RETURN(rc); } -static int cmm_object_exists(struct lu_context *ctx, struct lu_object *lo) +static int cmm_object_exists(const struct lu_context *ctx, struct lu_object *lo) { return lu_object_exists(ctx, lu_object_next(lo)); } -static int cmm_object_print(struct lu_context *ctx, +static int cmm_object_print(const struct lu_context *ctx, struct seq_file *f, const struct lu_object *lo) { return seq_printf(f, LUSTRE_CMM0_NAME"-object@%p", lo); @@ -143,7 +143,7 @@ static struct lu_object_operations cmm_obj_ops = { }; /* md_object operations */ -static int cmm_object_create(struct lu_context *ctx, struct md_object *mo, +static int cmm_object_create(const struct lu_context *ctx, struct md_object *mo, struct lu_attr *attr) { struct md_object *ch = cmm2child_obj(md2cmm_obj(mo)); @@ -158,18 +158,18 @@ static int cmm_object_create(struct lu_context *ctx, struct md_object *mo, RETURN(rc); } -static int cmm_attr_get(struct lu_context *ctx, struct md_object *mo, +static int cmm_attr_get(const struct lu_context *ctx, struct md_object *mo, struct lu_attr *attr) { struct md_object *ch = cmm2child_obj(md2cmm_obj(mo)); int rc; ENTRY; - + LASSERT (cmm_is_local_obj(md2cmm_obj(mo))); - + rc = mo_attr_get(ctx, ch, attr); - + RETURN(rc); } @@ -178,23 +178,23 @@ static struct md_object_operations cmm_mo_ops = { .moo_object_create = cmm_object_create, }; -static int cmm_lookup(struct lu_context *ctx, struct md_object *mo_p, +static int cmm_lookup(const struct lu_context *ctx, struct md_object *mo_p, const char *name, struct lu_fid *lf) { struct md_object *ch_p = cmm2child_obj(md2cmm_obj(mo_p)); int rc; ENTRY; - + LASSERT(cmm_is_local_obj(md2cmm_obj(mo_p))); rc = mdo_lookup(ctx, ch_p, name, lf); RETURN(rc); - + } -static int cmm_mkdir(struct lu_context *ctx, struct lu_attr *attr, +static int cmm_mkdir(const struct lu_context *ctx, struct lu_attr *attr, struct md_object *mo_p, const char *name, struct md_object *mo_c) { diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index 805546c..41f5cbb 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -48,7 +48,7 @@ static inline int lu_device_is_mdc(struct lu_device *ld) ld->ld_ops == &mdc_lu_ops); } -static int mdc_root_get(struct lu_context *ctx, struct md_device *md, +static int mdc_root_get(const struct lu_context *ctx, struct md_device *md, struct lu_fid *fid) { //struct mdc_device *mdc_dev = md2mdc_dev(md); @@ -56,7 +56,7 @@ static int mdc_root_get(struct lu_context *ctx, struct md_device *md, return -EOPNOTSUPP; } -static int mdc_config(struct lu_context *ctx, +static int mdc_config(const struct lu_context *ctx, struct md_device *md, const char *name, void *buf, int size, int mode) { @@ -67,7 +67,7 @@ static int mdc_config(struct lu_context *ctx, RETURN(rc); } -static int mdc_statfs(struct lu_context *ctx, +static int mdc_statfs(const struct lu_context *ctx, struct md_device *md, struct kstatfs *sfs) { //struct mdc_device *mdc_dev = md2mdc_dev(md); int rc; @@ -127,7 +127,7 @@ static int mdc_add_obd(struct mdc_device *mc, struct lustre_cfg *cfg) RETURN(rc); } -static int mdc_process_config(struct lu_context *ctx, +static int mdc_process_config(const struct lu_context *ctx, struct lu_device *ld, struct lustre_cfg *cfg) { struct mdc_device *mc = lu2mdc_dev(ld); @@ -182,7 +182,7 @@ static int mdc_device_connect(struct mdc_device *mc) RETURN(0); } -static int mdc_device_init(struct lu_context *ctx, +static int mdc_device_init(const struct lu_context *ctx, struct lu_device *ld, struct lu_device *next) { struct mdc_device *mc = lu2mdc_dev(ld); @@ -247,7 +247,7 @@ err: RETURN(rc); } -static struct lu_device *mdc_device_fini(struct lu_context *ctx, +static struct lu_device *mdc_device_fini(const struct lu_context *ctx, struct lu_device *ld) { struct mdc_device *mc = lu2mdc_dev(ld); @@ -263,7 +263,7 @@ static struct lu_device *mdc_device_fini(struct lu_context *ctx, RETURN (NULL); } -struct lu_device *mdc_device_alloc(struct lu_context *ctx, +struct lu_device *mdc_device_alloc(const struct lu_context *ctx, struct lu_device_type *ldt, struct lustre_cfg *cfg) { @@ -294,7 +294,7 @@ struct lu_device *mdc_device_alloc(struct lu_context *ctx, RETURN (ld); } #endif -static int mdc_device_init(struct lu_context *ctx, +static int mdc_device_init(const struct lu_context *ctx, struct lu_device *ld, struct lu_device *next) { /* struct mdc_device *mc = lu2mdc_dev(ld); */ @@ -305,7 +305,7 @@ static int mdc_device_init(struct lu_context *ctx, RETURN(rc); } -static struct lu_device *mdc_device_fini(struct lu_context *ctx, +static struct lu_device *mdc_device_fini(const struct lu_context *ctx, struct lu_device *ld) { /* struct mdc_device *mc = lu2mdc_dev(ld); */ @@ -315,7 +315,7 @@ static struct lu_device *mdc_device_fini(struct lu_context *ctx, RETURN (NULL); } -struct lu_device *mdc_device_alloc(struct lu_context *ctx, +struct lu_device *mdc_device_alloc(const struct lu_context *ctx, struct lu_device_type *ldt, struct lustre_cfg *cfg) { @@ -336,7 +336,7 @@ struct lu_device *mdc_device_alloc(struct lu_context *ctx, RETURN (ld); } -void mdc_device_free(struct lu_context *ctx, struct lu_device *ld) +void mdc_device_free(const struct lu_context *ctx, struct lu_device *ld) { struct mdc_device *mc = lu2mdc_dev(ld); diff --git a/lustre/cmm/mdc_internal.h b/lustre/cmm/mdc_internal.h index 01b360f..a24e29d 100644 --- a/lustre/cmm/mdc_internal.h +++ b/lustre/cmm/mdc_internal.h @@ -77,10 +77,11 @@ static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld) return container_of0(ld, struct mdc_device, mc_md_dev.md_lu_dev); } -int mdc_object_init(struct lu_context *, struct lu_object*); -struct lu_object *mdc_object_alloc(struct lu_context *, struct lu_device *); -void mdc_object_free(struct lu_context *, struct lu_object *); -void mdc_object_release(struct lu_context *, struct lu_object *); +int mdc_object_init(const struct lu_context *, struct lu_object*); +struct lu_object *mdc_object_alloc(const struct lu_context *, + struct lu_device *); +void mdc_object_free(const struct lu_context *, struct lu_object *); +void mdc_object_release(const struct lu_context *, struct lu_object *); #endif /* __KERNEL__ */ #endif /* _CMM_MDC_INTERNAL_H */ diff --git a/lustre/cmm/mdc_object.c b/lustre/cmm/mdc_object.c index a0f35c7..64aa1c9 100644 --- a/lustre/cmm/mdc_object.c +++ b/lustre/cmm/mdc_object.c @@ -42,7 +42,7 @@ static struct md_object_operations mdc_mo_ops; static struct md_dir_operations mdc_dir_ops; static struct lu_object_operations mdc_obj_ops; -struct lu_object *mdc_object_alloc(struct lu_context *ctx, +struct lu_object *mdc_object_alloc(const struct lu_context *ctx, struct lu_device *ld) { struct mdc_object *mco; @@ -62,7 +62,7 @@ struct lu_object *mdc_object_alloc(struct lu_context *ctx, RETURN(NULL); } -int mdc_object_init(struct lu_context *ctx, struct lu_object *lo) +int mdc_object_init(const struct lu_context *ctx, struct lu_object *lo) { //struct mdc_device *d = lu2mdc_dev(o->lo_dev); //struct lu_device *under; @@ -73,31 +73,31 @@ int mdc_object_init(struct lu_context *ctx, struct lu_object *lo) RETURN(0); } -void mdc_object_free(struct lu_context *ctx, struct lu_object *lo) +void mdc_object_free(const struct lu_context *ctx, struct lu_object *lo) { struct mdc_object *mco = lu2mdc_obj(lo); lu_object_fini(lo); OBD_FREE_PTR(mco); } -void mdc_object_release(struct lu_context *ctx, struct lu_object *lo) +void mdc_object_release(const struct lu_context *ctx, struct lu_object *lo) { return; } -static int mdc_object_exists(struct lu_context *ctx, struct lu_object *lo) +static int mdc_object_exists(const struct lu_context *ctx, struct lu_object *lo) { return 0; } -static int mdc_object_print(struct lu_context *ctx, +static int mdc_object_print(const struct lu_context *ctx, struct seq_file *f, const struct lu_object *lo) { return seq_printf(f, LUSTRE_MDC0_NAME"-object@%p", lo); } -static int mdc_object_create(struct lu_context *ctx, struct md_object *mo, - struct lu_attr *attr) +static int mdc_object_create(const struct lu_context *ctx, + struct md_object *mo, struct lu_attr *attr) { struct mdc_device *mc = md2mdc_dev(md_device_get(mo)); struct obd_export *exp = mc->mc_desc.cl_exp; @@ -111,7 +111,7 @@ static int mdc_object_create(struct lu_context *ctx, struct md_object *mo, }; int rc; - + #if 0 req = ptlrpc_prep_req(mc->mc_desc.cl_import, LUSTRE_MDS_VERSION, MDS_REINT, 1, &size, NULL); diff --git a/lustre/fid/fid_seq.c b/lustre/fid/fid_seq.c index 3f5706e..4d310c8 100644 --- a/lustre/fid/fid_seq.c +++ b/lustre/fid/fid_seq.c @@ -57,14 +57,14 @@ void seq_mgr_fini(struct lu_seq_mgr *mgr) } EXPORT_SYMBOL(seq_mgr_fini); -int seq_mgr_write(struct lu_context *ctx, struct lu_seq_mgr *mgr) +int seq_mgr_write(const struct lu_context *ctx, struct lu_seq_mgr *mgr) { ENTRY; RETURN(mgr->m_ops->smo_write(ctx, mgr->m_opaque, &mgr->m_seq)); } EXPORT_SYMBOL(seq_mgr_write); -int seq_mgr_read(struct lu_context *ctx, struct lu_seq_mgr *mgr) +int seq_mgr_read(const struct lu_context *ctx, struct lu_seq_mgr *mgr) { ENTRY; RETURN(mgr->m_ops->smo_read(ctx, mgr->m_opaque, &mgr->m_seq)); @@ -72,7 +72,7 @@ int seq_mgr_read(struct lu_context *ctx, struct lu_seq_mgr *mgr) EXPORT_SYMBOL(seq_mgr_read); /* manager functionality stuff */ -int seq_mgr_alloc(struct lu_context *ctx, struct lu_seq_mgr *mgr, +int seq_mgr_alloc(const struct lu_context *ctx, struct lu_seq_mgr *mgr, __u64 *seq) { int rc = 0; @@ -99,7 +99,7 @@ EXPORT_SYMBOL(seq_mgr_alloc); /* initialize meta-sequence. First of all try to get it from lower layer, * falling down to back store one. In the case this is first run and there is * not meta-sequence initialized yet - store it to backstore. */ -int seq_mgr_setup(struct lu_context *ctx, struct lu_seq_mgr *mgr) +int seq_mgr_setup(const struct lu_context *ctx, struct lu_seq_mgr *mgr) { int rc = 0; ENTRY; diff --git a/lustre/fld/fld_handle.c b/lustre/fld/fld_handle.c index 7b395af..f3d824e 100644 --- a/lustre/fld/fld_handle.c +++ b/lustre/fld/fld_handle.c @@ -44,7 +44,7 @@ #include #include "fld_internal.h" -static int fld_handle(struct lu_context *ctx, +static int fld_handle(const struct lu_context *ctx, struct fld *fld, __u32 opts, struct md_fld *mf); /*XXX maybe these 2 items should go to sbi*/ @@ -284,7 +284,7 @@ static void __exit fld_mod_exit(void) struct fld_list fld_list_head; -static int fld_req_handle0(struct lu_context *ctx, +static int fld_req_handle0(const struct lu_context *ctx, struct fld *fld, struct ptlrpc_request *req) { struct md_fld *in; @@ -320,7 +320,7 @@ static int fld_req_handle0(struct lu_context *ctx, static int fld_req_handle(struct ptlrpc_request *req) { int result; - struct lu_context *ctx; + const struct lu_context *ctx; struct lu_site *site; ENTRY; @@ -408,7 +408,7 @@ void fld_server_fini(struct fld *fld) } EXPORT_SYMBOL(fld_server_fini); -static int fld_handle(struct lu_context *ctx, +static int fld_handle(const struct lu_context *ctx, struct fld *fld, __u32 opts, struct md_fld *mf) { int rc; diff --git a/lustre/fld/fld_iam.c b/lustre/fld/fld_iam.c index d69c6ed..0d4d62f 100644 --- a/lustre/fld/fld_iam.c +++ b/lustre/fld/fld_iam.c @@ -63,7 +63,7 @@ struct iam_descr fld_param = { #endif }; -int fld_handle_insert(struct lu_context *ctx, struct fld *fld, +int fld_handle_insert(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t mdsno) { /* @@ -80,7 +80,7 @@ int fld_handle_insert(struct lu_context *ctx, struct fld *fld, #endif } -int fld_handle_delete(struct lu_context *ctx, struct fld *fld, +int fld_handle_delete(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t mds_num) { #if 0 @@ -93,7 +93,7 @@ int fld_handle_delete(struct lu_context *ctx, struct fld *fld, #endif } -int fld_handle_lookup(struct lu_context *ctx, +int fld_handle_lookup(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t *mds_num) { #if 0 diff --git a/lustre/fld/fld_internal.h b/lustre/fld/fld_internal.h index a15d23b..0e5cf13 100644 --- a/lustre/fld/fld_internal.h +++ b/lustre/fld/fld_internal.h @@ -64,11 +64,11 @@ enum fld_op { #define FLD_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000) -int fld_handle_insert(struct lu_context *ctx, +int fld_handle_insert(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t mdsno); -int fld_handle_delete(struct lu_context *ctx, +int fld_handle_delete(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t mdsno); -int fld_handle_lookup(struct lu_context *ctx, +int fld_handle_lookup(const struct lu_context *ctx, struct fld *fld, fidseq_t seq_num, mdsno_t *mds); int fld_info_init(struct fld_info *fld_info); diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 95d0251..1f941a7 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -70,28 +70,29 @@ struct dt_device_operations { * * XXX this is ioctl()-like interface we want to get rid of. */ - int (*dt_config) (struct lu_context *ctx, + int (*dt_config) (const struct lu_context *ctx, struct dt_device *dev, const char *name, void *buf, int size, int mode); /* * Return device-wide statistics. */ - int (*dt_statfs)(struct lu_context *ctx, + int (*dt_statfs)(const struct lu_context *ctx, struct dt_device *dev, struct kstatfs *sfs); /* * Start transaction, described by @param. */ - struct thandle *(*dt_trans_start)(struct lu_context *ctx, + struct thandle *(*dt_trans_start)(const struct lu_context *ctx, struct dt_device *dev, struct txn_param *param); /* * Finish previously started transaction. */ - void (*dt_trans_stop)(struct lu_context *ctx, struct thandle *th); + void (*dt_trans_stop)(const struct lu_context *ctx, + struct thandle *th); /* * Return fid of root index object. */ - int (*dt_root_get)(struct lu_context *ctx, + int (*dt_root_get)(const struct lu_context *ctx, struct dt_device *dev, struct lu_fid *f); }; @@ -99,9 +100,9 @@ struct dt_device_operations { * Per-dt-object operations. */ struct dt_object_operations { - void (*do_object_lock)(struct lu_context *ctx, + void (*do_object_lock)(const struct lu_context *ctx, struct dt_object *dt, enum dt_lock_mode mode); - void (*do_object_unlock)(struct lu_context *ctx, + void (*do_object_unlock)(const struct lu_context *ctx, struct dt_object *dt, enum dt_lock_mode mode); /* * Note: following ->do_{x,}attr_{set,get}() operations are very @@ -118,37 +119,40 @@ struct dt_object_operations { * * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*do_attr_get)(struct lu_context *ctxt, struct dt_object *dt, - struct lu_attr *attr); + int (*do_attr_get)(const struct lu_context *ctxt, + struct dt_object *dt, struct lu_attr *attr); /* * Set standard attributes. * * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*do_attr_set)(struct lu_context *ctxt, struct dt_object *dt, + int (*do_attr_set)(const struct lu_context *ctxt, + struct dt_object *dt, struct lu_attr *attr, struct thandle *handle); /* * Return a value of an extended attribute. * * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*do_xattr_get)(struct lu_context *ctxt, struct dt_object *dt, + int (*do_xattr_get)(const struct lu_context *ctxt, + struct dt_object *dt, void *buf, int buf_len, const char *name); /* * Set value of an extended attribute. * * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*do_xattr_set)(struct lu_context *ctxt, struct dt_object *dt, - void *buf, int buf_len, const char *name, - struct thandle *handle); + int (*do_xattr_set)(const struct lu_context *ctxt, + struct dt_object *dt, void *buf, int buf_len, + const char *name, struct thandle *handle); /* * Create new object on this device. * * precondition: !lu_object_exists(ctxt, &dt->do_lu); * postcondition: ergo(result == 0, lu_object_exists(ctxt, &dt->do_lu)); */ - int (*do_object_create)(struct lu_context *ctxt, struct dt_object *dt, + int (*do_object_create)(const struct lu_context *ctxt, + struct dt_object *dt, struct lu_attr *attr, struct thandle *th); /* * Destroy existing object. @@ -157,7 +161,7 @@ struct dt_object_operations { * postcondition: ergo(result == 0, * !lu_object_exists(ctxt, &dt->do_lu)); */ - int (*do_object_destroy)(struct lu_context *ctxt, + int (*do_object_destroy)(const struct lu_context *ctxt, struct dt_object *dt, struct thandle *th); }; @@ -168,15 +172,18 @@ struct dt_body_operations { /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dbo_read)(struct lu_context *ctxt, struct dt_object *dt, ...); + int (*dbo_read)(const struct lu_context *ctxt, + struct dt_object *dt, ...); /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dbo_write)(struct lu_context *ctxt, struct dt_object *dt, ...); + int (*dbo_write)(const struct lu_context *ctxt, + struct dt_object *dt, ...); /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dbo_truncate)(struct lu_context *ctxt, struct dt_object *dt, ...); + int (*dbo_truncate)(const struct lu_context *ctxt, + struct dt_object *dt, ...); }; /* @@ -226,18 +233,18 @@ struct dt_index_operations { /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dio_lookup)(struct lu_context *ctxt, struct dt_object *dt, + int (*dio_lookup)(const struct lu_context *ctxt, struct dt_object *dt, struct dt_rec *rec, const struct dt_key *key); /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dio_insert)(struct lu_context *ctxt, struct dt_object *dt, + int (*dio_insert)(const struct lu_context *ctxt, struct dt_object *dt, const struct dt_rec *rec, const struct dt_key *key, struct thandle *handle); /* * precondition: lu_object_exists(ctxt, &dt->do_lu); */ - int (*dio_delete)(struct lu_context *ctxt, struct dt_object *dt, + int (*dio_delete)(const struct lu_context *ctxt, struct dt_object *dt, const struct dt_rec *rec, const struct dt_key *key, struct thandle *handle); @@ -245,7 +252,7 @@ struct dt_index_operations { * Features probing. Returns 1 if this index supports all features in * @feat, -ve on error, 0 otherwise. */ - int (*dio_probe)(struct lu_context *ctxt, struct dt_object *dt, + int (*dio_probe)(const struct lu_context *ctxt, struct dt_object *dt, const struct dt_index_features *feat); }; @@ -306,11 +313,14 @@ struct thandle { * before each transaction commit. */ struct dt_txn_callback { - int (*dtc_txn_start)(struct lu_context *ctx, struct dt_device *dev, + int (*dtc_txn_start)(const struct lu_context *ctx, + struct dt_device *dev, struct txn_param *param, void *cookie); - int (*dtc_txn_stop)(struct lu_context *ctx, struct dt_device *dev, + int (*dtc_txn_stop)(const struct lu_context *ctx, + struct dt_device *dev, struct thandle *txn, void *cookie); - int (*dtc_txn_commit)(struct lu_context *ctx, struct dt_device *dev, + int (*dtc_txn_commit)(const struct lu_context *ctx, + struct dt_device *dev, struct thandle *txn, void *cookie); void *dtc_cookie; struct list_head dtc_linkage; @@ -319,11 +329,11 @@ struct dt_txn_callback { void dt_txn_callback_add(struct dt_device *dev, struct dt_txn_callback *cb); void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb); -int dt_txn_hook_start(struct lu_context *ctx, +int dt_txn_hook_start(const struct lu_context *ctx, struct dt_device *dev, struct txn_param *param); -int dt_txn_hook_stop(struct lu_context *ctx, +int dt_txn_hook_stop(const struct lu_context *ctx, struct dt_device *dev, struct thandle *txn); -int dt_txn_hook_commit(struct lu_context *ctx, +int dt_txn_hook_commit(const struct lu_context *ctx, struct dt_device *dev, struct thandle *txn); #endif /* __LUSTRE_DT_OBJECT_H */ diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 7ae835c..1096bc2 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -132,18 +132,18 @@ struct lu_device_operations { * postcondition: ergo(!IS_ERR(result), result->lo_dev == d && * result->lo_ops != NULL); */ - struct lu_object *(*ldo_object_alloc)(struct lu_context *ctx, + struct lu_object *(*ldo_object_alloc)(const struct lu_context *ctx, struct lu_device *d); /* * Dual to ->ldo_object_alloc(). Called when object is removed from * memory. */ - void (*ldo_object_free)(struct lu_context *ctx, struct lu_object *o); + void (*ldo_object_free)(const struct lu_context *ctx, struct lu_object *o); /* * process config specific for device */ - int (*ldo_process_config)(struct lu_context *ctx, + int (*ldo_process_config)(const struct lu_context *ctx, struct lu_device *, struct lustre_cfg *); }; @@ -160,27 +160,31 @@ struct lu_object_operations { * stack. It's responsibility of this method to insert lower-layer * object(s) it create into appropriate places of object stack. */ - int (*loo_object_init)(struct lu_context *ctx, struct lu_object *o); + int (*loo_object_init)(const struct lu_context *ctx, + struct lu_object *o); /* * Called before ->ldo_object_free() to signal that object is being * destroyed. Dual to ->loo_object_init(). */ - void (*loo_object_delete)(struct lu_context *ctx, struct lu_object *o); + void (*loo_object_delete)(const struct lu_context *ctx, + struct lu_object *o); /* * Called when last active reference to the object is released (and * object returns to the cache). */ - void (*loo_object_release)(struct lu_context *ctx, struct lu_object *o); + void (*loo_object_release)(const struct lu_context *ctx, + struct lu_object *o); /* * Return true off object @o exists on a storage. */ - int (*loo_object_exists)(struct lu_context *ctx, struct lu_object *o); + int (*loo_object_exists)(const struct lu_context *ctx, + struct lu_object *o); /* * Debugging helper. Print given object. */ - int (*loo_object_print)(struct lu_context *ctx, + int (*loo_object_print)(const struct lu_context *ctx, struct seq_file *f, const struct lu_object *o); }; @@ -260,24 +264,25 @@ struct lu_device_type_operations { /* * Allocate new device. */ - struct lu_device *(*ldto_device_alloc)(struct lu_context *ctx, + struct lu_device *(*ldto_device_alloc)(const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *lcfg); /* * Free device. Dual to ->ldto_device_alloc(). */ - void (*ldto_device_free)(struct lu_context *ctx, struct lu_device *d); + void (*ldto_device_free)(const struct lu_context *ctx, + struct lu_device *d); /* * Initialize the devices after allocation */ - int (*ldto_device_init)(struct lu_context *ctx, + int (*ldto_device_init)(const struct lu_context *ctx, struct lu_device *, struct lu_device *); /* * Finalize device. Dual to ->ldto_device_init(). Returns pointer to * the next device in the stack. */ - struct lu_device *(*ldto_device_fini)(struct lu_context *ctx, + struct lu_device *(*ldto_device_fini)(const struct lu_context *ctx, struct lu_device *); /* @@ -579,19 +584,21 @@ static inline int lu_object_is_dying(struct lu_object_header *h) * object to the cache, unless lu_object_is_dying(o) holds. In the latter * case, free object immediately. */ -void lu_object_put(struct lu_context *ctxt, struct lu_object *o); +void lu_object_put(const struct lu_context *ctxt, + struct lu_object *o); /* * Free @nr objects from the cold end of the site LRU list. */ -void lu_site_purge(struct lu_context *ctx, struct lu_site *s, int nr); +void lu_site_purge(const struct lu_context *ctx, + struct lu_site *s, int nr); /* * Search cache for an object with the fid @f. If such object is found, return * it. Otherwise, create new object, insert it into cache and return it. In * any case, additional reference is acquired on the returned object. */ -struct lu_object *lu_object_find(struct lu_context *ctxt, +struct lu_object *lu_object_find(const struct lu_context *ctxt, struct lu_site *s, const struct lu_fid *f); /* @@ -642,13 +649,14 @@ struct lu_object *lu_object_locate(struct lu_object_header *h, /* * Print human readable representation of the @o to the @f. */ -int lu_object_print(struct lu_context *ctxt, +int lu_object_print(const struct lu_context *ctxt, struct seq_file *f, const struct lu_object *o); /* * Returns true iff object @o exists on the stable storage. */ -static inline int lu_object_exists(struct lu_context *ctx, struct lu_object *o) +static inline int lu_object_exists(const struct lu_context *ctx, + struct lu_object *o) { return o->lo_ops->loo_object_exists(ctx, o); } @@ -708,13 +716,13 @@ struct lu_context_key { * Value constructor. This is called when new value is created for a * context. Returns pointer to new value of error pointer. */ - void *(*lct_init)(struct lu_context *ctx); + void *(*lct_init)(const struct lu_context *ctx); /* * Value destructor. Called when context with previously allocated * value of this slot is destroyed. @data is a value that was returned * by a matching call to ->lct_init(). */ - void (*lct_fini)(struct lu_context *ctx, void *data); + void (*lct_fini)(const struct lu_context *ctx, void *data); /* * Internal implementation detail: index within ->lc_value[] reserved * for this key. @@ -738,7 +746,8 @@ void lu_context_key_degister(struct lu_context_key *key); /* * Return value associated with key @key in context @ctx. */ -void *lu_context_key_get(struct lu_context *ctx, struct lu_context_key *key); +void *lu_context_key_get(const struct lu_context *ctx, + struct lu_context_key *key); /* * Initialize context data-structure. Create values for all keys. diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 6476fa7..7791223 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -33,8 +33,8 @@ struct lu_context; struct lu_seq_mgr_ops { - int (*smo_read) (struct lu_context *, void *opaque, __u64 *); - int (*smo_write) (struct lu_context *, void *opaque, __u64 *); + int (*smo_read) (const struct lu_context *, void *opaque, __u64 *); + int (*smo_write) (const struct lu_context *, void *opaque, __u64 *); }; struct lu_seq_mgr { @@ -55,11 +55,12 @@ struct lu_seq_mgr *seq_mgr_init(struct lu_seq_mgr_ops *, void *); void seq_mgr_fini(struct lu_seq_mgr *); /* seq management methods */ -int seq_mgr_setup(struct lu_context *, struct lu_seq_mgr *); -int seq_mgr_read(struct lu_context *, struct lu_seq_mgr *); -int seq_mgr_write(struct lu_context *, struct lu_seq_mgr *); -int seq_mgr_alloc(struct lu_context *, struct lu_seq_mgr *, __u64 *); -int seq_mgr_range_alloc(struct lu_context *, struct lu_seq_mgr *, __u64 *); +int seq_mgr_setup(const struct lu_context *, struct lu_seq_mgr *); +int seq_mgr_read(const struct lu_context *, struct lu_seq_mgr *); +int seq_mgr_write(const struct lu_context *, struct lu_seq_mgr *); +int seq_mgr_alloc(const struct lu_context *, struct lu_seq_mgr *, __u64 *); +int seq_mgr_range_alloc(const struct lu_context *, + struct lu_seq_mgr *, __u64 *); struct lu_site; #if 0 int fid_is_local(struct lu_site *site, const struct lu_fid *fid); diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 217f0c4..049c122 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -126,7 +126,7 @@ #define MGS_MAX_THREADS 8UL #define MGS_NUM_THREADS max(2UL, min_t(unsigned long, MGS_MAX_THREADS, \ num_physpages * smp_num_cpus >> (26 - PAGE_SHIFT))) - + #define MGS_NBUFS (64 * smp_num_cpus) #define MGS_BUFSIZE (8 * 1024) #define MGS_MAXREQSIZE (5 * 1024) @@ -568,7 +568,7 @@ struct ptlrpc_service { struct list_head srv_free_rs_list; /* waitq to run, when adding stuff to srv_free_rs_list */ cfs_waitq_t srv_free_rs_waitq; - + /* * if non-NULL called during thread creation (ptlrpc_start_thread()) * to initialize service specific per-thread state. diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 6ca1d9e..790ce43 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -49,63 +49,66 @@ struct md_object; * Operations implemented for each md object (both directory and leaf). */ struct md_object_operations { - int (*moo_attr_get)(struct lu_context *ctxt, struct md_object *dt, + int (*moo_attr_get)(const struct lu_context *ctxt, struct md_object *dt, struct lu_attr *attr); - int (*moo_attr_set)(struct lu_context *ctxt, struct md_object *dt, + int (*moo_attr_set)(const struct lu_context *ctxt, struct md_object *dt, struct lu_attr *attr); - int (*moo_xattr_get)(struct lu_context *ctxt, struct md_object *obj, + int (*moo_xattr_get)(const struct lu_context *ctxt, + struct md_object *obj, void *buf, int buf_len, const char *name); - int (*moo_xattr_set)(struct lu_context *ctxt, struct md_object *obj, + int (*moo_xattr_set)(const struct lu_context *ctxt, + struct md_object *obj, void *buf, int buf_len, const char *name); /* part of cross-ref operation */ - int (*moo_object_create)(struct lu_context *, + int (*moo_object_create)(const struct lu_context *, struct md_object *, struct lu_attr *); - int (*moo_ref_add)(struct lu_context *, struct md_object *); - int (*moo_ref_del)(struct lu_context *, struct md_object *); - int (*moo_open)(struct lu_context *, struct md_object *); - int (*moo_close)(struct lu_context *, struct md_object *); + int (*moo_ref_add)(const struct lu_context *, struct md_object *); + int (*moo_ref_del)(const struct lu_context *, struct md_object *); + int (*moo_open)(const struct lu_context *, struct md_object *); + int (*moo_close)(const struct lu_context *, struct md_object *); }; /* * Operations implemented for each directory object. */ struct md_dir_operations { - int (*mdo_lookup)(struct lu_context *, struct md_object *, + int (*mdo_lookup)(const struct lu_context *, struct md_object *, const char *, struct lu_fid *); - int (*mdo_mkdir)(struct lu_context *, struct lu_attr *, + int (*mdo_mkdir)(const struct lu_context *, struct lu_attr *, struct md_object *, const char *, struct md_object *); - int (*mdo_rename)(struct lu_context *ctxt, struct md_object *spobj, + int (*mdo_rename)(const struct lu_context *ctxt, + struct md_object *spobj, struct md_object *tpobj, struct md_object *sobj, const char *sname, struct md_object *tobj, const char *tname); - int (*mdo_link)(struct lu_context *ctxt, struct md_object *tobj, + int (*mdo_link)(const struct lu_context *ctxt, struct md_object *tobj, struct md_object *sobj, const char *name); /* partial ops for cross-ref case */ - int (*mdo_name_insert)(struct lu_context *, struct md_object *, + int (*mdo_name_insert)(const struct lu_context *, struct md_object *, const char *, const struct lu_fid *, struct lu_attr *); - int (*mdo_name_remove)(struct lu_context *, struct md_object *, + int (*mdo_name_remove)(const struct lu_context *, struct md_object *, const char *, struct lu_attr *); }; struct md_device_operations { /* method for getting/setting device wide back stored config data, like * last used meta-sequence, etc. */ - int (*mdo_config) (struct lu_context *ctx, + int (*mdo_config) (const struct lu_context *ctx, struct md_device *m, const char *name, void *buf, int size, int mode); /* meta-data device related handlers. */ - int (*mdo_root_get)(struct lu_context *ctx, + int (*mdo_root_get)(const struct lu_context *ctx, struct md_device *m, struct lu_fid *f); - int (*mdo_statfs)(struct lu_context *ctx, + int (*mdo_statfs)(const struct lu_context *ctx, struct md_device *m, struct kstatfs *sfs); }; @@ -165,32 +168,33 @@ static inline void md_device_fini(struct md_device *md) } /* md operations */ -static inline int mo_attr_get(struct lu_context *cx, struct md_object *m, +static inline int mo_attr_get(const struct lu_context *cx, struct md_object *m, struct lu_attr *at) { return m->mo_ops->moo_attr_get(cx, m, at); } -static inline int mo_object_create(struct lu_context *cx, struct md_object *m, - struct lu_attr *at) +static inline int mo_object_create(const struct lu_context *cx, + struct md_object *m, struct lu_attr *at) { return m->mo_ops->moo_object_create(cx, m, at); } -static inline int mdo_lookup(struct lu_context *cx, struct md_object *p, +static inline int mdo_lookup(const struct lu_context *cx, struct md_object *p, const char *name, struct lu_fid *f) { return p->mo_dir_ops->mdo_lookup(cx, p, name, f); } -static inline int mdo_mkdir(struct lu_context *cx, struct lu_attr *at, +static inline int mdo_mkdir(const struct lu_context *cx, struct lu_attr *at, struct md_object *p, const char *name, struct md_object *c) { return p->mo_dir_ops->mdo_mkdir(cx, at, p, name, c); } -static inline int mdo_name_insert(struct lu_context *cx, struct md_object *p, +static inline int mdo_name_insert(const struct lu_context *cx, + struct md_object *p, const char *name, const struct lu_fid *f, struct lu_attr *at) { diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index a0c7c2f..b5ef373 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -45,15 +45,15 @@ #include "mdd_internal.h" -static struct thandle* mdd_trans_start(struct lu_context *ctxt, +static struct thandle* mdd_trans_start(const struct lu_context *ctxt, struct mdd_device *); -static void mdd_trans_stop(struct lu_context *ctxt, +static void mdd_trans_stop(const struct lu_context *ctxt, struct mdd_device *mdd, struct thandle *handle); static struct dt_object* mdd_object_child(struct mdd_object *o); static struct lu_device_operations mdd_lu_ops; -static void mdd_lock(struct lu_context *ctx, +static void mdd_lock(const struct lu_context *ctx, struct mdd_object *obj, enum dt_lock_mode mode); -static void mdd_unlock(struct lu_context *ctx, +static void mdd_unlock(const struct lu_context *ctx, struct mdd_object *obj, enum dt_lock_mode mode); static struct md_object_operations mdd_obj_ops; @@ -69,7 +69,7 @@ struct mdd_thread_info { const char *mdd_root_dir_name = "ROOT"; -static struct mdd_thread_info *mdd_ctx_info(struct lu_context *ctx) +static struct mdd_thread_info *mdd_ctx_info(const struct lu_context *ctx) { struct mdd_thread_info *info; @@ -118,7 +118,7 @@ static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d) return d->mdd_child->dd_ops; } -static struct lu_object *mdd_object_alloc(struct lu_context *ctxt, +static struct lu_object *mdd_object_alloc(const struct lu_context *ctxt, struct lu_device *d) { struct mdd_object *mdo; @@ -138,7 +138,7 @@ static struct lu_object *mdd_object_alloc(struct lu_context *ctxt, return NULL; } -static int mdd_object_init(struct lu_context *ctxt, struct lu_object *o) +static int mdd_object_init(const struct lu_context *ctxt, struct lu_object *o) { struct mdd_device *d = lu2mdd_dev(o->lo_dev); struct lu_object *below; @@ -155,7 +155,7 @@ static int mdd_object_init(struct lu_context *ctxt, struct lu_object *o) RETURN(0); } -static void mdd_object_free(struct lu_context *ctxt, struct lu_object *o) +static void mdd_object_free(const struct lu_context *ctxt, struct lu_object *o) { struct lu_object_header *h; struct mdd_object *mdd = mdd_obj(o); @@ -166,7 +166,7 @@ static void mdd_object_free(struct lu_context *ctxt, struct lu_object *o) } static int -mdd_attr_get(struct lu_context *ctxt, +mdd_attr_get(const struct lu_context *ctxt, struct md_object *obj, struct lu_attr *attr) { struct mdd_object *mdd_obj = mdo2mddo(obj); @@ -180,7 +180,7 @@ mdd_attr_get(struct lu_context *ctxt, } static int -mdd_xattr_get(struct lu_context *ctxt, struct md_object *obj, void *buf, +mdd_xattr_get(const struct lu_context *ctxt, struct md_object *obj, void *buf, int buf_len, const char *name) { struct mdd_object *mdd_obj = mdo2mddo(obj); @@ -194,7 +194,7 @@ mdd_xattr_get(struct lu_context *ctxt, struct md_object *obj, void *buf, } static int -__mdd_object_destroy(struct lu_context *ctxt, struct mdd_object *obj, +__mdd_object_destroy(const struct lu_context *ctxt, struct mdd_object *obj, struct thandle *handle) { struct dt_object *next = mdd_object_child(obj); @@ -274,14 +274,14 @@ DEFINE_MDD_TXN_OP_DESC(MDD_TXN_LINK); DEFINE_MDD_TXN_OP_DESC(MDD_TXN_RENAME); DEFINE_MDD_TXN_OP_DESC(MDD_TXN_MKDIR); -static void mdd_txn_param_build(struct lu_context *ctx, +static void mdd_txn_param_build(const struct lu_context *ctx, const struct mdd_txn_op_descr *opd) { mdd_ctx_info(ctx)->mti_param.tp_credits = opd->mod_credits; } static int -mdd_object_destroy(struct lu_context *ctxt, struct md_object *obj) +mdd_object_destroy(const struct lu_context *ctxt, struct md_object *obj) { struct mdd_device *mdd = mdo2mdd(obj); struct mdd_object *mdd_obj = mdo2mddo(obj); @@ -308,22 +308,23 @@ mdd_object_destroy(struct lu_context *ctxt, struct md_object *obj) RETURN(rc); } -static void mdd_object_release(struct lu_context *ctxt, struct lu_object *o) +static void mdd_object_release(const struct lu_context *ctxt, + struct lu_object *o) { } -static int mdd_object_exists(struct lu_context *ctx, struct lu_object *o) +static int mdd_object_exists(const struct lu_context *ctx, struct lu_object *o) { return lu_object_exists(ctx, lu_object_next(o)); } -static int mdd_object_print(struct lu_context *ctxt, +static int mdd_object_print(const struct lu_context *ctxt, struct seq_file *f, const struct lu_object *o) { return seq_printf(f, LUSTRE_MDD0_NAME"-object@%p", o); } -static int mdd_dt_lookup(struct lu_context *ctx, struct mdd_device *mdd, +static int mdd_dt_lookup(const struct lu_context *ctx, struct mdd_device *mdd, struct mdd_object *obj, const char *name, struct lu_fid *fid) { @@ -339,7 +340,7 @@ static int mdd_dt_lookup(struct lu_context *ctx, struct mdd_device *mdd, return result; } -static int mdd_mount(struct lu_context *ctx, struct mdd_device *mdd) +static int mdd_mount(const struct lu_context *ctx, struct mdd_device *mdd) { int result; struct mdd_thread_info *info = lu_context_key_get(ctx, @@ -374,7 +375,7 @@ static int mdd_mount(struct lu_context *ctx, struct mdd_device *mdd) return result; } -static int mdd_fs_setup(struct lu_context *ctx, struct mdd_device *mdd) +static int mdd_fs_setup(const struct lu_context *ctx, struct mdd_device *mdd) { return 0; } @@ -384,7 +385,7 @@ static int mdd_fs_cleanup(struct mdd_device *mdd) return 0; } -static int mdd_device_init(struct lu_context *ctx, +static int mdd_device_init(const struct lu_context *ctx, struct lu_device *d, struct lu_device *next) { struct mdd_device *mdd = lu2mdd_dev(d); @@ -404,7 +405,7 @@ err: RETURN(rc); } -static struct lu_device *mdd_device_fini(struct lu_context *ctx, +static struct lu_device *mdd_device_fini(const struct lu_context *ctx, struct lu_device *d) { struct mdd_device *m = lu2mdd_dev(d); @@ -413,7 +414,7 @@ static struct lu_device *mdd_device_fini(struct lu_context *ctx, return next; } -static int mdd_process_config(struct lu_context *ctx, +static int mdd_process_config(const struct lu_context *ctx, struct lu_device *d, struct lustre_cfg *cfg) { struct mdd_device *m = lu2mdd_dev(d); @@ -450,7 +451,7 @@ static struct dt_object* mdd_object_child(struct mdd_object *o) struct dt_object, do_lu); } -static void mdd_lock(struct lu_context *ctxt, +static void mdd_lock(const struct lu_context *ctxt, struct mdd_object *obj, enum dt_lock_mode mode) { struct dt_object *next = mdd_object_child(obj); @@ -458,7 +459,7 @@ static void mdd_lock(struct lu_context *ctxt, next->do_ops->do_object_lock(ctxt, next, mode); } -static void mdd_unlock(struct lu_context *ctxt, +static void mdd_unlock(const struct lu_context *ctxt, struct mdd_object *obj, enum dt_lock_mode mode) { struct dt_object *next = mdd_object_child(obj); @@ -466,21 +467,21 @@ static void mdd_unlock(struct lu_context *ctxt, next->do_ops->do_object_unlock(ctxt, next, mode); } -static void mdd_lock2(struct lu_context *ctxt, +static void mdd_lock2(const struct lu_context *ctxt, struct mdd_object *o0, struct mdd_object *o1) { mdd_lock(ctxt, o0, DT_WRITE_LOCK); mdd_lock(ctxt, o1, DT_WRITE_LOCK); } -static void mdd_unlock2(struct lu_context *ctxt, +static void mdd_unlock2(const struct lu_context *ctxt, struct mdd_object *o0, struct mdd_object *o1) { mdd_unlock(ctxt, o0, DT_WRITE_LOCK); mdd_unlock(ctxt, o1, DT_WRITE_LOCK); } -static struct thandle* mdd_trans_start(struct lu_context *ctxt, +static struct thandle* mdd_trans_start(const struct lu_context *ctxt, struct mdd_device *mdd) { struct txn_param *p = &mdd_ctx_info(ctxt)->mti_param; @@ -488,14 +489,14 @@ static struct thandle* mdd_trans_start(struct lu_context *ctxt, return mdd_child_ops(mdd)->dt_trans_start(ctxt, mdd->mdd_child, p); } -static void mdd_trans_stop(struct lu_context *ctxt, +static void mdd_trans_stop(const struct lu_context *ctxt, struct mdd_device *mdd, struct thandle *handle) { mdd_child_ops(mdd)->dt_trans_stop(ctxt, handle); } static int -__mdd_object_create(struct lu_context *ctxt, struct mdd_object *obj, +__mdd_object_create(const struct lu_context *ctxt, struct mdd_object *obj, struct lu_attr *attr, struct thandle *handle) { struct dt_object *next = mdd_object_child(obj); @@ -507,7 +508,7 @@ __mdd_object_create(struct lu_context *ctxt, struct mdd_object *obj, RETURN(rc); } -static int mdd_object_create(struct lu_context *ctxt, struct md_object *obj, +static int mdd_object_create(const struct lu_context *ctxt, struct md_object *obj, struct lu_attr *attr) { @@ -530,7 +531,7 @@ static int mdd_object_create(struct lu_context *ctxt, struct md_object *obj, static int -__mdd_attr_set(struct lu_context *ctxt, struct md_object *obj, +__mdd_attr_set(const struct lu_context *ctxt, struct md_object *obj, struct lu_attr *attr, struct thandle *handle) { struct dt_object *next = mdd_object_child(mdo2mddo(obj)); @@ -538,7 +539,7 @@ __mdd_attr_set(struct lu_context *ctxt, struct md_object *obj, } static int -mdd_attr_set(struct lu_context *ctxt, +mdd_attr_set(const struct lu_context *ctxt, struct md_object *obj, struct lu_attr *attr) { struct mdd_device *mdd = mdo2mdd(obj); @@ -561,7 +562,7 @@ mdd_attr_set(struct lu_context *ctxt, static int -__mdd_xattr_set(struct lu_context *ctxt, struct mdd_device *mdd, +__mdd_xattr_set(const struct lu_context *ctxt, struct mdd_device *mdd, struct mdd_object *obj, void *buf, int buf_len, const char *name, struct thandle *handle) { @@ -571,7 +572,7 @@ __mdd_xattr_set(struct lu_context *ctxt, struct mdd_device *mdd, } static int -mdd_xattr_set(struct lu_context *ctxt, struct md_object *obj, void *buf, +mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj, void *buf, int buf_len, const char *name) { struct mdd_device *mdd = mdo2mdd(obj); @@ -598,7 +599,7 @@ static const struct lu_fid *mdd_object_getfid(struct mdd_object *obj) } static int -__mdd_index_insert(struct lu_context *ctxt, struct mdd_object *pobj, +__mdd_index_insert(const struct lu_context *ctxt, struct mdd_object *pobj, const struct lu_fid *lf, const char *name, struct thandle *handle) { @@ -611,7 +612,7 @@ __mdd_index_insert(struct lu_context *ctxt, struct mdd_object *pobj, } static int -__mdd_index_delete(struct lu_context *ctxt, struct mdd_device *mdd, +__mdd_index_delete(const struct lu_context *ctxt, struct mdd_device *mdd, struct mdd_object *pobj, struct mdd_object *obj, const char *name, struct thandle *handle) @@ -631,7 +632,7 @@ __mdd_index_delete(struct lu_context *ctxt, struct mdd_device *mdd, } static int -mdd_index_delete(struct lu_context *ctxt, struct md_object *pobj, +mdd_index_delete(const struct lu_context *ctxt, struct md_object *pobj, struct md_object *obj, const char *name) { struct mdd_object *mdd_pobj = mdo2mddo(pobj); @@ -654,7 +655,7 @@ mdd_index_delete(struct lu_context *ctxt, struct md_object *pobj, } static int -mdd_link(struct lu_context *ctxt, struct md_object *tgt_obj, +mdd_link(const struct lu_context *ctxt, struct md_object *tgt_obj, struct md_object *src_obj, const char *name) { struct mdd_object *mdd_tobj = mdo2mddo(tgt_obj); @@ -705,7 +706,7 @@ static void mdd_rename_unlock(struct mdd_device *mdd, struct mdd_object *src_pob } static int -mdd_rename(struct lu_context *ctxt, struct md_object *src_pobj, +mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj, struct md_object *tgt_pobj, struct md_object *sobj, const char *sname, struct md_object *tobj, const char *tname) { @@ -749,13 +750,13 @@ cleanup: RETURN(rc); } -static int mdd_lookup(struct lu_context *ctxt, struct md_object *pobj, +static int mdd_lookup(const struct lu_context *ctxt, struct md_object *pobj, const char *name, struct lu_fid* fid) { return mdd_dt_lookup(ctxt, mdo2mdd(pobj), mdo2mddo(pobj), name, fid); } -static int mdd_mkdir(struct lu_context *ctxt, struct lu_attr* attr, +static int mdd_mkdir(const struct lu_context *ctxt, struct lu_attr* attr, struct md_object *pobj, const char *name, struct md_object *child) { @@ -786,7 +787,7 @@ cleanup: RETURN(rc); } -static int mdd_mkname(struct lu_context *ctxt, struct md_object *pobj, +static int mdd_mkname(const struct lu_context *ctxt, struct md_object *pobj, const char *name, const struct lu_fid *fid, struct lu_attr *attr) { struct mdd_device *mdd = mdo2mdd(pobj); @@ -809,7 +810,7 @@ static int mdd_mkname(struct lu_context *ctxt, struct md_object *pobj, RETURN(rc); } -static int mdd_root_get(struct lu_context *ctx, +static int mdd_root_get(const struct lu_context *ctx, struct md_device *m, struct lu_fid *f) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); @@ -819,7 +820,7 @@ static int mdd_root_get(struct lu_context *ctx, RETURN(0); } -static int mdd_config(struct lu_context *ctx, struct md_device *m, +static int mdd_config(const struct lu_context *ctx, struct md_device *m, const char *name, void *buf, int size, int mode) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); @@ -831,7 +832,7 @@ static int mdd_config(struct lu_context *ctx, struct md_device *m, RETURN(rc); } -static int mdd_statfs(struct lu_context *ctx, +static int mdd_statfs(const struct lu_context *ctx, struct md_device *m, struct kstatfs *sfs) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); int rc; @@ -869,7 +870,7 @@ static struct obd_ops mdd_obd_device_ops = { .o_owner = THIS_MODULE }; -struct lu_device *mdd_device_alloc(struct lu_context *ctx, +struct lu_device *mdd_device_alloc(const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *lcfg) { @@ -889,7 +890,7 @@ struct lu_device *mdd_device_alloc(struct lu_context *ctx, return l; } -static void mdd_device_free(struct lu_context *ctx, struct lu_device *lu) +static void mdd_device_free(const struct lu_context *ctx, struct lu_device *lu) { struct mdd_device *m = lu2mdd_dev(lu); @@ -926,7 +927,7 @@ static struct lu_device_type mdd_device_type = { .ldt_ops = &mdd_device_type_ops }; -static void *mdd_key_init(struct lu_context *ctx) +static void *mdd_key_init(const struct lu_context *ctx) { struct mdd_thread_info *info; @@ -936,7 +937,7 @@ static void *mdd_key_init(struct lu_context *ctx) return info; } -static void mdd_key_fini(struct lu_context *ctx, void *data) +static void mdd_key_fini(const struct lu_context *ctx, void *data) { struct mdd_thread_info *info = data; OBD_FREE_PTR(info); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 11d7322..a4bf538 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -495,7 +495,7 @@ static struct mdt_object *mdt_obj(struct lu_object *o) return container_of0(o, struct mdt_object, mot_obj.mo_lu); } -struct mdt_object *mdt_object_find(struct lu_context *ctxt, +struct mdt_object *mdt_object_find(const struct lu_context *ctxt, struct mdt_device *d, struct lu_fid *f) { @@ -508,7 +508,7 @@ struct mdt_object *mdt_object_find(struct lu_context *ctxt, return mdt_obj(o); } -void mdt_object_put(struct lu_context *ctxt, struct mdt_object *o) +void mdt_object_put(const struct lu_context *ctxt, struct mdt_object *o) { lu_object_put(ctxt, &o->mot_obj.mo_lu); } @@ -541,7 +541,7 @@ void mdt_object_unlock(struct ldlm_namespace *ns, struct mdt_object *o, } } -struct mdt_object *mdt_object_find_lock(struct lu_context *ctxt, +struct mdt_object *mdt_object_find_lock(const struct lu_context *ctxt, struct mdt_device *d, struct lu_fid *f, struct mdt_lock_handle *lh, @@ -665,7 +665,7 @@ static int mdt_req_handle(struct mdt_thread_info *info, req_capsule_init(&info->mti_pill, req, RCL_SERVER); if (flags & HABEO_CORPUS) { struct mdt_body *body; - struct lu_context *ctx; + const struct lu_context *ctx; struct mdt_object *obj; ctx = info->mti_ctxt; @@ -763,14 +763,12 @@ static void mdt_thread_info_init(struct mdt_thread_info *info) info->mti_rep_buf_nr = i; for (i = 0; i < ARRAY_SIZE(info->mti_lh); i++) mdt_lock_handle_init(&info->mti_lh[i]); - lu_context_enter(info->mti_ctxt); } static void mdt_thread_info_fini(struct mdt_thread_info *info) { int i; - lu_context_exit(info->mti_ctxt); if (info->mti_object != NULL) { mdt_object_put(info->mti_ctxt, info->mti_object); info->mti_object = NULL; @@ -1081,7 +1079,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, lustre_swab_mdt_body); if (body != NULL) { struct mdt_object *obj; - struct lu_context *ctx = info->mti_ctxt; + const struct lu_context *ctx = info->mti_ctxt; obj = mdt_object_find(ctx, info->mti_mdt, &body->fid1); if (!IS_ERR(obj)) { @@ -1146,7 +1144,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, RETURN(ELDLM_OK); } -static int mdt_config(struct lu_context *ctx, struct mdt_device *m, +static int mdt_config(const struct lu_context *ctx, struct mdt_device *m, const char *name, void *buf, int size, int mode) { struct md_device *child = m->mdt_child; @@ -1154,8 +1152,8 @@ static int mdt_config(struct lu_context *ctx, struct mdt_device *m, RETURN(child->md_ops->mdo_config(ctx, child, name, buf, size, mode)); } -static int mdt_seq_mgr_hpr(struct lu_context *ctx, void *opaque, __u64 *seq, - int mode) +static int mdt_seq_mgr_hpr(const struct lu_context *ctx, + void *opaque, __u64 *seq, int mode) { struct mdt_device *m = opaque; int rc; @@ -1166,13 +1164,15 @@ static int mdt_seq_mgr_hpr(struct lu_context *ctx, void *opaque, __u64 *seq, RETURN(rc); } -static int mdt_seq_mgr_read(struct lu_context *ctx, void *opaque, __u64 *seq) +static int mdt_seq_mgr_read(const struct lu_context *ctx, + void *opaque, __u64 *seq) { ENTRY; RETURN(mdt_seq_mgr_hpr(ctx, opaque, seq, LUSTRE_CONFIG_GET)); } -static int mdt_seq_mgr_write(struct lu_context *ctx, void *opaque, __u64 *seq) +static int mdt_seq_mgr_write(const struct lu_context *ctx, + void *opaque, __u64 *seq) { ENTRY; RETURN(mdt_seq_mgr_hpr(ctx, opaque, seq, LUSTRE_CONFIG_SET)); @@ -1271,7 +1271,7 @@ err_mdt_svc: RETURN(rc); } -static void mdt_stack_fini(struct lu_context *ctx, +static void mdt_stack_fini(const struct lu_context *ctx, struct mdt_device *m, struct lu_device *d) { /* goes through all stack */ @@ -1296,7 +1296,7 @@ static void mdt_stack_fini(struct lu_context *ctx, m->mdt_child = NULL; } -static struct lu_device *mdt_layer_setup(struct lu_context *ctx, +static struct lu_device *mdt_layer_setup(const struct lu_context *ctx, const char *typename, struct lu_device *child, struct lustre_cfg *cfg) @@ -1347,7 +1347,7 @@ out: RETURN(ERR_PTR(rc)); } -static int mdt_stack_init(struct lu_context *ctx, +static int mdt_stack_init(const struct lu_context *ctx, struct mdt_device *m, struct lustre_cfg *cfg) { struct lu_device *d = &m->mdt_md_dev.md_lu_dev; @@ -1531,7 +1531,7 @@ err_fini_site: } /* used by MGS to process specific configurations */ -static int mdt_process_config(struct lu_context *ctx, +static int mdt_process_config(const struct lu_context *ctx, struct lu_device *d, struct lustre_cfg *cfg) { struct lu_device *next = md2lu_dev(mdt_dev(d)->mdt_child); @@ -1547,7 +1547,7 @@ static int mdt_process_config(struct lu_context *ctx, RETURN(err); } -static struct lu_object *mdt_object_alloc(struct lu_context *ctxt, +static struct lu_object *mdt_object_alloc(const struct lu_context *ctxt, struct lu_device *d) { struct mdt_object *mo; @@ -1570,7 +1570,7 @@ static struct lu_object *mdt_object_alloc(struct lu_context *ctxt, RETURN(NULL); } -static int mdt_object_init(struct lu_context *ctxt, struct lu_object *o) +static int mdt_object_init(const struct lu_context *ctxt, struct lu_object *o) { struct mdt_device *d = mdt_dev(o->lo_dev); struct lu_device *under; @@ -1585,7 +1585,7 @@ static int mdt_object_init(struct lu_context *ctxt, struct lu_object *o) return -ENOMEM; } -static void mdt_object_free(struct lu_context *ctxt, struct lu_object *o) +static void mdt_object_free(const struct lu_context *ctxt, struct lu_object *o) { struct mdt_object *mo = mdt_obj(o); struct lu_object_header *h; @@ -1597,16 +1597,17 @@ static void mdt_object_free(struct lu_context *ctxt, struct lu_object *o) EXIT; } -static void mdt_object_release(struct lu_context *ctxt, struct lu_object *o) +static void mdt_object_release(const struct lu_context *ctxt, + struct lu_object *o) { } -static int mdt_object_exists(struct lu_context *ctx, struct lu_object *o) +static int mdt_object_exists(const struct lu_context *ctx, struct lu_object *o) { return lu_object_exists(ctx, lu_object_next(o)); } -static int mdt_object_print(struct lu_context *ctxt, +static int mdt_object_print(const struct lu_context *ctxt, struct seq_file *f, const struct lu_object *o) { return seq_printf(f, LUSTRE_MDT0_NAME"-object@%p", o); @@ -1743,7 +1744,7 @@ static struct obd_ops mdt_obd_device_ops = { .o_disconnect = mdt_obd_disconnect, }; -static void mdt_device_free(struct lu_context *ctx, struct lu_device *d) +static void mdt_device_free(const struct lu_context *ctx, struct lu_device *d) { struct mdt_device *m = mdt_dev(d); @@ -1751,7 +1752,7 @@ static void mdt_device_free(struct lu_context *ctx, struct lu_device *d) OBD_FREE_PTR(m); } -static struct lu_device *mdt_device_alloc(struct lu_context *ctx, +static struct lu_device *mdt_device_alloc(const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *cfg) { @@ -1775,7 +1776,7 @@ static struct lu_device *mdt_device_alloc(struct lu_context *ctx, } -static void *mdt_thread_init(struct lu_context *ctx) +static void *mdt_thread_init(const struct lu_context *ctx) { struct mdt_thread_info *info; @@ -1787,7 +1788,7 @@ static void *mdt_thread_init(struct lu_context *ctx) return info; } -static void mdt_thread_fini(struct lu_context *ctx, void *data) +static void mdt_thread_fini(const struct lu_context *ctx, void *data) { struct mdt_thread_info *info = data; OBD_FREE_PTR(info); diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index add79d5..ccaa9e3 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -136,49 +136,49 @@ struct mdt_reint_record { * reduce stack consumption. */ struct mdt_thread_info { - struct lu_context *mti_ctxt; - struct mdt_device *mti_mdt; + const struct lu_context *mti_ctxt; + struct mdt_device *mti_mdt; /* * number of buffers in reply message. */ - int mti_rep_buf_nr; + int mti_rep_buf_nr; /* * sizes of reply buffers. */ - int mti_rep_buf_size[MDT_REP_BUF_NR_MAX]; + int mti_rep_buf_size[MDT_REP_BUF_NR_MAX]; /* * Body for "habeo corpus" operations. */ - struct mdt_body *mti_body; + struct mdt_body *mti_body; /* * Lock request for "habeo clavis" operations. */ - struct ldlm_request *mti_dlm_req; + struct ldlm_request *mti_dlm_req; /* * Host object. This is released at the end of mdt_handler(). */ - struct mdt_object *mti_object; + struct mdt_object *mti_object; /* * Object attributes. */ - struct lu_attr mti_attr; + struct lu_attr mti_attr; /* * reint record. Containing information for reint operations. */ - struct mdt_reint_record mti_rr; + struct mdt_reint_record mti_rr; /* * Additional fail id that can be set by handler. Passed to * target_send_reply(). */ - int mti_fail_id; + int mti_fail_id; /* * A couple of lock handles. */ - struct mdt_lock_handle mti_lh[MDT_LH_NR]; + struct mdt_lock_handle mti_lh[MDT_LH_NR]; /* * for req-layout interface. */ - struct req_capsule mti_pill; + struct req_capsule mti_pill; }; int fid_lock(struct ldlm_namespace *, const struct lu_fid *, @@ -188,9 +188,9 @@ int fid_lock(struct ldlm_namespace *, const struct lu_fid *, void fid_unlock(struct ldlm_namespace *, const struct lu_fid *, struct lustre_handle *, ldlm_mode_t); -struct mdt_object *mdt_object_find(struct lu_context *, struct mdt_device *, - struct lu_fid *); -void mdt_object_put(struct lu_context *ctxt, struct mdt_object *); +struct mdt_object *mdt_object_find(const struct lu_context *, + struct mdt_device *, struct lu_fid *); +void mdt_object_put(const struct lu_context *ctxt, struct mdt_object *); int mdt_object_lock(struct ldlm_namespace *, struct mdt_object *, struct mdt_lock_handle *, __u64); @@ -198,8 +198,8 @@ int mdt_object_lock(struct ldlm_namespace *, struct mdt_object *, void mdt_object_unlock(struct ldlm_namespace *, struct mdt_object *, struct mdt_lock_handle *); -struct mdt_object *mdt_object_find_lock(struct lu_context *, struct mdt_device *, - struct lu_fid *, +struct mdt_object *mdt_object_find_lock(const struct lu_context *, + struct mdt_device *, struct lu_fid *, struct mdt_lock_handle *, __u64); int mdt_reint_unpack(struct mdt_thread_info *, struct ptlrpc_request *, diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index f5639d5..47f1cc2 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -47,7 +47,7 @@ void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb) } EXPORT_SYMBOL(dt_txn_callback_del); -int dt_txn_hook_start(struct lu_context *ctx, +int dt_txn_hook_start(const struct lu_context *ctx, struct dt_device *dev, struct txn_param *param) { int result; @@ -65,7 +65,7 @@ int dt_txn_hook_start(struct lu_context *ctx, } EXPORT_SYMBOL(dt_txn_hook_start); -int dt_txn_hook_stop(struct lu_context *ctx, +int dt_txn_hook_stop(const struct lu_context *ctx, struct dt_device *dev, struct thandle *txn) { int result; @@ -83,7 +83,7 @@ int dt_txn_hook_stop(struct lu_context *ctx, } EXPORT_SYMBOL(dt_txn_hook_stop); -int dt_txn_hook_commit(struct lu_context *ctx, +int dt_txn_hook_commit(const struct lu_context *ctx, struct dt_device *dev, struct thandle *txn) { int result; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index fae1341..6d3b5a9 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -39,14 +39,14 @@ #include #include -static void lu_object_free(struct lu_context *ctx, struct lu_object *o); +static void lu_object_free(const struct lu_context *ctx, struct lu_object *o); /* * Decrease reference counter on object. If last reference is freed, return * object to the cache, unless lu_object_is_dying(o) holds. In the latter * case, free object immediately. */ -void lu_object_put(struct lu_context *ctxt, struct lu_object *o) +void lu_object_put(const struct lu_context *ctxt, struct lu_object *o) { struct lu_object_header *top; struct lu_site *site; @@ -98,7 +98,7 @@ EXPORT_SYMBOL(lu_object_put); * This follows object creation protocol, described in the comment within * struct lu_device_operations definition. */ -static struct lu_object *lu_object_alloc(struct lu_context *ctxt, +static struct lu_object *lu_object_alloc(const struct lu_context *ctxt, struct lu_site *s, const struct lu_fid *f) { @@ -146,7 +146,7 @@ static struct lu_object *lu_object_alloc(struct lu_context *ctxt, /* * Free object. */ -static void lu_object_free(struct lu_context *ctx, struct lu_object *o) +static void lu_object_free(const struct lu_context *ctx, struct lu_object *o) { struct list_head splice; struct lu_object *scan; @@ -179,7 +179,7 @@ static void lu_object_free(struct lu_context *ctx, struct lu_object *o) /* * Free @nr objects from the cold end of the site LRU list. */ -void lu_site_purge(struct lu_context *ctx, struct lu_site *s, int nr) +void lu_site_purge(const struct lu_context *ctx, struct lu_site *s, int nr) { struct list_head dispose; struct lu_object_header *h; @@ -217,7 +217,7 @@ EXPORT_SYMBOL(lu_site_purge); /* * Print human readable representation of the @o to the @f. */ -int lu_object_print(struct lu_context *ctx, +int lu_object_print(const struct lu_context *ctx, struct seq_file *f, const struct lu_object *o) { static char ruler[] = "........................................"; @@ -279,8 +279,8 @@ static __u32 fid_hash(const struct lu_fid *f) * it. Otherwise, create new object, insert it into cache and return it. In * any case, additional reference is acquired on the returned object. */ -struct lu_object *lu_object_find(struct lu_context *ctxt, struct lu_site *s, - const struct lu_fid *f) +struct lu_object *lu_object_find(const struct lu_context *ctxt, + struct lu_site *s, const struct lu_fid *f) { struct lu_object *o; struct lu_object *shadow; @@ -584,7 +584,8 @@ EXPORT_SYMBOL(lu_context_key_degister); /* * Return value associated with key @key in context @ctx. */ -void *lu_context_key_get(struct lu_context *ctx, struct lu_context_key *key) +void *lu_context_key_get(const struct lu_context *ctx, + struct lu_context_key *key) { LASSERT(0 <= key->lct_index && key->lct_index < ARRAY_SIZE(lu_keys)); return ctx->lc_value[key->lct_index]; diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 4f2832f..f6d2f15 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -65,9 +65,9 @@ #include "osd_internal.h" -static int osd_root_get (struct lu_context *ctxt, +static int osd_root_get (const struct lu_context *ctxt, struct dt_device *dev, struct lu_fid *f); -static int osd_statfs (struct lu_context *ctxt, +static int osd_statfs (const struct lu_context *ctxt, struct dt_device *dev, struct kstatfs *sfs); static int lu_device_is_osd (const struct lu_device *d); @@ -75,33 +75,41 @@ static void osd_mod_exit (void) __exit; static int osd_mod_init (void) __init; static int osd_type_init (struct lu_device_type *t); static void osd_type_fini (struct lu_device_type *t); -static int osd_object_init (struct lu_context *ctxt, struct lu_object *l); -static void osd_object_release(struct lu_context *ctxt, struct lu_object *l); -static int osd_object_exists (struct lu_context *ctx, struct lu_object *o); -static int osd_object_print (struct lu_context *ctx, +static int osd_object_init (const struct lu_context *ctxt, + struct lu_object *l); +static void osd_object_release(const struct lu_context *ctxt, + struct lu_object *l); +static int osd_object_exists (const struct lu_context *ctx, + struct lu_object *o); +static int osd_object_print (const struct lu_context *ctx, struct seq_file *f, const struct lu_object *o); -static void osd_device_free (struct lu_context *ctx, struct lu_device *m); -static void *osd_key_init (struct lu_context *ctx); -static void osd_key_fini (struct lu_context *ctx, void *data); +static void osd_device_free (const struct lu_context *ctx, + struct lu_device *m); +static void *osd_key_init (const struct lu_context *ctx); +static void osd_key_fini (const struct lu_context *ctx, void *data); static int osd_has_index (struct osd_object *obj); static void osd_object_init0 (struct osd_object *obj); -static int osd_device_init (struct lu_context *ctx, +static int osd_device_init (const struct lu_context *ctx, struct lu_device *d, struct lu_device *); -static int osd_fid_lookup (struct lu_context *ctx, struct osd_object *obj, +static int osd_fid_lookup (const struct lu_context *ctx, + struct osd_object *obj, const struct lu_fid *fid); -static int osd_inode_getattr (struct lu_context *ctx, +static int osd_inode_getattr (const struct lu_context *ctx, struct inode *inode, struct lu_attr *attr); static int osd_inode_get_fid (struct osd_device *d, const struct inode *inode, struct lu_fid *fid); static int osd_param_is_sane (const struct osd_device *dev, const struct txn_param *param); -static int osd_index_lookup (struct lu_context *ctxt, struct dt_object *dt, +static int osd_index_lookup (const struct lu_context *ctxt, + struct dt_object *dt, struct dt_rec *rec, const struct dt_key *key); -static int osd_index_insert (struct lu_context *ctxt, struct dt_object *dt, +static int osd_index_insert (const struct lu_context *ctxt, + struct dt_object *dt, const struct dt_rec *rec, const struct dt_key *key, struct thandle *handle); -static int osd_index_probe (struct lu_context *ctxt, struct dt_object *dt, +static int osd_index_probe (const struct lu_context *ctxt, + struct dt_object *dt, const struct dt_index_features *feat); static struct osd_object *osd_obj (const struct lu_object *o); @@ -110,12 +118,12 @@ static struct osd_device *osd_dt_dev (const struct dt_device *d); static struct osd_object *osd_dt_obj (const struct dt_object *d); static struct osd_device *osd_obj2dev (struct osd_object *o); static struct lu_device *osd2lu_dev (struct osd_device * osd); -static struct lu_device *osd_device_fini (struct lu_context *ctx, +static struct lu_device *osd_device_fini (const struct lu_context *ctx, struct lu_device *d); -static struct lu_device *osd_device_alloc (struct lu_context *ctx, +static struct lu_device *osd_device_alloc (const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *cfg); -static struct lu_object *osd_object_alloc (struct lu_context *ctx, +static struct lu_object *osd_object_alloc (const struct lu_context *ctx, struct lu_device *d); static struct inode *osd_iget (struct osd_thread_info *info, struct osd_device *dev, @@ -143,7 +151,7 @@ struct osd_thandle { /* * DT methods. */ -static int osd_root_get(struct lu_context *ctx, +static int osd_root_get(const struct lu_context *ctx, struct dt_device *dev, struct lu_fid *f) { struct osd_device *d = osd_dt_dev(dev); @@ -156,7 +164,7 @@ static int osd_root_get(struct lu_context *ctx, * OSD object methods. */ -static struct lu_object *osd_object_alloc(struct lu_context *ctx, +static struct lu_object *osd_object_alloc(const struct lu_context *ctx, struct lu_device *d) { struct osd_object *mo; @@ -185,7 +193,7 @@ static void osd_object_init0(struct osd_object *obj) obj->oo_dt.do_body_ops = &osd_body_ops; } -static int osd_object_init(struct lu_context *ctxt, struct lu_object *l) +static int osd_object_init(const struct lu_context *ctxt, struct lu_object *l) { struct osd_object *obj = osd_obj(l); int result; @@ -198,14 +206,14 @@ static int osd_object_init(struct lu_context *ctxt, struct lu_object *l) return result; } -static void osd_object_free(struct lu_context *ctx, struct lu_object *l) +static void osd_object_free(const struct lu_context *ctx, struct lu_object *l) { struct osd_object *obj = osd_obj(l); dt_object_fini(&obj->oo_dt); OBD_FREE_PTR(obj); } -static void osd_object_delete(struct lu_context *ctx, struct lu_object *l) +static void osd_object_delete(const struct lu_context *ctx, struct lu_object *l) { struct osd_object *o = osd_obj(l); @@ -218,7 +226,8 @@ static int osd_inode_unlinked(const struct inode *inode) return inode->i_nlink == !!S_ISDIR(inode->i_mode); } -static void osd_object_release(struct lu_context *ctxt, struct lu_object *l) +static void osd_object_release(const struct lu_context *ctxt, + struct lu_object *l) { struct osd_object *o = osd_obj(l); @@ -226,12 +235,12 @@ static void osd_object_release(struct lu_context *ctxt, struct lu_object *l) set_bit(LU_OBJECT_HEARD_BANSHEE, &l->lo_header->loh_flags); } -static int osd_object_exists(struct lu_context *ctx, struct lu_object *o) +static int osd_object_exists(const struct lu_context *ctx, struct lu_object *o) { return osd_obj(o)->oo_inode != NULL; } -static int osd_object_print(struct lu_context *ctx, +static int osd_object_print(const struct lu_context *ctx, struct seq_file *f, const struct lu_object *l) { struct osd_object *o = osd_obj(l); @@ -242,7 +251,7 @@ static int osd_object_print(struct lu_context *ctx, o->oo_inode ? o->oo_inode->i_generation : 0); } -static int osd_config(struct lu_context *ctx, +static int osd_config(const struct lu_context *ctx, struct dt_device *d, const char *name, void *buf, int size, int mode) { @@ -255,7 +264,7 @@ static int osd_config(struct lu_context *ctx, } } -static int osd_statfs(struct lu_context *ctx, +static int osd_statfs(const struct lu_context *ctx, struct dt_device *d, struct kstatfs *sfs) { struct osd_device *osd = osd_dt_dev(d); @@ -280,7 +289,7 @@ static int osd_param_is_sane(const struct osd_device *dev, return param->tp_credits <= osd_journal(dev)->j_max_transaction_buffers; } -static struct thandle *osd_trans_start(struct lu_context *ctx, +static struct thandle *osd_trans_start(const struct lu_context *ctx, struct dt_device *d, struct txn_param *p) { @@ -323,7 +332,7 @@ static struct thandle *osd_trans_start(struct lu_context *ctx, RETURN(th); } -static void osd_trans_stop(struct lu_context *ctx, struct thandle *th) +static void osd_trans_stop(const struct lu_context *ctx, struct thandle *th) { int result; struct osd_thandle *oh; @@ -358,7 +367,7 @@ static struct dt_device_operations osd_dt_ops = { .dt_trans_stop = osd_trans_stop, }; -static void osd_object_lock(struct lu_context *ctx, struct dt_object *dt, +static void osd_object_lock(const struct lu_context *ctx, struct dt_object *dt, enum dt_lock_mode mode) { struct osd_object *obj = osd_dt_obj(dt); @@ -370,8 +379,8 @@ static void osd_object_lock(struct lu_context *ctx, struct dt_object *dt, down_read(&obj->oo_sem); } -static void osd_object_unlock(struct lu_context *ctx, struct dt_object *dt, - enum dt_lock_mode mode) +static void osd_object_unlock(const struct lu_context *ctx, + struct dt_object *dt, enum dt_lock_mode mode) { struct osd_object *obj = osd_dt_obj(dt); @@ -382,7 +391,7 @@ static void osd_object_unlock(struct lu_context *ctx, struct dt_object *dt, up_read(&obj->oo_sem); } -static int osd_attr_get(struct lu_context *ctxt, struct dt_object *dt, +static int osd_attr_get(const struct lu_context *ctxt, struct dt_object *dt, struct lu_attr *attr) { LASSERT(lu_object_exists(ctxt, &dt->do_lu)); @@ -489,7 +498,7 @@ static osd_obj_type_f osd_create_type_f(__u32 mode) return result; } -static int osd_object_create(struct lu_context *ctx, struct dt_object *dt, +static int osd_object_create(const struct lu_context *ctx, struct dt_object *dt, struct lu_attr *attr, struct thandle *th) { const struct lu_fid *fid = lu_object_fid(&dt->do_lu); @@ -594,7 +603,7 @@ static int osd_build_fid(struct osd_device *osd, * XXX This is temporary solution: inode operations are used until iam is * ready. */ -static int osd_index_lookup(struct lu_context *ctxt, struct dt_object *dt, +static int osd_index_lookup(const struct lu_context *ctxt, struct dt_object *dt, struct dt_rec *rec, const struct dt_key *key) { struct osd_object *obj = osd_dt_obj(dt); @@ -687,7 +696,7 @@ static int osd_add_rec(struct osd_thread_info *info, struct osd_device *dev, /* * XXX Temporary stuff. */ -static int osd_index_insert(struct lu_context *ctx, struct dt_object *dt, +static int osd_index_insert(const struct lu_context *ctx, struct dt_object *dt, const struct dt_rec *rec, const struct dt_key *key, struct thandle *handle) { @@ -729,7 +738,7 @@ static int osd_index_insert(struct lu_context *ctx, struct dt_object *dt, const struct dt_index_features dt_directory_features; -static int osd_index_probe(struct lu_context *ctxt, struct dt_object *dt, +static int osd_index_probe(const struct lu_context *ctxt, struct dt_object *dt, const struct dt_index_features *feat) { struct osd_object *obj = osd_dt_obj(dt); @@ -764,7 +773,7 @@ static struct lu_context_key osd_key = { .lct_fini = osd_key_fini }; -static void *osd_key_init(struct lu_context *ctx) +static void *osd_key_init(const struct lu_context *ctx) { struct osd_thread_info *info; @@ -774,19 +783,19 @@ static void *osd_key_init(struct lu_context *ctx) return info; } -static void osd_key_fini(struct lu_context *ctx, void *data) +static void osd_key_fini(const struct lu_context *ctx, void *data) { struct osd_thread_info *info = data; OBD_FREE_PTR(info); } -static int osd_device_init(struct lu_context *ctx, +static int osd_device_init(const struct lu_context *ctx, struct lu_device *d, struct lu_device *next) { return 0; } -static int osd_mount(struct lu_context *ctx, +static int osd_mount(const struct lu_context *ctx, struct osd_device *o, struct lustre_cfg *cfg) { struct lustre_mount_info *lmi; @@ -844,7 +853,7 @@ static int osd_mount(struct lu_context *ctx, RETURN(result); } -static struct lu_device *osd_device_fini(struct lu_context *ctx, +static struct lu_device *osd_device_fini(const struct lu_context *ctx, struct lu_device *d) { struct osd_device *o = osd_dev(d); @@ -863,7 +872,7 @@ static struct lu_device *osd_device_fini(struct lu_context *ctx, RETURN(NULL); } -static struct lu_device *osd_device_alloc(struct lu_context *ctx, +static struct lu_device *osd_device_alloc(const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *cfg) { @@ -886,7 +895,7 @@ static struct lu_device *osd_device_alloc(struct lu_context *ctx, return l; } -static void osd_device_free(struct lu_context *ctx, struct lu_device *d) +static void osd_device_free(const struct lu_context *ctx, struct lu_device *d) { struct osd_device *o = osd_dev(d); @@ -894,7 +903,7 @@ static void osd_device_free(struct lu_context *ctx, struct lu_device *d) OBD_FREE_PTR(o); } -static int osd_process_config(struct lu_context *ctx, +static int osd_process_config(const struct lu_context *ctx, struct lu_device *d, struct lustre_cfg *cfg) { struct osd_device *o = osd_dev(d); @@ -1001,7 +1010,7 @@ static struct inode *osd_iget(struct osd_thread_info *info, } -static int osd_fid_lookup(struct lu_context *ctx, +static int osd_fid_lookup(const struct lu_context *ctx, struct osd_object *obj, const struct lu_fid *fid) { struct osd_thread_info *info; @@ -1038,7 +1047,7 @@ static int osd_fid_lookup(struct lu_context *ctx, RETURN(result); } -static int osd_inode_getattr(struct lu_context *ctx, +static int osd_inode_getattr(const struct lu_context *ctx, struct inode *inode, struct lu_attr *attr) { //attr->la_atime = inode->i_atime; diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index d0fcb3a..cca18c7 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -988,8 +988,11 @@ static int ptlrpc_main(void *arg) * requests */ if (!list_empty (&svc->srv_request_queue) && (svc->srv_n_difficult_replies == 0 || - svc->srv_n_active_reqs < (svc->srv_nthreads - 1))) + svc->srv_n_active_reqs < (svc->srv_nthreads - 1))) { + lu_context_enter(&ctx); ptlrpc_server_handle_request(svc, thread); + lu_context_exit(&ctx); + } if (!list_empty(&svc->srv_idle_rqbds) && ptlrpc_server_post_idle_rqbds(svc) < 0) { -- 1.8.3.1