-
Notifications
You must be signed in to change notification settings - Fork 2
/
fsc.h
54 lines (47 loc) · 1.22 KB
/
fsc.h
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
/*
* =====================================================================================
*
* Filename: fsc.h
*
* Description: fixed size chunking
*
* Version: 1.0
* Created: 10/14/2018 04:36:15 PM
* Revision: none
* Compiler: gcc
*
* Author: fan ni
* Organization:
*
* =====================================================================================
*/
#ifndef CHUNKER_FSC_H_H
#define CHUNKER_FSC_H_H
#include "common.h"
static int regular_chunking_fsc(struct file_struct *fs){
uint64_t n_bytes_left;
uint64_t offset = 0;
uint32_t hash = 0;
uint8_t *str = (uint8_t *)fs->map;
uint64_t local_offset = 0;
uint64_t last_offset = 0;
struct chunk_boundary cb;
uint32_t avg_size= 1<< break_mask_bit;
int tid = fs_idx(fs);
reset_chunk_boundary_list(tid);
while( offset < fs->test_length ){
if ( fs->test_length < avg_size + offset+min_chunksize){
offset = fs->test_length;
}else{
offset = offset+avg_size;
}
cb.left = last_offset;
cb.right = offset;
insert_chunk_boundary(tid, &cb);
dedup_stats.total_chunks++;
dedup_stats.total_size += cb.right-cb.left;
last_offset = offset;
}
return 0;
}
#endif