summaryrefslogtreecommitdiffstats
path: root/fs/fuse/control.c
diff options
context:
space:
mode:
authorKirill Tkhai2018-08-27 17:29:46 +0200
committerMiklos Szeredi2018-09-28 16:43:22 +0200
commitae2dffa39485c6fd4f22321814c7287c274b473a (patch)
treeae65ad5f3ac4f02fb9f7ba8b7fce89cac5d565bf /fs/fuse/control.c
parentfuse: add locking to max_background and congestion_threshold changes (diff)
downloadkernel-qcow2-linux-ae2dffa39485c6fd4f22321814c7287c274b473a.tar.gz
kernel-qcow2-linux-ae2dffa39485c6fd4f22321814c7287c274b473a.tar.xz
kernel-qcow2-linux-ae2dffa39485c6fd4f22321814c7287c274b473a.zip
fuse: introduce fc->bg_lock
To reduce contention of fc->lock, this patch introduces bg_lock for protection of fields related to background queue. These are: max_background, congestion_threshold, num_background, active_background, bg_queue and blocked. This allows next patch to make async reads not requiring fc->lock, so async reads and writes will have better performance executed in parallel. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/control.c')
-rw-r--r--fs/fuse/control.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index eaa0e2b21623..989df5accaee 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -125,12 +125,12 @@ static ssize_t fuse_conn_max_background_write(struct file *file,
if (ret > 0) {
struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
if (fc) {
- spin_lock(&fc->lock);
+ spin_lock(&fc->bg_lock);
fc->max_background = val;
fc->blocked = fc->num_background >= fc->max_background;
if (!fc->blocked)
wake_up(&fc->blocked_waitq);
- spin_unlock(&fc->lock);
+ spin_unlock(&fc->bg_lock);
fuse_conn_put(fc);
}
}
@@ -171,7 +171,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
if (!fc)
goto out;
- spin_lock(&fc->lock);
+ spin_lock(&fc->bg_lock);
fc->congestion_threshold = val;
if (fc->sb) {
if (fc->num_background < fc->congestion_threshold) {
@@ -182,7 +182,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC);
}
}
- spin_unlock(&fc->lock);
+ spin_unlock(&fc->bg_lock);
fuse_conn_put(fc);
out:
return ret;