in turbonfs/src/main.cpp [83:218]
static void aznfsc_ll_init(void *userdata,
struct fuse_conn_info *conn)
{
/*
* TODO: Kernel conveys us the various filesystem limits by passing the
* fuse_conn_info pointer. If we need to reduce any of the limits
* we can do so. Usually we may not be interested in reducing any
* of those limits.
* We can at least log from here so that we know the limits.
*/
/*
* Apply the user passed options (-o). This must be done before
* the overrides we have below. This is because those overrides are
* our limitation and we cannot let user bypass them.
*
* Note: fuse_session_new() no longer accepts arguments
* command line options can only be set using
* fuse_apply_conn_info_opts().
*/
fuse_apply_conn_info_opts(fuse_conn_info_opts_ptr, conn);
/*
* XXX Disable readdir temporarily while I work on fixing readdirplus.
* Once readdirplus is audited/fixed, enable readdir and audit/fix
* that.
* TODO: Readdir works fine but just that for readdir fuse kernel
* will not send FORGET and thus we currently don't delete those
* entries and the inodes. Need to add memory pressure based
* deletion for those.
*/
conn->want |= FUSE_CAP_READDIRPLUS;
conn->want |= FUSE_CAP_READDIRPLUS_AUTO;
/*
* Fuse kernel driver must issue parallel readahead requests.
*/
// conn->want |= FUSE_CAP_ASYNC_READ;
// Blob NFS doesn't support locking.
conn->want &= ~FUSE_CAP_POSIX_LOCKS;
conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
// TODO: See if we can support O_TRUNC.
conn->want &= ~FUSE_CAP_ATOMIC_O_TRUNC;
/*
* For availing perf advantage of splice() we must add splice()/sendfile()
* support to libnfs. Till then just disable splicing so fuse never sends
* us fd+offset but just a plain buffer.
* Test splice read/write performance before enabling.
*/
conn->want &= ~FUSE_CAP_SPLICE_WRITE;
conn->want &= ~FUSE_CAP_SPLICE_MOVE;
conn->want &= ~FUSE_CAP_SPLICE_READ;
// conn->want |= FUSE_CAP_AUTO_INVAL_DATA;
// conn->want |= FUSE_CAP_ASYNC_DIO;
if (aznfsc_cfg.cache.data.kernel.enable) {
conn->want |= FUSE_CAP_WRITEBACK_CACHE;
} else {
conn->want &= ~FUSE_CAP_WRITEBACK_CACHE;
}
// conn->want |= FUSE_CAP_PARALLEL_DIROPS;
conn->want &= ~FUSE_CAP_POSIX_ACL;
// TODO: See if we should enable this.
conn->want &= ~FUSE_CAP_CACHE_SYMLINKS;
#if 0
conn->want &= ~FUSE_CAP_SETXATTR_EXT;
#endif
#if 0
/*
* Fuse wants max_read set here to match the mount option passed
* -o max_read=<n>
*/
if (conn->max_read) {
conn->max_read =
std::min<unsigned int>(conn->max_read, AZNFSC_MAX_CHUNK_SIZE);
} else {
conn->max_read = AZNFSC_MAX_CHUNK_SIZE;
}
if (conn->max_readahead) {
conn->max_readahead =
std::min<unsigned int>(conn->max_readahead, AZNFSC_MAX_CHUNK_SIZE);
} else {
conn->max_readahead = AZNFSC_MAX_CHUNK_SIZE;
}
if (conn->max_write) {
conn->max_write =
std::min<unsigned int>(conn->max_write, AZNFSC_MAX_CHUNK_SIZE);
} else {
conn->max_write = AZNFSC_MAX_CHUNK_SIZE;
}
#endif
/*
* If user has explicitly specified "-o max_background=", honour that,
* else if he has specified fuse_max_background config, use that, else
* pick a good default.
*/
if (conn->max_background == 0) {
if (aznfsc_cfg.fuse_max_background != -1) {
conn->max_background = aznfsc_cfg.fuse_max_background;
} else {
conn->max_background = AZNFSCFG_FUSE_MAX_BG_DEF;
}
}
/*
* Set kernel readahead_kb if kernel data cache is enabled.
*/
set_kernel_readahead();
/*
* Disable OOM killing for aznfsclient process if user has selected.
*/
disable_oom_kill();
AZLogDebug("===== fuse_conn_info fields start =====");
AZLogDebug("proto_major = {}", conn->proto_major);
AZLogDebug("proto_minor = {}", conn->proto_minor);
AZLogDebug("max_write = {}", conn->max_write);
AZLogDebug("max_read = {}", conn->max_read);
AZLogDebug("max_readahead = {}", conn->max_readahead);
AZLogDebug("capable = 0x{:x}", conn->capable);
AZLogDebug("want = 0x{:x}", conn->want);
AZLogDebug("max_background = {}", conn->max_background);
AZLogDebug("congestion_threshold = {}", conn->congestion_threshold);
AZLogDebug("time_gran = {}", conn->time_gran);
AZLogDebug("===== fuse_conn_info fields end =====");
}