[sheepdog] [PATCH 4/4] collie: use snapid zero for the current vdi

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Mar 11 06:39:14 CET 2013


Using non-zero snapid for the current vdi is confusing.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/common.c |  4 +++-
 tests/029.out   |  6 +++---
 tests/031.out   | 12 ++++++------
 tests/039.out   | 10 +++++-----
 tests/040.out   |  4 ++--
 tests/041.out   | 10 +++++-----
 tests/043.out   | 16 ++++++++--------
 tests/046.out   |  6 +++---
 tests/047.out   |  2 +-
 tests/048.out   |  4 ++--
 tests/052.out   | 18 +++++++++---------
 11 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/collie/common.c b/collie/common.c
index 90501c7..1e2e36e 100644
--- a/collie/common.c
+++ b/collie/common.c
@@ -159,6 +159,7 @@ int parse_vdi(vdi_parser_func_t func, size_t size, void *data)
 
 	for (nr = 0; nr < SD_NR_VDIS; nr++) {
 		uint64_t oid;
+		uint32_t snapid;
 
 		if (!test_bit(nr, vdi_inuse))
 			continue;
@@ -190,7 +191,8 @@ int parse_vdi(vdi_parser_func_t func, size_t size, void *data)
 			}
 		}
 
-		func(i.vdi_id, i.name, i.tag, i.snap_id, 0, &i, data);
+		snapid = is_current(&i) ? 0: i.snap_id;
+		func(i.vdi_id, i.name, i.tag, snapid, 0, &i, data);
 	}
 
 out:
diff --git a/tests/029.out b/tests/029.out
index 57d224f..050745a 100644
--- a/tests/029.out
+++ b/tests/029.out
@@ -1,9 +1,9 @@
 QA output created by 029
 using backend farm store
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test4        1   20 MB   20 MB  0.0 MB DATE   fd2de3     4              
-  test3        1   20 MB   20 MB  0.0 MB DATE   fd3662     3              
-  test2        2   20 MB  0.0 MB   20 MB DATE   fd3816     2              
+  test4        0   20 MB   20 MB  0.0 MB DATE   fd2de3     4              
+  test3        0   20 MB   20 MB  0.0 MB DATE   fd3662     3              
+  test2        0   20 MB  0.0 MB   20 MB DATE   fd3816     2              
 Looking for the object 0xfd381500000001 (the inode vid 0xfd3816 idx 1) with 7 nodes
 
 127.0.0.1:7000 doesn't have the object
diff --git a/tests/031.out b/tests/031.out
index 175c386..95e0f4b 100644
--- a/tests/031.out
+++ b/tests/031.out
@@ -1,10 +1,10 @@
 QA output created by 031
 using backend farm store
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test1        1  100 MB  0.0 MB  0.0 MB DATE   fd32fc     1              
-  test3        1  300 MB  0.0 MB  0.0 MB DATE   fd3662     1              
-  test2        1  200 MB  0.0 MB  0.0 MB DATE   fd3815     1              
+  test1        0  100 MB  0.0 MB  0.0 MB DATE   fd32fc     1              
+  test3        0  300 MB  0.0 MB  0.0 MB DATE   fd3662     1              
+  test2        0  200 MB  0.0 MB  0.0 MB DATE   fd3815     1              
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test1        1  100 MB  0.0 MB  0.0 MB DATE   fd32fc     1              
-  test3        1  300 MB  0.0 MB  0.0 MB DATE   fd3662     1              
-  test2        1  200 MB  0.0 MB  0.0 MB DATE   fd3815     1              
+  test1        0  100 MB  0.0 MB  0.0 MB DATE   fd32fc     1              
+  test3        0  300 MB  0.0 MB  0.0 MB DATE   fd3662     1              
+  test2        0  200 MB  0.0 MB  0.0 MB DATE   fd3815     1              
diff --git a/tests/039.out b/tests/039.out
index d51b867..d4e5894 100644
--- a/tests/039.out
+++ b/tests/039.out
@@ -9,7 +9,7 @@ read 512/512 bytes at offset 0
 test---[DATE]---(you are here)
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
-  test         2  4.0 GB  0.0 MB  4.0 MB DATE   7c2b26     3              
+  test         0  4.0 GB  0.0 MB  4.0 MB DATE   7c2b26     3              
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 512/512 bytes at offset 0
@@ -21,14 +21,14 @@ test---[DATE]-+-[DATE]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2  4.0 GB  4.0 MB  0.0 MB DATE   7c2b26     3         snap2
-  test         3  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
+  test         0  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 test---[DATE]---[DATE]---(you are here)
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2  4.0 GB  4.0 MB  0.0 MB DATE   7c2b26     3         snap2
-  test         3  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
+  test         0  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 test---[DATE]-+-[DATE]
@@ -36,7 +36,7 @@ test---[DATE]-+-[DATE]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2  4.0 GB  4.0 MB  0.0 MB DATE   7c2b26     3         snap2
-  test         3  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
+  test         0  4.0 GB  0.0 MB  4.0 MB DATE   7c2b27     3              
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 512/512 bytes at offset 0
@@ -53,4 +53,4 @@ s test         1  4.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2  4.0 GB  4.0 MB  0.0 MB DATE   7c2b26     3         snap2
 s test         3  4.0 GB  4.0 MB  0.0 MB DATE   7c2b27     3         snap3
 s test         4  4.0 GB  4.0 MB  0.0 MB DATE   7c2b28     3         snap4
-  test         5  4.0 GB  0.0 MB  4.0 MB DATE   7c2b29     3              
+  test         0  4.0 GB  0.0 MB  4.0 MB DATE   7c2b29     3              
diff --git a/tests/040.out b/tests/040.out
index 489d90e..7e7f4d3 100644
--- a/tests/040.out
+++ b/tests/040.out
@@ -1,6 +1,6 @@
 QA output created by 040
 using backend farm store
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     1              
+  test         0  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     1              
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     1              
+  test         0  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     1              
diff --git a/tests/041.out b/tests/041.out
index a22d241..34454ee 100644
--- a/tests/041.out
+++ b/tests/041.out
@@ -4,7 +4,7 @@ using backend farm store
 s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
 s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
-  test         4   12 MB  0.0 MB  8.0 MB DATE   7c2b28     3              
+  test         0   12 MB  0.0 MB  8.0 MB DATE   7c2b28     3              
 test---[DATE]---[DATE]---[DATE]---(you are here)
 b6338c1861851820f8d289c3b4e6443c  -
 1885611ba75e996f619e8eaf136366e6  -
@@ -14,7 +14,7 @@ s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
 s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
 s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
 s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b28     3              
-  test         5   12 MB  0.0 MB  8.0 MB DATE   7c2b29     3              
+  test         0   12 MB  0.0 MB  8.0 MB DATE   7c2b29     3              
 test---[DATE]-+-[DATE]---[DATE]---(you are here)
                           `-[DATE]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
@@ -23,7 +23,7 @@ s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
 s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
 s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b28     3              
 s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
-  test         6   12 MB  0.0 MB  8.0 MB DATE   7c2b2a     3              
+  test         0   12 MB  0.0 MB  8.0 MB DATE   7c2b2a     3              
 test---[DATE]-+-[DATE]---[DATE]---(you are here)
                           `-[DATE]---[DATE]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
@@ -33,7 +33,7 @@ s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
 s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b28     3              
 s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
 s test         6   12 MB  8.0 MB  0.0 MB DATE   7c2b2a     3              
-  test         7   12 MB  0.0 MB  8.0 MB DATE   7c2b2b     3              
+  test         0   12 MB  0.0 MB  8.0 MB DATE   7c2b2b     3              
 test---[DATE]-+-[DATE]---[DATE]---(you are here)
                           |-[DATE]---[DATE]
                           `-[DATE]
@@ -45,7 +45,7 @@ s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b28     3
 s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
 s test         6   12 MB  8.0 MB  0.0 MB DATE   7c2b2a     3              
 s test         7   12 MB  4.0 MB  4.0 MB DATE   7c2b2b     3              
-  test         8   12 MB  0.0 MB  8.0 MB DATE   7c2b2c     3              
+  test         0   12 MB  0.0 MB  8.0 MB DATE   7c2b2c     3              
 test---[DATE]-+-[DATE]-+-[DATE]---(you are here)
                           |                    `-[DATE]
                           |-[DATE]---[DATE]
diff --git a/tests/043.out b/tests/043.out
index 201e2f9..34d8029 100644
--- a/tests/043.out
+++ b/tests/043.out
@@ -112,14 +112,14 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127.0.0.1:7004]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
-  test2        1   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
+  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
+  test2        0   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
-  test2        1   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
+  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
+  test2        0   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
-  test2        1   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
+  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
+  test2        0   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
-  test2        1   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
+  test         0   40 MB   40 MB  0.0 MB DATE   7c2b25     3              
+  test2        0   20 MB  0.0 MB  0.0 MB DATE   fd3815     3              
diff --git a/tests/046.out b/tests/046.out
index 96adc2b..4ef4c09 100644
--- a/tests/046.out
+++ b/tests/046.out
@@ -3,18 +3,18 @@ using backend farm store
 delete snapshot image before current one
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     2          snap
-  test         2  4.0 GB  0.0 MB  0.0 MB DATE   7c2b26     2              
+  test         0  4.0 GB  0.0 MB  0.0 MB DATE   7c2b26     2              
 Cannot get VDI info for test 0 snap: Failed to find requested tag
 Failed to open VDI test
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         2  4.0 GB  0.0 MB  0.0 MB DATE   7c2b26     2              
+  test         0  4.0 GB  0.0 MB  0.0 MB DATE   7c2b26     2              
 Cannot get VDI info for test 0 : No VDI found
 Failed to open VDI test
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 delete current image before snapshot one
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
 s test         1  4.0 GB  0.0 MB  0.0 MB DATE   7c2b25     2          snap
-  test         2  4.0 GB  0.0 MB  0.0 MB DATE   7c2b27     2              
+  test         0  4.0 GB  0.0 MB  0.0 MB DATE   7c2b27     2              
 Cannot get VDI info for test 0 : No VDI found
 Failed to open VDI test
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
diff --git a/tests/047.out b/tests/047.out
index 4bd7363..75ee250 100644
--- a/tests/047.out
+++ b/tests/047.out
@@ -1,5 +1,5 @@
 QA output created by 047
 using backend farm store
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1  4.0 GB  8.0 MB  0.0 MB DATE   7c2b25     1              
+  test         0  4.0 GB  8.0 MB  0.0 MB DATE   7c2b25     1              
 hello sheepdog
diff --git a/tests/048.out b/tests/048.out
index 7b71326..3849cde 100644
--- a/tests/048.out
+++ b/tests/048.out
@@ -64,8 +64,8 @@ obj 7c2b2500000001 locations at epoch 5, copies = 3
 127.0.0.1:7001
 127.0.0.1:7004
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1  1.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3              
-= test 1 1073741824 4194304 0 MASKED 7c2b25 3
+  test         0  1.0 GB  4.0 MB  0.0 MB DATE   7c2b25     3              
+= test 0 1073741824 4194304 0 MASKED 7c2b25 3
 finish check&repair test
 fixed replica 7c2b2500000001
 fixed replica 7c2b2500000001
diff --git a/tests/052.out b/tests/052.out
index 23ad723..7fef873 100644
--- a/tests/052.out
+++ b/tests/052.out
@@ -58,7 +58,7 @@ Epoch Time           Version
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -67,7 +67,7 @@ Epoch Time           Version
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -76,7 +76,7 @@ Epoch Time           Version
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -85,7 +85,7 @@ Epoch Time           Version
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -95,7 +95,7 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -105,7 +105,7 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -115,7 +115,7 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -125,7 +125,7 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
 Cluster status: running
 
 Cluster created at DATE
@@ -135,4 +135,4 @@ DATE      3 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127
 DATE      2 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7004]
 DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003]
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
-  test         1   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
+  test         0   20 MB   20 MB  0.0 MB DATE   7c2b25     3              
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list