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);
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);
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;
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;
}
-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);
/* --- 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)
{
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);
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);
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);
}
/* 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 */
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;
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;
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);
};
/* 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));
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);
}
.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)
{
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);
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)
{
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;
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);
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);
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);
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)
{
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); */
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); */
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)
{
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);
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 */
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;
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;
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;
};
int rc;
-
+
#if 0
req = ptlrpc_prep_req(mc->mc_desc.cl_import, LUSTRE_MDS_VERSION,
MDS_REINT, 1, &size, NULL);
}
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));
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;
/* 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;
#include <lustre_fid.h>
#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*/
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;
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;
}
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;
#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)
{
/*
#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
#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
#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);
*
* 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);
};
* 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
*
* 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.
* 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);
};
/*
* 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, ...);
};
/*
/*
* 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);
* 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);
};
* 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;
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 */
* 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 *);
};
* 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);
};
/*
* 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 *);
/*
* 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);
/*
/*
* 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);
}
* 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.
/*
* 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.
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 {
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);
#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)
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.
* 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);
};
}
/* 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)
{
#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;
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;
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;
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;
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);
}
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);
}
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);
}
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);
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);
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)
{
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,
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;
}
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);
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);
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);
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);
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);
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;
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);
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)
{
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));
}
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);
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)
{
}
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);
}
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)
{
}
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)
}
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);
}
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);
}
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)
{
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)
{
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);
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);
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);
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;
.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)
{
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);
.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;
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);
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)
{
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);
}
}
}
-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,
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;
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;
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)) {
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;
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;
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));
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 */
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)
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;
}
/* 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);
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;
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;
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;
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);
.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);
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)
{
}
-static void *mdt_thread_init(struct lu_context *ctx)
+static void *mdt_thread_init(const struct lu_context *ctx)
{
struct mdt_thread_info *info;
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);
* 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 *,
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);
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 *,
}
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;
}
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;
}
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;
#include <lu_object.h>
#include <libcfs/list.h>
-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;
* 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)
{
/*
* 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;
/*
* 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;
/*
* 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[] = "........................................";
* 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;
/*
* 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];
#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);
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);
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,
/*
* 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);
* 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;
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;
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);
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);
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);
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)
{
}
}
-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);
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)
{
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;
.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);
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);
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));
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);
* 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);
/*
* 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)
{
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);
.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;
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;
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);
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)
{
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);
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);
}
-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;
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;
* 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) {