@@ -30,7 +30,7 @@ let string_of_request r =
30
30
let int x = string_of_int x in
31
31
let list ty xs = String. concat " ; " (List. map ty xs) in
32
32
Printf. sprintf " { id = [ %s ]; op = %s; sector = %Ld; length = %d; buffers = [ %s ]; depends = [ %s ]}"
33
- (list int64 r.id) (string_of_op r.op) r.sector r.length (list int (List. map Cstruct. len r.buffers)) (list int64 r.depends)
33
+ (list int64 r.id) (string_of_op r.op) r.sector r.length (list int (List. map Cstruct. length r.buffers)) (list int64 r.depends)
34
34
35
35
type t = request list
36
36
@@ -46,7 +46,7 @@ let conflicts a b = match a.op, b.op with
46
46
|| (add b.sector (of_int b.length) < a.sector))
47
47
48
48
let add t id op sector buffers =
49
- let length = List. fold_left (+ ) 0 (List. map Cstruct. len buffers) / 512 in
49
+ let length = List. fold_left (+ ) 0 (List. map Cstruct. length buffers) / 512 in
50
50
let r = { id = [id]; op; sector; length; buffers; depends = [] } in
51
51
let depends = List. (concat (map (fun r -> r.id) (filter (conflicts r) t))) in
52
52
let r = { r with depends } in
@@ -60,12 +60,8 @@ let coalesce requests =
60
60
| r :: rs -> reqs (if current = [] then finished else current :: finished) (Int64. (add r.sector (of_int r.length))) [ r ] rs in
61
61
(* merge adjacent cstruct buffers *)
62
62
let rec merge_buffers finished current = function
63
- | [] -> List. rev (if Cstruct. len current = 0 then finished else current :: finished)
64
- | b :: bs when current.Cstruct. len <> 0
65
- && current.Cstruct. buffer == b.Cstruct. buffer
66
- && (current.Cstruct. off + current.Cstruct. len = b.Cstruct. off) ->
67
- merge_buffers finished (Cstruct. add_len current b.Cstruct. len) bs
68
- | b :: bs -> merge_buffers (if Cstruct. len current = 0 then finished else current :: finished) b bs in
63
+ | [] -> List. rev (if Cstruct. length current = 0 then finished else current :: finished)
64
+ | b :: bs -> merge_buffers (if Cstruct. length current = 0 then finished else current :: finished) b bs in
69
65
let merge requests =
70
66
let batches = reqs [] (- 1L ) [] requests in
71
67
List. map (function
0 commit comments