[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 11 of 21] blktap3/drivers: Introduce I/O request filtering functionality



This patch copies from blktap2 what seems to be I/O request filtering
functionality (e.g. failure injection, data integrity check), with changes
coming from blktap2.5.

Signed-off-by: Thanos Makatos <thanos.makatos@xxxxxxxxxx>

diff --git a/tools/blktap2/drivers/tapdisk-filter.c 
b/tools/blktap3/drivers/tapdisk-filter.c
copy from tools/blktap2/drivers/tapdisk-filter.c
copy to tools/blktap3/drivers/tapdisk-filter.c
--- a/tools/blktap2/drivers/tapdisk-filter.c
+++ b/tools/blktap3/drivers/tapdisk-filter.c
@@ -1,5 +1,7 @@
 /* 
- * Copyright (c) 2008, XenSource Inc.
+ * Copyright (c) 2007, XenSource Inc.
+ * Copyright (c) 2010, Citrix Systems, Inc.
+ *
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -113,11 +115,10 @@ check_hash(struct tfilter *filter, uint6
        if (hash->hash != chksum(buf)) {
                struct timeval now;
                gettimeofday(&now, NULL);
-               DBG("%s: hash table: 0x%020" PRIx64 " at %012lu.%06llu, "
-                   "from disk: 0x%020" PRIx64 " at %012lu.%06llu\n",
+               DBG("%s: hash table: 0x%020" PRIx64 " at %012lu.%06lu, "
+                   "from disk: 0x%020" PRIx64 " at %012lu.%06lu\n",
                    type, hash->hash, hash->time.tv_sec,
-                   (unsigned long long)hash->time.tv_usec, sum,
-                   now.tv_sec, (unsigned long long)now.tv_usec);
+                   hash->time.tv_usec, sum, now.tv_sec, now.tv_usec);
        }
 }
 
@@ -134,13 +135,9 @@ insert_hash(struct tfilter *filter, uint
 static void
 check_sector(struct tfilter *filter, int type, int rw, uint64_t sec, char *buf)
 {
-       struct dhash *hash;
-
        if (sec >= filter->secs)
                return;
 
-       hash = filter->dhash + sec;
-
        if (rw) {
                if (type == PRE_CHECK)
                        insert_hash(filter, sec, buf);
@@ -156,7 +153,7 @@ static void
 check_data(struct tfilter *filter, int type, struct iocb *io)
 {
        int rw;
-       uint64_t i, sec;
+    uint64_t i;
 
        rw = (io->aio_lio_opcode == IO_CMD_PWRITE);
 
diff --git a/tools/blktap2/drivers/tapdisk-filter.h 
b/tools/blktap3/drivers/tapdisk-filter.h
copy from tools/blktap2/drivers/tapdisk-filter.h
copy to tools/blktap3/drivers/tapdisk-filter.h

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.