-
Notifications
You must be signed in to change notification settings - Fork 4
/
inode_fs.dfy
703 lines (642 loc) · 20.2 KB
/
inode_fs.dfy
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
include "../util/std.dfy"
include "../util/marshal.i.dfy"
include "../jrnl/jrnl.s.dfy"
include "super.dfy"
include "inode/mem_inode.dfy"
module InodeFs {
import Arith
import opened Std
import C = Collections
import Inode
import opened MemInodes
import Round
import opened Machine
import opened ByteSlice
import opened JrnlTypes
import opened JrnlSpec
import opened Kinds
import opened FsKinds
import opened Marshal
ghost function zero_lookup(m: map<Blkno, Block>, bn: Blkno): Block
requires blkno_dom(m)
requires blkno_ok(bn)
{
if bn == 0
then block0
else m[bn]
}
ghost predicate blkno_dom<T>(m: map<Blkno, T>)
{
forall bn: Blkno :: blkno_ok(bn) <==> bn in m
}
ghost predicate ino_dom<T>(m: map<Ino, T>)
{
forall ino: Ino :: ino in m
}
class InodeFilesys<AllocState(!new)>
{
// inodes, block_used, and data_block are basically just the data in the
// journal (except block_used additionally has inode owners)
// encoded inodes on disk
ghost var inodes: map<Ino, Inode.Inode>
ghost var cur_inode: Option<(Ino, Inode.Inode)>
// allocator state + some stuff
ghost var block_used: map<Blkno, Option<AllocState>>
// on-disk value for all the data blocks
ghost var data_block: map<Blkno, Block>
const jrnl: Jrnl
const balloc: Allocator
const ballocActualMax: uint64
static ghost predicate Valid_basics(jrnl: Jrnl)
reads jrnl
{
&& jrnl.Valid()
&& jrnl.kinds == fs_kinds
}
ghost predicate Valid_domains()
reads this
{
&& blkno_dom(block_used)
&& blkno_dom(data_block)
&& ino_dom(inodes)
}
ghost predicate {:opaque} Valid_jrnl_super_block(actual_blocks: uint64)
reads jrnl
requires Valid_basics(jrnl)
{
super_block_inbounds(jrnl);
jrnl.data[SuperBlkAddr] == ObjData(SuperBlock(super, actual_blocks).enc())
}
ghost predicate {:opaque} Valid_jrnl_to_block_used(block_used: map<Blkno, Option<AllocState>>)
reads jrnl
requires blkno_dom(block_used)
requires Valid_basics(jrnl)
{
blkno_bit_inbounds(jrnl);
&& (forall bn | blkno_ok(bn) ::
&& jrnl.data[DataBitAddr(bn)] == ObjBit(block_used[bn].Some?))
}
ghost predicate {:opaque} Valid_jrnl_to_data_block(data_block: map<Blkno, Block>)
reads jrnl
requires blkno_dom(data_block)
requires Valid_basics(jrnl)
{
&& (forall bn | blkno_ok(bn) && bn != 0 ::
datablk_inbounds(jrnl, bn);
&& jrnl.data[DataBlk(bn)] == ObjData(data_block[bn]))
}
ghost predicate {:opaque} Valid_jrnl_to_data_block_except(data_block: map<Blkno, Block>, bn0: Blkno)
reads jrnl
requires blkno_dom(data_block)
requires Valid_basics(jrnl)
{
&& (forall bn | blkno_ok(bn) && bn != 0 && bn != bn0 ::
datablk_inbounds(jrnl, bn);
&& jrnl.data[DataBlk(bn)] == ObjData(data_block[bn]))
}
ghost predicate {:opaque} Valid_jrnl_to_inodes(inodes: map<Ino, Inode.Inode>)
reads this, jrnl
requires ino_dom(inodes)
requires Valid_basics(jrnl)
{
forall ino: Ino ::
inode_inbounds(jrnl, ino);
if on_inode(ino)
then jrnl.data[InodeAddr(ino)] == ObjData(Inode.enc(cur_inode.x.1))
else jrnl.data[InodeAddr(ino)] == ObjData(Inode.enc(inodes[ino]))
}
ghost predicate quiescent()
reads this
{
cur_inode == None
}
ghost predicate on_inode(ino: Ino)
reads this
{
&& cur_inode.Some?
&& cur_inode.x.0 == ino
}
static const ballocMax: uint64 := super.data_bitmaps as uint64 * (4096*8) - 8
ghost predicate Valid_balloc()
reads this
{
&& this.balloc.max == ballocActualMax <= ballocMax
&& this.balloc.Valid()
}
ghost const Repr: set<object> := {this, jrnl}
ghost predicate Valid()
reads Repr
{
&& Valid_basics(jrnl)
&& Valid_domains()
&& Valid_jrnl_super_block(ballocActualMax)
&& Valid_jrnl_to_block_used(block_used)
&& Valid_jrnl_to_data_block(data_block)
&& Valid_jrnl_to_inodes(inodes)
&& Valid_balloc()
}
ghost predicate ValidExcept(bn: Blkno)
reads Repr
{
&& Valid_basics(jrnl)
&& Valid_domains()
&& Valid_jrnl_super_block(ballocActualMax)
&& Valid_jrnl_to_block_used(block_used)
&& Valid_jrnl_to_data_block_except(data_block, bn)
&& Valid_jrnl_to_inodes(inodes)
&& Valid_balloc()
&& blkno_ok(bn)
}
ghost predicate ValidQ()
reads Repr
{
&& Valid()
&& quiescent()
}
constructor Init(d: Disk)
ensures ValidQ()
ensures fresh(Repr)
ensures block_used == map bn: Blkno | blkno_ok(bn) :: None
ensures cur_inode == None
ensures inodes == map ino: Ino {:trigger} :: Inode.zero
ensures data_block == map bn: Blkno | blkno_ok(bn) :: block0
{
var jrnl := NewJrnl(d, fs_kinds);
this.jrnl := jrnl;
var num_blks := DiskSize(d);
var actual_max := ballocMax;
if super_data_start+8 < num_blks <= actual_max {
actual_max := Round.roundup64(num_blks - super_data_start - 8, 8);
assert super_data_start + actual_max < num_blks;
}
var sb := SuperBlock(super, actual_max);
var sb_bs := sb.encode();
var txn := jrnl.Begin();
super_block_inbounds(jrnl);
txn.Write(SuperBlkAddr, sb_bs);
var _ := txn.Commit(true);
var balloc := NewAllocator(actual_max);
this.balloc := balloc;
this.ballocActualMax := actual_max;
this.inodes := map ino: Ino {:trigger} :: Inode.zero;
this.cur_inode := None;
Inode.zero_encoding();
this.block_used := map bn: uint64 | blkno_ok(bn) :: None;
this.data_block := map bn: uint64 | blkno_ok(bn) :: block0;
new;
reveal jrnl.Valid();
reveal addrsForKinds();
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_inodes();
reveal DataBlk();
reveal InodeAddr();
}
// Recovery is needed for the file-system to recover its in-memory allocator
// state. Due to the use of translation validation we don't have to prove
// anything about how the used bits are recovered, but in practice they need
// to be correct for the system to allocate any new blocks.
constructor Recover(jrnl_: Jrnl, ghost fs: InodeFilesys<AllocState>)
// not allowed to modify jrnl so can't break any invariants
modifies {}
requires fs.ValidQ()
requires same_jrnl(jrnl_, fs.jrnl)
ensures this.inodes == fs.inodes
ensures this.cur_inode == fs.cur_inode
ensures this.block_used == fs.block_used
ensures this.data_block == fs.data_block
ensures this.ballocActualMax == fs.ballocActualMax
ensures ValidQ()
ensures fresh(Repr - {jrnl_})
ensures this.jrnl == jrnl_
{
same_jrnl_valid();
var txn := jrnl_.Begin();
super_block_inbounds(jrnl_);
var sb_bs := txn.Read(SuperBlkAddr, 4096*8);
reveal fs.Valid_jrnl_super_block();
var sb := SuperBlock.decode(sb_bs, SuperBlock(super, fs.ballocActualMax));
var balloc := NewAllocator(sb.actual_blocks);
blkno_bit_inbounds(jrnl_);
var bn: Blkno := 1;
while bn < sb.actual_blocks
invariant txn.jrnl == jrnl_
invariant Valid_basics(jrnl_)
invariant balloc.Valid()
invariant 1 <= bn as nat <= sb.actual_blocks as nat
{
var used := txn.ReadBit(DataBitAddr(bn));
if used {
balloc.MarkUsed(bn);
}
bn := bn + 1;
}
var ok := txn.Commit(true);
expect ok, "recovery transaction failed";
this.jrnl := jrnl_;
this.balloc := balloc;
this.ballocActualMax := sb.actual_blocks;
// copy all ghost state
inodes := fs.inodes;
cur_inode := fs.cur_inode;
block_used := fs.block_used;
data_block := fs.data_block;
new;
reveal jrnl.Valid();
reveal addrsForKinds();
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_inodes();
reveal DataBlk();
reveal InodeAddr();
}
static ghost predicate is_alloc_bn(bn: Blkno)
{
&& 0 < bn < ballocMax
&& blkno_ok(bn)
}
// private
method allocBlkno(txn: Txn) returns (ok:bool, bn:Blkno)
requires txn.jrnl == this.jrnl
requires Valid() ensures Valid()
ensures ok ==>
(&& is_alloc_bn(bn)
&& block_used[bn].None?
)
{
bn := balloc.Alloc();
if bn == 0 {
return false, 0;
}
blkno_bit_inbounds(jrnl);
var used := txn.ReadBit(DataBitAddr(bn));
if used {
print "block allocator returned used block ", bn, "\n";
ok := false;
balloc.Free(bn);
return;
}
ok := true;
reveal Valid_jrnl_to_block_used();
}
// public
method getDataBlock(txn: Txn, bn: Blkno) returns (bs: Bytes)
modifies {}
requires Valid() ensures Valid()
requires this.jrnl == txn.jrnl
requires blkno_ok(bn)
ensures fresh(bs)
ensures is_block(bs.data)
ensures bs.data == zero_lookup(data_block, bn)
{
if bn == 0 {
bs := NewBytes(4096);
return;
}
datablk_inbounds(jrnl, bn);
bs := txn.Read(DataBlk(bn), 4096*8);
reveal Valid_jrnl_to_data_block();
}
// public
method writeDataBlock(txn: Txn, bn: Blkno, blk: Bytes)
modifies this, jrnl, blk
requires Valid() ensures Valid()
requires txn.jrnl == jrnl
requires is_block(blk.data)
requires bn != 0 && blkno_ok(bn)
ensures
&& inodes == old(inodes)
&& cur_inode == old(cur_inode)
&& block_used == old(block_used)
&& data_block == old(data_block[bn := blk.data])
{
addException(bn);
fakeWriteDataBlock(bn, blk.data);
finishWriteDataBlock(txn, bn, blk);
}
// public
ghost method fakeWriteDataBlock(bn: Blkno, blk: Block)
modifies this
requires ValidExcept(bn) ensures ValidExcept(bn)
requires bn != 0 && blkno_ok(bn)
ensures
&& inodes == old(inodes)
&& cur_inode == old(cur_inode)
&& block_used == old(block_used)
&& data_block == old(data_block)[bn := blk]
{
data_block := data_block[bn := blk];
assert ValidExcept(bn) by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_data_block_except();
reveal Valid_jrnl_to_inodes();
}
}
ghost method addException(bn: Blkno)
requires blkno_ok(bn)
requires Valid() ensures ValidExcept(bn)
{
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_data_block_except();
reveal Valid_jrnl_to_inodes();
}
method finishWriteDataBlock(txn: Txn, bn: Blkno, blk: Bytes)
modifies jrnl, blk
requires txn.jrnl == jrnl
requires ValidExcept(bn) ensures Valid()
requires blk.data == data_block[bn]
ensures blk.data == []
ensures
&& inodes == old(inodes)
&& cur_inode == old(cur_inode)
&& block_used == old(block_used)
&& data_block == old(data_block)
{
datablk_inbounds(jrnl, bn);
txn.Write(DataBlk(bn), blk);
assert Valid() by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_data_block_except();
reveal Valid_jrnl_to_inodes();
FsKinds.DataBlk_disjoint(bn);
reveal_DataBlk();
}
}
ghost predicate is_inode(ino: Ino, i: Inode.Inode)
reads this, jrnl
requires Valid_basics(jrnl)
requires Valid_domains()
{
&& inodes[ino] == i
}
ghost predicate is_cur_inode(ino: Ino, i: Inode.Inode)
reads this, jrnl
requires Valid_basics(jrnl)
requires Valid_domains()
{
&& is_inode(ino, i)
&& on_inode(ino)
}
// public
ghost method startInode(ino: Ino, i: Inode.Inode)
modifies this
requires ValidQ()
requires is_inode(ino, i)
ensures Valid()
ensures is_cur_inode(ino, i)
ensures cur_inode == Some((ino, i))
ensures inodes == old(inodes)
ensures block_used == old(block_used)
ensures data_block == old(data_block)
{
cur_inode := Some( (ino, i) );
reveal_Valid_jrnl_to_inodes();
}
// public
method finishInode(txn: Txn, ino: Ino, i: MemInode)
modifies this, jrnl, i.bs
requires Valid()
requires on_inode(ino)
requires txn.jrnl == this.jrnl
requires i.Valid()
requires is_inode(ino, i.val())
ensures ValidQ()
ensures inodes == old(inodes)
ensures data_block == old(data_block)
ensures block_used == old(block_used)
{
cur_inode := None;
inode_inbounds(jrnl, ino);
var buf' := i.encode();
txn.Write(InodeAddr(ino), buf');
assert jrnl.data[InodeAddr(ino)] == ObjData(Inode.enc(inodes[ino]));
assert Valid_jrnl_to_inodes(inodes) by {
reveal_Valid_jrnl_to_inodes();
InodeAddr_inj();
// NOTE: good example of debugging
// forall ino':Ino
// ensures jrnl.data[InodeAddr(ino')] == ObjData(Inode.enc(inodes[ino']))
// {
// if ino' == ino {} else {
// assert InodeAddr(ino) != InodeAddr(ino') by {
// reveal_InodeAddr();
// }
// }
// }
}
assert Valid() by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
assert && Valid_basics(jrnl)
&& Valid_domains()
&& Valid_jrnl_super_block(ballocActualMax)
&& Valid_jrnl_to_block_used(block_used)
&& Valid_jrnl_to_inodes(inodes)
&& Valid_balloc();
assert Valid_jrnl_to_data_block(data_block) by {
reveal Valid_jrnl_to_data_block();
forall bn | blkno_ok(bn) && bn != 0
ensures (
datablk_inbounds(jrnl, bn);
jrnl.data[DataBlk(bn)] == ObjData(data_block[bn])) {
datablk_inbounds(jrnl, bn);
assert jrnl.data[DataBlk(bn)] == old(jrnl.data[DataBlk(bn)]);
}
assert Valid_jrnl_to_data_block(data_block);
}
}
}
// For read-only calls, we can still use the on_inode machinery to "focus"
// on an inode but also keep track of the fact that the inode doesn't need
// to be written back out. Then finishInodeReadonly allows to restore the
// quiescent state without involving the transaction.
ghost method finishInodeReadonly(ino: Ino, i: Inode.Inode)
modifies this
requires Valid()
requires is_inode(ino, i)
requires cur_inode == Some((ino, i))
ensures ValidQ()
ensures inodes == old(inodes)
ensures data_block == old(data_block)
ensures block_used == old(block_used)
{
cur_inode := None;
assert Valid_jrnl_to_inodes(inodes) by {
reveal Valid_jrnl_to_inodes();
}
assert Valid() by {
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_block_used();
}
}
method lockInode(txn: Txn, ino: Ino)
modifies {}
requires Valid()
requires txn.jrnl == jrnl
{
reveal_Valid_jrnl_to_inodes();
inode_inbounds(jrnl, ino);
var _ := txn.Read(InodeAddr(ino), 128*8);
}
method lockInodes(txn: Txn, inos: seq<uint64>)
modifies {}
requires Valid()
requires txn.jrnl == jrnl
{
if |inos| == 0 {}
else {
var ino := inos[0];
var ok := is_ino_ok(ino);
if ok {
lockInode(txn, ino);
}
lockInodes(txn, inos[1..]);
}
}
// public
method getInode(txn: Txn, ino: Ino) returns (i: MemInode)
modifies {}
requires ValidQ()
requires txn.jrnl == jrnl
ensures i.Valid()
ensures is_inode(ino, i.val())
ensures fresh(i.Repr)
{
reveal_Valid_jrnl_to_inodes();
inode_inbounds(jrnl, ino);
var buf := txn.Read(InodeAddr(ino), 128*8);
i := new MemInode(buf, inodes[ino]);
}
// public
ghost method writeInode(ino: Ino, i': MemInode)
modifies this
requires Valid() ensures Valid()
requires on_inode(ino)
requires i'.Valid()
ensures is_cur_inode(ino, i'.val())
ensures inodes == old(inodes)[ino:=i'.val()]
ensures block_used == old(block_used)
ensures data_block == old(data_block)
ensures cur_inode == old(cur_inode)
{
inodes := inodes[ino:=i'.val()];
assert Valid() by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_inodes();
}
}
// public
method allocateTo(txn: Txn, ghost state: AllocState)
returns (ok: bool, bn:Blkno)
modifies Repr
requires Valid() ensures Valid()
requires txn.jrnl == jrnl
ensures inodes == old(inodes)
ensures cur_inode == old(cur_inode)
ensures data_block == old(data_block)
ensures !ok ==> block_used == old(block_used)
ensures ok ==> block_used == old(block_used[bn:=Some(state)])
ensures ok ==> is_alloc_bn(bn)
ensures ok ==> old(block_used[bn].None?)
{
ok, bn := allocBlkno(txn);
if !ok {
return;
}
blkno_bit_inbounds(jrnl);
block_used := block_used[bn:=Some(state)];
txn.WriteBit(DataBitAddr(bn), true);
assert Valid() by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_inodes();
DataBitAddr_disjoint(bn);
}
return;
}
method free(txn: Txn, bn: Blkno)
modifies Repr
requires Valid() ensures Valid()
requires txn.jrnl == jrnl
requires blkno_ok(bn)
requires block_used[bn].Some?
ensures inodes == old(inodes)
ensures block_used == old(block_used[bn:=None])
ensures cur_inode == old(cur_inode)
ensures data_block == old(data_block)
{
blkno_bit_inbounds(jrnl);
block_used := block_used[bn:=None];
txn.WriteBit(DataBitAddr(bn), false);
if 0 < bn < ballocActualMax {
balloc.Free(bn);
}
assert Valid() by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_inodes();
DataBitAddr_disjoint(bn);
}
}
method freeWithException(txn: Txn, bn: Blkno, ghost bn0: Blkno)
modifies Repr
requires ValidExcept(bn0) ensures ValidExcept(bn0)
requires txn.jrnl == jrnl
requires blkno_ok(bn)
requires block_used[bn].Some?
ensures inodes == old(inodes)
ensures block_used == old(block_used[bn:=None])
ensures cur_inode == old(cur_inode)
ensures data_block == old(data_block)
{
blkno_bit_inbounds(jrnl);
block_used := block_used[bn:=None];
txn.WriteBit(DataBitAddr(bn), false);
if 0 < bn < ballocActualMax {
balloc.Free(bn);
}
assert ValidExcept(bn0) by {
reveal Valid_jrnl_super_block();
reveal Valid_jrnl_to_block_used();
reveal Valid_jrnl_to_data_block();
reveal Valid_jrnl_to_data_block_except();
reveal Valid_jrnl_to_inodes();
DataBitAddr_disjoint(bn);
}
}
// public
method Size(ino: Ino) returns (sz: uint64)
modifies {}
requires ValidQ()
ensures sz as nat == inodes[ino].sz as nat
{
var txn := jrnl.Begin();
var i := getInode(txn, ino);
sz := i.sz;
var _ := txn.Commit(true);
}
method TotalBytes() returns (sz: uint64)
requires Valid()
{
return ballocActualMax*4096;
}
method FreeBytes() returns (sz: uint64)
requires Valid()
{
var num_blocks := balloc.NumFree();
return num_blocks * 4096;
}
}
}