commit c6c38c6642f1ae9b144aa6c19c98f21cbe5141bd
parent 43c87556750bad8f4b129dc5421060ce26952a55
Author: sin <sin@2f30.org>
Date: Thu, 7 Mar 2019 13:09:28 +0000
Re-order function
Diffstat:
M | dedup.c | | | 42 | +++++++++++++++++++++--------------------- |
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/dedup.c b/dedup.c
@@ -121,27 +121,6 @@ print_stats(struct stats *st)
fprintf(stderr, "Cache misses: %llu\n", cache_misses);
}
-static void
-append_snap(struct snapshot *snap)
-{
- if (mul_overflow(snap->nr_blk_descs, BLK_DESC_SIZE))
- errx(1, "%s: overflow", __func__);
- snap->size = snap->nr_blk_descs * BLK_DESC_SIZE;
-
- if (add_overflow(SNAPSHOT_SIZE, snap->size))
- errx(1, "%s: overflow", __func__);
- snap->size += SNAPSHOT_SIZE;
-
- xlseek(ifd, snap_hdr.size, SEEK_SET);
- write_snapshot(ifd, snap);
- write_snapshot_blk_descs(ifd, snap);
-
- if (add_overflow(snap_hdr.size, snap->size))
- errx(1, "%s: overflow", __func__);
- snap_hdr.size += snap->size;
- snap_hdr.nr_snapshots++;
-}
-
static struct snapshot *
alloc_snap(void)
{
@@ -178,6 +157,27 @@ grow_snap(struct snapshot *snap, uint64_t nr_blk_descs)
return snap;
}
+static void
+append_snap(struct snapshot *snap)
+{
+ if (mul_overflow(snap->nr_blk_descs, BLK_DESC_SIZE))
+ errx(1, "%s: overflow", __func__);
+ snap->size = snap->nr_blk_descs * BLK_DESC_SIZE;
+
+ if (add_overflow(SNAPSHOT_SIZE, snap->size))
+ errx(1, "%s: overflow", __func__);
+ snap->size += SNAPSHOT_SIZE;
+
+ xlseek(ifd, snap_hdr.size, SEEK_SET);
+ write_snapshot(ifd, snap);
+ write_snapshot_blk_descs(ifd, snap);
+
+ if (add_overflow(snap_hdr.size, snap->size))
+ errx(1, "%s: overflow", __func__);
+ snap_hdr.size += snap->size;
+ snap_hdr.nr_snapshots++;
+}
+
static uint8_t *
alloc_buf(size_t size)
{