add manual flag to mmap dictionary
This commit is contained in:
+9
-4
@@ -485,6 +485,11 @@ void FIO_setPassThroughFlag(FIO_prefs_t* const prefs, int value) {
|
|||||||
prefs->passThrough = (value != 0);
|
prefs->passThrough = (value != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIO_setMMapDict(FIO_prefs_t* const prefs, int value)
|
||||||
|
{
|
||||||
|
prefs->mmapDict = value;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIO_ctx_t functions */
|
/* FIO_ctx_t functions */
|
||||||
|
|
||||||
void FIO_setHasStdoutOutput(FIO_ctx_t* const fCtx, int value) {
|
void FIO_setHasStdoutOutput(FIO_ctx_t* const fCtx, int value) {
|
||||||
@@ -1028,7 +1033,7 @@ static void FIO_adjustParamsForPatchFromMode(FIO_prefs_t* const prefs,
|
|||||||
static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
|
static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
|
||||||
const char* dictFileName, unsigned long long const maxSrcFileSize,
|
const char* dictFileName, unsigned long long const maxSrcFileSize,
|
||||||
int cLevel, ZSTD_compressionParameters comprParams) {
|
int cLevel, ZSTD_compressionParameters comprParams) {
|
||||||
int mmapDict = 0;
|
int mmapDict = prefs->mmapDict;
|
||||||
cRess_t ress;
|
cRess_t ress;
|
||||||
memset(&ress, 0, sizeof(ress));
|
memset(&ress, 0, sizeof(ress));
|
||||||
|
|
||||||
@@ -1045,7 +1050,7 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
|
|||||||
if (prefs->patchFromMode) {
|
if (prefs->patchFromMode) {
|
||||||
U64 const dictSize = UTIL_getFileSizeStat(&ress.dictFileStat);
|
U64 const dictSize = UTIL_getFileSizeStat(&ress.dictFileStat);
|
||||||
unsigned long long const ssSize = (unsigned long long)prefs->streamSrcSize;
|
unsigned long long const ssSize = (unsigned long long)prefs->streamSrcSize;
|
||||||
mmapDict = dictSize > prefs->memLimit;
|
mmapDict |= dictSize > prefs->memLimit;
|
||||||
FIO_adjustParamsForPatchFromMode(prefs, &comprParams, dictSize, ssSize > 0 ? ssSize : maxSrcFileSize, cLevel);
|
FIO_adjustParamsForPatchFromMode(prefs, &comprParams, dictSize, ssSize > 0 ? ssSize : maxSrcFileSize, cLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2136,7 +2141,7 @@ typedef struct {
|
|||||||
|
|
||||||
static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFileName)
|
static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFileName)
|
||||||
{
|
{
|
||||||
int mmapDict = 0;
|
int mmapDict = prefs->mmapDict;
|
||||||
stat_t statbuf;
|
stat_t statbuf;
|
||||||
dRess_t ress;
|
dRess_t ress;
|
||||||
memset(&ress, 0, sizeof(ress));
|
memset(&ress, 0, sizeof(ress));
|
||||||
@@ -2145,7 +2150,7 @@ static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFi
|
|||||||
|
|
||||||
if (prefs->patchFromMode){
|
if (prefs->patchFromMode){
|
||||||
U64 const dictSize = UTIL_getFileSizeStat(&statbuf);
|
U64 const dictSize = UTIL_getFileSizeStat(&statbuf);
|
||||||
mmapDict = dictSize > prefs->memLimit;
|
mmapDict |= dictSize > prefs->memLimit;
|
||||||
FIO_adjustMemLimitForPatchFromMode(prefs, dictSize, 0 /* just use the dict size */);
|
FIO_adjustMemLimitForPatchFromMode(prefs, dictSize, 0 /* just use the dict size */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ void FIO_setContentSize(FIO_prefs_t* const prefs, int value);
|
|||||||
void FIO_displayCompressionParameters(const FIO_prefs_t* prefs);
|
void FIO_displayCompressionParameters(const FIO_prefs_t* prefs);
|
||||||
void FIO_setAsyncIOFlag(FIO_prefs_t* const prefs, int value);
|
void FIO_setAsyncIOFlag(FIO_prefs_t* const prefs, int value);
|
||||||
void FIO_setPassThroughFlag(FIO_prefs_t* const prefs, int value);
|
void FIO_setPassThroughFlag(FIO_prefs_t* const prefs, int value);
|
||||||
|
void FIO_setMMapDict(FIO_prefs_t* const prefs, int value);
|
||||||
|
|
||||||
/* FIO_ctx_t functions */
|
/* FIO_ctx_t functions */
|
||||||
void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value);
|
void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value);
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ typedef struct FIO_prefs_s {
|
|||||||
int contentSize;
|
int contentSize;
|
||||||
int allowBlockDevices;
|
int allowBlockDevices;
|
||||||
int passThrough;
|
int passThrough;
|
||||||
|
int mmapDict;
|
||||||
} FIO_prefs_t;
|
} FIO_prefs_t;
|
||||||
|
|
||||||
#endif /* FILEIO_TYPES_HEADER */
|
#endif /* FILEIO_TYPES_HEADER */
|
||||||
|
|||||||
+5
-1
@@ -254,6 +254,7 @@ static void usage_advanced(const char* programName)
|
|||||||
|
|
||||||
DISPLAYOUT("\n");
|
DISPLAYOUT("\n");
|
||||||
DISPLAYOUT(" --format=zstd Compress files to the `.zst` format. [Default]\n");
|
DISPLAYOUT(" --format=zstd Compress files to the `.zst` format. [Default]\n");
|
||||||
|
DISPLAYOUT(" --mmap-dict Memory-map dictionary file rather than mallocing and loading all at once");
|
||||||
#ifdef ZSTD_GZCOMPRESS
|
#ifdef ZSTD_GZCOMPRESS
|
||||||
DISPLAYOUT(" --format=gzip Compress files to the `.gz` format.\n");
|
DISPLAYOUT(" --format=gzip Compress files to the `.gz` format.\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -850,7 +851,8 @@ int main(int argCount, const char* argv[])
|
|||||||
showDefaultCParams = 0,
|
showDefaultCParams = 0,
|
||||||
ultra=0,
|
ultra=0,
|
||||||
contentSize=1,
|
contentSize=1,
|
||||||
removeSrcFile=0;
|
removeSrcFile=0,
|
||||||
|
mmapDict=0;
|
||||||
ZSTD_paramSwitch_e useRowMatchFinder = ZSTD_ps_auto;
|
ZSTD_paramSwitch_e useRowMatchFinder = ZSTD_ps_auto;
|
||||||
FIO_compressionType_t cType = FIO_zstdCompression;
|
FIO_compressionType_t cType = FIO_zstdCompression;
|
||||||
unsigned nbWorkers = 0;
|
unsigned nbWorkers = 0;
|
||||||
@@ -984,6 +986,7 @@ int main(int argCount, const char* argv[])
|
|||||||
if (longCommandWArg(&argument, "--adapt=")) { adapt = 1; if (!parseAdaptParameters(argument, &adaptMin, &adaptMax)) { badusage(programName); CLEAN_RETURN(1); } continue; }
|
if (longCommandWArg(&argument, "--adapt=")) { adapt = 1; if (!parseAdaptParameters(argument, &adaptMin, &adaptMax)) { badusage(programName); CLEAN_RETURN(1); } continue; }
|
||||||
if (!strcmp(argument, "--single-thread")) { nbWorkers = 0; singleThread = 1; continue; }
|
if (!strcmp(argument, "--single-thread")) { nbWorkers = 0; singleThread = 1; continue; }
|
||||||
if (!strcmp(argument, "--format=zstd")) { suffix = ZSTD_EXTENSION; cType = FIO_zstdCompression; continue; }
|
if (!strcmp(argument, "--format=zstd")) { suffix = ZSTD_EXTENSION; cType = FIO_zstdCompression; continue; }
|
||||||
|
if (!strcmp(argument, "--mmap-dict")) { mmapDict = 1; continue; }
|
||||||
#ifdef ZSTD_GZCOMPRESS
|
#ifdef ZSTD_GZCOMPRESS
|
||||||
if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; cType = FIO_gzipCompression; continue; }
|
if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; cType = FIO_gzipCompression; continue; }
|
||||||
if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
|
if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
|
||||||
@@ -1526,6 +1529,7 @@ int main(int argCount, const char* argv[])
|
|||||||
FIO_setNotificationLevel(g_displayLevel);
|
FIO_setNotificationLevel(g_displayLevel);
|
||||||
FIO_setAllowBlockDevices(prefs, allowBlockDevices);
|
FIO_setAllowBlockDevices(prefs, allowBlockDevices);
|
||||||
FIO_setPatchFromMode(prefs, patchFromDictFileName != NULL);
|
FIO_setPatchFromMode(prefs, patchFromDictFileName != NULL);
|
||||||
|
FIO_setMMapDict(prefs, mmapDict);
|
||||||
if (memLimit == 0) {
|
if (memLimit == 0) {
|
||||||
if (compressionParams.windowLog == 0) {
|
if (compressionParams.windowLog == 0) {
|
||||||
memLimit = (U32)1 << g_defaultMaxWindowLog;
|
memLimit = (U32)1 << g_defaultMaxWindowLog;
|
||||||
|
|||||||
Reference in New Issue
Block a user