X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fosd%2Fosd_handler.c;h=68f2e3e758bebbb143e84f8b811d44c53baca175;hb=2ce82af177059e9fe56f1a48a38b2b9338b74b4c;hp=fedddcdfe25af3c242ec6a2b740416c79f690cfa;hpb=068d1a3fbd94d4f8cab3d897b6b6ef7c385b4fc1;p=fs%2Flustre-release.git diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index fedddcd..68f2e3e 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -60,11 +60,6 @@ #include /* struct ptlrpc_thread */ #include -/* LUSTRE_OSD_NAME */ -#include -/* class_register_type(), class_unregister_type(), class_get_type() */ -#include -#include /* fid_is_local() */ #include @@ -98,51 +93,8 @@ struct osd_object { #endif }; -/* - * osd device. - */ -struct osd_device { - /* super-class */ - struct dt_device od_dt_dev; - /* information about underlying file system */ - struct lustre_mount_info *od_mount; - /* object index */ - struct osd_oi od_oi; - /* - * XXX temporary stuff for object index: directory where every object - * is named by its fid. - */ - struct dentry *od_obj_area; - - /* Environment for transaction commit callback. - * Currently, OSD is based on ext3/JBD. Transaction commit in ext3/JBD - * is serialized, that is there is no more than one transaction commit - * at a time (JBD journal_commit_transaction() is serialized). - * This means that it's enough to have _one_ lu_context. - */ - struct lu_env od_env_for_commit; - - /* - * Fid Capability - */ - unsigned int od_fl_capa:1; - unsigned long od_capa_timeout; - __u32 od_capa_alg; - struct lustre_capa_key *od_capa_keys; - struct hlist_head *od_capa_hash; - - /* - * statfs optimization: we cache a bit. - */ - cfs_time_t od_osfs_age; - struct kstatfs od_kstatfs; - spinlock_t od_osfs_lock; -}; - static int osd_root_get (const struct lu_env *env, struct dt_device *dev, struct lu_fid *f); -static int osd_statfs (const struct lu_env *env, - struct dt_device *dev, struct kstatfs *sfs); static int lu_device_is_osd (const struct lu_device *d); static void osd_mod_exit (void) __exit; @@ -155,7 +107,7 @@ static void osd_object_release(const struct lu_env *env, struct lu_object *l); static int osd_object_print (const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o); -static void osd_device_free (const struct lu_env *env, +static struct lu_device *osd_device_free (const struct lu_env *env, struct lu_device *m); static void *osd_key_init (const struct lu_context *ctx, struct lu_context_key *key); @@ -252,8 +204,6 @@ static struct lu_device_type_operations osd_device_type_ops; static struct lu_device_type osd_device_type; static struct lu_object_operations osd_lu_obj_ops; static struct obd_ops osd_obd_device_ops; -static struct lprocfs_vars lprocfs_osd_module_vars[]; -static struct lprocfs_vars lprocfs_osd_obd_vars[]; static struct lu_device_operations osd_lu_ops; static struct lu_context_key osd_key; static struct dt_object_operations osd_obj_ops; @@ -556,8 +506,8 @@ static int osd_object_print(const struct lu_env *env, void *cookie, /* * Concurrency: shouldn't matter. */ -static int osd_statfs(const struct lu_env *env, - struct dt_device *d, struct kstatfs *sfs) +int osd_statfs(const struct lu_env *env, struct dt_device *d, + struct kstatfs *sfs) { struct osd_device *osd = osd_dt_dev(d); struct super_block *sb = osd_sb(osd); @@ -1959,7 +1909,7 @@ static struct dt_rec *osd_it_rec(const struct lu_env *env, return (struct dt_rec *)iam_it_rec_get(&it->oi_it); } -static __u32 osd_it_store(const struct lu_env *env, const struct dt_it *di) +static __u64 osd_it_store(const struct lu_env *env, const struct dt_it *di) { struct osd_it *it = (struct osd_it *)di; @@ -1967,7 +1917,7 @@ static __u32 osd_it_store(const struct lu_env *env, const struct dt_it *di) } static int osd_it_load(const struct lu_env *env, - const struct dt_it *di, __u32 hash) + const struct dt_it *di, __u64 hash) { struct osd_it *it = (struct osd_it *)di; @@ -2250,8 +2200,13 @@ static void osd_key_exit(const struct lu_context *ctx, static int osd_device_init(const struct lu_env *env, struct lu_device *d, const char *name, struct lu_device *next) { - return lu_context_init(&osd_dev(d)->od_env_for_commit.le_ctx, - LCT_MD_THREAD); + int rc; + /* context for commit hooks */ + rc = lu_context_init(&osd_dev(d)->od_env_for_commit.le_ctx, + LCT_MD_THREAD); + if (rc == 0) + rc = osd_procfs_init(osd_dev(d), name); + return rc; } static int osd_shutdown(const struct lu_env *env, struct osd_device *o) @@ -2311,11 +2266,18 @@ static int osd_mount(const struct lu_env *env, static struct lu_device *osd_device_fini(const struct lu_env *env, struct lu_device *d) { + int rc; ENTRY; shrink_dcache_sb(osd_sb(osd_dev(d))); osd_sync(env, lu2dt_dev(d)); + rc = osd_procfs_fini(osd_dev(d)); + if (rc) { + CERROR("proc fini error %d \n", rc); + RETURN (ERR_PTR(rc)); + } + if (osd_dev(d)->od_mount) server_put_mount(osd_dev(d)->od_mount->lmi_name, osd_dev(d)->od_mount->lmi_mnt); @@ -2353,13 +2315,16 @@ static struct lu_device *osd_device_alloc(const struct lu_env *env, return l; } -static void osd_device_free(const struct lu_env *env, struct lu_device *d) +static struct lu_device *osd_device_free(const struct lu_env *env, + struct lu_device *d) { struct osd_device *o = osd_dev(d); + ENTRY; cleanup_capa_hash(o->od_capa_hash); dt_device_fini(&o->od_dt_dev); OBD_FREE_PTR(o); + RETURN(NULL); } static int osd_process_config(const struct lu_env *env, @@ -2592,25 +2557,10 @@ static struct lu_device_type osd_device_type = { /* * lprocfs legacy support. */ -static struct lprocfs_vars lprocfs_osd_obd_vars[] = { - { 0 } -}; - -static struct lprocfs_vars lprocfs_osd_module_vars[] = { - { 0 } -}; - static struct obd_ops osd_obd_device_ops = { .o_owner = THIS_MODULE }; -static void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars) -{ - lvars->module_vars = lprocfs_osd_module_vars; - lvars->obd_vars = lprocfs_osd_obd_vars; -} - - static int __init osd_mod_init(void) { struct lprocfs_static_vars lvars;