Whamcloud - gitweb
LU-6529 ldlm: cancel aged locks for LRUR
[fs/lustre-release.git] / lustre / osc / osc_quota.c
index f22447b..1524ea7 100644 (file)
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * 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)
+static inline struct osc_quota_info *osc_oqi_alloc(u32 id)
 {
        struct osc_quota_info *oqi;
 
@@ -75,7 +72,7 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
                                                : OBD_FL_NO_GRPQUOTA)
 
 int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
-                    obd_flag valid, obd_flag flags)
+                   u64 valid, u32 flags)
 {
        int type;
        int rc = 0;
@@ -147,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;
+       u32 uid;
 
        LASSERT(key != NULL);
-       uid = *((obd_uid*)key);
-       oqi = cfs_hlist_entry(hnode, struct osc_quota_info, oqi_hash);
+       uid = *((u32 *)key);
+       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);
 }
@@ -284,49 +281,3 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp,
 
         RETURN(rc);
 }
-
-int osc_quotacheck(struct obd_device *unused, struct obd_export *exp,
-                   struct obd_quotactl *oqctl)
-{
-        struct client_obd       *cli = &exp->exp_obd->u.cli;
-        struct ptlrpc_request   *req;
-        struct obd_quotactl     *body;
-        int                      rc;
-        ENTRY;
-
-        req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
-                                        &RQF_OST_QUOTACHECK, LUSTRE_OST_VERSION,
-                                        OST_QUOTACHECK);
-        if (req == NULL)
-                RETURN(-ENOMEM);
-
-        body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
-        *body = *oqctl;
-
-        ptlrpc_request_set_replen(req);
-
-        /* the next poll will find -ENODATA, that means quotacheck is
-         * going on */
-        cli->cl_qchk_stat = -ENODATA;
-        rc = ptlrpc_queue_wait(req);
-        if (rc)
-                cli->cl_qchk_stat = rc;
-        ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk)
-{
-        struct client_obd *cli = &exp->exp_obd->u.cli;
-        int rc;
-        ENTRY;
-
-        qchk->obd_uuid = cli->cl_target_uuid;
-        memcpy(qchk->obd_type, LUSTRE_OST_NAME, strlen(LUSTRE_OST_NAME));
-
-        rc = cli->cl_qchk_stat;
-        /* the client is not the previous one */
-        if (rc == CL_NOT_QUOTACHECKED)
-                rc = -EINTR;
-        RETURN(rc);
-}