scoutfs: avoid reading forest roots with block IO

The forest item operations were reading the super block to find the
roots that it should read items from.

This was easiest to implement to start, but it is too expensive.  We
have to find the roots for every newly acquired lock and every call to
walk the inode seq indexes.

To avoid all these reads we first send the current stable versions of
the fs and logs btrees roots along with root grants.  Then we add a net
command to get the current stable roots from the server.  This is used
to refresh the roots if stale blocks are encountered and on the seq
index queries.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2020-08-26 14:39:12 -07:00
committed by Zach Brown
parent 304dbbbafa
commit b7943c5412
11 changed files with 190 additions and 71 deletions
+11
View File
@@ -683,6 +683,7 @@ enum {
SCOUTFS_NET_CMD_ALLOC_INODES,
SCOUTFS_NET_CMD_GET_LOG_TREES,
SCOUTFS_NET_CMD_COMMIT_LOG_TREES,
SCOUTFS_NET_CMD_GET_FS_ROOTS,
SCOUTFS_NET_CMD_ADVANCE_SEQ,
SCOUTFS_NET_CMD_GET_LAST_SEQ,
SCOUTFS_NET_CMD_STATFS,
@@ -731,6 +732,11 @@ struct scoutfs_net_statfs {
__u8 uuid[SCOUTFS_UUID_BYTES]; /* logical volume uuid */
} __packed;
struct scoutfs_net_fs_roots {
struct scoutfs_btree_root fs_root;
struct scoutfs_btree_root logs_root;
} __packed;
struct scoutfs_net_lock {
struct scoutfs_key key;
__le64 write_version;
@@ -738,6 +744,11 @@ struct scoutfs_net_lock {
__u8 new_mode;
} __packed;
struct scoutfs_net_lock_grant_response {
struct scoutfs_net_lock nl;
struct scoutfs_net_fs_roots nfr;
} __packed;
struct scoutfs_net_lock_recover {
__le16 nr;
struct scoutfs_net_lock locks[0];