From cde344137b2adb496e1b86b7ba8b8be14e610ee4 Mon Sep 17 00:00:00 2001 From: waterwin Date: Sun, 21 May 2023 13:29:01 +0000 Subject: [PATCH] hmdfs delete 1.0 Signed-off-by: waterwin --- fs/hmdfs/comm/connection.c | 16 ++------ fs/hmdfs/inode_remote.c | 78 +++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 56 deletions(-) diff --git a/fs/hmdfs/comm/connection.c b/fs/hmdfs/comm/connection.c index 7613da514c7c..8207d044f7d0 100644 --- a/fs/hmdfs/comm/connection.c +++ b/fs/hmdfs/comm/connection.c @@ -612,17 +612,6 @@ void connection_to_working(struct hmdfs_peer *node) peer_online(node); } -static int connection_check_version(__u8 version) -{ - __u8 min_ver = USERSPACE_MAX_VER; - - if (version <= min_ver || version >= MAX_VERSION) { - hmdfs_info("version err. version %u", version); - return -1; - } - return 0; -} - void connection_handshake_recv_handler(struct connection *conn_impl, void *buf, void *data, __u32 data_len) { @@ -633,10 +622,11 @@ void connection_handshake_recv_handler(struct connection *conn_impl, void *buf, struct connection_msg_head *head = (struct connection_msg_head *)buf; int ret; + if (head->version != DFS_2_0) + goto out; + version = head->version; conn_impl->node->version = version; - if (connection_check_version(version) != 0) - goto out; conn_impl->node->conn_operations = hmdfs_get_peer_operation(version); ops = head->operations; status = conn_impl->status; diff --git a/fs/hmdfs/inode_remote.c b/fs/hmdfs/inode_remote.c index 6a19e6e6b135..e81217b3b013 100644 --- a/fs/hmdfs/inode_remote.c +++ b/fs/hmdfs/inode_remote.c @@ -175,49 +175,41 @@ struct hmdfs_lookup_ret *hmdfs_lookup_by_con(struct hmdfs_peer *con, { struct hmdfs_lookup_ret *result = NULL; - if (con->version > USERSPACE_MAX_VER) { - /* - * LOOKUP_REVAL means we found stale info from dentry file, thus - * we need to use remote getattr. - */ - if (flags & LOOKUP_REVAL) { - /* - * HMDFS_LOOKUP_REVAL means we need to skip dentry cache - * in lookup, because dentry cache in server might have - * stale data. - */ - result = get_remote_inode_info(con, dentry, - HMDFS_LOOKUP_REVAL); - get_remote_dentry_file_in_wq(dentry->d_parent, con); - return result; - } - - /* If cache file is still valid */ - if (hmdfs_cache_revalidate(READ_ONCE(con->conn_time), - con->device_id, dentry->d_parent)) { - result = lookup_remote_dentry(dentry, qstr, - con->device_id); - /* - * If lookup from cache file failed, use getattr to see - * if remote have created the file. - */ - if (!(flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) && - !result) - result = get_remote_inode_info(con, dentry, 0); - /* If cache file expired, use getattr directly - * except create and rename opt - */ - } else { - result = get_remote_inode_info(con, dentry, 0); - get_remote_dentry_file_in_wq(dentry->d_parent, con); - } - } else { - if (!relative_path) - return NULL; - - result = con->conn_operations->remote_lookup( - con, relative_path, dentry->d_name.name); - } + /* + * LOOKUP_REVAL means we found stale info from dentry file, thus + * we need to use remote getattr. + */ + if (flags & LOOKUP_REVAL) { + /* + * HMDFS_LOOKUP_REVAL means we need to skip dentry cache + * in lookup, because dentry cache in server might have + * stale data. + */ + result = get_remote_inode_info(con, dentry, + HMDFS_LOOKUP_REVAL); + get_remote_dentry_file_in_wq(dentry->d_parent, con); + return result; + } + + /* If cache file is still valid */ + if (hmdfs_cache_revalidate(READ_ONCE(con->conn_time), + con->device_id, dentry->d_parent)) { + result = lookup_remote_dentry(dentry, qstr, + con->device_id); + /* + * If lookup from cache file failed, use getattr to see + * if remote have created the file. + */ + if (!(flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) && + !result) + result = get_remote_inode_info(con, dentry, 0); + /* If cache file expired, use getattr directly + * except create and rename opt + */ + } else { + result = get_remote_inode_info(con, dentry, 0); + get_remote_dentry_file_in_wq(dentry->d_parent, con); + } return result; } -- Gitee