Whamcloud - gitweb
test_brw/echo: verify == (objid != 0), highmem == (objid & 1), test default objid...
authoreeb <eeb>
Thu, 22 Aug 2002 13:34:20 +0000 (13:34 +0000)
committereeb <eeb>
Thu, 22 Aug 2002 13:34:20 +0000 (13:34 +0000)
lustre/obdclass/class_obd.c
lustre/obdecho/echo.c

index 4c67ad4..4b2b079 100644 (file)
@@ -53,8 +53,6 @@ unsigned long obd_fail_loc = 0;
 unsigned long obd_timeout = 100;
 char obd_recovery_upcall[128] = "/usr/lib/lustre/ha_assist";
 
-int  obdclass_highmem = 0;
-
 extern struct obd_type *class_nm_to_type(char *nm);
 
 /*  opening /dev/obd */
@@ -498,6 +496,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                 struct brw_page *pga, *pgp;
                 int             j;
                 unsigned long off;
+                int   highmem;
+                int   verify;
                 __u64 id;
 
                 if (!cbd)
@@ -517,11 +517,13 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
 
                 memset(&smd, 0, sizeof(smd));
                 id = smd.lmd_object_id = data->ioc_obdo1.o_id;
-
+                highmem = (id & 1) != 0;
+                verify = (id != 0);
+                
                 off = data->ioc_offset;
 
                 for (j = 0, pgp = pga; j < pages; j++, off += PAGE_SIZE, pgp++){
-                        pgp->pg = alloc_pages(obdclass_highmem ? GFP_HIGHUSER : GFP_KERNEL, 0);
+                        pgp->pg = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL, 0);
                         if (!pgp->pg) {
                                 CERROR("no memory for brw pages\n");
                                 GOTO(brw_cleanup, err = -ENOMEM);
@@ -530,7 +532,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                         pgp->off = off;
                         pgp->flag = 0;
 
-                        if (rw == OBD_BRW_WRITE) {
+                        if (verify && (rw == OBD_BRW_WRITE)) {
                                 page_debug_setup(kmap(pgp->pg), pgp->count,
                                                  pgp->off, id);
                                 kunmap(pgp->pg);
@@ -542,15 +544,17 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
         brw_cleanup:
                 for (j = 0, pgp = pga; j < pages; j++, pgp++) {
                         if (pgp->pg != NULL) {
-                                int err2;
-                                void *addr = kmap(pgp->pg);
-
-                                err2 = page_debug_check("test_brw", addr,
-                                                        PAGE_SIZE, pgp->off,id);
+                                if (verify) 
+                                {
+                                        void *addr = kmap(pgp->pg);
+                                        int err2 = page_debug_check("test_brw", addr,
+                                                                    PAGE_SIZE, pgp->off,id);
+                                        
+                                        if (!err)
+                                                err = err2;
+                                }
                                 kunmap(pgp->pg);
                                 __free_pages(pgp->pg, 0);
-                                if (!err)
-                                        err = err2;
                         }
                 }
         brw_free:
index a63f67e..3d05d60 100644 (file)
@@ -11,8 +11,8 @@
  * by Peter Braam <braam@clusterfs.com>
  */
 
-static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.25 2002/08/21 22:17:39 eeb Exp $";
-#define OBDECHO_VERSION "$Revision: 1.25 $"
+static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.26 2002/08/22 13:34:20 eeb Exp $";
+#define OBDECHO_VERSION "$Revision: 1.26 $"
 
 #define EXPORT_SYMTAB
 
@@ -43,8 +43,6 @@ static long echo_pages = 0;
 static atomic_t echo_page_rws;
 static atomic_t echo_getattrs;
 
-int obdecho_highmem = 0;
-
 #define ECHO_PROC_STAT "sys/obdecho"
 
 int
@@ -152,10 +150,12 @@ int echo_preprw(int cmd, struct lustre_handle *conn, int objcount,
         *desc_private = (void *)DESC_PRIV;
 
         for (i = 0; i < objcount; i++, obj++) {
+                int highmem = (obj->ioo_id & 1) != 0;
+                int verify  = obj->ioo_id != 0;
                 int j;
 
                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, nb++, r++) {
-                        r->page = alloc_pages(obdecho_highmem ? GFP_HIGHUSER : GFP_KERNEL, 0);
+                        r->page = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL, 0);
                         if (!r->page) {
                                 CERROR("can't get page %d/%d for id "LPU64"\n",
                                        j, obj->ioo_bufcnt, obj->ioo_id);
@@ -169,7 +169,8 @@ int echo_preprw(int cmd, struct lustre_handle *conn, int objcount,
 
                         CDEBUG(D_PAGE, "$$$$ get page %p, addr %p@"LPU64"\n",
                                r->page, r->addr, r->offset);
-                        if (cmd & OBD_BRW_READ)
+
+                        if (verify && (cmd & OBD_BRW_READ) != 0)
                                 page_debug_setup(r->addr, r->len, r->offset,
                                                  obj->ioo_id);
                 }
@@ -215,6 +216,7 @@ int echo_commitrw(int cmd, struct lustre_handle *conn, int objcount,
         LASSERT(desc_private == (void *)DESC_PRIV);
 
         for (i = 0; i < objcount; i++, obj++) {
+                int verify = obj->ioo_id != 0;
                 int j;
 
                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, r++) {
@@ -233,7 +235,8 @@ int echo_commitrw(int cmd, struct lustre_handle *conn, int objcount,
 
                         CDEBUG(D_PAGE, "$$$$ use page %p, addr %p@"LPU64"\n",
                                r->page, addr, r->offset);
-                        if (cmd & OBD_BRW_WRITE)
+
+                        if (verify && (cmd & OBD_BRW_WRITE))
                                 page_debug_check("echo", addr, r->len,
                                                  r->offset, obj->ioo_id);