X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosc%2Fosc_dev.c;h=cbddab5c0f319a5bbde212a13a6fb0641669a8e3;hb=73be3386684f35ad401f0d57be90cea61327aee8;hp=281ea61ba3ea966136a729eb9b9765f89f46e64c;hpb=9fe4b52ad2ffadf125d9b5c78bb2ff9a01725707;p=fs%2Flustre-release.git diff --git a/lustre/osc/osc_dev.c b/lustre/osc/osc_dev.c index 281ea61..cbddab5 100644 --- a/lustre/osc/osc_dev.c +++ b/lustre/osc/osc_dev.c @@ -15,23 +15,21 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, 2017, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * - * Implementation of cl_device, cl_req for OSC layer. + * Implementation of cl_device, for OSC layer. * * Author: Nikita Danilov */ @@ -40,28 +38,27 @@ /* class_name2obd() */ #include +#include -#include "osc_cl_internal.h" +#include "osc_internal.h" -/** \addtogroup osc - * @{ +/** \addtogroup osc + * @{ */ -cfs_mem_cache_t *osc_page_kmem; -cfs_mem_cache_t *osc_lock_kmem; -cfs_mem_cache_t *osc_object_kmem; -cfs_mem_cache_t *osc_thread_kmem; -cfs_mem_cache_t *osc_session_kmem; -cfs_mem_cache_t *osc_req_kmem; -cfs_mem_cache_t *osc_extent_kmem; +struct kmem_cache *osc_lock_kmem; +EXPORT_SYMBOL(osc_lock_kmem); +struct kmem_cache *osc_object_kmem; +EXPORT_SYMBOL(osc_object_kmem); + +struct kmem_cache *osc_thread_kmem; +struct kmem_cache *osc_session_kmem; +struct kmem_cache *osc_extent_kmem; +struct kmem_cache *osc_quota_kmem; +struct kmem_cache *osc_obdo_kmem; struct lu_kmem_descr osc_caches[] = { { - .ckd_cache = &osc_page_kmem, - .ckd_name = "osc_page_kmem", - .ckd_size = sizeof (struct osc_page) - }, - { .ckd_cache = &osc_lock_kmem, .ckd_name = "osc_lock_kmem", .ckd_size = sizeof (struct osc_lock) @@ -82,33 +79,25 @@ struct lu_kmem_descr osc_caches[] = { .ckd_size = sizeof (struct osc_session) }, { - .ckd_cache = &osc_req_kmem, - .ckd_name = "osc_req_kmem", - .ckd_size = sizeof (struct osc_req) - }, - { .ckd_cache = &osc_extent_kmem, .ckd_name = "osc_extent_kmem", .ckd_size = sizeof (struct osc_extent) }, { - .ckd_cache = NULL - } + .ckd_cache = &osc_quota_kmem, + .ckd_name = "osc_quota_kmem", + .ckd_size = sizeof(struct osc_quota_info) + }, + { + .ckd_cache = &osc_obdo_kmem, + .ckd_name = "osc_obdo_kmem", + .ckd_size = sizeof(struct obdo) + }, + { + .ckd_cache = NULL + } }; -cfs_lock_class_key_t osc_ast_guard_class; - -/***************************************************************************** - * - * Type conversions. - * - */ - -static struct lu_device *osc2lu_dev(struct osc_device *osc) -{ - return &osc->od_cl.cd_lu_dev; -} - /***************************************************************************** * * Osc device and device type functions. @@ -116,21 +105,23 @@ static struct lu_device *osc2lu_dev(struct osc_device *osc) */ static void *osc_key_init(const struct lu_context *ctx, - struct lu_context_key *key) + struct lu_context_key *key) { - struct osc_thread_info *info; + struct osc_thread_info *info; - OBD_SLAB_ALLOC_PTR_GFP(info, osc_thread_kmem, CFS_ALLOC_IO); - if (info == NULL) - info = ERR_PTR(-ENOMEM); - return info; + OBD_SLAB_ALLOC_PTR_GFP(info, osc_thread_kmem, GFP_NOFS); + if (info == NULL) + info = ERR_PTR(-ENOMEM); + return info; } static void osc_key_fini(const struct lu_context *ctx, struct lu_context_key *key, void *data) { - struct osc_thread_info *info = data; - OBD_SLAB_FREE_PTR(info, osc_thread_kmem); + struct osc_thread_info *info = data; + + lu_buf_free(&info->oti_ladvise_buf); + OBD_SLAB_FREE_PTR(info, osc_thread_kmem); } struct lu_context_key osc_key = { @@ -138,16 +129,17 @@ struct lu_context_key osc_key = { .lct_init = osc_key_init, .lct_fini = osc_key_fini }; +EXPORT_SYMBOL(osc_key); static void *osc_session_init(const struct lu_context *ctx, - struct lu_context_key *key) + struct lu_context_key *key) { - struct osc_session *info; + struct osc_session *info; - OBD_SLAB_ALLOC_PTR_GFP(info, osc_session_kmem, CFS_ALLOC_IO); - if (info == NULL) - info = ERR_PTR(-ENOMEM); - return info; + OBD_SLAB_ALLOC_PTR_GFP(info, osc_session_kmem, GFP_NOFS); + if (info == NULL) + info = ERR_PTR(-ENOMEM); + return info; } static void osc_session_fini(const struct lu_context *ctx, @@ -162,6 +154,7 @@ struct lu_context_key osc_session_key = { .lct_init = osc_session_init, .lct_fini = osc_session_fini }; +EXPORT_SYMBOL(osc_session_key); /* type constructor/destructor: osc_type_{init,fini,start,stop}(). */ LU_TYPE_INIT_FINI(osc, &osc_key, &osc_session_key); @@ -179,31 +172,30 @@ static const struct lu_device_operations osc_lu_ops = { .ldo_recovery_complete = NULL }; -static const struct cl_device_operations osc_cl_ops = { - .cdo_req_init = osc_req_init -}; - -static int osc_device_init(const struct lu_env *env, struct lu_device *d, - const char *name, struct lu_device *next) +int osc_device_init(const struct lu_env *env, struct lu_device *d, + const char *name, struct lu_device *next) { RETURN(0); } +EXPORT_SYMBOL(osc_device_init); -static struct lu_device *osc_device_fini(const struct lu_env *env, - struct lu_device *d) +struct lu_device *osc_device_fini(const struct lu_env *env, + struct lu_device *d) { - return 0; + return NULL; } +EXPORT_SYMBOL(osc_device_fini); -static struct lu_device *osc_device_free(const struct lu_env *env, - struct lu_device *d) +struct lu_device *osc_device_free(const struct lu_env *env, + struct lu_device *d) { - struct osc_device *od = lu2osc_dev(d); + struct osc_device *od = lu2osc_dev(d); - cl_device_fini(lu2cl_dev(d)); - OBD_FREE_PTR(od); - return NULL; + cl_device_fini(lu2cl_dev(d)); + OBD_FREE_PTR(od); + return NULL; } +EXPORT_SYMBOL(osc_device_free); static struct lu_device *osc_device_alloc(const struct lu_env *env, struct lu_device_type *t, @@ -221,7 +213,6 @@ static struct lu_device *osc_device_alloc(const struct lu_env *env, cl_device_init(&od->od_cl, t); d = osc2lu_dev(od); d->ld_ops = &osc_lu_ops; - od->od_cl.cd_ops = &osc_cl_ops; /* Setup OSC OBD */ obd = class_name2obd(lustre_cfg_string(cfg, 0));