diff options
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r-- | fs/fuse/fuse_i.h | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 67aaf6ee38ea..dadffa21a206 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/backing-dev.h> | 16 | #include <linux/backing-dev.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/rwsem.h> | ||
18 | 19 | ||
19 | /** Max number of pages that can be used in a single read request */ | 20 | /** Max number of pages that can be used in a single read request */ |
20 | #define FUSE_MAX_PAGES_PER_REQ 32 | 21 | #define FUSE_MAX_PAGES_PER_REQ 32 |
@@ -25,6 +26,9 @@ | |||
25 | /** Congestion starts at 75% of maximum */ | 26 | /** Congestion starts at 75% of maximum */ |
26 | #define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100) | 27 | #define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100) |
27 | 28 | ||
29 | /** Bias for fi->writectr, meaning new writepages must not be sent */ | ||
30 | #define FUSE_NOWRITE INT_MIN | ||
31 | |||
28 | /** It could be as large as PATH_MAX, but would that have any uses? */ | 32 | /** It could be as large as PATH_MAX, but would that have any uses? */ |
29 | #define FUSE_NAME_MAX 1024 | 33 | #define FUSE_NAME_MAX 1024 |
30 | 34 | ||
@@ -73,6 +77,19 @@ struct fuse_inode { | |||
73 | 77 | ||
74 | /** Files usable in writepage. Protected by fc->lock */ | 78 | /** Files usable in writepage. Protected by fc->lock */ |
75 | struct list_head write_files; | 79 | struct list_head write_files; |
80 | |||
81 | /** Writepages pending on truncate or fsync */ | ||
82 | struct list_head queued_writes; | ||
83 | |||
84 | /** Number of sent writes, a negative bias (FUSE_NOWRITE) | ||
85 | * means more writes are blocked */ | ||
86 | int writectr; | ||
87 | |||
88 | /** Waitq for writepage completion */ | ||
89 | wait_queue_head_t page_waitq; | ||
90 | |||
91 | /** List of writepage requestst (pending or sent) */ | ||
92 | struct list_head writepages; | ||
76 | }; | 93 | }; |
77 | 94 | ||
78 | /** FUSE specific file data */ | 95 | /** FUSE specific file data */ |
@@ -222,7 +239,10 @@ struct fuse_req { | |||
222 | } release; | 239 | } release; |
223 | struct fuse_init_in init_in; | 240 | struct fuse_init_in init_in; |
224 | struct fuse_init_out init_out; | 241 | struct fuse_init_out init_out; |
225 | struct fuse_read_in read_in; | 242 | struct { |
243 | struct fuse_read_in in; | ||
244 | u64 attr_ver; | ||
245 | } read; | ||
226 | struct { | 246 | struct { |
227 | struct fuse_write_in in; | 247 | struct fuse_write_in in; |
228 | struct fuse_write_out out; | 248 | struct fuse_write_out out; |
@@ -242,6 +262,12 @@ struct fuse_req { | |||
242 | /** File used in the request (or NULL) */ | 262 | /** File used in the request (or NULL) */ |
243 | struct fuse_file *ff; | 263 | struct fuse_file *ff; |
244 | 264 | ||
265 | /** Inode used in the request or NULL */ | ||
266 | struct inode *inode; | ||
267 | |||
268 | /** Link on fi->writepages */ | ||
269 | struct list_head writepages_entry; | ||
270 | |||
245 | /** Request completion callback */ | 271 | /** Request completion callback */ |
246 | void (*end)(struct fuse_conn *, struct fuse_req *); | 272 | void (*end)(struct fuse_conn *, struct fuse_req *); |
247 | 273 | ||
@@ -390,8 +416,8 @@ struct fuse_conn { | |||
390 | /** Entry on the fuse_conn_list */ | 416 | /** Entry on the fuse_conn_list */ |
391 | struct list_head entry; | 417 | struct list_head entry; |
392 | 418 | ||
393 | /** Unique ID */ | 419 | /** Device ID from super block */ |
394 | u64 id; | 420 | dev_t dev; |
395 | 421 | ||
396 | /** Dentries in the control filesystem */ | 422 | /** Dentries in the control filesystem */ |
397 | struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES]; | 423 | struct dentry *ctl_dentry[FUSE_CTL_NUM_DENTRIES]; |
@@ -438,7 +464,7 @@ extern const struct file_operations fuse_dev_operations; | |||
438 | /** | 464 | /** |
439 | * Get a filled in inode | 465 | * Get a filled in inode |
440 | */ | 466 | */ |
441 | struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | 467 | struct inode *fuse_iget(struct super_block *sb, u64 nodeid, |
442 | int generation, struct fuse_attr *attr, | 468 | int generation, struct fuse_attr *attr, |
443 | u64 attr_valid, u64 attr_version); | 469 | u64 attr_valid, u64 attr_version); |
444 | 470 | ||
@@ -446,7 +472,7 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, | |||
446 | * Send FORGET command | 472 | * Send FORGET command |
447 | */ | 473 | */ |
448 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | 474 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, |
449 | unsigned long nodeid, u64 nlookup); | 475 | u64 nodeid, u64 nlookup); |
450 | 476 | ||
451 | /** | 477 | /** |
452 | * Initialize READ or READDIR request | 478 | * Initialize READ or READDIR request |
@@ -504,6 +530,11 @@ void fuse_init_symlink(struct inode *inode); | |||
504 | void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, | 530 | void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, |
505 | u64 attr_valid, u64 attr_version); | 531 | u64 attr_valid, u64 attr_version); |
506 | 532 | ||
533 | void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, | ||
534 | u64 attr_valid); | ||
535 | |||
536 | void fuse_truncate(struct address_space *mapping, loff_t offset); | ||
537 | |||
507 | /** | 538 | /** |
508 | * Initialize the client device | 539 | * Initialize the client device |
509 | */ | 540 | */ |
@@ -522,6 +553,8 @@ void fuse_ctl_cleanup(void); | |||
522 | */ | 553 | */ |
523 | struct fuse_req *fuse_request_alloc(void); | 554 | struct fuse_req *fuse_request_alloc(void); |
524 | 555 | ||
556 | struct fuse_req *fuse_request_alloc_nofs(void); | ||
557 | |||
525 | /** | 558 | /** |
526 | * Free a request | 559 | * Free a request |
527 | */ | 560 | */ |
@@ -558,6 +591,8 @@ void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req); | |||
558 | */ | 591 | */ |
559 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req); | 592 | void request_send_background(struct fuse_conn *fc, struct fuse_req *req); |
560 | 593 | ||
594 | void request_send_background_locked(struct fuse_conn *fc, struct fuse_req *req); | ||
595 | |||
561 | /* Abort all requests */ | 596 | /* Abort all requests */ |
562 | void fuse_abort_conn(struct fuse_conn *fc); | 597 | void fuse_abort_conn(struct fuse_conn *fc); |
563 | 598 | ||
@@ -600,3 +635,10 @@ u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id); | |||
600 | 635 | ||
601 | int fuse_update_attributes(struct inode *inode, struct kstat *stat, | 636 | int fuse_update_attributes(struct inode *inode, struct kstat *stat, |
602 | struct file *file, bool *refreshed); | 637 | struct file *file, bool *refreshed); |
638 | |||
639 | void fuse_flush_writepages(struct inode *inode); | ||
640 | |||
641 | void fuse_set_nowrite(struct inode *inode); | ||
642 | void fuse_release_nowrite(struct inode *inode); | ||
643 | |||
644 | u64 fuse_get_attr_version(struct fuse_conn *fc); | ||