X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fquota_adjust_qunit.c;h=d1426f7c5d952ea528b567c14483810cc194bc36;hb=84a3fd67356c8073a917ea6abd63928055e38156;hp=45f8c388a65a4ef493eac0e9b694dc0cb8d9f1c6;hpb=9364f1f12c830985b4d262c6a963bc0949facd17;p=fs%2Flustre-release.git diff --git a/lustre/quota/quota_adjust_qunit.c b/lustre/quota/quota_adjust_qunit.c index 45f8c38..d1426f7 100644 --- a/lustre/quota/quota_adjust_qunit.c +++ b/lustre/quota/quota_adjust_qunit.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. @@ -28,14 +26,14 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif + #define DEBUG_SUBSYSTEM S_LQUOTA #ifdef __KERNEL__ @@ -62,8 +60,6 @@ #include #include "quota_internal.h" -#ifdef HAVE_QUOTA_SUPPORT - #ifdef __KERNEL__ /** * This function is charge of recording lqs_ino_rec and @@ -284,94 +280,3 @@ int filter_quota_adjust_qunit(struct obd_export *exp, RETURN(rc); } #endif /* __KERNEL__ */ -#endif - -int client_quota_adjust_qunit(struct obd_export *exp, - struct quota_adjust_qunit *oqaq, - struct lustre_quota_ctxt *qctxt, - struct ptlrpc_request_set *rqset) -{ - struct ptlrpc_request *req; - struct quota_adjust_qunit *oqa; - int rc = 0; - ENTRY; - - /* client don't support this kind of operation, abort it */ - if (!(exp->exp_connect_flags & OBD_CONNECT_CHANGE_QS)) { - CDEBUG(D_QUOTA, "osc: %s don't support change qunit size\n", - exp->exp_obd->obd_name); - RETURN(rc); - } - if (strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_OSC_NAME)) - RETURN(-EINVAL); - - LASSERT(rqset); - - req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), - &RQF_OST_QUOTA_ADJUST_QUNIT, - LUSTRE_OST_VERSION, - OST_QUOTA_ADJUST_QUNIT); - if (req == NULL) - RETURN(-ENOMEM); - - oqa = req_capsule_client_get(&req->rq_pill, &RMF_QUOTA_ADJUST_QUNIT); - *oqa = *oqaq; - - ptlrpc_request_set_replen(req); - - ptlrpc_set_add_req(rqset, req); - RETURN (rc); -} - -int lov_quota_adjust_qunit(struct obd_export *exp, - struct quota_adjust_qunit *oqaq, - struct lustre_quota_ctxt *qctxt, - struct ptlrpc_request_set *rqset) -{ - struct obd_device *obd = class_exp2obd(exp); - struct lov_obd *lov = &obd->u.lov; - int i, err, rc = 0; - unsigned no_set = 0; - ENTRY; - - if (!QAQ_IS_ADJBLK(oqaq)) { - CERROR("bad qaq_flags %x for lov obd.\n", oqaq->qaq_flags); - RETURN(-EFAULT); - } - - - if (rqset == NULL) { - rqset = ptlrpc_prep_set(); - if (!rqset) - RETURN(-ENOMEM); - no_set = 1; - } - - obd_getref(obd); - for (i = 0; i < lov->desc.ld_tgt_count; i++) { - - if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) { - CDEBUG(D_HA, "ost %d is inactive\n", i); - continue; - } - - err = obd_quota_adjust_qunit(lov->lov_tgts[i]->ltd_exp, oqaq, - NULL, rqset); - if (err) { - if (lov->lov_tgts[i]->ltd_active && !rc) - rc = err; - continue; - } - } - - err = ptlrpc_set_wait(rqset); - if (!rc) - rc = err; - - /* Destroy the set if none was provided by the caller */ - if (no_set) - ptlrpc_set_destroy(rqset); - - obd_putref(obd); - RETURN(rc); -}