kmod: rename idempotency window and make it a sysctl

This commit is contained in:
Miroslav Crnic
2026-04-17 08:44:10 +00:00
parent 902db94d15
commit 9890df2190
3 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ int ternfs_mtu = TERNFS_DEFAULT_MTU;
int ternfs_default_mtu = TERNFS_DEFAULT_MTU;
int ternfs_max_mtu = TERNFS_MAX_MTU;
#define TERNFS_RENAME_NEW_EDGE_CREATION_TIME_FUZZ_NS (60ULL * 1000 * 1000 * 1000) // 60 seconds
int ternfs_rename_idempotency_window_jiffies = MSECS_TO_JIFFIES(120000); // 120 seconds
static DEFINE_PER_CPU(u64, next_request_id);
@@ -374,7 +374,7 @@ static bool check_new_edge_after_rename(
if (likely(ctx.err == 0) && !good && TERNFS_GET_EXTRA_ID(edge_target.x) == target) {
u64 now_ns = ktime_get_real_ns();
u64 delta = now_ns > edge_creation_time.x ? now_ns - edge_creation_time.x : edge_creation_time.x - now_ns;
if (delta < TERNFS_RENAME_NEW_EDGE_CREATION_TIME_FUZZ_NS) {
if (delta < (u64)jiffies_to_msecs(ternfs_rename_idempotency_window_jiffies) * 1000000ULL) {
good = true;
*creation_time = edge_creation_time.x;
}
+1
View File
@@ -17,6 +17,7 @@
extern int ternfs_mtu;
extern int ternfs_default_mtu;
extern int ternfs_max_mtu;
extern int ternfs_rename_idempotency_window_jiffies;
int ternfs_shard_lookup(struct ternfs_fs_info* info, u64 dir, const char* name, int name_len, u64* ino, u64* creation_time);
int ternfs_shard_readdir(struct ternfs_fs_info* info, u64 dir, u64 start_pos, void* data, u64* next_hash);
+1
View File
@@ -157,6 +157,7 @@ static struct ctl_table ternfs_cb_sysctls[] = {
TERNFS_CTL_UINT(file_io_timeout_sec),
TERNFS_CTL_UINT(file_io_retry_refresh_span_interval_sec),
TERNFS_CTL_UINT(disable_ftruncate),
TERNFS_CTL_INT_JIFFIES(rename_idempotency_window),
{
.procname = "mtu",