Commit 6806c50d authored by Marc Vef's avatar Marc Vef
Browse files

Read: Making zeroing of buffer configurable

It is only relevant for sparse files but the current implementation
has a too high overhead on a single node (~10%). We need to find
a better solution at a later point.
parent 8068d1ae
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@
//#define CHECK_ACCESS_DURING_OPEN
// If disabled, a file or directory is always presumed to be there (even if it is not). No check is executed (enabled by default)
#define DO_LOOKUP
/*
 * Zero buffer before read. This is relevant if sparse files are used.
 * If buffer is not zeroed, sparse regions contain invalid data.
 */
//#define ZERO_BUFFER_BEFORE_READ

// Write-ahead logging of rocksdb
//#define KV_WOL
+3 −0
Original line number Diff line number Diff line
@@ -200,7 +200,10 @@ ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off64_t offset) {
    init_ld_env_if_needed();
    auto adafs_fd = file_map.get(fd);
    auto path = make_shared<string>(adafs_fd->path());
    // Zeroing buffer before read is only relevant for sparse files. Otherwise sparse regions contain invalid data.
#if defined(ZERO_BUFFER_BEFORE_READ)
    memset(buf, 0, sizeof(char)*count);
#endif
    auto ret = rpc_send_read(*path, buf, offset, count);
    if (ret < 0) {
        ld_logger->warn("{}() rpc_send_read failed with ret {}", __func__, ret);