aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/Locking26
-rw-r--r--Documentation/filesystems/porting21
-rw-r--r--Documentation/filesystems/vfs.txt35
3 files changed, 64 insertions, 18 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 8e2da1e06e3b..7f647e17830c 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -9,7 +9,7 @@ be able to use diff(1).
9 9
10--------------------------- dentry_operations -------------------------- 10--------------------------- dentry_operations --------------------------
11prototypes: 11prototypes:
12 int (*d_revalidate)(struct dentry *, struct nameidata *); 12 int (*d_revalidate)(struct dentry *, unsigned int);
13 int (*d_hash)(const struct dentry *, const struct inode *, 13 int (*d_hash)(const struct dentry *, const struct inode *,
14 struct qstr *); 14 struct qstr *);
15 int (*d_compare)(const struct dentry *, const struct inode *, 15 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -37,9 +37,8 @@ d_manage: no no yes (ref-walk) maybe
37 37
38--------------------------- inode_operations --------------------------- 38--------------------------- inode_operations ---------------------------
39prototypes: 39prototypes:
40 int (*create) (struct inode *,struct dentry *,umode_t, struct nameidata *); 40 int (*create) (struct inode *,struct dentry *,umode_t, bool);
41 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameid 41 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
42ata *);
43 int (*link) (struct dentry *,struct inode *,struct dentry *); 42 int (*link) (struct dentry *,struct inode *,struct dentry *);
44 int (*unlink) (struct inode *,struct dentry *); 43 int (*unlink) (struct inode *,struct dentry *);
45 int (*symlink) (struct inode *,struct dentry *,const char *); 44 int (*symlink) (struct inode *,struct dentry *,const char *);
@@ -62,6 +61,9 @@ ata *);
62 int (*removexattr) (struct dentry *, const char *); 61 int (*removexattr) (struct dentry *, const char *);
63 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); 62 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
64 void (*update_time)(struct inode *, struct timespec *, int); 63 void (*update_time)(struct inode *, struct timespec *, int);
64 int (*atomic_open)(struct inode *, struct dentry *,
65 struct file *, unsigned open_flag,
66 umode_t create_mode, int *opened);
65 67
66locking rules: 68locking rules:
67 all may block 69 all may block
@@ -89,6 +91,7 @@ listxattr: no
89removexattr: yes 91removexattr: yes
90fiemap: no 92fiemap: no
91update_time: no 93update_time: no
94atomic_open: yes
92 95
93 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 96 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
94victim. 97victim.
@@ -203,6 +206,8 @@ prototypes:
203 int (*launder_page)(struct page *); 206 int (*launder_page)(struct page *);
204 int (*is_partially_uptodate)(struct page *, read_descriptor_t *, unsigned long); 207 int (*is_partially_uptodate)(struct page *, read_descriptor_t *, unsigned long);
205 int (*error_remove_page)(struct address_space *, struct page *); 208 int (*error_remove_page)(struct address_space *, struct page *);
209 int (*swap_activate)(struct file *);
210 int (*swap_deactivate)(struct file *);
206 211
207locking rules: 212locking rules:
208 All except set_page_dirty and freepage may block 213 All except set_page_dirty and freepage may block
@@ -226,6 +231,8 @@ migratepage: yes (both)
226launder_page: yes 231launder_page: yes
227is_partially_uptodate: yes 232is_partially_uptodate: yes
228error_remove_page: yes 233error_remove_page: yes
234swap_activate: no
235swap_deactivate: no
229 236
230 ->write_begin(), ->write_end(), ->sync_page() and ->readpage() 237 ->write_begin(), ->write_end(), ->sync_page() and ->readpage()
231may be called from the request handler (/dev/loop). 238may be called from the request handler (/dev/loop).
@@ -327,6 +334,15 @@ cleaned, or an error value if not. Note that in order to prevent the page
327getting mapped back in and redirtied, it needs to be kept locked 334getting mapped back in and redirtied, it needs to be kept locked
328across the entire operation. 335across the entire operation.
329 336
337 ->swap_activate will be called with a non-zero argument on
338files backing (non block device backed) swapfiles. A return value
339of zero indicates success, in which case this file can be used for
340backing swapspace. The swapspace operations will be proxied to the
341address space operations.
342
343 ->swap_deactivate() will be called in the sys_swapoff()
344path after ->swap_activate() returned success.
345
330----------------------- file_lock_operations ------------------------------ 346----------------------- file_lock_operations ------------------------------
331prototypes: 347prototypes:
332 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 348 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
@@ -343,7 +359,6 @@ prototypes:
343 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 359 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
344 void (*lm_notify)(struct file_lock *); /* unblock callback */ 360 void (*lm_notify)(struct file_lock *); /* unblock callback */
345 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 361 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
346 void (*lm_release_private)(struct file_lock *);
347 void (*lm_break)(struct file_lock *); /* break_lease callback */ 362 void (*lm_break)(struct file_lock *); /* break_lease callback */
348 int (*lm_change)(struct file_lock **, int); 363 int (*lm_change)(struct file_lock **, int);
349 364
@@ -352,7 +367,6 @@ locking rules:
352lm_compare_owner: yes no 367lm_compare_owner: yes no
353lm_notify: yes no 368lm_notify: yes no
354lm_grant: no no 369lm_grant: no no
355lm_release_private: maybe no
356lm_break: yes no 370lm_break: yes no
357lm_change yes no 371lm_change yes no
358 372
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 8c91d1057d9a..2bef2b3843d1 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -355,12 +355,10 @@ protects *all* the dcache state of a given dentry.
355via rcu-walk path walk (basically, if the file can have had a path name in the 355via rcu-walk path walk (basically, if the file can have had a path name in the
356vfs namespace). 356vfs namespace).
357 357
358 i_dentry and i_rcu share storage in a union, and the vfs expects 358 Even though i_dentry and i_rcu share storage in a union, we will
359i_dentry to be reinitialized before it is freed, so an: 359initialize the former in inode_init_always(), so just leave it alone in
360 360the callback. It used to be necessary to clean it there, but not anymore
361 INIT_LIST_HEAD(&inode->i_dentry); 361(starting at 3.2).
362
363must be done in the RCU callback.
364 362
365-- 363--
366[recommended] 364[recommended]
@@ -433,3 +431,14 @@ release it yourself.
433 d_alloc_root() is gone, along with a lot of bugs caused by code 431 d_alloc_root() is gone, along with a lot of bugs caused by code
434misusing it. Replacement: d_make_root(inode). The difference is, 432misusing it. Replacement: d_make_root(inode). The difference is,
435d_make_root() drops the reference to inode if dentry allocation fails. 433d_make_root() drops the reference to inode if dentry allocation fails.
434
435--
436[mandatory]
437 The witch is dead! Well, 2/3 of it, anyway. ->d_revalidate() and
438->lookup() do *not* take struct nameidata anymore; just the flags.
439--
440[mandatory]
441 ->create() doesn't take struct nameidata *; unlike the previous
442two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that
443local filesystems can ignore tha argument - they are guaranteed that the
444object doesn't exist. It's remote/distributed ones that might care...
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index efd23f481704..065aa2dc0835 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -341,8 +341,8 @@ This describes how the VFS can manipulate an inode in your
341filesystem. As of kernel 2.6.22, the following members are defined: 341filesystem. As of kernel 2.6.22, the following members are defined:
342 342
343struct inode_operations { 343struct inode_operations {
344 int (*create) (struct inode *,struct dentry *, umode_t, struct nameidata *); 344 int (*create) (struct inode *,struct dentry *, umode_t, bool);
345 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 345 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
346 int (*link) (struct dentry *,struct inode *,struct dentry *); 346 int (*link) (struct dentry *,struct inode *,struct dentry *);
347 int (*unlink) (struct inode *,struct dentry *); 347 int (*unlink) (struct inode *,struct dentry *);
348 int (*symlink) (struct inode *,struct dentry *,const char *); 348 int (*symlink) (struct inode *,struct dentry *,const char *);
@@ -364,6 +364,9 @@ struct inode_operations {
364 ssize_t (*listxattr) (struct dentry *, char *, size_t); 364 ssize_t (*listxattr) (struct dentry *, char *, size_t);
365 int (*removexattr) (struct dentry *, const char *); 365 int (*removexattr) (struct dentry *, const char *);
366 void (*update_time)(struct inode *, struct timespec *, int); 366 void (*update_time)(struct inode *, struct timespec *, int);
367 int (*atomic_open)(struct inode *, struct dentry *,
368 struct file *, unsigned open_flag,
369 umode_t create_mode, int *opened);
367}; 370};
368 371
369Again, all methods are called without any locks being held, unless 372Again, all methods are called without any locks being held, unless
@@ -476,6 +479,14 @@ otherwise noted.
476 an inode. If this is not defined the VFS will update the inode itself 479 an inode. If this is not defined the VFS will update the inode itself
477 and call mark_inode_dirty_sync. 480 and call mark_inode_dirty_sync.
478 481
482 atomic_open: called on the last component of an open. Using this optional
483 method the filesystem can look up, possibly create and open the file in
484 one atomic operation. If it cannot perform this (e.g. the file type
485 turned out to be wrong) it may signal this by returning 1 instead of
486 usual 0 or -ve . This method is only called if the last
487 component is negative or needs lookup. Cached positive dentries are
488 still handled by f_op->open().
489
479The Address Space Object 490The Address Space Object
480======================== 491========================
481 492
@@ -581,6 +592,8 @@ struct address_space_operations {
581 int (*migratepage) (struct page *, struct page *); 592 int (*migratepage) (struct page *, struct page *);
582 int (*launder_page) (struct page *); 593 int (*launder_page) (struct page *);
583 int (*error_remove_page) (struct mapping *mapping, struct page *page); 594 int (*error_remove_page) (struct mapping *mapping, struct page *page);
595 int (*swap_activate)(struct file *);
596 int (*swap_deactivate)(struct file *);
584}; 597};
585 598
586 writepage: called by the VM to write a dirty page to backing store. 599 writepage: called by the VM to write a dirty page to backing store.
@@ -749,6 +762,16 @@ struct address_space_operations {
749 Setting this implies you deal with pages going away under you, 762 Setting this implies you deal with pages going away under you,
750 unless you have them locked or reference counts increased. 763 unless you have them locked or reference counts increased.
751 764
765 swap_activate: Called when swapon is used on a file to allocate
766 space if necessary and pin the block lookup information in
767 memory. A return value of zero indicates success,
768 in which case this file can be used to back swapspace. The
769 swapspace operations will be proxied to this address space's
770 ->swap_{out,in} methods.
771
772 swap_deactivate: Called during swapoff on files where swap_activate
773 was successful.
774
752 775
753The File Object 776The File Object
754=============== 777===============
@@ -891,7 +914,7 @@ the VFS uses a default. As of kernel 2.6.22, the following members are
891defined: 914defined:
892 915
893struct dentry_operations { 916struct dentry_operations {
894 int (*d_revalidate)(struct dentry *, struct nameidata *); 917 int (*d_revalidate)(struct dentry *, unsigned int);
895 int (*d_hash)(const struct dentry *, const struct inode *, 918 int (*d_hash)(const struct dentry *, const struct inode *,
896 struct qstr *); 919 struct qstr *);
897 int (*d_compare)(const struct dentry *, const struct inode *, 920 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -910,11 +933,11 @@ struct dentry_operations {
910 dcache. Most filesystems leave this as NULL, because all their 933 dcache. Most filesystems leave this as NULL, because all their
911 dentries in the dcache are valid 934 dentries in the dcache are valid
912 935
913 d_revalidate may be called in rcu-walk mode (nd->flags & LOOKUP_RCU). 936 d_revalidate may be called in rcu-walk mode (flags & LOOKUP_RCU).
914 If in rcu-walk mode, the filesystem must revalidate the dentry without 937 If in rcu-walk mode, the filesystem must revalidate the dentry without
915 blocking or storing to the dentry, d_parent and d_inode should not be 938 blocking or storing to the dentry, d_parent and d_inode should not be
916 used without care (because they can go NULL), instead nd->inode should 939 used without care (because they can change and, in d_inode case, even
917 be used. 940 become NULL under us).
918 941
919 If a situation is encountered that rcu-walk cannot handle, return 942 If a situation is encountered that rcu-walk cannot handle, return
920 -ECHILD and it will be called again in ref-walk mode. 943 -ECHILD and it will be called again in ref-walk mode.