From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [RFC PATCH dlm/next 09/16] fs: dlm: make new buffer handling softirq ready
Date: Fri, 13 Nov 2020 17:58:07 -0500 [thread overview]
Message-ID: <20201113225814.461167-10-aahringo@redhat.com> (raw)
In-Reply-To: <20201113225814.461167-1-aahringo@redhat.com>
This patch makes the writequeue and message handling ready to be called
from a softirq by using spinlock handling to stop software interrupts
on local cpu while they are hold. The coming midcomms retransmit
handling will introduce a timer which is using this functionality when
the timer expires.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/lowcomms.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 3e1ddcb3f69b..3c133cd2ff22 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1391,7 +1391,7 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,
{
struct writequeue_entry *e;
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
if (!list_empty(&con->writequeue)) {
e = list_last_entry(&con->writequeue, struct writequeue_entry, list);
if (DLM_WQ_REMAIN_BYTES(e) >= len) {
@@ -1403,12 +1403,12 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,
e->end += len;
e->users++;
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
return e;
}
}
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
e = new_writequeue_entry(con, allocation);
if (!e)
@@ -1418,12 +1418,12 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,
*ppc = page_address(e->page);
e->end += len;
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
if (cb)
cb(*ppc, priv);
list_add_tail(&e->list, &con->writequeue);
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
return e;
};
@@ -1472,7 +1472,7 @@ void dlm_lowcomms_commit_buffer(void *mh)
struct connection *con = e->con;
int users;
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
list_add(&msg->list, &e->msgs);
kref_get(&msg->ref);
@@ -1481,13 +1481,13 @@ void dlm_lowcomms_commit_buffer(void *mh)
goto out;
e->len = DLM_WQ_LENGTH_BYTES(e);
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
queue_work(send_workqueue, &con->swork);
return;
out:
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
return;
}
@@ -1518,7 +1518,7 @@ static void send_to_sock(struct connection *con)
if (con->sock == NULL)
goto out_connect;
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
for (;;) {
if (list_empty(&con->writequeue))
break;
@@ -1527,7 +1527,7 @@ static void send_to_sock(struct connection *con)
len = e->len;
offset = e->offset;
BUG_ON(len == 0 && e->users == 0);
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
ret = 0;
if (len) {
@@ -1555,10 +1555,10 @@ static void send_to_sock(struct connection *con)
count = 0;
}
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
writequeue_entry_complete(e, ret);
}
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
out:
mutex_unlock(&con->sock_mutex);
return;
@@ -1581,11 +1581,11 @@ static void clean_one_writequeue(struct connection *con)
{
struct writequeue_entry *e, *safe;
- spin_lock(&con->writequeue_lock);
+ spin_lock_bh(&con->writequeue_lock);
list_for_each_entry_safe(e, safe, &con->writequeue, list) {
free_entry(e);
}
- spin_unlock(&con->writequeue_lock);
+ spin_unlock_bh(&con->writequeue_lock);
}
/* Called from recovery when it knows that a node has
--
2.26.2
next prev parent reply other threads:[~2020-11-13 22:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 22:57 [Cluster-devel] [RFC PATCH dlm/next 00/16] fs: dlm: introduce dlm retransmission layer Alexander Aring
2020-11-13 22:57 ` [Cluster-devel] [RFC PATCH dlm/next 01/16] fs: dlm: add errno handling to check callback Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 02/16] fs: dlm: add check if dlm is currently running Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 03/16] fs: dlm: add check for minimum allocation length Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 04/16] fs: dlm: public utils header utils Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 05/16] fs: dlm: use GFP_ZERO for page buffer Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 06/16] fs: dlm: simplify writequeue handling Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 07/16] fs: dlm: add more midcomms hooks Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 08/16] fs: dlm: make buffer handling per msg Alexander Aring
2020-11-13 22:58 ` Alexander Aring [this message]
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 10/16] fs: dlm: add functionality to retransmit a message Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 11/16] fs: dlm: move out some hash functionality Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 12/16] fs: dlm: remove unaligned memory access handling Alexander Aring
2020-11-24 14:50 ` Alexander Ahring Oder Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 13/16] fs: dlm: check on minimum header size Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 14/16] fs: dlm: add union in dlm header for lockspace id Alexander Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 15/16] fs: dlm: add reliable connection if reconnect Alexander Aring
2020-11-16 18:45 ` Alexander Ahring Oder Aring
2020-11-17 18:48 ` Alexander Ahring Oder Aring
2020-11-23 22:40 ` Alexander Ahring Oder Aring
2020-11-13 22:58 ` [Cluster-devel] [RFC PATCH dlm/next 16/16] fs: dlm: don't allow half transmitted messages Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201113225814.461167-10-aahringo@redhat.com \
--to=aahringo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).