Skip to content

Commit

Permalink
Merge pull request #262 from zevv/tcbdbtune
Browse files Browse the repository at this point in the history
Tcbdbtune
  • Loading branch information
l8gravely committed Oct 5, 2020
2 parents e5eb93c + e4eca4c commit 11a06b7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/duc/cmd-ui.c
Expand Up @@ -283,7 +283,10 @@ static duc_dir *do_dir(duc_dir *dir, int depth)
free(path);
}
endwin();
system(cmd);
int ret = system(cmd);
if (ret == -1) {
printw("Cannot run command: %s", cmd);
}
doupdate();
}
break;
Expand Down
5 changes: 4 additions & 1 deletion src/libduc-graph/graph.c
Expand Up @@ -386,7 +386,10 @@ static int do_dir(duc_graph *g, duc_dir *dir, int level, double r1, double a1_di
shorten_name(name, g->max_name_len);

pol2car(g, ang((a1+a2)/2), (r1+r2)/2, &label->x, &label->y);
asprintf(&label->text, "%s\n%s", name, siz);
int r = asprintf(&label->text, "%s\n%s", name, siz);
if (r < 0) {
label->text = "\0";
}
LL_APPEND(g->label_list, label);

free(name);
Expand Down
8 changes: 6 additions & 2 deletions src/libduc/db-tokyo.c
Expand Up @@ -61,8 +61,12 @@ struct db *db_open(const char *path_db, int flags, duc_errno *e)

int opts = BDBTLARGE;
if(compress) opts |= BDBTDEFLATE;
tcbdbtune(db->hdb, -1, -1, -1, -1, -1, opts);

int ret = tcbdbtune(db->hdb, 256, 512, 131072, 9, 11, opts);
if(ret == 0) {
*e = tcdb_to_errno(db->hdb);
goto err2;
}

int r = tcbdbopen(db->hdb, path_db, mode);
if(r == 0) {
*e = tcdb_to_errno(db->hdb);
Expand Down
6 changes: 5 additions & 1 deletion src/libduc/dir.c
Expand Up @@ -99,9 +99,13 @@ char *duc_dir_get_path(duc_dir *dir)

duc_dir *duc_dir_openent(duc_dir *dir, const struct duc_dirent *e)
{

duc_dir *dir2 = duc_dir_new(dir->duc, &e->devino);
if(dir2) {
asprintf(&dir2->path, "%s/%s", dir->path, e->name);
int r = asprintf(&dir2->path, "%s/%s", dir->path, e->name);
if (r < 0) {
dir2->path = '\0';
}
}
return dir2;
}
Expand Down
23 changes: 18 additions & 5 deletions src/libduc/index.c
Expand Up @@ -294,7 +294,10 @@ static void report_skip(struct duc *duc, const char *name, const char *fmt, ...)
{
char path_full[DUC_PATH_MAX];
char msg[DUC_PATH_MAX + 128];
realpath(name, path_full);
char *res = realpath(name, path_full);
if (res == NULL) {
duc_log(duc, DUC_LOG_WRN, "Cannot determine realpath of: %s", name);
}
va_list va;
va_start(va, fmt);
vsnprintf(msg, sizeof(msg), fmt, va);
Expand All @@ -320,7 +323,11 @@ static int is_fstype_allowed(struct duc_index_req *req, const char *name)
/* Find file system type */

char path_full[DUC_PATH_MAX];
realpath(name, path_full);
char *res = realpath(name, path_full);
if (res == NULL) {
report_skip(duc, name, "Cannot determine realpath result");
return 0;
}
struct fstype *fstype = NULL;
HASH_FIND_STR(req->fstypes_mounted, path_full, fstype);
if(fstype == NULL) {
Expand Down Expand Up @@ -411,14 +418,15 @@ static struct scanner *scanner_new(struct duc *duc, struct scanner *scanner_pare

static void scanner_scan(struct scanner *scanner_dir)
{
struct duc *duc = scanner_dir->duc;
int r;
struct duc *duc = scanner_dir->duc;
struct duc_index_req *req = scanner_dir->req;
struct duc_index_report *report = scanner_dir->rep;

report->dir_count ++;
duc_size_accum(&report->size, &scanner_dir->ent.size);

int r = chdir(scanner_dir->ent.name);
r = chdir(scanner_dir->ent.name);
if(r != 0) {
report_skip(duc, scanner_dir->ent.name, strerror(errno));
return;
Expand Down Expand Up @@ -533,7 +541,12 @@ static void scanner_scan(struct scanner *scanner_dir)
}
}

chdir("..");
r = chdir("..");
if(r != 0) {
report_skip(duc, scanner_dir->ent.name, strerror(errno));
return;
}

}


Expand Down

0 comments on commit 11a06b7

Please sign in to comment.