summaryrefslogtreecommitdiffstats
path: root/qa/rbd/krbd_zeroout.t
blob: 10bb230e8025b2f94906414743ca58939586fe9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
  $ rbd create --size 4M img
  $ DEV=$(sudo rbd map img)

Zero, < 1 block:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 156672 -l 512 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0026400 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0026600 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131584 -l 64512 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  002fe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131584 -l 65024 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0030000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 65024 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  002fe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

Zero, 1 block:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 65536 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0030000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 66048 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0030200 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 130560 -l 66048 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  001fe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0030000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 130560 -l 66560 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  001fe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0030200 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

Zero, < 2 blocks:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 163840 -l 65536 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0028000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0038000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131584 -l 130048 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  003fe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131584 -l 130560 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0040000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 130560 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  003fe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

Zero, 2 blocks:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 131072 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0040000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 131072 -l 131584 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0020000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0040200 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 130560 -l 131584 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  001fe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0040000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 130560 -l 132096 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  001fe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0040200 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

Zero, 37 blocks:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 589824 -l 2424832 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0090000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  02e0000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 589312 -l 2424832 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  008fe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  02dfe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 590336 -l 2424832 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0090200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  02e0200 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

Truncate:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4193792 -l 512 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03ffe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4129280 -l 65024 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03f0200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4128768 -l 65536 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03f0000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4128256 -l 66048 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03efe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4063744 -l 130560 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03e0200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4063232 -l 131072 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03e0000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 4062720 -l 131584 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  03dfe00 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 512 -l 4193792 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0000200 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

Delete:

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 0 -l 4194304 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

Empty clone:

  $ xfs_io -c 'pwrite -S 0xab -w 0 4M' $DEV >/dev/null
  $ sudo rbd unmap $DEV
  $ rbd snap create --no-progress img@snap
  $ rbd snap protect img@snap

  $ rbd clone img@snap cloneimg1
  $ DEV=$(sudo rbd map cloneimg1)
  $ fallocate -z -o 720896 -l 2719744 $DEV
  $ hexdump $DEV
  0000000 abab abab abab abab abab abab abab abab
  *
  00b0000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0348000 abab abab abab abab abab abab abab abab
  *
  0400000
  $ sudo rbd unmap $DEV

  $ rbd clone img@snap cloneimg2
  $ DEV=$(sudo rbd map cloneimg2)
  $ fallocate -z -o 1474560 -l 2719744 $DEV
  $ hexdump $DEV
  0000000 abab abab abab abab abab abab abab abab
  *
  0168000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000
  $ sudo rbd unmap $DEV

  $ rbd clone img@snap cloneimg3
  $ DEV=$(sudo rbd map cloneimg3)
  $ fallocate -z -o 0 -l 4194304 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000
  $ sudo rbd unmap $DEV

Full clone:

  $ rbd clone img@snap cloneimg4
  $ DEV=$(sudo rbd map cloneimg4)

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 720896 -l 2719744 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  00b0000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0348000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 1474560 -l 2719744 $DEV
  $ hexdump $DEV
  0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  0168000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ xfs_io -c 'pwrite -w 0 4M' $DEV >/dev/null
  $ fallocate -z -o 0 -l 4194304 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0400000

  $ sudo rbd unmap $DEV

Multiple object requests:

  $ rbd create --size 50M --stripe-unit 16K --stripe-count 5 fancyimg
  $ DEV=$(sudo rbd map fancyimg)

  $ xfs_io -c 'pwrite -b 4M -w 0 50M' $DEV >/dev/null
  $ fallocate -z -o 0 -l 143360 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0023000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  3200000

  $ xfs_io -c 'pwrite -b 4M -w 0 50M' $DEV >/dev/null
  $ fallocate -z -o 0 -l 286720 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  0046000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  3200000

  $ xfs_io -c 'pwrite -b 4M -w 0 50M' $DEV >/dev/null
  $ fallocate -z -o 0 -l 573440 $DEV
  $ hexdump $DEV
  0000000 0000 0000 0000 0000 0000 0000 0000 0000
  *
  008c000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
  *
  3200000

  $ sudo rbd unmap $DEV

  $ rbd rm --no-progress fancyimg
  $ rbd rm --no-progress cloneimg4
  $ rbd rm --no-progress cloneimg3
  $ rbd rm --no-progress cloneimg2
  $ rbd rm --no-progress cloneimg1
  $ rbd snap unprotect img@snap
  $ rbd snap rm --no-progress img@snap
  $ rbd rm --no-progress img