X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flovsub_dev.c;h=a21aeeb2de29b07a38963a4089d80c0576374787;hb=a42a91c783903ea15ad902032166c7e312dad7ee;hp=ce76771bde9f2d990f5c0a909986d28c5c46275d;hpb=b15f3875f46eec3c5186fe6b84cf2cda7ceb8518;p=fs%2Flustre-release.git diff --git a/lustre/lov/lovsub_dev.c b/lustre/lov/lovsub_dev.c index ce76771..a21aeeb 100644 --- a/lustre/lov/lovsub_dev.c +++ b/lustre/lov/lovsub_dev.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -17,17 +15,15 @@ * * 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 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2013, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -48,50 +44,6 @@ /***************************************************************************** * - * Lovsub transfer operations. - * - */ - -static void lovsub_req_completion(const struct lu_env *env, - const struct cl_req_slice *slice, int ioret) -{ - struct lovsub_req *lsr; - - ENTRY; - lsr = cl2lovsub_req(slice); - OBD_SLAB_FREE_PTR(lsr, lovsub_req_kmem); - EXIT; -} - -/** - * Implementation of struct cl_req_operations::cro_attr_set() for lovsub - * layer. Lov and lovsub are responsible only for struct obdo::o_stripe_idx - * field, which is filled there. - */ -static void lovsub_req_attr_set(const struct lu_env *env, - const struct cl_req_slice *slice, - const struct cl_object *obj, - struct cl_req_attr *attr, obd_valid flags) -{ - struct lovsub_object *subobj; - - ENTRY; - subobj = cl2lovsub(obj); - /* - * There is no OBD_MD_* flag for obdo::o_stripe_idx, so set it - * unconditionally. It never changes anyway. - */ - attr->cra_oa->o_stripe_idx = subobj->lso_index; - EXIT; -} - -static const struct cl_req_operations lovsub_req_ops = { - .cro_attr_set = lovsub_req_attr_set, - .cro_completion = lovsub_req_completion -}; - -/***************************************************************************** - * * Lov-sub device and device type functions. * */ @@ -125,38 +77,26 @@ static struct lu_device *lovsub_device_fini(const struct lu_env *env, struct lu_device *next; struct lovsub_device *lsd; - ENTRY; - lsd = lu2lovsub_dev(d); - next = cl2lu_dev(lsd->acid_next); - lsd->acid_super = NULL; - lsd->acid_next = NULL; - RETURN(next); + ENTRY; + lsd = lu2lovsub_dev(d); + next = cl2lu_dev(lsd->acid_next); + lsd->acid_next = NULL; + RETURN(next); } static struct lu_device *lovsub_device_free(const struct lu_env *env, - struct lu_device *d) + struct lu_device *d) { - struct lovsub_device *lsd = lu2lovsub_dev(d); - struct lu_device *next = cl2lu_dev(lsd->acid_next); - - cl_device_fini(lu2cl_dev(d)); - OBD_FREE_PTR(lsd); - return next; -} - -static int lovsub_req_init(const struct lu_env *env, struct cl_device *dev, - struct cl_req *req) -{ - struct lovsub_req *lsr; - int result; - - OBD_SLAB_ALLOC_PTR_GFP(lsr, lovsub_req_kmem, CFS_ALLOC_IO); - if (lsr != NULL) { - cl_req_slice_add(req, &lsr->lsrq_cl, dev, &lovsub_req_ops); - result = 0; - } else - result = -ENOMEM; - return result; + struct lovsub_device *lsd = lu2lovsub_dev(d); + struct lu_device *next = cl2lu_dev(lsd->acid_next); + + if (atomic_read(&d->ld_ref) && d->ld_site) { + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL); + lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer); + } + cl_device_fini(lu2cl_dev(d)); + OBD_FREE_PTR(lsd); + return next; } static const struct lu_device_operations lovsub_lu_ops = { @@ -165,10 +105,6 @@ static const struct lu_device_operations lovsub_lu_ops = { .ldo_recovery_complete = NULL }; -static const struct cl_device_operations lovsub_cl_ops = { - .cdo_req_init = lovsub_req_init -}; - static struct lu_device *lovsub_device_alloc(const struct lu_env *env, struct lu_device_type *t, struct lustre_cfg *cfg) @@ -184,7 +120,6 @@ static struct lu_device *lovsub_device_alloc(const struct lu_env *env, if (result == 0) { d = lovsub2lu_dev(lsd); d->ld_ops = &lovsub_lu_ops; - lsd->acid_cl.cd_ops = &lovsub_cl_ops; } else d = ERR_PTR(result); } else