--- data/gdmap.1 +++ data/gdmap.1 @@ -10,6 +10,11 @@ gdmap [\fB\-?\fR|\fB--help\fR] \fBGdMap\fR is a tool to display disk space using tree maps. .LP +Each link to a file with +.I n +hard links gets credit for one +.IR n th +of its size. .SH OPTIONS --- src/tree.c +++ src/tree.c @@ -186,6 +186,7 @@ static tree_t* tree_scan_rec(const char* dirname, const char* shortname, int dep { gint64 rsize = buf.st_size; gint64 ssize = buf.st_blocks * 512; + nlink_t linkcount = buf.st_nlink; if (S_ISREG(buf.st_mode) && ssize && ssize < rsize) { @@ -193,17 +194,17 @@ static tree_t* tree_scan_rec(const char* dirname, const char* shortname, int dep if (pref_get_use_reported_size()) { /* g_message("-reported: ("FF")", rsize); */ - return tree_new(shortname, rsize, depth); + return tree_new(shortname, rsize / linkcount, depth); } else { /* g_message("-on disk: ("FF")", ssize); */ - return tree_new(shortname, ssize, depth); + return tree_new(shortname, ssize / linkcount, depth); } } else { - return tree_new(shortname, rsize, depth); + return tree_new(shortname, rsize / linkcount, depth); } } }