Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

o add include for off_t

o make oversize factor configurable.
  • Loading branch information...
commit 145e4193dd62890d58742cb170f2ce77ebca2b40 1 parent 94c5c61
@hzeller authored
View
3  file-handler.h
@@ -21,6 +21,9 @@
#include <string>
+#include <sys/types.h>
+#include <unistd.h>
+
// Status about some handler, filled in by various subsystem.
// This is mostly used to be displayed in the UI.
// Data collected in this struct will survive after the FileHandler is long
View
4 folve-filesystem.cc
@@ -45,7 +45,9 @@
FolveFilesystem::FolveFilesystem()
: gapless_processing_(false), pre_buffer_size_(-1), open_file_cache_(4),
processor_pool_(3), buffer_thread_(NULL),
- total_file_openings_(0), total_file_reopen_(0) {
+ total_file_openings_(0), total_file_reopen_(0),
+ // oversize factor of 1.25 seems to be a good initial size.
+ file_oversize_factor_(1.25) {
}
void FolveFilesystem::RequestPrebuffer(ConversionBuffer *buffer) {
View
5 folve-filesystem.h
@@ -105,8 +105,8 @@ class FolveFilesystem {
// know the final file-size as well. So we multiply the original file size
// with a factor - overestimating seems to be less of a problem than
// understimating.
- // This is the factor (maybe configurable later).
- double file_oversize_factor() { return 1.15; }
+ float file_oversize_factor() { return file_oversize_factor_; }
+ void set_file_oversize_factor(float v) { file_oversize_factor_ = v; }
// Some stats.
int total_file_openings() { return total_file_openings_; }
@@ -146,6 +146,7 @@ class FolveFilesystem {
BufferThread *buffer_thread_;
int total_file_openings_;
int total_file_reopen_;
+ float file_oversize_factor_;
};
#endif // FOLVE_FILESYSTEM_H
View
16 folve-main.cc
@@ -280,6 +280,8 @@ static int usage(const char *prg) {
"\t Default is %d seconds; switch off with -1.\n"
"\t-g : Gapless convolving alphabetically adjacent files.\n"
"\t-b <KibiByte>: Predictive pre-buffer by given KiB (%d...%d).\n"
+ "\t-O <factor> : Oversize: Multiply orig. file sizes with this. "
+ "Default 1.25.\n"
"\t-o <mnt-opt> : other generic mount parameters passed to FUSE.\n"
"\t-D : Moderate volume Folve debug messages to syslog,\n"
"\t and some more detailed configuration info in UI\n"
@@ -303,6 +305,7 @@ enum {
FOLVE_OPT_PREBUFFER,
FOLVE_OPT_REFRESH_TIME,
FOLVE_OPT_CONFIG,
+ FOLVE_OPT_OVERSIZE_PREDICT,
FOLVE_OPT_DEBUG,
FOLVE_OPT_DEBUG_READDIR,
FOLVE_OPT_GAPLESS,
@@ -334,6 +337,18 @@ int FolveOptionHandling(void *data, const char *arg, int key,
rt->status_port = atoi(arg + 2); // strip "-p"
return 0;
+ case FOLVE_OPT_OVERSIZE_PREDICT: {
+ char *end;
+ const float value = strtof(arg + 2, &end);
+ if (*end != '\0') {
+ fprintf(stderr, "-O: Invalid number %s\n", arg + 2);
+ rt->parameter_error= true;
+ } else {
+ rt->fs->set_file_oversize_factor(value);
+ }
+ return 0;
+ }
+
case FOLVE_OPT_PREBUFFER: {
char *end;
const double value = strtod(arg + 2, &end);
@@ -402,6 +417,7 @@ int main(int argc, char *argv[]) {
FUSE_OPT_KEY("-C ", FOLVE_OPT_CONFIG),
FUSE_OPT_KEY("-D", FOLVE_OPT_DEBUG),
FUSE_OPT_KEY("-R ", FOLVE_OPT_DEBUG_READDIR),
+ FUSE_OPT_KEY("-O ", FOLVE_OPT_OVERSIZE_PREDICT),
FUSE_OPT_KEY("-g", FOLVE_OPT_GAPLESS),
FUSE_OPT_END // This fails to compile for fuse <= 2.8.1; get >= 2.8.4
};
Please sign in to comment.
Something went wrong with that request. Please try again.