diff options
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r-- | fs/fuse/fuse_i.h | 61 |
1 files changed, 25 insertions, 36 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index a16a04fcf41e..19c7185a7546 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 | ||
@@ -213,6 +210,9 @@ struct fuse_req { | |||
213 | * unmounted. | 210 | * unmounted. |
214 | */ | 211 | */ |
215 | struct fuse_conn { | 212 | struct fuse_conn { |
213 | /** Lock protecting accessess to members of this structure */ | ||
214 | spinlock_t lock; | ||
215 | |||
216 | /** The user id for this mount */ | 216 | /** The user id for this mount */ |
217 | uid_t user_id; | 217 | uid_t user_id; |
218 | 218 | ||
@@ -244,19 +244,20 @@ struct fuse_conn { | |||
244 | interrupted request) */ | 244 | interrupted request) */ |
245 | struct list_head background; | 245 | struct list_head background; |
246 | 246 | ||
247 | /** Controls the maximum number of outstanding requests */ | 247 | /** Number of requests currently in the background */ |
248 | struct semaphore outstanding_sem; | 248 | unsigned num_background; |
249 | |||
250 | /** Flag indicating if connection is blocked. This will be | ||
251 | the case before the INIT reply is received, and if there | ||
252 | are too many outstading backgrounds requests */ | ||
253 | int blocked; | ||
249 | 254 | ||
250 | /** This counts the number of outstanding requests if | 255 | /** waitq for blocked connection */ |
251 | outstanding_sem would go negative */ | 256 | wait_queue_head_t blocked_waitq; |
252 | unsigned outstanding_debt; | ||
253 | 257 | ||
254 | /** RW semaphore for exclusion with fuse_put_super() */ | 258 | /** RW semaphore for exclusion with fuse_put_super() */ |
255 | struct rw_semaphore sbput_sem; | 259 | struct rw_semaphore sbput_sem; |
256 | 260 | ||
257 | /** The list of unused requests */ | ||
258 | struct list_head unused_list; | ||
259 | |||
260 | /** The next unique request id */ | 261 | /** The next unique request id */ |
261 | u64 reqctr; | 262 | u64 reqctr; |
262 | 263 | ||
@@ -318,6 +319,9 @@ struct fuse_conn { | |||
318 | 319 | ||
319 | /** kobject */ | 320 | /** kobject */ |
320 | struct kobject kobj; | 321 | struct kobject kobj; |
322 | |||
323 | /** O_ASYNC requests */ | ||
324 | struct fasync_struct *fasync; | ||
321 | }; | 325 | }; |
322 | 326 | ||
323 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) | 327 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) |
@@ -349,21 +353,6 @@ static inline u64 get_node_id(struct inode *inode) | |||
349 | extern const struct file_operations fuse_dev_operations; | 353 | extern const struct file_operations fuse_dev_operations; |
350 | 354 | ||
351 | /** | 355 | /** |
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 | 356 | * Get a filled in inode |
368 | */ | 357 | */ |
369 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | 358 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, |
@@ -461,11 +450,11 @@ void fuse_reset_request(struct fuse_req *req); | |||
461 | /** | 450 | /** |
462 | * Reserve a preallocated request | 451 | * Reserve a preallocated request |
463 | */ | 452 | */ |
464 | struct fuse_req *fuse_get_request(struct fuse_conn *fc); | 453 | struct fuse_req *fuse_get_req(struct fuse_conn *fc); |
465 | 454 | ||
466 | /** | 455 | /** |
467 | * Decrement reference count of a request. If count goes to zero put | 456 | * Decrement reference count of a request. If count goes to zero free |
468 | * on unused list (preallocated) or free request (not preallocated). | 457 | * the request. |
469 | */ | 458 | */ |
470 | void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); | 459 | void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req); |
471 | 460 | ||
@@ -487,7 +476,7 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req); | |||
487 | /** | 476 | /** |
488 | * Release inodes and file associated with background request | 477 | * Release inodes and file associated with background request |
489 | */ | 478 | */ |
490 | void fuse_release_background(struct fuse_req *req); | 479 | void fuse_release_background(struct fuse_conn *fc, struct fuse_req *req); |
491 | 480 | ||
492 | /* Abort all requests */ | 481 | /* Abort all requests */ |
493 | void fuse_abort_conn(struct fuse_conn *fc); | 482 | void fuse_abort_conn(struct fuse_conn *fc); |