diff options
author | Paul Mackerras <paulus@samba.org> | 2007-05-10 07:08:37 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-10 07:08:37 -0400 |
commit | 2ecf042ef530dd0943e41d84b6344f507941af3e (patch) | |
tree | 73100361dd74e3f80f14c7c81ba4675948983f44 /fs/afs/internal.h | |
parent | 32a56ebb24f23da1bbaf24292acf85b6c04526ab (diff) | |
parent | de5603748af8bf7deac403e6ba92887f8d18e812 (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'fs/afs/internal.h')
-rw-r--r-- | fs/afs/internal.h | 95 |
1 files changed, 87 insertions, 8 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index d90c158cd934..a30d4fa768e3 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #define AFS_CELL_MAX_ADDRS 15 | 22 | #define AFS_CELL_MAX_ADDRS 15 |
23 | 23 | ||
24 | struct pagevec; | ||
24 | struct afs_call; | 25 | struct afs_call; |
25 | 26 | ||
26 | typedef enum { | 27 | typedef enum { |
@@ -75,12 +76,15 @@ struct afs_call { | |||
75 | struct key *key; /* security for this call */ | 76 | struct key *key; /* security for this call */ |
76 | struct afs_server *server; /* server affected by incoming CM call */ | 77 | struct afs_server *server; /* server affected by incoming CM call */ |
77 | void *request; /* request data (first part) */ | 78 | void *request; /* request data (first part) */ |
78 | void *request2; /* request data (second part) */ | 79 | struct address_space *mapping; /* page set */ |
80 | struct afs_writeback *wb; /* writeback being performed */ | ||
79 | void *buffer; /* reply receive buffer */ | 81 | void *buffer; /* reply receive buffer */ |
80 | void *reply; /* reply buffer (first part) */ | 82 | void *reply; /* reply buffer (first part) */ |
81 | void *reply2; /* reply buffer (second part) */ | 83 | void *reply2; /* reply buffer (second part) */ |
82 | void *reply3; /* reply buffer (third part) */ | 84 | void *reply3; /* reply buffer (third part) */ |
83 | void *reply4; /* reply buffer (fourth part) */ | 85 | void *reply4; /* reply buffer (fourth part) */ |
86 | pgoff_t first; /* first page in mapping to deal with */ | ||
87 | pgoff_t last; /* last page in mapping to deal with */ | ||
84 | enum { /* call state */ | 88 | enum { /* call state */ |
85 | AFS_CALL_REQUESTING, /* request is being sent for outgoing call */ | 89 | AFS_CALL_REQUESTING, /* request is being sent for outgoing call */ |
86 | AFS_CALL_AWAIT_REPLY, /* awaiting reply to outgoing call */ | 90 | AFS_CALL_AWAIT_REPLY, /* awaiting reply to outgoing call */ |
@@ -97,14 +101,18 @@ struct afs_call { | |||
97 | unsigned request_size; /* size of request data */ | 101 | unsigned request_size; /* size of request data */ |
98 | unsigned reply_max; /* maximum size of reply */ | 102 | unsigned reply_max; /* maximum size of reply */ |
99 | unsigned reply_size; /* current size of reply */ | 103 | unsigned reply_size; /* current size of reply */ |
104 | unsigned first_offset; /* offset into mapping[first] */ | ||
105 | unsigned last_to; /* amount of mapping[last] */ | ||
100 | unsigned short offset; /* offset into received data store */ | 106 | unsigned short offset; /* offset into received data store */ |
101 | unsigned char unmarshall; /* unmarshalling phase */ | 107 | unsigned char unmarshall; /* unmarshalling phase */ |
102 | bool incoming; /* T if incoming call */ | 108 | bool incoming; /* T if incoming call */ |
109 | bool send_pages; /* T if data from mapping should be sent */ | ||
103 | u16 service_id; /* RxRPC service ID to call */ | 110 | u16 service_id; /* RxRPC service ID to call */ |
104 | __be16 port; /* target UDP port */ | 111 | __be16 port; /* target UDP port */ |
105 | __be32 operation_ID; /* operation ID for an incoming call */ | 112 | __be32 operation_ID; /* operation ID for an incoming call */ |
106 | u32 count; /* count for use in unmarshalling */ | 113 | u32 count; /* count for use in unmarshalling */ |
107 | __be32 tmp; /* place to extract temporary data */ | 114 | __be32 tmp; /* place to extract temporary data */ |
115 | afs_dataversion_t store_version; /* updated version expected from store */ | ||
108 | }; | 116 | }; |
109 | 117 | ||
110 | struct afs_call_type { | 118 | struct afs_call_type { |
@@ -124,6 +132,32 @@ struct afs_call_type { | |||
124 | }; | 132 | }; |
125 | 133 | ||
126 | /* | 134 | /* |
135 | * record of an outstanding writeback on a vnode | ||
136 | */ | ||
137 | struct afs_writeback { | ||
138 | struct list_head link; /* link in vnode->writebacks */ | ||
139 | struct work_struct writer; /* work item to perform the writeback */ | ||
140 | struct afs_vnode *vnode; /* vnode to which this write applies */ | ||
141 | struct key *key; /* owner of this write */ | ||
142 | wait_queue_head_t waitq; /* completion and ready wait queue */ | ||
143 | pgoff_t first; /* first page in batch */ | ||
144 | pgoff_t point; /* last page in current store op */ | ||
145 | pgoff_t last; /* last page in batch (inclusive) */ | ||
146 | unsigned offset_first; /* offset into first page of start of write */ | ||
147 | unsigned to_last; /* offset into last page of end of write */ | ||
148 | int num_conflicts; /* count of conflicting writes in list */ | ||
149 | int usage; | ||
150 | bool conflicts; /* T if has dependent conflicts */ | ||
151 | enum { | ||
152 | AFS_WBACK_SYNCING, /* synchronisation being performed */ | ||
153 | AFS_WBACK_PENDING, /* write pending */ | ||
154 | AFS_WBACK_CONFLICTING, /* conflicting writes posted */ | ||
155 | AFS_WBACK_WRITING, /* writing back */ | ||
156 | AFS_WBACK_COMPLETE /* the writeback record has been unlinked */ | ||
157 | } state __attribute__((packed)); | ||
158 | }; | ||
159 | |||
160 | /* | ||
127 | * AFS superblock private data | 161 | * AFS superblock private data |
128 | * - there's one superblock per volume | 162 | * - there's one superblock per volume |
129 | */ | 163 | */ |
@@ -305,6 +339,7 @@ struct afs_vnode { | |||
305 | wait_queue_head_t update_waitq; /* status fetch waitqueue */ | 339 | wait_queue_head_t update_waitq; /* status fetch waitqueue */ |
306 | int update_cnt; /* number of outstanding ops that will update the | 340 | int update_cnt; /* number of outstanding ops that will update the |
307 | * status */ | 341 | * status */ |
342 | spinlock_t writeback_lock; /* lock for writebacks */ | ||
308 | spinlock_t lock; /* waitqueue/flags lock */ | 343 | spinlock_t lock; /* waitqueue/flags lock */ |
309 | unsigned long flags; | 344 | unsigned long flags; |
310 | #define AFS_VNODE_CB_BROKEN 0 /* set if vnode's callback was broken */ | 345 | #define AFS_VNODE_CB_BROKEN 0 /* set if vnode's callback was broken */ |
@@ -316,6 +351,8 @@ struct afs_vnode { | |||
316 | 351 | ||
317 | long acl_order; /* ACL check count (callback break count) */ | 352 | long acl_order; /* ACL check count (callback break count) */ |
318 | 353 | ||
354 | struct list_head writebacks; /* alterations in pagecache that need writing */ | ||
355 | |||
319 | /* outstanding callback notification on this file */ | 356 | /* outstanding callback notification on this file */ |
320 | struct rb_node server_rb; /* link in server->fs_vnodes */ | 357 | struct rb_node server_rb; /* link in server->fs_vnodes */ |
321 | struct rb_node cb_promise; /* link in server->cb_promises */ | 358 | struct rb_node cb_promise; /* link in server->cb_promises */ |
@@ -433,10 +470,6 @@ extern const struct file_operations afs_file_operations; | |||
433 | extern int afs_open(struct inode *, struct file *); | 470 | extern int afs_open(struct inode *, struct file *); |
434 | extern int afs_release(struct inode *, struct file *); | 471 | extern int afs_release(struct inode *, struct file *); |
435 | 472 | ||
436 | #ifdef AFS_CACHING_SUPPORT | ||
437 | extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **); | ||
438 | #endif | ||
439 | |||
440 | /* | 473 | /* |
441 | * fsclient.c | 474 | * fsclient.c |
442 | */ | 475 | */ |
@@ -467,6 +500,12 @@ extern int afs_fs_rename(struct afs_server *, struct key *, | |||
467 | struct afs_vnode *, const char *, | 500 | struct afs_vnode *, const char *, |
468 | struct afs_vnode *, const char *, | 501 | struct afs_vnode *, const char *, |
469 | const struct afs_wait_mode *); | 502 | const struct afs_wait_mode *); |
503 | extern int afs_fs_store_data(struct afs_server *, struct afs_writeback *, | ||
504 | pgoff_t, pgoff_t, unsigned, unsigned, | ||
505 | const struct afs_wait_mode *); | ||
506 | extern int afs_fs_setattr(struct afs_server *, struct key *, | ||
507 | struct afs_vnode *, struct iattr *, | ||
508 | const struct afs_wait_mode *); | ||
470 | 509 | ||
471 | /* | 510 | /* |
472 | * inode.c | 511 | * inode.c |
@@ -474,10 +513,10 @@ extern int afs_fs_rename(struct afs_server *, struct key *, | |||
474 | extern struct inode *afs_iget(struct super_block *, struct key *, | 513 | extern struct inode *afs_iget(struct super_block *, struct key *, |
475 | struct afs_fid *, struct afs_file_status *, | 514 | struct afs_fid *, struct afs_file_status *, |
476 | struct afs_callback *); | 515 | struct afs_callback *); |
516 | extern void afs_zap_data(struct afs_vnode *); | ||
477 | extern int afs_validate(struct afs_vnode *, struct key *); | 517 | extern int afs_validate(struct afs_vnode *, struct key *); |
478 | extern int afs_inode_getattr(struct vfsmount *, struct dentry *, | 518 | extern int afs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
479 | struct kstat *); | 519 | extern int afs_setattr(struct dentry *, struct iattr *); |
480 | extern void afs_zap_permits(struct rcu_head *); | ||
481 | extern void afs_clear_inode(struct inode *); | 520 | extern void afs_clear_inode(struct inode *); |
482 | 521 | ||
483 | /* | 522 | /* |
@@ -533,6 +572,7 @@ extern int afs_extract_data(struct afs_call *, struct sk_buff *, bool, void *, | |||
533 | */ | 572 | */ |
534 | extern void afs_clear_permits(struct afs_vnode *); | 573 | extern void afs_clear_permits(struct afs_vnode *); |
535 | extern void afs_cache_permit(struct afs_vnode *, struct key *, long); | 574 | extern void afs_cache_permit(struct afs_vnode *, struct key *, long); |
575 | extern void afs_zap_permits(struct rcu_head *); | ||
536 | extern struct key *afs_request_key(struct afs_cell *); | 576 | extern struct key *afs_request_key(struct afs_cell *); |
537 | extern int afs_permission(struct inode *, int, struct nameidata *); | 577 | extern int afs_permission(struct inode *, int, struct nameidata *); |
538 | 578 | ||
@@ -629,6 +669,9 @@ extern int afs_vnode_symlink(struct afs_vnode *, struct key *, const char *, | |||
629 | struct afs_file_status *, struct afs_server **); | 669 | struct afs_file_status *, struct afs_server **); |
630 | extern int afs_vnode_rename(struct afs_vnode *, struct afs_vnode *, | 670 | extern int afs_vnode_rename(struct afs_vnode *, struct afs_vnode *, |
631 | struct key *, const char *, const char *); | 671 | struct key *, const char *, const char *); |
672 | extern int afs_vnode_store_data(struct afs_writeback *, pgoff_t, pgoff_t, | ||
673 | unsigned, unsigned); | ||
674 | extern int afs_vnode_setattr(struct afs_vnode *, struct key *, struct iattr *); | ||
632 | 675 | ||
633 | /* | 676 | /* |
634 | * volume.c | 677 | * volume.c |
@@ -645,6 +688,23 @@ extern struct afs_server *afs_volume_pick_fileserver(struct afs_vnode *); | |||
645 | extern int afs_volume_release_fileserver(struct afs_vnode *, | 688 | extern int afs_volume_release_fileserver(struct afs_vnode *, |
646 | struct afs_server *, int); | 689 | struct afs_server *, int); |
647 | 690 | ||
691 | /* | ||
692 | * write.c | ||
693 | */ | ||
694 | extern int afs_set_page_dirty(struct page *); | ||
695 | extern void afs_put_writeback(struct afs_writeback *); | ||
696 | extern int afs_prepare_write(struct file *, struct page *, unsigned, unsigned); | ||
697 | extern int afs_commit_write(struct file *, struct page *, unsigned, unsigned); | ||
698 | extern int afs_writepage(struct page *, struct writeback_control *); | ||
699 | extern int afs_writepages(struct address_space *, struct writeback_control *); | ||
700 | extern int afs_write_inode(struct inode *, int); | ||
701 | extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *); | ||
702 | extern ssize_t afs_file_write(struct kiocb *, const struct iovec *, | ||
703 | unsigned long, loff_t); | ||
704 | extern int afs_writeback_all(struct afs_vnode *); | ||
705 | extern int afs_fsync(struct file *, struct dentry *, int); | ||
706 | |||
707 | |||
648 | /*****************************************************************************/ | 708 | /*****************************************************************************/ |
649 | /* | 709 | /* |
650 | * debug tracing | 710 | * debug tracing |
@@ -726,6 +786,21 @@ do { \ | |||
726 | } \ | 786 | } \ |
727 | } while(0) | 787 | } while(0) |
728 | 788 | ||
789 | #define ASSERTRANGE(L, OP1, N, OP2, H) \ | ||
790 | do { \ | ||
791 | if (unlikely(!((L) OP1 (N)) || !((N) OP2 (H)))) { \ | ||
792 | printk(KERN_ERR "\n"); \ | ||
793 | printk(KERN_ERR "AFS: Assertion failed\n"); \ | ||
794 | printk(KERN_ERR "%lu "#OP1" %lu "#OP2" %lu is false\n", \ | ||
795 | (unsigned long)(L), (unsigned long)(N), \ | ||
796 | (unsigned long)(H)); \ | ||
797 | printk(KERN_ERR "0x%lx "#OP1" 0x%lx "#OP2" 0x%lx is false\n", \ | ||
798 | (unsigned long)(L), (unsigned long)(N), \ | ||
799 | (unsigned long)(H)); \ | ||
800 | BUG(); \ | ||
801 | } \ | ||
802 | } while(0) | ||
803 | |||
729 | #define ASSERTIF(C, X) \ | 804 | #define ASSERTIF(C, X) \ |
730 | do { \ | 805 | do { \ |
731 | if (unlikely((C) && !(X))) { \ | 806 | if (unlikely((C) && !(X))) { \ |
@@ -758,6 +833,10 @@ do { \ | |||
758 | do { \ | 833 | do { \ |
759 | } while(0) | 834 | } while(0) |
760 | 835 | ||
836 | #define ASSERTRANGE(L, OP1, N, OP2, H) \ | ||
837 | do { \ | ||
838 | } while(0) | ||
839 | |||
761 | #define ASSERTIF(C, X) \ | 840 | #define ASSERTIF(C, X) \ |
762 | do { \ | 841 | do { \ |
763 | } while(0) | 842 | } while(0) |