Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hpc/gekkofs
  • dauer/gekkofs
2 results
Show changes
Commits on Source (9)
......@@ -66,6 +66,10 @@
*.idea/
.run/
# clangd
.clangd
.cache
# OS generated files
.DS_Store
.DS_Store?
......
......@@ -302,7 +302,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Paths inside kernel pseudo filesystems (`/sys`, `/proc`) are forwarded directly to the kernel and internal path
resolution will be skipped. Be aware that also paths like `/sys/../tmp/gkfs_mountpoint/asd` will be forwarded to the
kernel
- Added new Cmake flag `CREATE_CHECK_PARENTS` to controls if the existance of the parent node needs to be checked during
- Added new Cmake flag `GKFS_CREATE_CHECK_PARENTS` to controls if the existance of the parent node needs to be checked during
the creation of a child node.
### Changed
......
......@@ -235,16 +235,14 @@ cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS
################################################################################
## check before create
# FIXME: should be prefixed with GKFS_
gkfs_define_option(
CREATE_CHECK_PARENTS
GKFS_CREATE_CHECK_PARENTS
HELP_TEXT "Enable checking parent directory for existence before creating children"
DEFAULT_VALUE ON
DESCRIPTION "Verify that a parent directory exists before creating new files or directories"
)
## symbolic link support
# FIXME: should be prefixed with GKFS_
gkfs_define_option(
GKFS_SYMLINK_SUPPORT
HELP_TEXT "Enable support for symlinks"
......@@ -266,13 +264,11 @@ gkfs_define_option(
################################################################################
## Maximum number of internal file descriptors reserved for GekkoFS
# FIXME: should be prefixed with GKFS_
gkfs_define_variable(MAX_INTERNAL_FDS 256
gkfs_define_variable(GKFS_MAX_INTERNAL_FDS 256
STRING "Number of file descriptors reserved for internal use" ADVANCED
)
## Maximum number of open file descriptors for GekkoFS
# FIXME: should be prefixed with GKFS_
execute_process(COMMAND getconf OPEN_MAX
OUTPUT_VARIABLE _GETCONF_MAX_FDS
OUTPUT_STRIP_TRAILING_WHITESPACE
......@@ -282,7 +278,7 @@ if (NOT _GETCONF_MAX_FDS)
endif ()
gkfs_define_variable(
MAX_OPEN_FDS
GKFS_MAX_OPEN_FDS
${_GETCONF_MAX_FDS}
STRING
"Maximum number of open file descriptors supported"
......@@ -326,15 +322,13 @@ gkfs_define_option(
################################################################################
## Client logging support
# FIXME: should be prefixed with GKFS_
gkfs_define_option(
ENABLE_CLIENT_LOG HELP_TEXT "Enable logging messages in clients"
GKFS_ENABLE_CLIENT_LOG HELP_TEXT "Enable logging messages in clients"
DEFAULT_VALUE ON
)
# FIXME: should be prefixed with GKFS_
gkfs_define_variable(
CLIENT_LOG_MESSAGE_SIZE
GKFS_CLIENT_LOG_MESSAGE_SIZE
1024
STRING
"Maximum size of a log message in the client library"
......
......@@ -121,7 +121,7 @@ include(gkfs-utils)
################################################################################
include(gkfs-options)
set(CMAKE_EXPORT_COMPILE_COMMANDS 0)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# ##############################################################################
......@@ -266,17 +266,17 @@ if (GKFS_RENAME_SUPPORT)
add_definitions(-DHAS_RENAME)
endif ()
if(MAX_INTERNAL_FDS)
add_definitions(-DMAX_INTERNAL_FDS=${MAX_INTERNAL_FDS})
if(GKFS_MAX_INTERNAL_FDS)
add_definitions(-DGKFS_MAX_INTERNAL_FDS=${GKFS_MAX_INTERNAL_FDS})
endif()
if(MAX_OPEN_FDS)
add_definitions(-DMAX_OPEN_FDS=${MAX_OPEN_FDS})
if(GKFS_MAX_OPEN_FDS)
add_definitions(-DGKFS_MAX_OPEN_FDS=${GKFS_MAX_OPEN_FDS})
endif()
if(ENABLE_CLIENT_LOG)
if(GKFS_ENABLE_CLIENT_LOG)
add_definitions(-DGKFS_ENABLE_LOGGING)
add_definitions(-DLIBGKFS_LOG_MESSAGE_SIZE=${CLIENT_LOG_MESSAGE_SIZE})
add_definitions(-DLIBGKFS_LOG_MESSAGE_SIZE=${GKFS_CLIENT_LOG_MESSAGE_SIZE})
endif ()
if(GKFS_ENABLE_UNUSED_FUNCTIONS)
......@@ -289,7 +289,7 @@ endif ()
configure_file(include/common/cmake_configure.hpp.in include/common/cmake_configure.hpp)
if(ENABLE_CLIENT_LOG)
if(GKFS_ENABLE_CLIENT_LOG)
option(HERMES_LOGGING "" ON)
option(HERMES_LOGGING_FMT_USE_BUNDLED "" OFF)
option(HERMES_LOGGING_FMT_HEADER_ONLY "" OFF)
......
......@@ -18,8 +18,8 @@
"GKFS_ENABLE_PARALLAX": false,
"GKFS_BUILD_TESTS": false,
"GKFS_INSTALL_TESTS": false,
"ENABLE_CLIENT_LOG": true,
"CLIENT_LOG_MESSAGE_SIZE": "1024",
"GKFS_ENABLE_CLIENT_LOG": true,
"GKFS_CLIENT_LOG_MESSAGE_SIZE": "1024",
"GKFS_SYMLINK_SUPPORT": false
},
"warnings": {
......@@ -85,8 +85,8 @@
"GKFS_CHUNK_STATS": true,
"GKFS_ENABLE_PROMETHEUS": true,
"GKFS_RENAME_SUPPORT": true,
"MAX_OPEN_FDS": "10000",
"MAX_INTERNAL_FDS": "1024"
"GKFS_MAX_OPEN_FDS": "10000",
"GKFS_MAX_INTERNAL_FDS": "1024"
}
},
{
......
......@@ -49,7 +49,6 @@ that greatly simplify this process. Thus, GekkoFS provides a CMake
$ cmake --preset=default-coverage
Preset CMake variables:
CLIENT_LOG_MESSAGE_SIZE="512"
CMAKE_BUILD_TYPE="Coverage"
CMAKE_CXX_COMPILER="/usr/bin/g++"
CMAKE_CXX_FLAGS="-Wall -Wextra -fdiagnostics-color=always --pedantic -Wno-unused-parameter -Wno-missing-field-initializers -DGKFS_DEBUG_BUILD -DHERMES_DEBUG_BUILD"
......@@ -59,7 +58,8 @@ Preset CMake variables:
CMAKE_EXE_LINKER_FLAGS_COVERAGE="--coverage"
CMAKE_MAP_IMPORTED_CONFIG_COVERAGE="Coverage;RelWithDebInfo;Release;Debug;"
CMAKE_SHARED_LINKER_FLAGS_COVERAGE="--coverage"
ENABLE_CLIENT_LOG:BOOL="TRUE"
GKFS_CLIENT_LOG_MESSAGE_SIZE="512"
GKFS_ENABLE_CLIENT_LOG:BOOL="TRUE"
GKFS_BUILD_DOCUMENTATION:BOOL="TRUE"
GKFS_BUILD_TESTS:BOOL="TRUE"
GKFS_CHUNK_STATS:BOOL="TRUE"
......
......@@ -77,7 +77,8 @@ enum class RelativizeStatus { internal, external, fd_unknown, fd_not_a_dir };
*/
class PreloadContext {
static auto constexpr MIN_INTERNAL_FD = MAX_OPEN_FDS - MAX_INTERNAL_FDS;
static auto constexpr MIN_INTERNAL_FD =
GKFS_MAX_OPEN_FDS - GKFS_MAX_INTERNAL_FDS;
static auto constexpr MAX_USER_FDS = MIN_INTERNAL_FD;
private:
......@@ -99,7 +100,7 @@ private:
bool interception_enabled_;
std::bitset<MAX_INTERNAL_FDS> internal_fds_;
std::bitset<GKFS_MAX_INTERNAL_FDS> internal_fds_;
mutable std::mutex internal_fds_mutex_;
bool internal_fds_must_relocate_;
std::bitset<MAX_USER_FDS> protected_fds_;
......
......@@ -14,7 +14,7 @@
#ifndef GKFS_CMAKE_CONFIGURE_HPP
#define GKFS_CMAKE_CONFIGURE_HPP
#cmakedefine01 CREATE_CHECK_PARENTS
#cmakedefine01 GKFS_CREATE_CHECK_PARENTS
#cmakedefine01 LOG_SYSCALLS
#cmakedefine GKFS_USE_GUIDED_DISTRIBUTION
#define GKFS_USE_GUIDED_DISTRIBUTION_PATH "@GKFS_USE_GUIDED_DISTRIBUTION_PATH@"
......
......@@ -66,4 +66,9 @@ constexpr auto na_sm = "na+sm";
} // namespace protocol
} // namespace gkfs::rpc
namespace gkfs::config::syscall::stat {
// Number 512-byte blocks allocated as it is in the linux kernel (struct_stat.h)
constexpr auto st_nblocksize = 512;
} // namespace gkfs::config::syscall::stat
#endif // GEKKOFS_COMMON_DEFS_HPP
......@@ -91,13 +91,13 @@ namespace {
/**
* Checks if metadata for parent directory exists (can be disabled with
* CREATE_CHECK_PARENTS). errno may be set
* GKFS_CREATE_CHECK_PARENTS). errno may be set
* @param path
* @return 0 on success, -1 on failure
*/
int
check_parent_dir(const std::string& path) {
#if CREATE_CHECK_PARENTS
#if GKFS_CREATE_CHECK_PARENTS
auto p_comp = gkfs::path::dirname(path);
auto md = gkfs::utils::get_metadata(p_comp);
if(!md) {
......@@ -114,7 +114,7 @@ check_parent_dir(const std::string& path) {
errno = ENOTDIR;
return -1;
}
#endif // CREATE_CHECK_PARENTS
#endif // GKFS_CREATE_CHECK_PARENTS
return 0;
}
} // namespace
......
......@@ -266,7 +266,9 @@ init_preload() {
// happens during our internal initialization, there's no way for us to
// control this creation and the fd will be created in the
// [0, MAX_USER_FDS) range rather than in our private
// [MAX_USER_FDS, MAX_OPEN_FDS) range. To prevent this for our internal
// [MAX_USER_FDS, GKFS_MAX_OPEN_FDS) range.
// with MAX_USER_FDS = GKFS_MAX_OPEN_FDS - GKFS_MAX_INTERNAL_FDS
// To prevent this for our internal
// initialization code, we forcefully occupy the user fd range to force
// such modules to create fds in our private range.
CTX->protect_user_fds();
......
......@@ -316,7 +316,7 @@ PreloadContext::register_internal_fd(int fd) {
if(static_cast<std::size_t>(pos) == internal_fds_.size()) {
throw std::runtime_error(
"Internal GekkoFS file descriptors exhausted, increase MAX_INTERNAL_FDS in "
"Internal GekkoFS file descriptors exhausted, increase GKFS_MAX_INTERNAL_FDS in "
"CMake, rebuild GekkoFS and try again.");
}
internal_fds_.reset(pos);
......
......@@ -268,9 +268,10 @@ metadata_to_stat(const std::string& path, const gkfs::metadata::Metadata& md,
if(CTX->fs_conf()->link_cnt_state) {
attr.st_nlink = md.link_count();
}
if(CTX->fs_conf()->blocks_state) { // last one will not encounter a
// delimiter anymore
if(CTX->fs_conf()->blocks_state) {
attr.st_blocks = md.blocks();
} else {
attr.st_blocks = md.size() / gkfs::config::syscall::stat::st_nblocksize;
}
return 0;
}
......
......@@ -813,7 +813,7 @@ main(int argc, const char* argv[]) {
#else
cout << "Debug: OFF" << endl;
#endif
#if CREATE_CHECK_PARENTS
#if GKFS_CREATE_CHECK_PARENTS
cout << "Create check parents: ON" << endl;
#else
cout << "Create check parents: OFF" << endl;
......