Skip to content

Commit 9b5cf82

Browse files
committed
Merge tag 'fuse-update-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse updates from Miklos Szeredi: "As well as the usual bug fixes, this adds the following new features: - cached readdir and readlink - max I/O size increased from 128k to 1M - improved performance and scalability of request queues - copy_file_range support The only non-fuse bits are trivial cleanups of macros in <linux/bitops.h>" * tag 'fuse-update-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: (31 commits) fuse: enable caching of symlinks fuse: only invalidate atime in direct read fuse: don't need GETATTR after every READ fuse: allow fine grained attr cache invaldation bitops: protect variables in bit_clear_unless() macro bitops: protect variables in set_mask_bits() macro fuse: realloc page array fuse: add max_pages to init_out fuse: allocate page array more efficiently fuse: reduce size of struct fuse_inode fuse: use iversion for readdir cache verification fuse: use mtime for readdir cache verification fuse: add readdir cache version fuse: allow using readdir cache fuse: allow caching readdir fuse: extract fuse_emit() helper fuse: add FOPEN_CACHE_DIR fuse: split out readdir.c fuse: Use hash table to link processing request fuse: kill req->intr_unique ...
2 parents 31990f0 + 5571f1e commit 9b5cf82

File tree

10 files changed

+1201
-490
lines changed

10 files changed

+1201
-490
lines changed

fs/fuse/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
obj-$(CONFIG_FUSE_FS) += fuse.o
66
obj-$(CONFIG_CUSE) += cuse.o
77

8-
fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o
8+
fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o

fs/fuse/control.c

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,
107107
if (!fc)
108108
return 0;
109109

110-
val = fc->max_background;
110+
val = READ_ONCE(fc->max_background);
111111
fuse_conn_put(fc);
112112

113113
return fuse_conn_limit_read(file, buf, len, ppos, val);
@@ -125,7 +125,12 @@ static ssize_t fuse_conn_max_background_write(struct file *file,
125125
if (ret > 0) {
126126
struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
127127
if (fc) {
128+
spin_lock(&fc->bg_lock);
128129
fc->max_background = val;
130+
fc->blocked = fc->num_background >= fc->max_background;
131+
if (!fc->blocked)
132+
wake_up(&fc->blocked_waitq);
133+
spin_unlock(&fc->bg_lock);
129134
fuse_conn_put(fc);
130135
}
131136
}
@@ -144,7 +149,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file,
144149
if (!fc)
145150
return 0;
146151

147-
val = fc->congestion_threshold;
152+
val = READ_ONCE(fc->congestion_threshold);
148153
fuse_conn_put(fc);
149154

150155
return fuse_conn_limit_read(file, buf, len, ppos, val);
@@ -155,18 +160,31 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
155160
size_t count, loff_t *ppos)
156161
{
157162
unsigned uninitialized_var(val);
163+
struct fuse_conn *fc;
158164
ssize_t ret;
159165

160166
ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
161167
max_user_congthresh);
162-
if (ret > 0) {
163-
struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
164-
if (fc) {
165-
fc->congestion_threshold = val;
166-
fuse_conn_put(fc);
168+
if (ret <= 0)
169+
goto out;
170+
fc = fuse_ctl_file_conn_get(file);
171+
if (!fc)
172+
goto out;
173+
174+
spin_lock(&fc->bg_lock);
175+
fc->congestion_threshold = val;
176+
if (fc->sb) {
177+
if (fc->num_background < fc->congestion_threshold) {
178+
clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC);
179+
clear_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC);
180+
} else {
181+
set_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC);
182+
set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC);
167183
}
168184
}
169-
185+
spin_unlock(&fc->bg_lock);
186+
fuse_conn_put(fc);
187+
out:
170188
return ret;
171189
}
172190

0 commit comments

Comments
 (0)