diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2015-07-01 10:26:03 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2015-07-01 10:26:03 -0400 |
commit | 5250921bb0b25e7fc77ba732e569224410743a05 (patch) | |
tree | 29b0b47aa7dc3dcef3ce31acb59375716f2a41b5 /fs/fuse | |
parent | fd22d62ed0c36e260ac3e13167bc073f28407c70 (diff) |
fuse: simplify request_wait()
wait_event_interruptible_exclusive_locked() will do everything
request_wait() does, so replace it.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dev.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 35453f229ef3..b6f901a0dbdd 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1072,27 +1072,6 @@ static int request_pending(struct fuse_iqueue *fiq) | |||
1072 | forget_pending(fiq); | 1072 | forget_pending(fiq); |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | /* Wait until a request is available on the pending list */ | ||
1076 | static void request_wait(struct fuse_iqueue *fiq) | ||
1077 | __releases(fiq->waitq.lock) | ||
1078 | __acquires(fiq->waitq.lock) | ||
1079 | { | ||
1080 | DECLARE_WAITQUEUE(wait, current); | ||
1081 | |||
1082 | add_wait_queue_exclusive(&fiq->waitq, &wait); | ||
1083 | while (fiq->connected && !request_pending(fiq)) { | ||
1084 | set_current_state(TASK_INTERRUPTIBLE); | ||
1085 | if (signal_pending(current)) | ||
1086 | break; | ||
1087 | |||
1088 | spin_unlock(&fiq->waitq.lock); | ||
1089 | schedule(); | ||
1090 | spin_lock(&fiq->waitq.lock); | ||
1091 | } | ||
1092 | set_current_state(TASK_RUNNING); | ||
1093 | remove_wait_queue(&fiq->waitq, &wait); | ||
1094 | } | ||
1095 | |||
1096 | /* | 1075 | /* |
1097 | * Transfer an interrupt request to userspace | 1076 | * Transfer an interrupt request to userspace |
1098 | * | 1077 | * |
@@ -1272,13 +1251,14 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file, | |||
1272 | !request_pending(fiq)) | 1251 | !request_pending(fiq)) |
1273 | goto err_unlock; | 1252 | goto err_unlock; |
1274 | 1253 | ||
1275 | request_wait(fiq); | 1254 | err = wait_event_interruptible_exclusive_locked(fiq->waitq, |
1255 | !fiq->connected || request_pending(fiq)); | ||
1256 | if (err) | ||
1257 | goto err_unlock; | ||
1258 | |||
1276 | err = -ENODEV; | 1259 | err = -ENODEV; |
1277 | if (!fiq->connected) | 1260 | if (!fiq->connected) |
1278 | goto err_unlock; | 1261 | goto err_unlock; |
1279 | err = -ERESTARTSYS; | ||
1280 | if (!request_pending(fiq)) | ||
1281 | goto err_unlock; | ||
1282 | 1262 | ||
1283 | if (!list_empty(&fiq->interrupts)) { | 1263 | if (!list_empty(&fiq->interrupts)) { |
1284 | req = list_entry(fiq->interrupts.next, struct fuse_req, | 1264 | req = list_entry(fiq->interrupts.next, struct fuse_req, |