mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-29 03:23:13 +00:00
Introduce the concept of acquiring write locks around write operations. The core idea is that reads are unlocked and that write lock contention between nodes should be rare. This first pass simply broadcasts write lock requests to all the mounts in the volume. It achieves a reasonable degree of fairness and doesn't require centralizing state in a lock server. We have to flesh out a bit of initial infrastructure to support the write locking protocol. The roster manages cluster membership and messaging and only understands mounts in the same kernel for now. Creation needs to know which inodes to try and lock so we see the start of per-mount free inode reservations. The transformation of users is straight forward: they aquire the write lock on the inodes they're working with instead of holding a transaction. The write lock machinery now manages transactions. This passes single mount testing but that isn't saying much. The next step is to run multi-mount tests. Signed-off-by: Zach Brown <zab@versity.com>
37 lines
667 B
C
37 lines
667 B
C
#ifndef _SCOUTFS_WIRE_H_
|
|
#define _SCOUTFS_WIRE_H_
|
|
|
|
/* an arbitrarily small number to keep things reasonable */
|
|
#define SCOUTFS_WRLOCK_MAX_SHARDS 5
|
|
|
|
enum {
|
|
SCOUTFS_MSG_WRLOCK_REQUEST = 1,
|
|
SCOUTFS_MSG_WRLOCK_GRANT = 2,
|
|
};
|
|
|
|
struct scoutfs_wrlock_id {
|
|
__le64 counter;
|
|
__le32 jitter;
|
|
} __packed;
|
|
|
|
struct scoutfs_wrlock_request {
|
|
struct scoutfs_wrlock_id wid;
|
|
u8 nr_shards;
|
|
__le32 shards[SCOUTFS_WRLOCK_MAX_SHARDS];
|
|
} __packed;
|
|
|
|
struct scoutfs_wrlock_grant {
|
|
struct scoutfs_wrlock_id wid;
|
|
} __packed;
|
|
|
|
struct scoutfs_message {
|
|
u8 cmd;
|
|
u8 len;
|
|
union {
|
|
struct scoutfs_wrlock_grant grant;
|
|
struct scoutfs_wrlock_request request;
|
|
} __packed;
|
|
} __packed;
|
|
|
|
#endif
|