Whamcloud - gitweb
LU-6042 osc: osc_object_ast_clear() LBUG
[fs/lustre-release.git] / lustre / osc / osc_quota.c
index 0cd9fae..efc3b48 100644 (file)
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  *
- * Copyright (c) 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  *
  * Code originally extracted from quota directory
  */
-#ifndef __KERNEL__
-# include <liblustre.h>
-#endif
 
-#include <obd_ost.h>
+#include <obd.h>
 #include "osc_internal.h"
 
 static inline struct osc_quota_info *osc_oqi_alloc(obd_uid id)
@@ -55,11 +52,8 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
 
                oqi = cfs_hash_lookup(cli->cl_quota_hash[type], &qid[type]);
                if (oqi) {
-                       obd_uid id = oqi->oqi_id;
-
-                       LASSERTF(id == qid[type],
-                                "The ids don't match %u != %u\n",
-                                id, qid[type]);
+                       /* do not try to access oqi here, it could have been
+                        * freed by osc_quota_setdq() */
 
                        /* the slot is busy, the user is about to run out of
                         * quota space on this OST */
@@ -150,48 +144,48 @@ oqi_hashfn(cfs_hash_t *hs, const void *key, unsigned mask)
 }
 
 static int
-oqi_keycmp(const void *key, cfs_hlist_node_t *hnode)
+oqi_keycmp(const void *key, struct hlist_node *hnode)
 {
        struct osc_quota_info *oqi;
        obd_uid uid;
 
        LASSERT(key != NULL);
        uid = *((obd_uid*)key);
-       oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash);
+       oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
 
        return uid == oqi->oqi_id;
 }
 
 static void *
-oqi_key(cfs_hlist_node_t *hnode)
+oqi_key(struct hlist_node *hnode)
 {
        struct osc_quota_info *oqi;
-       oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash);
+       oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
        return &oqi->oqi_id;
 }
 
 static void *
-oqi_object(cfs_hlist_node_t *hnode)
+oqi_object(struct hlist_node *hnode)
 {
-       return cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash);
+       return hlist_entry(hnode, struct osc_quota_info, oqi_hash);
 }
 
 static void
-oqi_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+oqi_get(cfs_hash_t *hs, struct hlist_node *hnode)
 {
 }
 
 static void
-oqi_put_locked(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+oqi_put_locked(cfs_hash_t *hs, struct hlist_node *hnode)
 {
 }
 
 static void
-oqi_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+oqi_exit(cfs_hash_t *hs, struct hlist_node *hnode)
 {
        struct osc_quota_info *oqi;
 
-       oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash);
+       oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
 
         OBD_SLAB_FREE_PTR(oqi, osc_quota_kmem);
 }
@@ -333,40 +327,3 @@ int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk)
                 rc = -EINTR;
         RETURN(rc);
 }
-
-int osc_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);
-}