These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / lov / lov_request.c
index 933e2d1..1a150c2 100644 (file)
@@ -67,23 +67,11 @@ void lov_finish_set(struct lov_request_set *set)
                list_del_init(&req->rq_link);
 
                if (req->rq_oi.oi_oa)
-                       OBDO_FREE(req->rq_oi.oi_oa);
-               if (req->rq_oi.oi_md)
-                       OBD_FREE_LARGE(req->rq_oi.oi_md, req->rq_buflen);
-               if (req->rq_oi.oi_osfs)
-                       OBD_FREE(req->rq_oi.oi_osfs,
-                                sizeof(*req->rq_oi.oi_osfs));
-               OBD_FREE(req, sizeof(*req));
+                       kmem_cache_free(obdo_cachep, req->rq_oi.oi_oa);
+               kfree(req->rq_oi.oi_osfs);
+               kfree(req);
        }
-
-       if (set->set_pga) {
-               int len = set->set_oabufs * sizeof(*set->set_pga);
-               OBD_FREE_LARGE(set->set_pga, len);
-       }
-       if (set->set_lockh)
-               lov_llh_put(set->set_lockh);
-
-       OBD_FREE(set, sizeof(*set));
+       kfree(set);
 }
 
 int lov_set_finished(struct lov_request_set *set, int idempotent)
@@ -214,7 +202,7 @@ static int common_attr_done(struct lov_request_set *set)
        if (!atomic_read(&set->set_success))
                return -EIO;
 
-       OBDO_ALLOC(tmp_oa);
+       tmp_oa = kmem_cache_alloc(obdo_cachep, GFP_NOFS | __GFP_ZERO);
        if (tmp_oa == NULL) {
                rc = -ENOMEM;
                goto out;
@@ -248,7 +236,7 @@ static int common_attr_done(struct lov_request_set *set)
        memcpy(set->set_oi->oi_oa, tmp_oa, sizeof(*set->set_oi->oi_oa));
 out:
        if (tmp_oa)
-               OBDO_FREE(tmp_oa);
+               kmem_cache_free(obdo_cachep, tmp_oa);
        return rc;
 
 }
@@ -286,8 +274,8 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
        struct lov_obd *lov = &exp->exp_obd->u.lov;
        int rc = 0, i;
 
-       OBD_ALLOC(set, sizeof(*set));
-       if (set == NULL)
+       set = kzalloc(sizeof(*set), GFP_NOFS);
+       if (!set)
                return -ENOMEM;
        lov_init_set(set);
 
@@ -312,8 +300,8 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
                        continue;
                }
 
-               OBD_ALLOC(req, sizeof(*req));
-               if (req == NULL) {
+               req = kzalloc(sizeof(*req), GFP_NOFS);
+               if (!req) {
                        rc = -ENOMEM;
                        goto out_set;
                }
@@ -321,9 +309,10 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
                req->rq_stripe = i;
                req->rq_idx = loi->loi_ost_idx;
 
-               OBDO_ALLOC(req->rq_oi.oi_oa);
+               req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
+                                                   GFP_NOFS | __GFP_ZERO);
                if (req->rq_oi.oi_oa == NULL) {
-                       OBD_FREE(req, sizeof(*req));
+                       kfree(req);
                        rc = -ENOMEM;
                        goto out_set;
                }
@@ -331,7 +320,6 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
                       sizeof(*req->rq_oi.oi_oa));
                req->rq_oi.oi_oa->o_oi = loi->loi_oi;
                req->rq_oi.oi_cb_up = cb_getattr_update;
-               req->rq_oi.oi_capa = oinfo->oi_capa;
 
                lov_set_add_req(req, set);
        }
@@ -369,8 +357,8 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo,
        struct lov_obd *lov = &exp->exp_obd->u.lov;
        int rc = 0, i;
 
-       OBD_ALLOC(set, sizeof(*set));
-       if (set == NULL)
+       set = kzalloc(sizeof(*set), GFP_NOFS);
+       if (!set)
                return -ENOMEM;
        lov_init_set(set);
 
@@ -395,8 +383,8 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo,
                        continue;
                }
 
-               OBD_ALLOC(req, sizeof(*req));
-               if (req == NULL) {
+               req = kzalloc(sizeof(*req), GFP_NOFS);
+               if (!req) {
                        rc = -ENOMEM;
                        goto out_set;
                }
@@ -404,9 +392,10 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo,
                req->rq_stripe = i;
                req->rq_idx = loi->loi_ost_idx;
 
-               OBDO_ALLOC(req->rq_oi.oi_oa);
+               req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
+                                                   GFP_NOFS | __GFP_ZERO);
                if (req->rq_oi.oi_oa == NULL) {
-                       OBD_FREE(req, sizeof(*req));
+                       kfree(req);
                        rc = -ENOMEM;
                        goto out_set;
                }
@@ -488,8 +477,8 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
        struct lov_obd *lov = &exp->exp_obd->u.lov;
        int rc = 0, i;
 
-       OBD_ALLOC(set, sizeof(*set));
-       if (set == NULL)
+       set = kzalloc(sizeof(*set), GFP_NOFS);
+       if (!set)
                return -ENOMEM;
        lov_init_set(set);
 
@@ -511,17 +500,18 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
                        continue;
                }
 
-               OBD_ALLOC(req, sizeof(*req));
-               if (req == NULL) {
+               req = kzalloc(sizeof(*req), GFP_NOFS);
+               if (!req) {
                        rc = -ENOMEM;
                        goto out_set;
                }
                req->rq_stripe = i;
                req->rq_idx = loi->loi_ost_idx;
 
-               OBDO_ALLOC(req->rq_oi.oi_oa);
+               req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
+                                                   GFP_NOFS | __GFP_ZERO);
                if (req->rq_oi.oi_oa == NULL) {
-                       OBD_FREE(req, sizeof(*req));
+                       kfree(req);
                        rc = -ENOMEM;
                        goto out_set;
                }
@@ -530,7 +520,6 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
                req->rq_oi.oi_oa->o_oi = loi->loi_oi;
                req->rq_oi.oi_oa->o_stripe_idx = i;
                req->rq_oi.oi_cb_up = cb_setattr_update;
-               req->rq_oi.oi_capa = oinfo->oi_capa;
 
                if (oinfo->oi_oa->o_valid & OBD_MD_FLSIZE) {
                        int off = lov_stripe_offset(oinfo->oi_md,
@@ -619,8 +608,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
                                if (tmp & 1) {
                                        if (quit)
                                                break;
-                                       else
-                                               quit = 1;
+                                       quit = 1;
                                        shift = 0;
                                }
                                tmp >>= 1;
@@ -716,8 +704,8 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
        struct lov_obd *lov = &obd->u.lov;
        int rc = 0, i;
 
-       OBD_ALLOC(set, sizeof(*set));
-       if (set == NULL)
+       set = kzalloc(sizeof(*set), GFP_NOFS);
+       if (!set)
                return -ENOMEM;
        lov_init_set(set);
 
@@ -742,15 +730,16 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
                        continue;
                }
 
-               OBD_ALLOC(req, sizeof(*req));
-               if (req == NULL) {
+               req = kzalloc(sizeof(*req), GFP_NOFS);
+               if (!req) {
                        rc = -ENOMEM;
                        goto out_set;
                }
 
-               OBD_ALLOC(req->rq_oi.oi_osfs, sizeof(*req->rq_oi.oi_osfs));
-               if (req->rq_oi.oi_osfs == NULL) {
-                       OBD_FREE(req, sizeof(*req));
+               req->rq_oi.oi_osfs = kzalloc(sizeof(*req->rq_oi.oi_osfs),
+                                            GFP_NOFS);
+               if (!req->rq_oi.oi_osfs) {
+                       kfree(req);
                        rc = -ENOMEM;
                        goto out_set;
                }