Use wrapper script to set paths when launching pcompress from build directory.

Use smaller max block size when doing global dedupe.
Fix init of executable name.
This commit is contained in:
Moinak Ghosh 2013-08-07 22:03:52 +05:30
parent f34cfb1aa6
commit fe18afbcf4
6 changed files with 25 additions and 4 deletions

View file

@ -342,6 +342,9 @@ $(LIB): $(OBJS)
$(PROG): $(LIB) $(PROGOBJS)
$(LINK.PROG) -o $@ $(PROGOBJS) $(LDLIBS) -L. -l$(LINKLIB)
cp $@ buildtmp
cat utils/pcompress.sh | sed "s#<PC_PATH>#`pwd`#" > pcompress
chmod +x pcompress
test: all
(cd test; ulimit -c unlimited; sh ./run_test.sh $(TESTSUITE) ) 2>&1 | tee test.log
@ -358,7 +361,7 @@ distclean: clean
install: $(PROG)
@mkdir -p $(DESTDIR)$(PREFIX)/bin
@chmod 0755 $(DESTDIR)$(PREFIX)/bin
@cp $(PROG) $(DESTDIR)$(PREFIX)/bin
@cp buildtmp/$(PROG) $(DESTDIR)$(PREFIX)/bin
@chmod 0555 $(DESTDIR)$(PREFIX)/bin/$(PROG)
@mkdir -p $(DESTDIR)$(PREFIX)/lib

View file

@ -2531,6 +2531,7 @@ create_pc_context(void)
init_pcompress();
memset(ctx, 0, sizeof (pc_ctx_t));
ctx->exec_name = (char *)malloc(NAME_MAX);
ctx->hide_mem_stats = 1;
ctx->hide_cmp_stats = 1;
ctx->enable_rabin_split = 1;
@ -2574,11 +2575,16 @@ int DLL_EXPORT
init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
{
int opt, num_rem, err, my_optind;
char *pos;
pctx->level = 6;
err = 0;
pctx->keylen = DEFAULT_KEYLEN;
pctx->chunksize = DEFAULT_CHUNKSIZE;
pos = argv[0] + strlen(argv[0]);
while (*pos != '/' && pos > argv[0]) pos--;
if (*pos == '/') pos++;
strcpy(pctx->exec_name, pos);
pthread_mutex_lock(&opt_parse);
while ((opt = getopt(argc, argv, "dc:s:l:pt:MCDGEe:w:rLPS:B:Fk:")) != -1) {

View file

@ -200,7 +200,8 @@ typedef struct pc_ctx {
unsigned int chunk_num;
uint64_t largest_chunk, smallest_chunk, avg_chunk;
uint64_t chunksize;
const char *exec_name, *algo, *filename, *to_filename;
const char *algo, *filename, *to_filename;
char *exec_name;
int do_compress, level;
int do_uncompress;
int cksum_bytes, mac_bytes;

View file

@ -284,8 +284,10 @@ create_dedupe_context(uint64_t chunksize, uint64_t real_chunksize, int rab_blk_s
ctx->deltac_min_distance = props->deltac_min_distance;
ctx->pagesize = sysconf(_SC_PAGE_SIZE);
ctx->similarity_cksums = NULL;
if (arc)
if (arc) {
arc->pagesize = ctx->pagesize;
ctx->rabin_poly_max_block_size = RAB_POLY_MAX_BLOCK_SIZE_GLOBAL;
}
/*
* Scale down similarity percentage based on avg block size unless user specified

View file

@ -80,7 +80,8 @@
#define RAB_POLYNOMIAL_WIN_SIZE 16
#define RAB_POLYNOMIAL_MIN_WIN_SIZE 8
#define RAB_POLYNOMIAL_MAX_WIN_SIZE 64
#define RAB_POLYNOMIAL_MAX_BLOCK_SIZE (64 * 1024)
#define RAB_POLYNOMIAL_MAX_BLOCK_SIZE (128 * 1024)
#define RAB_POLY_MAX_BLOCK_SIZE_GLOBAL (64 * 1024)
#define RAB_BLK_MASK (((1 << RAB_BLK_MIN_BITS) - 1) >> 1)
#define RAB_BLK_AVG_SZ(x) (1 << ((x) + RAB_BLK_MIN_BITS))

8
utils/pcompress.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/sh
PC_PATH="<PC_PATH>"
LD_LIBRARY_PATH="${PC_PATH}"
export LD_LIBRARY_PATH
exec ${PC_PATH}/buildtmp/pcompress "$@"