From bceb9f25671e65cb2f0987a84370055e7c36900f Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Thu, 9 Aug 2018 11:46:33 +0200 Subject: fuse: interrupt handling framework - add sub-framework to send timed responses to kernel - add interrupt handler queue - implement INTERRUPT fuse_interrupt looks up handlers for interrupted messages in the queue. If found, it invokes the handler function. Else responds with EAGAIN with a delay. See spec at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/fuse.txt?h=v4.17#n148 and explanation in comments. Change-Id: I1a79d3679b31f36e14b4ac8f60b7f2c1ea2badfb updates: #465 Signed-off-by: Csaba Henk --- libglusterfs/src/libglusterfs.sym | 2 ++ libglusterfs/src/timespec.c | 16 ++++++++++++++++ libglusterfs/src/timespec.h | 2 ++ 3 files changed, 20 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 27eb1175b56..c8c42311c80 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -1057,6 +1057,8 @@ tbf_init tbf_throttle timespec_now timespec_sub +timespec_adjust_delta +timespec_cmp token_iter_init trap trie_add diff --git a/libglusterfs/src/timespec.c b/libglusterfs/src/timespec.c index d17506662ac..c0d4ab9315b 100644 --- a/libglusterfs/src/timespec.c +++ b/libglusterfs/src/timespec.c @@ -90,3 +90,19 @@ timespec_sub(const struct timespec *begin, const struct timespec *end, res->tv_nsec = end->tv_nsec - begin->tv_nsec; } } + +int +timespec_cmp(const struct timespec *lhs_ts, const struct timespec *rhs_ts) +{ + if (lhs_ts->tv_sec < rhs_ts->tv_sec) { + return -1; + } else if (lhs_ts->tv_sec > rhs_ts->tv_sec) { + return 1; + } else if (lhs_ts->tv_nsec < rhs_ts->tv_nsec) { + return -1; + } else if (lhs_ts->tv_nsec > rhs_ts->tv_nsec) { + return 1; + } + + return 0; +} diff --git a/libglusterfs/src/timespec.h b/libglusterfs/src/timespec.h index 73db2d16abe..871871d538c 100644 --- a/libglusterfs/src/timespec.h +++ b/libglusterfs/src/timespec.h @@ -25,5 +25,7 @@ timespec_adjust_delta(struct timespec *ts, struct timespec delta); void timespec_sub(const struct timespec *begin, const struct timespec *end, struct timespec *res); +int +timespec_cmp(const struct timespec *lhs_ts, const struct timespec *rhs_ts); #endif /* __INCLUDE_TIMESPEC_H__ */ -- cgit