diff options
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r-- | fs/fuse/fuse_i.h | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index a16a04fcf41e..59661c481d9d 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | FUSE: Filesystem in Userspace | 2 | FUSE: Filesystem in Userspace |
3 | Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> | 3 | Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> |
4 | 4 | ||
5 | This program can be distributed under the terms of the GNU GPL. | 5 | This program can be distributed under the terms of the GNU GPL. |
6 | See the file COPYING. | 6 | See the file COPYING. |
@@ -18,8 +18,8 @@ | |||
18 | /** Max number of pages that can be used in a single read request */ | 18 | /** Max number of pages that can be used in a single read request */ |
19 | #define FUSE_MAX_PAGES_PER_REQ 32 | 19 | #define FUSE_MAX_PAGES_PER_REQ 32 |
20 | 20 | ||
21 | /** If more requests are outstanding, then the operation will block */ | 21 | /** Maximum number of outstanding background requests */ |
22 | #define FUSE_MAX_OUTSTANDING 10 | 22 | #define FUSE_MAX_BACKGROUND 10 |
23 | 23 | ||
24 | /** It could be as large as PATH_MAX, but would that have any uses? */ | 24 | /** It could be as large as PATH_MAX, but would that have any uses? */ |
25 | #define FUSE_NAME_MAX 1024 | 25 | #define FUSE_NAME_MAX 1024 |
@@ -131,8 +131,8 @@ struct fuse_conn; | |||
131 | * A request to the client | 131 | * A request to the client |
132 | */ | 132 | */ |
133 | struct fuse_req { | 133 | struct fuse_req { |
134 | /** This can be on either unused_list, pending processing or | 134 | /** This can be on either pending processing or io lists in |
135 | io lists in fuse_conn */ | 135 | fuse_conn */ |
136 | struct list_head list; | 136 | struct list_head list; |
137 | 137 | ||
138 | /** Entry on the background list */ | 138 | /** Entry on the background list */ |
@@ -144,15 +144,12 @@ struct fuse_req { | |||
144 | /* | 144 | /* |
145 | * The following bitfields are either set once before the | 145 | * The following bitfields are either set once before the |
146 | * request is queued or setting/clearing them is protected by | 146 | * request is queued or setting/clearing them is protected by |
147 | * fuse_lock | 147 | * fuse_conn->lock |
148 | */ | 148 | */ |
149 | 149 | ||
150 | /** True if the request has reply */ | 150 | /** True if the request has reply */ |
151 | unsigned isreply:1; | 151 | unsigned isreply:1; |
152 | 152 | ||
153 | /** The request is preallocated */ | ||
154 | unsigned preallocated:1; | ||
155 | |||
156 | /** The request was interrupted */ | 153 | /** The request was interrupted */ |
157 | unsigned interrupted:1; | 154 | unsigned interrupted:1; |
158 | 155 | ||
@@ -162,6 +159,9 @@ struct fuse_req { | |||
162 | /** Data is being copied to/from the request */ | 159 | /** Data is being copied to/from the request */ |
163 | unsigned locked:1; | 160 | unsigned locked:1; |
164 | 161 | ||
162 | /** Request is counted as "waiting" */ | ||
163 | unsigned waiting:1; | ||
164 | |||
165 | /** State of the request */ | 165 | /** State of the request */ |
166 | enum fuse_req_state state; | 166 | enum fuse_req_state state; |
167 | 167 | ||
@@ -213,6 +213,9 @@ struct fuse_req { | |||
213 | * unmounted. | 213 | * unmounted. |
214 | */ | 214 | */ |
215 | struct fuse_conn { | 215 | struct fuse_conn { |
216 | /** Lock protecting accessess to members of this structure */ | ||
217 | spinlock_t lock; | ||
218 | |||
216 | /** The user id for this mount */ | 219 | /** The user id for this mount */ |
217 | uid_t user_id; | 220 | uid_t user_id; |
218 | 221 | ||
@@ -244,25 +247,20 @@ struct fuse_conn { | |||
244 | interrupted request) */ | 247 | interrupted request) */ |
245 | struct list_head background; | 248 | struct list_head background; |
246 | 249 | ||
247 | /** Controls the maximum number of outstanding requests */ | 250 | /** Number of requests currently in the background */ |
248 | struct semaphore outstanding_sem; | 251 | unsigned num_background; |
249 | 252 | ||
250 | /** This counts the number of outstanding requests if | 253 | /** Flag indicating if connection is blocked. This will be |
251 | outstanding_sem would go negative */ | 254 | the case before the INIT reply is received, and if there |
252 | unsigned outstanding_debt; | 255 | are too many outstading backgrounds requests */ |
256 | int blocked; | ||
253 | 257 | ||
254 | /** RW semaphore for exclusion with fuse_put_super() */ | 258 | /** waitq for blocked connection */ |
255 | struct rw_semaphore sbput_sem; | 259 | wait_queue_head_t blocked_waitq; |
256 | |||
257 | /** The list of unused requests */ | ||
258 | struct list_head unused_list; | ||
259 | 260 | ||
260 | /** The next unique request id */ | 261 | /** The next unique request id */ |
261 | u64 reqctr; | 262 | u64 reqctr; |
262 | 263 | ||
263 | /** Mount is active */ | ||
264 | unsigned mounted; | ||
265 | |||
266 | /** Connection established, cleared on umount, connection | 264 | /** Connection established, cleared on umount, connection |
267 | abort and device release */ | 265 | abort and device release */ |
268 | unsigned connected; | 266 | unsigned connected; |
@@ -318,6 +316,9 @@ struct fuse_conn { | |||
318 | 316 | ||
319 | /** kobject */ | 317 | /** kobject */ |
320 | struct kobject kobj; | 318 | struct kobject kobj; |
319 | |||
320 | /** O_ASYNC requests */ | ||
321 | struct fasync_struct *fasync; | ||
321 | }; | 322 | }; |
322 | 323 | ||
323 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) | 324 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) |
@@ -349,21 +350,6 @@ static inline u64 get_node_id(struct inode *inode) | |||
349 | extern const struct file_operations fuse_dev_operations; | 350 | extern const struct file_operations fuse_dev_operations; |
350 | 351 | ||
351 | /** | 352 | /** |
352 | * This is the single global spinlock which protects FUSE's structures | ||
353 | * | ||
354 | * The following data is protected by this lock: | ||
355 | * | ||
356 | * - the private_data field of the device file | ||
357 | * - the s_fs_info field of the super block | ||
358 | * - unused_list, pending, processing lists in fuse_conn | ||
359 | * - background list in fuse_conn | ||
360 | * - the unique request ID counter reqctr in fuse_conn | ||
361 | * - the sb (super_block) field in fuse_conn | ||
362 | * - the file (device file) field in fuse_conn | ||
363 | */ | ||
364 | extern spinlock_t fuse_lock; | ||
365 | |||
366 | /** | ||
367 | * Get a filled in inode | 353 | * Get a filled in inode |
368 | */ | 354 | */ |
369 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | 355 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, |
@@ -461,11 +447,11 @@ void fuse_reset_request(struct fuse_req *req); | |||
461 | /** | 447 | /** |
462 | * Reserve a preallocated request | 448 | * Reserve a preallocated request |
463 | */ | 449 | */ |
464 | struct fuse_req *fuse_get_request(struct fuse_conn *fc); | 450 | struct fuse_req *fuse_get_req(struct fuse_conn *fc); |
465 | 451 | ||
466 | /** | 452 | /** |
467 | * Decrement reference count of a request. If count goes to zero put | 453 | * Decrement reference count of a request. If count goes to zero free |
468 | * on unused list (preallocated) or free request (not preallocated). | 454 | * the request. |
469 | */ | 455 | */ |
470 | void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); | 456 | void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); |
471 | 457 | ||
@@ -485,11 +471,11 @@ void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req); | |||
485 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req); | 471 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req); |
486 | 472 | ||
487 | /** | 473 | /** |
488 | * Release inodes and file associated with background request | 474 | * Remove request from the the background list |
489 | */ | 475 | */ |
490 | void fuse_release_background(struct fuse_req *req); | 476 | void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req); |
491 | 477 | ||
492 | /* Abort all requests */ | 478 | /** Abort all requests */ |
493 | void fuse_abort_conn(struct fuse_conn *fc); | 479 | void fuse_abort_conn(struct fuse_conn *fc); |
494 | 480 | ||
495 | /** | 481 | /** |