scoutfs-utils: net uses rid instead of node_id

Now that networking is identifing clients by their rid some persistent
structures are using that to store records of clients.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2019-07-10 14:07:47 -07:00
committed by Zach Brown
parent 3670a5b80d
commit 7cd8738add
3 changed files with 17 additions and 19 deletions

View File

@@ -287,7 +287,7 @@ struct scoutfs_extent_btree_key {
* server failover knows who to wait for before resuming operations.
*/
struct scoutfs_lock_client_btree_key {
__be64 node_id;
__be64 rid;
} __packed;
/*
@@ -296,14 +296,14 @@ struct scoutfs_lock_client_btree_key {
*/
struct scoutfs_trans_seq_btree_key {
__be64 trans_seq;
__be64 node_id;
__be64 rid;
} __packed;
/*
* The server keeps a persistent record of mounted clients.
*/
struct scoutfs_mounted_client_btree_key {
__be64 node_id;
__be64 rid;
} __packed;
struct scoutfs_mounted_client_btree_val {
@@ -479,7 +479,6 @@ struct scoutfs_super_block {
__le64 alloc_cursor;
struct scoutfs_btree_ring bring;
__le64 next_seg_seq;
__le64 next_node_id;
__le64 next_compact_id;
__le64 quorum_fenced_term;
__le64 quorum_server_term;
@@ -611,8 +610,9 @@ enum {
*
* @server_term: The raft term that elected the server. Initially 0
* from the client, sent by the server, then sent by the client as it
* tries to reconnect. Used to identify a client reconnecting to a
* server that has timed out its connection.
* tries to reconnect. Used to identify a client reconnecting to both
* the same serer after receiving a greeting response and to a new
* server after failover.
*
* @unmount_barrier: Incremented every time the remaining majority of
* quorum members all agree to leave. The server tells a quorum member
@@ -620,17 +620,17 @@ enum {
* value increase in the super block then it knows that the server has
* processed its farewell and can safely unmount.
*
* @node_id: The id of the client. Initially 0 from the client,
* assigned by the server, and sent by the client as it reconnects.
* Used by the server to identify reconnecting clients whose existing
* state must be dealt with.
* @rid: The client's random id that was generated once as the mount
* started up. This identifies a specific remote mount across
* connections and servers. It's set to the client's rid in both the
* request and response for consistency.
*/
struct scoutfs_net_greeting {
__le64 fsid;
__le64 format_hash;
__le64 server_term;
__le64 unmount_barrier;
__le64 node_id;
__le64 rid;
__le64 flags;
} __packed;

View File

@@ -235,7 +235,6 @@ static int write_new_fs(char *path, int fd, u8 quorum_count)
super->next_trans_seq = cpu_to_le64(1);
super->total_blocks = cpu_to_le64(total_blocks);
super->next_seg_seq = cpu_to_le64(2);
super->next_node_id = cpu_to_le64(1);
super->next_compact_id = cpu_to_le64(1);
super->quorum_count = quorum_count;

View File

@@ -359,7 +359,7 @@ static int print_lock_clients_entry(void *key, unsigned key_len, void *val,
{
struct scoutfs_lock_client_btree_key *cbk = key;
printf(" node_ld %llu\n", be64_to_cpu(cbk->node_id));
printf(" rid %016llx\n", be64_to_cpu(cbk->rid));
return 0;
}
@@ -369,8 +369,8 @@ static int print_trans_seqs_entry(void *key, unsigned key_len, void *val,
{
struct scoutfs_trans_seq_btree_key *tsk = key;
printf(" trans_seq %llu node_ld %llu\n",
be64_to_cpu(tsk->trans_seq), be64_to_cpu(tsk->node_id));
printf(" trans_seq %llu rid %016llx\n",
be64_to_cpu(tsk->trans_seq), be64_to_cpu(tsk->rid));
return 0;
}
@@ -382,8 +382,8 @@ static int print_mounted_client_entry(void *key, unsigned key_len, void *val,
struct scoutfs_mounted_client_btree_key *mck = key;
struct scoutfs_mounted_client_btree_val *mcv = val;
printf(" node_id %llu flags 0x%x\n",
be64_to_cpu(mck->node_id), mcv->flags);
printf(" rid %016llx flags 0x%x\n",
be64_to_cpu(mck->rid), mcv->flags);
return 0;
}
@@ -588,7 +588,7 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno)
/* XXX these are all in a crazy order */
printf(" next_ino %llu next_trans_seq %llu next_seg_seq %llu\n"
" next_node_id %llu next_compact_id %llu\n"
" next_compact_id %llu\n"
" total_blocks %llu free_blocks %llu alloc_cursor %llu\n"
" quorum_fenced_term %llu quorum_server_term %llu unmount_barrier %llu\n"
" quorum_count %u server_addr %s\n"
@@ -602,7 +602,6 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno)
le64_to_cpu(super->next_ino),
le64_to_cpu(super->next_trans_seq),
le64_to_cpu(super->next_seg_seq),
le64_to_cpu(super->next_node_id),
le64_to_cpu(super->next_compact_id),
le64_to_cpu(super->total_blocks),
le64_to_cpu(super->free_blocks),