Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / obdecho / echo_client.c
index ef16000..00cd063 100644 (file)
@@ -543,7 +543,7 @@ static int echo_client_kbrw(struct obd_device *obd, int rw, struct obdo *oa,
                 LASSERT (pgp->pg == NULL);      /* for cleanup */
 
                 rc = -ENOMEM;
-                pgp->pg = cfs_alloc_page (gfp_mask);
+                OBD_PAGE_ALLOC(pgp->pg, gfp_mask);
                 if (pgp->pg == NULL)
                         goto out;
 
@@ -575,84 +575,13 @@ static int echo_client_kbrw(struct obd_device *obd, int rw, struct obdo *oa,
                         if (vrc != 0 && rc == 0)
                                 rc = vrc;
                 }
-                cfs_free_page(pgp->pg);
+                OBD_PAGE_FREE(pgp->pg);
         }
         OBD_FREE(pga, npages * sizeof(*pga));
         return (rc);
 }
 
 #ifdef __KERNEL__
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/iobuf.h>
-
-static int echo_client_ubrw(struct obd_device *obd, int rw,
-                            struct obdo *oa, struct lov_stripe_md *lsm,
-                            obd_off offset, obd_size count, char *buffer,
-                            struct obd_trans_info *oti)
-{
-        struct echo_client_obd *ec = &obd->u.echo_client;
-        struct obd_info         oinfo = { { { 0 } } };
-        obd_count               npages;
-        struct brw_page        *pga;
-        struct brw_page        *pgp;
-        obd_off                 off;
-        struct kiobuf          *kiobuf;
-        int                     i;
-        int                     rc;
-
-        LASSERT (rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
-
-        /* NB: for now, only whole pages, page aligned */
-
-        if (count <= 0 ||
-            ((long)buffer & (~CFS_PAGE_MASK)) != 0 ||
-            (count & (~CFS_PAGE_MASK)) != 0 ||
-            (lsm != NULL && lsm->lsm_object_id != oa->o_id))
-                return (-EINVAL);
-
-        /* XXX think again with misaligned I/O */
-        npages = count >> CFS_PAGE_SHIFT;
-
-        OBD_ALLOC(pga, npages * sizeof(*pga));
-        if (pga == NULL)
-                return (-ENOMEM);
-
-        rc = alloc_kiovec (1, &kiobuf);
-        if (rc != 0)
-                goto out_1;
-
-        rc = map_user_kiobuf ((rw == OBD_BRW_READ) ? READ : WRITE,
-                              kiobuf, (unsigned long)buffer, count);
-        if (rc != 0)
-                goto out_2;
-
-        LASSERT (kiobuf->offset == 0);
-        LASSERT (kiobuf->nr_pages == npages);
-
-        for (i = 0, off = offset, pgp = pga;
-             i < npages;
-             i++, off += CFS_PAGE_SIZE, pgp++) {
-                pgp->off = off;
-                pgp->pg = kiobuf->maplist[i];
-                pgp->count = CFS_PAGE_SIZE;
-                pgp->flag = 0;
-        }
-
-        oinfo.oi_oa = oa;
-        oinfo.oi_md = lsm;
-        rc = obd_brw(rw, ec->ec_exp, &oinfo, npages, pga, oti);
-
-        //        if (rw == OBD_BRW_READ)
-        //                mark_dirty_kiobuf (kiobuf, count);
-
-        unmap_kiobuf (kiobuf);
- out_2:
-        free_kiovec (1, &kiobuf);
- out_1:
-        OBD_FREE(pga, npages * sizeof(*pga));
-        return (rc);
-}
-#else
 static int echo_client_ubrw(struct obd_device *obd, int rw,
                             struct obdo *oa, struct lov_stripe_md *lsm,
                             obd_off offset, obd_size count, char *buffer,
@@ -663,7 +592,6 @@ static int echo_client_ubrw(struct obd_device *obd, int rw,
         return 0;
 }
 #endif
-#endif
 
 struct echo_async_state;
 
@@ -806,13 +734,14 @@ static int echo_client_async_page(struct obd_export *exp, int rw,
         /* prepare the group of pages that we're going to be keeping
          * in flight */
         for (i = 0; i < npages; i++) {
-                cfs_page_t *page = cfs_alloc_page(CFS_ALLOC_STD);
+                cfs_page_t *page;
+                OBD_PAGE_ALLOC(page, CFS_ALLOC_STD);
                 if (page == NULL)
                         GOTO(out, rc = -ENOMEM);
 
                 OBD_ALLOC(eap, sizeof(*eap));
                 if (eap == NULL) {
-                        cfs_free_page(page);
+                        OBD_PAGE_FREE(page);
                         GOTO(out, rc = -ENOMEM);
                 }
 
@@ -907,7 +836,7 @@ out:
                                 obd_teardown_async_page(exp, lsm, NULL,
                                                         eap->eap_cookie);
                         OBD_FREE(eap, sizeof(*eap));
-                        cfs_free_page(page);
+                        OBD_PAGE_FREE(page);
                 }
                 OBD_FREE(aps, npages * sizeof aps[0]);
         }