diff options
Diffstat (limited to 'Documentation/filesystems/Locking')
-rw-r--r-- | Documentation/filesystems/Locking | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index d9c37ec4c760..1b3c39a7de62 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -15,11 +15,14 @@ prototypes: | |||
15 | int (*d_compare)(const struct dentry *, const struct dentry *, | 15 | int (*d_compare)(const struct dentry *, const struct dentry *, |
16 | unsigned int, const char *, const struct qstr *); | 16 | unsigned int, const char *, const struct qstr *); |
17 | int (*d_delete)(struct dentry *); | 17 | int (*d_delete)(struct dentry *); |
18 | int (*d_init)(struct dentry *); | ||
18 | void (*d_release)(struct dentry *); | 19 | void (*d_release)(struct dentry *); |
19 | void (*d_iput)(struct dentry *, struct inode *); | 20 | void (*d_iput)(struct dentry *, struct inode *); |
20 | char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); | 21 | char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); |
21 | struct vfsmount *(*d_automount)(struct path *path); | 22 | struct vfsmount *(*d_automount)(struct path *path); |
22 | int (*d_manage)(struct dentry *, bool); | 23 | int (*d_manage)(struct dentry *, bool); |
24 | struct dentry *(*d_real)(struct dentry *, const struct inode *, | ||
25 | unsigned int); | ||
23 | 26 | ||
24 | locking rules: | 27 | locking rules: |
25 | rename_lock ->d_lock may block rcu-walk | 28 | rename_lock ->d_lock may block rcu-walk |
@@ -28,12 +31,14 @@ d_weak_revalidate:no no yes no | |||
28 | d_hash no no no maybe | 31 | d_hash no no no maybe |
29 | d_compare: yes no no maybe | 32 | d_compare: yes no no maybe |
30 | d_delete: no yes no no | 33 | d_delete: no yes no no |
34 | d_init: no no yes no | ||
31 | d_release: no no yes no | 35 | d_release: no no yes no |
32 | d_prune: no yes no no | 36 | d_prune: no yes no no |
33 | d_iput: no no yes no | 37 | d_iput: no no yes no |
34 | d_dname: no no no no | 38 | d_dname: no no no no |
35 | d_automount: no no yes no | 39 | d_automount: no no yes no |
36 | d_manage: no no yes (ref-walk) maybe | 40 | d_manage: no no yes (ref-walk) maybe |
41 | d_real no no yes no | ||
37 | 42 | ||
38 | --------------------------- inode_operations --------------------------- | 43 | --------------------------- inode_operations --------------------------- |
39 | prototypes: | 44 | prototypes: |
@@ -66,7 +71,6 @@ prototypes: | |||
66 | struct file *, unsigned open_flag, | 71 | struct file *, unsigned open_flag, |
67 | umode_t create_mode, int *opened); | 72 | umode_t create_mode, int *opened); |
68 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); | 73 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); |
69 | int (*dentry_open)(struct dentry *, struct file *, const struct cred *); | ||
70 | 74 | ||
71 | locking rules: | 75 | locking rules: |
72 | all may block | 76 | all may block |
@@ -95,7 +99,6 @@ fiemap: no | |||
95 | update_time: no | 99 | update_time: no |
96 | atomic_open: yes | 100 | atomic_open: yes |
97 | tmpfile: no | 101 | tmpfile: no |
98 | dentry_open: no | ||
99 | 102 | ||
100 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 103 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on |
101 | victim. | 104 | victim. |
@@ -179,7 +182,6 @@ unlocks and drops the reference. | |||
179 | prototypes: | 182 | prototypes: |
180 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 183 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
181 | int (*readpage)(struct file *, struct page *); | 184 | int (*readpage)(struct file *, struct page *); |
182 | int (*sync_page)(struct page *); | ||
183 | int (*writepages)(struct address_space *, struct writeback_control *); | 185 | int (*writepages)(struct address_space *, struct writeback_control *); |
184 | int (*set_page_dirty)(struct page *page); | 186 | int (*set_page_dirty)(struct page *page); |
185 | int (*readpages)(struct file *filp, struct address_space *mapping, | 187 | int (*readpages)(struct file *filp, struct address_space *mapping, |
@@ -195,7 +197,9 @@ prototypes: | |||
195 | int (*releasepage) (struct page *, int); | 197 | int (*releasepage) (struct page *, int); |
196 | void (*freepage)(struct page *); | 198 | void (*freepage)(struct page *); |
197 | int (*direct_IO)(struct kiocb *, struct iov_iter *iter); | 199 | int (*direct_IO)(struct kiocb *, struct iov_iter *iter); |
200 | bool (*isolate_page) (struct page *, isolate_mode_t); | ||
198 | int (*migratepage)(struct address_space *, struct page *, struct page *); | 201 | int (*migratepage)(struct address_space *, struct page *, struct page *); |
202 | void (*putback_page) (struct page *); | ||
199 | int (*launder_page)(struct page *); | 203 | int (*launder_page)(struct page *); |
200 | int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); | 204 | int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); |
201 | int (*error_remove_page)(struct address_space *, struct page *); | 205 | int (*error_remove_page)(struct address_space *, struct page *); |
@@ -208,7 +212,6 @@ locking rules: | |||
208 | PageLocked(page) i_mutex | 212 | PageLocked(page) i_mutex |
209 | writepage: yes, unlocks (see below) | 213 | writepage: yes, unlocks (see below) |
210 | readpage: yes, unlocks | 214 | readpage: yes, unlocks |
211 | sync_page: maybe | ||
212 | writepages: | 215 | writepages: |
213 | set_page_dirty no | 216 | set_page_dirty no |
214 | readpages: | 217 | readpages: |
@@ -219,15 +222,17 @@ invalidatepage: yes | |||
219 | releasepage: yes | 222 | releasepage: yes |
220 | freepage: yes | 223 | freepage: yes |
221 | direct_IO: | 224 | direct_IO: |
225 | isolate_page: yes | ||
222 | migratepage: yes (both) | 226 | migratepage: yes (both) |
227 | putback_page: yes | ||
223 | launder_page: yes | 228 | launder_page: yes |
224 | is_partially_uptodate: yes | 229 | is_partially_uptodate: yes |
225 | error_remove_page: yes | 230 | error_remove_page: yes |
226 | swap_activate: no | 231 | swap_activate: no |
227 | swap_deactivate: no | 232 | swap_deactivate: no |
228 | 233 | ||
229 | ->write_begin(), ->write_end(), ->sync_page() and ->readpage() | 234 | ->write_begin(), ->write_end() and ->readpage() may be called from |
230 | may be called from the request handler (/dev/loop). | 235 | the request handler (/dev/loop). |
231 | 236 | ||
232 | ->readpage() unlocks the page, either synchronously or via I/O | 237 | ->readpage() unlocks the page, either synchronously or via I/O |
233 | completion. | 238 | completion. |
@@ -283,11 +288,6 @@ will leave the page itself marked clean but it will be tagged as dirty in the | |||
283 | radix tree. This incoherency can lead to all sorts of hard-to-debug problems | 288 | radix tree. This incoherency can lead to all sorts of hard-to-debug problems |
284 | in the filesystem like having dirty inodes at umount and losing written data. | 289 | in the filesystem like having dirty inodes at umount and losing written data. |
285 | 290 | ||
286 | ->sync_page() locking rules are not well-defined - usually it is called | ||
287 | with lock on page, but that is not guaranteed. Considering the currently | ||
288 | existing instances of this method ->sync_page() itself doesn't look | ||
289 | well-defined... | ||
290 | |||
291 | ->writepages() is used for periodic writeback and for syscall-initiated | 291 | ->writepages() is used for periodic writeback and for syscall-initiated |
292 | sync operations. The address_space should start I/O against at least | 292 | sync operations. The address_space should start I/O against at least |
293 | *nr_to_write pages. *nr_to_write must be decremented for each page which is | 293 | *nr_to_write pages. *nr_to_write must be decremented for each page which is |
@@ -544,13 +544,13 @@ subsequent truncate), and then return with VM_FAULT_LOCKED, and the page | |||
544 | locked. The VM will unlock the page. | 544 | locked. The VM will unlock the page. |
545 | 545 | ||
546 | ->map_pages() is called when VM asks to map easy accessible pages. | 546 | ->map_pages() is called when VM asks to map easy accessible pages. |
547 | Filesystem should find and map pages associated with offsets from "pgoff" | 547 | Filesystem should find and map pages associated with offsets from "start_pgoff" |
548 | till "max_pgoff". ->map_pages() is called with page table locked and must | 548 | till "end_pgoff". ->map_pages() is called with page table locked and must |
549 | not block. If it's not possible to reach a page without blocking, | 549 | not block. If it's not possible to reach a page without blocking, |
550 | filesystem should skip it. Filesystem should use do_set_pte() to setup | 550 | filesystem should skip it. Filesystem should use do_set_pte() to setup |
551 | page table entry. Pointer to entry associated with offset "pgoff" is | 551 | page table entry. Pointer to entry associated with the page is passed in |
552 | passed in "pte" field in vm_fault structure. Pointers to entries for other | 552 | "pte" field in fault_env structure. Pointers to entries for other offsets |
553 | offsets should be calculated relative to "pte". | 553 | should be calculated relative to "pte". |
554 | 554 | ||
555 | ->page_mkwrite() is called when a previously read-only pte is | 555 | ->page_mkwrite() is called when a previously read-only pte is |
556 | about to become writeable. The filesystem again must ensure that there are | 556 | about to become writeable. The filesystem again must ensure that there are |