From: "Maxim V. Patlasov" <MPatlasov@parallels.com>
To: miklos@szeredi.hu
Cc: fuse-devel@lists.sourceforge.net, xemul@parallels.com,
linux-kernel@vger.kernel.org, devel@openvz.org,
dev@parallels.com
Subject: [PATCH 2/4] fuse: add flag fc->uninitialized
Date: Thu, 21 Mar 2013 18:02:15 +0400 [thread overview]
Message-ID: <20130321140209.4051.90573.stgit@maximpc.sw.ru> (raw)
In-Reply-To: <20130321140047.4051.6701.stgit@maximpc.sw.ru>
Existing flag fc->blocked is used to suspend request allocation both in case
of many background request submitted and period of time before init_reply
arrives from userspace. Next patch will skip blocking allocations of
synchronous request (disregarding fc->blocked). This is mostly OK, but
we still need to suspend allocations if init_reply is not arrived yet. The
patch introduces flag fc->uninitialized which will serve this purpose.
Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com>
---
fs/fuse/cuse.c | 1 +
fs/fuse/dev.c | 1 +
fs/fuse/fuse_i.h | 4 ++++
fs/fuse/inode.c | 3 +++
4 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index b7c7f30..8fe0998 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -505,6 +505,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
cc->fc.connected = 1;
cc->fc.blocked = 0;
+ cc->fc.uninitialized = 0;
rc = cuse_send_init(cc);
if (rc) {
fuse_conn_put(&cc->fc);
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 512626f..6137650 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2089,6 +2089,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
if (fc->connected) {
fc->connected = 0;
fc->blocked = 0;
+ fc->uninitialized = 0;
end_io_requests(fc);
end_queued_requests(fc);
end_polls(fc);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 457f62e..e893126 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -417,6 +417,10 @@ struct fuse_conn {
/** Batching of FORGET requests (positive indicates FORGET batch) */
int forget_batch;
+ /** Flag indicating that INIT reply is not received yet. Allocating
+ * any fuse request will be suspended until the flag is cleared */
+ int uninitialized;
+
/** Flag indicating if connection is blocked. This will be
the case before the INIT reply is received, and if there
are too many outstading backgrounds requests */
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index de0bee0..0d14f03 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -362,6 +362,7 @@ void fuse_conn_kill(struct fuse_conn *fc)
spin_lock(&fc->lock);
fc->connected = 0;
fc->blocked = 0;
+ fc->uninitialized = 0;
spin_unlock(&fc->lock);
/* Flush all readers on this fs */
kill_fasync(&fc->fasync, SIGIO, POLL_IN);
@@ -582,6 +583,7 @@ void fuse_conn_init(struct fuse_conn *fc)
fc->polled_files = RB_ROOT;
fc->reqctr = 0;
fc->blocked = 1;
+ fc->uninitialized = 1;
fc->attr_version = 1;
get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
}
@@ -881,6 +883,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
fc->conn_init = 1;
}
fc->blocked = 0;
+ fc->uninitialized = 0;
wake_up_all(&fc->blocked_waitq);
}
next prev parent reply other threads:[~2013-03-21 14:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 14:01 [PATCH 0/4] fuse: fix accounting background requests (v2) Maxim V. Patlasov
2013-03-21 14:02 ` [PATCH 1/4] fuse: make request allocations for background processing explicit Maxim V. Patlasov
2013-03-21 14:02 ` Maxim V. Patlasov [this message]
2013-03-21 14:02 ` [PATCH 3/4] fuse: skip blocking on allocations of synchronous requests Maxim V. Patlasov
2013-03-21 14:02 ` [PATCH 4/4] fuse: implement exclusive wakeup for blocked_waitq Maxim V. Patlasov
2013-04-11 11:19 ` [fuse-devel] [PATCH 0/4] fuse: fix accounting background requests (v2) Maxim V. Patlasov
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=20130321140209.4051.90573.stgit@maximpc.sw.ru \
--to=mpatlasov@parallels.com \
--cc=dev@parallels.com \
--cc=devel@openvz.org \
--cc=fuse-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=xemul@parallels.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
all inboxes | Powered by JetHome®