The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.17.vz10
------>
commit cd802c6720a89e22d2068902ffe8122b789f37b3
Author: Liu Kui <[email protected]>
Date: Tue Nov 11 10:02:42 2025 +0800
fs/fuse kio: remove unused code in pcs_rpc
https://virtuozzo.atlassian.net/browse/VSTOR-117505
Signed-off-by: Liu Kui <[email protected]>
Acked-by: Alexey Kuznetsov <[email protected]>
Feature: vStorage
---
fs/fuse/kio/pcs/pcs_auth.c | 5 +-
fs/fuse/kio/pcs/pcs_rdma_conn.c | 3 +-
fs/fuse/kio/pcs/pcs_rpc.c | 135 +---------------------------------------
fs/fuse/kio/pcs/pcs_rpc.h | 36 +----------
fs/fuse/kio/pcs/pcs_sock_conn.c | 3 +-
5 files changed, 7 insertions(+), 175 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_auth.c b/fs/fuse/kio/pcs/pcs_auth.c
index d853653c68bb8..e388fa99a1cdd 100644
--- a/fs/fuse/kio/pcs/pcs_auth.c
+++ b/fs/fuse/kio/pcs/pcs_auth.c
@@ -314,11 +314,8 @@ static int send_auth_msg(struct pcs_rpc *ep, void *data,
size_t size, int state)
if (!(ep->flags & PCS_RPC_F_PEER_ID))
au->flags |= PCS_RPC_AUTH_F_VOID_RECIPIENT;
- if (!(eng->flags & PCS_KNOWN_MYID)) {
+ if (!(eng->flags & PCS_KNOWN_MYID))
au->flags |= PCS_RPC_AUTH_F_VOID_SENDER;
- if (ep->flags & PCS_RPC_F_ACQ_ID)
- au->flags |= PCS_RPC_AUTH_F_ACQ_SENDER;
- }
if (!(eng->flags & PCS_KNOWN_CLUSTERID))
au->flags |= PCS_RPC_AUTH_F_VOID_CLUSTERID;
diff --git a/fs/fuse/kio/pcs/pcs_rdma_conn.c b/fs/fuse/kio/pcs/pcs_rdma_conn.c
index 3c1f7f9a8e449..1cb9d2aa995c8 100644
--- a/fs/fuse/kio/pcs/pcs_rdma_conn.c
+++ b/fs/fuse/kio/pcs/pcs_rdma_conn.c
@@ -158,8 +158,7 @@ void pcs_rdmaconnect_start(struct pcs_rpc *ep)
if (ep->gc)
list_lru_add_obj(&ep->gc->lru, &ep->lru_link);
- if (ep->flags & PCS_RPC_F_CLNT_PEER_ID)
- ep->flags |= PCS_RPC_F_PEER_ID;
+ ep->flags |= PCS_RPC_F_PEER_ID;
ep->state = PCS_RPC_AUTH;
diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index 353a032c7f58c..540225006726d 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -49,59 +49,6 @@ DECLARE_WAIT_QUEUE_HEAD(pcs_waitq);
static void timer_work(struct work_struct *w);
static int rpc_gc_classify(struct pcs_rpc * ep);
-static unsigned int rpc_hash(PCS_NODE_ID_T * id)
-{
- return *(unsigned int*)id % PCS_RPC_HASH_SIZE;
-}
-
-static struct pcs_rpc *
-pcs_rpc_lookup(struct pcs_rpc_engine * eng, PCS_NODE_ID_T * id)
__attribute__((unused));
-
-static struct pcs_rpc *
-pcs_rpc_lookup(struct pcs_rpc_engine * eng, PCS_NODE_ID_T * id)
-{
- struct pcs_rpc * ep;
-
- spin_lock(&eng->lock);
- hlist_for_each_entry(ep, &eng->ht[rpc_hash(id)], link) {
- if (memcmp(&ep->peer_id, id, sizeof(ep->peer_id)) == 0) {
- pcs_rpc_get(ep);
- break;
- }
- }
- spin_unlock(&eng->lock);
- return ep;
-}
-static void rpc_add_hash(struct pcs_rpc * ep) __attribute__ ((unused));
-static void rpc_del_hash(struct pcs_rpc * ep) __attribute__ ((unused));
-
-static void rpc_add_hash(struct pcs_rpc * ep)
-{
- spin_lock(&ep->eng->lock);
- if (!hlist_unhashed(&ep->link))
- hlist_del(&ep->link);
-
- if (!(ep->flags & PCS_RPC_F_HASHED)) {
- ep->flags |= PCS_RPC_F_HASHED;
- pcs_rpc_get(ep);
- }
-
- hlist_add_head(&ep->link, &ep->eng->ht[rpc_hash(&ep->peer_id)]);
- spin_unlock(&ep->eng->lock);
-}
-
-static void rpc_del_hash(struct pcs_rpc * ep)
-{
- if (ep->flags & PCS_RPC_F_HASHED) {
- ep->flags &= ~PCS_RPC_F_HASHED;
- spin_lock(&ep->eng->lock);
- hlist_del(&ep->link);
- hlist_add_head(&ep->link, &ep->eng->unhashed);
- spin_unlock(&ep->eng->lock);
- pcs_rpc_put(ep);
- }
-}
-
void pcs_rpc_report_error(struct pcs_rpc *ep, unsigned int err)
{
if (!ep->eng || !cc_from_rpc(ep->eng)->fc->ktrace) {
@@ -182,16 +129,11 @@ void rpc_abort(struct pcs_rpc * ep, int fatal, int error)
BUG_ON(!mutex_is_locked(&ep->mutex));
TRACE("ep:%p->state:%d fatal:%d error:%d\n", ep, state, fatal, error);
- ep->flags &= ~(PCS_RPC_F_PEER_VERIFIED | PCS_RPC_F_PEER_AUTHORIZED);
ep->flags &= ~PCS_RPC_F_PEER_ID;
if (state == PCS_RPC_DESTROY || state == PCS_RPC_ABORT)
return;
- /* Passively open connections are not reconnected */
- if (ep->flags & (PCS_RPC_F_PASSIVE|PCS_RPC_F_NO_RETRY|PCS_RPC_F_DEAD))
- fatal = 1;
-
ep->state = fatal ? PCS_RPC_ABORT : PCS_RPC_UNCONN;
cancel_delayed_work(&ep->timer_work);
@@ -352,7 +294,6 @@ static void pcs_rpc_destroy(struct pcs_rpc *ep)
{
bool last_ep;
BUG_ON(ep->state != PCS_RPC_DESTROY);
- BUG_ON(ep->flags & PCS_RPC_F_HASHED);
BUG_ON(!(ep->flags & PCS_RPC_F_DEAD));
BUG_ON(!list_empty(&ep->input_queue));
BUG_ON(!list_empty(&ep->state_queue));
@@ -1175,35 +1116,6 @@ void pcs_rpc_get_new_xid(struct pcs_rpc_engine *eng,
PCS_XID_T *xid)
xid->val = atomic64_inc_return(&eng->xid_generator);
}
-static int rpc_check_memlimit(struct pcs_rpc * ep)
-{
- struct pcs_rpc_engine * eng = ep->eng;
-
- if ((ep->flags & PCS_RPC_F_ACCT) &&
- eng->msg_allocated >= eng->mem_pressure_thresh) {
- /* If congestion avoidance works, this should not happen.
- * However, if this happens we must do something.
- */
- if (eng->msg_allocated > eng->mem_limit) {
- FUSE_KLOG(cc_from_rpc(ep->eng)->fc, LOG_ERR, "Hard
memory limit exceeded");
- return 1;
- }
- if (ep->peer_role == PCS_NODE_ROLE_CN) {
- /* CN contributes 3 (repl.norm) times of memory
pressure on cluster */
- if (3 * ep->accounted * eng->accounted_rpcs >=
eng->msg_allocated) {
- FUSE_KTRACE(cc_from_rpc(eng)->fc, "Soft memory
limit exceeded " PEER_FMT, PEER_ARGS(ep));
- return 1;
- }
- } else {
- if (ep->accounted * eng->accounted_rpcs >=
eng->msg_allocated) {
- FUSE_KTRACE(cc_from_rpc(eng)->fc, "Soft memory
limit exceeded " PEER_FMT, PEER_ARGS(ep));
- return 1;
- }
- }
- }
- return 0;
-}
-
void pcs_rpc_deaccount_msg(struct pcs_msg * msg)
{
struct pcs_rpc *ep = msg->rpc;
@@ -1212,19 +1124,8 @@ void pcs_rpc_deaccount_msg(struct pcs_msg * msg)
return;
msg->rpc = NULL;
- ep->eng->msg_count--;
- if (msg->accounted) {
- ep->accounted -= msg->accounted;
- ep->eng->msg_allocated -= msg->accounted;
- if (ep->accounted == 0)
- ep->eng->accounted_rpcs--;
- msg->accounted = 0;
- if (ep->state == PCS_RPC_WORK) {
- struct pcs_netio *netio = (struct pcs_netio *)ep->conn;
- netio->tops->unthrottle(netio);
- }
- }
+ ep->eng->msg_count--;
pcs_rpc_put(ep);
}
@@ -1234,27 +1135,6 @@ static void pcs_rpc_account_msg(struct pcs_rpc * ep,
struct pcs_msg * msg, int a
msg->rpc = pcs_rpc_get(ep);
ep->eng->msg_count++;
-
- if (ep->flags & PCS_RPC_F_ACCT) {
- msg->accounted = accounted;
-
- if (ep->accounted == 0)
- ep->eng->accounted_rpcs++;
-
- ep->eng->msg_allocated += accounted;
- ep->accounted += accounted;
- }
-}
-
-void pcs_rpc_account_adjust(struct pcs_msg * msg, int adjustment)
-{
- if (msg->accounted && (msg->rpc->flags & PCS_RPC_F_ACCT)) {
- struct pcs_rpc * ep = msg->rpc;
-
- msg->accounted += adjustment;
- ep->eng->msg_allocated += adjustment;
- ep->accounted += adjustment;
- }
}
static void pcs_rpc_input_destructor(struct pcs_msg * msg)
@@ -1288,9 +1168,6 @@ struct pcs_msg * pcs_rpc_alloc_input_msg(struct pcs_rpc *
ep, int datalen)
{
struct pcs_msg * msg;
- if (rpc_check_memlimit(ep))
- return NULL;
-
msg = kzalloc(sizeof(struct pcs_msg) + datalen, GFP_NOIO);
if (msg) {
pcs_rpc_init_input_msg(ep, msg, sizeof(struct pcs_msg) +
datalen);
@@ -1300,7 +1177,6 @@ struct pcs_msg * pcs_rpc_alloc_input_msg(struct pcs_rpc *
ep, int datalen)
return msg;
}
-
static void pcs_msg_output_destructor(struct pcs_msg * msg)
{
if (msg->rpc)
@@ -1357,10 +1233,8 @@ struct pcs_msg * pcs_alloc_response(struct pcs_rpc_hdr *
req_hdr, int size)
void pcs_rpc_set_peer_id(struct pcs_rpc * ep, PCS_NODE_ID_T * id, u8 role)
{
- BUG_ON(ep->flags & (PCS_RPC_F_PEER_ID|PCS_RPC_F_HASHED));
ep->peer_role = role;
memcpy(&ep->peer_id, id, sizeof(PCS_NODE_ID_T));
- ep->flags |= PCS_RPC_F_CLNT_PEER_ID;
}
int pcs_rpc_set_address(struct pcs_rpc * ep, PCS_NET_ADDR_T * addr)
@@ -1526,13 +1400,6 @@ void pcs_rpc_init_gc(struct pcs_rpc_engine * eng,
unsigned int limit)
}
}
-
-void pcs_rpc_set_memlimits(struct pcs_rpc_engine * eng, u64 thresh, u64 limit)
-{
- eng->mem_pressure_thresh = thresh;
- eng->mem_limit = limit;
-}
-
static const char *s_rpc_state_names[] = {
[PCS_RPC_UNCONN] = "UNCONN", /* Not connected */
[PCS_RPC_CONNECT] = "CONNECT", /* Connect in progress */
diff --git a/fs/fuse/kio/pcs/pcs_rpc.h b/fs/fuse/kio/pcs/pcs_rpc.h
index cef029a84579d..731ead2e73fd2 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.h
+++ b/fs/fuse/kio/pcs/pcs_rpc.h
@@ -87,19 +87,9 @@ struct pcs_rpc
unsigned int state;
unsigned int flags;
-#define PCS_RPC_F_HASHED 1
-#define PCS_RPC_F_PASSIVE 2
-#define PCS_RPC_F_PEER_ID 4
-#define PCS_RPC_F_NO_RETRY 8
-#define PCS_RPC_F_DEAD 0x10
-#define PCS_RPC_F_LISTEN 0x20
-#define PCS_RPC_F_ACQ_ID 0x40
-#define PCS_RPC_F_PEER_VERIFIED 0x80
-#define PCS_RPC_F_CLNT_PEER_ID 0x100 /* peer id set by
pcs_rpc_set_peer_id */
-#define PCS_RPC_F_ACCT 0x200
-#define PCS_RPC_F_LOCAL 0x400 /* local AF_UNIX
connection */
-#define PCS_RPC_F_PEER_AUTHORIZED 0x800 /* peer authorized by secure
method */
-#define PCS_RPC_F_LOCALAUTH 0x1000 /* skip authenitication, it is
provided by transport */
+#define PCS_RPC_F_PEER_ID 0x01
+#define PCS_RPC_F_LOCAL 0x02 /* local AF_UNIX
connection */
+#define PCS_RPC_F_DEAD 0x04
struct pcs_rpc_params params;
@@ -256,16 +246,8 @@ struct pcs_rpc * pcs_rpc_create(struct pcs_rpc_engine *
eng, struct pcs_rpc_para
void pcs_rpc_close(struct pcs_rpc * ep);
void pcs_rpc_reset(struct pcs_rpc * ep);
-int pcs_rpc_listen_ext(struct pcs_rpc * ep, PCS_NET_ADDR_T * addr, int flags);
-static inline int pcs_rpc_listen(struct pcs_rpc * ep, PCS_NET_ADDR_T * addr)
-{
- return pcs_rpc_listen_ext(ep, addr, 0);
-}
-
-int pcs_rpc_listen_local(struct pcs_rpc * ep, const char *path, int noauth);
void pcs_rpc_queue(struct pcs_rpc * ep, struct pcs_msg * msg);
void pcs_rpc_kick_queue(struct pcs_rpc * ep);
-void pcs_rpc_respond(struct pcs_rpc * ep, struct pcs_msg * msg);
void pcs_rpc_call(struct pcs_rpc * ep, struct pcs_msg * msg);
void pcs_rpc_connect(struct pcs_rpc * ep);
void pcs_rpc_cancel_request(struct pcs_msg * msg);
@@ -299,20 +281,8 @@ void pcs_rpc_init_output_msg(struct pcs_msg * msg);
void pcs_rpc_init_response(struct pcs_msg * msg, struct pcs_rpc_hdr * req_hdr,
int size);
/* Allocate message and initialize header */
-struct pcs_msg * pcs_rpc_alloc_msg_w_hdr(int type, int size);
struct pcs_msg *rpc_get_hdr(struct pcs_netio * netio, char *inline_buffer, u32
*msg_size);
-void pcs_rpc_set_memlimits(struct pcs_rpc_engine * eng, u64 thresh, u64 limit);
-void pcs_rpc_account_adjust(struct pcs_msg * msg, int adjustment);
-
-struct pcs_perf_counter;
-void perfcnt_collect_rpc(char ** ptr, int * max_size, struct pcs_rpc_engine
const*);
-
-int pcs_is_zero_cluster_id(PCS_CLUSTER_ID_T *id);
-int pcs_cluster_id_eq(PCS_CLUSTER_ID_T *id1, PCS_CLUSTER_ID_T *id2);
-
-void rpc_trace_health(struct pcs_rpc * ep);
-void pcs_rpc_enumerate_rpc(struct pcs_rpc_engine *eng, void (*cb)(struct
pcs_rpc *ep, void *arg), void *arg);
void pcs_rpc_enable(struct pcs_rpc * ep, int error);
void rpc_eof_cb(struct pcs_netio *netio);
diff --git a/fs/fuse/kio/pcs/pcs_sock_conn.c b/fs/fuse/kio/pcs/pcs_sock_conn.c
index aa5bf33f1edfe..a2985a7874c64 100644
--- a/fs/fuse/kio/pcs/pcs_sock_conn.c
+++ b/fs/fuse/kio/pcs/pcs_sock_conn.c
@@ -137,8 +137,7 @@ void pcs_sockconnect_start(struct pcs_rpc *ep)
if (ep->gc)
list_lru_add_obj(&ep->gc->lru, &ep->lru_link);
- if (ep->flags & PCS_RPC_F_CLNT_PEER_ID)
- ep->flags |= PCS_RPC_F_PEER_ID;
+ ep->flags |= PCS_RPC_F_PEER_ID;
ep->state = PCS_RPC_AUTH;
err = rpc_client_start_auth(ep, PCS_AUTH_DIGEST,
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel