aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/Locking43
-rw-r--r--Documentation/filesystems/f2fs.txt9
-rw-r--r--Documentation/filesystems/porting6
-rw-r--r--Documentation/filesystems/vfs.txt48
4 files changed, 66 insertions, 40 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 0706d32a61e6..fe7afe225381 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -11,10 +11,8 @@ be able to use diff(1).
11prototypes: 11prototypes:
12 int (*d_revalidate)(struct dentry *, unsigned int); 12 int (*d_revalidate)(struct dentry *, unsigned int);
13 int (*d_weak_revalidate)(struct dentry *, unsigned int); 13 int (*d_weak_revalidate)(struct dentry *, unsigned int);
14 int (*d_hash)(const struct dentry *, const struct inode *, 14 int (*d_hash)(const struct dentry *, struct qstr *);
15 struct qstr *); 15 int (*d_compare)(const struct dentry *, const struct dentry *,
16 int (*d_compare)(const struct dentry *, const struct inode *,
17 const struct dentry *, const struct inode *,
18 unsigned int, const char *, const struct qstr *); 16 unsigned int, const char *, const struct qstr *);
19 int (*d_delete)(struct dentry *); 17 int (*d_delete)(struct dentry *);
20 void (*d_release)(struct dentry *); 18 void (*d_release)(struct dentry *);
@@ -66,6 +64,7 @@ prototypes:
66 int (*atomic_open)(struct inode *, struct dentry *, 64 int (*atomic_open)(struct inode *, struct dentry *,
67 struct file *, unsigned open_flag, 65 struct file *, unsigned open_flag,
68 umode_t create_mode, int *opened); 66 umode_t create_mode, int *opened);
67 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
69 68
70locking rules: 69locking rules:
71 all may block 70 all may block
@@ -93,6 +92,7 @@ removexattr: yes
93fiemap: no 92fiemap: no
94update_time: no 93update_time: no
95atomic_open: yes 94atomic_open: yes
95tmpfile: no
96 96
97 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 97 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
98victim. 98victim.
@@ -189,7 +189,7 @@ prototypes:
189 loff_t pos, unsigned len, unsigned copied, 189 loff_t pos, unsigned len, unsigned copied,
190 struct page *page, void *fsdata); 190 struct page *page, void *fsdata);
191 sector_t (*bmap)(struct address_space *, sector_t); 191 sector_t (*bmap)(struct address_space *, sector_t);
192 int (*invalidatepage) (struct page *, unsigned long); 192 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
193 int (*releasepage) (struct page *, int); 193 int (*releasepage) (struct page *, int);
194 void (*freepage)(struct page *); 194 void (*freepage)(struct page *);
195 int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 195 int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
@@ -310,8 +310,8 @@ filesystems and by the swapper. The latter will eventually go away. Please,
310keep it that way and don't breed new callers. 310keep it that way and don't breed new callers.
311 311
312 ->invalidatepage() is called when the filesystem must attempt to drop 312 ->invalidatepage() is called when the filesystem must attempt to drop
313some or all of the buffers from the page when it is being truncated. It 313some or all of the buffers from the page when it is being truncated. It
314returns zero on success. If ->invalidatepage is zero, the kernel uses 314returns zero on success. If ->invalidatepage is zero, the kernel uses
315block_invalidatepage() instead. 315block_invalidatepage() instead.
316 316
317 ->releasepage() is called when the kernel is about to try to drop the 317 ->releasepage() is called when the kernel is about to try to drop the
@@ -344,25 +344,38 @@ prototypes:
344 344
345 345
346locking rules: 346locking rules:
347 file_lock_lock may block 347 inode->i_lock may block
348fl_copy_lock: yes no 348fl_copy_lock: yes no
349fl_release_private: maybe no 349fl_release_private: maybe no
350 350
351----------------------- lock_manager_operations --------------------------- 351----------------------- lock_manager_operations ---------------------------
352prototypes: 352prototypes:
353 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 353 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
354 unsigned long (*lm_owner_key)(struct file_lock *);
354 void (*lm_notify)(struct file_lock *); /* unblock callback */ 355 void (*lm_notify)(struct file_lock *); /* unblock callback */
355 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 356 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
356 void (*lm_break)(struct file_lock *); /* break_lease callback */ 357 void (*lm_break)(struct file_lock *); /* break_lease callback */
357 int (*lm_change)(struct file_lock **, int); 358 int (*lm_change)(struct file_lock **, int);
358 359
359locking rules: 360locking rules:
360 file_lock_lock may block 361
361lm_compare_owner: yes no 362 inode->i_lock blocked_lock_lock may block
362lm_notify: yes no 363lm_compare_owner: yes[1] maybe no
363lm_grant: no no 364lm_owner_key yes[1] yes no
364lm_break: yes no 365lm_notify: yes yes no
365lm_change yes no 366lm_grant: no no no
367lm_break: yes no no
368lm_change yes no no
369
370[1]: ->lm_compare_owner and ->lm_owner_key are generally called with
371*an* inode->i_lock held. It may not be the i_lock of the inode
372associated with either file_lock argument! This is the case with deadlock
373detection, since the code has to chase down the owners of locks that may
374be entirely unrelated to the one on which the lock is being acquired.
375For deadlock detection however, the blocked_lock_lock is also held. The
376fact that these locks are held ensures that the file_locks do not
377disappear out from under you while doing the comparison or generating an
378owner key.
366 379
367--------------------------- buffer_head ----------------------------------- 380--------------------------- buffer_head -----------------------------------
368prototypes: 381prototypes:
@@ -414,7 +427,7 @@ prototypes:
414 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 427 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
415 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 428 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
416 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 429 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
417 int (*readdir) (struct file *, void *, filldir_t); 430 int (*iterate) (struct file *, struct dir_context *);
418 unsigned int (*poll) (struct file *, struct poll_table_struct *); 431 unsigned int (*poll) (struct file *, struct poll_table_struct *);
419 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 432 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
420 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 433 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index bd3c56c67380..b91e2f26b672 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -98,8 +98,13 @@ Cleaning Overhead
98MOUNT OPTIONS 98MOUNT OPTIONS
99================================================================================ 99================================================================================
100 100
101background_gc_off Turn off cleaning operations, namely garbage collection, 101background_gc=%s Turn on/off cleaning operations, namely garbage
102 triggered in background when I/O subsystem is idle. 102 collection, triggered in background when I/O subsystem is
103 idle. If background_gc=on, it will turn on the garbage
104 collection and if background_gc=off, garbage collection
105 will be truned off.
106 Default value for this option is on. So garbage
107 collection is on by default.
103disable_roll_forward Disable the roll-forward recovery routine 108disable_roll_forward Disable the roll-forward recovery routine
104discard Issue discard/TRIM commands when a segment is cleaned. 109discard Issue discard/TRIM commands when a segment is cleaned.
105no_heap Disable heap-style segment allocation which finds free 110no_heap Disable heap-style segment allocation which finds free
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 4db22f6491e0..206a1bdc7321 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -445,3 +445,9 @@ object doesn't exist. It's remote/distributed ones that might care...
445[mandatory] 445[mandatory]
446 FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate() 446 FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate()
447in your dentry operations instead. 447in your dentry operations instead.
448--
449[mandatory]
450 vfs_readdir() is gone; switch to iterate_dir() instead
451--
452[mandatory]
453 ->readdir() is gone now; switch to ->iterate()
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index bc4b06b3160a..1f0ba30ae47e 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -360,6 +360,8 @@ struct inode_operations {
360 int (*removexattr) (struct dentry *, const char *); 360 int (*removexattr) (struct dentry *, const char *);
361 void (*update_time)(struct inode *, struct timespec *, int); 361 void (*update_time)(struct inode *, struct timespec *, int);
362 int (*atomic_open)(struct inode *, struct dentry *, 362 int (*atomic_open)(struct inode *, struct dentry *,
363 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
364} ____cacheline_aligned;
363 struct file *, unsigned open_flag, 365 struct file *, unsigned open_flag,
364 umode_t create_mode, int *opened); 366 umode_t create_mode, int *opened);
365}; 367};
@@ -472,6 +474,9 @@ otherwise noted.
472 component is negative or needs lookup. Cached positive dentries are 474 component is negative or needs lookup. Cached positive dentries are
473 still handled by f_op->open(). 475 still handled by f_op->open().
474 476
477 tmpfile: called in the end of O_TMPFILE open(). Optional, equivalent to
478 atomically creating, opening and unlinking a file in given directory.
479
475The Address Space Object 480The Address Space Object
476======================== 481========================
477 482
@@ -549,7 +554,7 @@ struct address_space_operations
549------------------------------- 554-------------------------------
550 555
551This describes how the VFS can manipulate mapping of a file to page cache in 556This describes how the VFS can manipulate mapping of a file to page cache in
552your filesystem. As of kernel 2.6.22, the following members are defined: 557your filesystem. The following members are defined:
553 558
554struct address_space_operations { 559struct address_space_operations {
555 int (*writepage)(struct page *page, struct writeback_control *wbc); 560 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -566,7 +571,7 @@ struct address_space_operations {
566 loff_t pos, unsigned len, unsigned copied, 571 loff_t pos, unsigned len, unsigned copied,
567 struct page *page, void *fsdata); 572 struct page *page, void *fsdata);
568 sector_t (*bmap)(struct address_space *, sector_t); 573 sector_t (*bmap)(struct address_space *, sector_t);
569 int (*invalidatepage) (struct page *, unsigned long); 574 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
570 int (*releasepage) (struct page *, int); 575 int (*releasepage) (struct page *, int);
571 void (*freepage)(struct page *); 576 void (*freepage)(struct page *);
572 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 577 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
@@ -685,14 +690,14 @@ struct address_space_operations {
685 invalidatepage: If a page has PagePrivate set, then invalidatepage 690 invalidatepage: If a page has PagePrivate set, then invalidatepage
686 will be called when part or all of the page is to be removed 691 will be called when part or all of the page is to be removed
687 from the address space. This generally corresponds to either a 692 from the address space. This generally corresponds to either a
688 truncation or a complete invalidation of the address space 693 truncation, punch hole or a complete invalidation of the address
689 (in the latter case 'offset' will always be 0). 694 space (in the latter case 'offset' will always be 0 and 'length'
690 Any private data associated with the page should be updated 695 will be PAGE_CACHE_SIZE). Any private data associated with the page
691 to reflect this truncation. If offset is 0, then 696 should be updated to reflect this truncation. If offset is 0 and
692 the private data should be released, because the page 697 length is PAGE_CACHE_SIZE, then the private data should be released,
693 must be able to be completely discarded. This may be done by 698 because the page must be able to be completely discarded. This may
694 calling the ->releasepage function, but in this case the 699 be done by calling the ->releasepage function, but in this case the
695 release MUST succeed. 700 release MUST succeed.
696 701
697 releasepage: releasepage is called on PagePrivate pages to indicate 702 releasepage: releasepage is called on PagePrivate pages to indicate
698 that the page should be freed if possible. ->releasepage 703 that the page should be freed if possible. ->releasepage
@@ -777,7 +782,7 @@ struct file_operations {
777 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 782 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
778 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 783 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
779 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 784 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
780 int (*readdir) (struct file *, void *, filldir_t); 785 int (*iterate) (struct file *, struct dir_context *);
781 unsigned int (*poll) (struct file *, struct poll_table_struct *); 786 unsigned int (*poll) (struct file *, struct poll_table_struct *);
782 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 787 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
783 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 788 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -815,7 +820,7 @@ otherwise noted.
815 820
816 aio_write: called by io_submit(2) and other asynchronous I/O operations 821 aio_write: called by io_submit(2) and other asynchronous I/O operations
817 822
818 readdir: called when the VFS needs to read the directory contents 823 iterate: called when the VFS needs to read the directory contents
819 824
820 poll: called by the VFS when a process wants to check if there is 825 poll: called by the VFS when a process wants to check if there is
821 activity on this file and (optionally) go to sleep until there 826 activity on this file and (optionally) go to sleep until there
@@ -901,10 +906,8 @@ defined:
901struct dentry_operations { 906struct dentry_operations {
902 int (*d_revalidate)(struct dentry *, unsigned int); 907 int (*d_revalidate)(struct dentry *, unsigned int);
903 int (*d_weak_revalidate)(struct dentry *, unsigned int); 908 int (*d_weak_revalidate)(struct dentry *, unsigned int);
904 int (*d_hash)(const struct dentry *, const struct inode *, 909 int (*d_hash)(const struct dentry *, struct qstr *);
905 struct qstr *); 910 int (*d_compare)(const struct dentry *, const struct dentry *,
906 int (*d_compare)(const struct dentry *, const struct inode *,
907 const struct dentry *, const struct inode *,
908 unsigned int, const char *, const struct qstr *); 911 unsigned int, const char *, const struct qstr *);
909 int (*d_delete)(const struct dentry *); 912 int (*d_delete)(const struct dentry *);
910 void (*d_release)(struct dentry *); 913 void (*d_release)(struct dentry *);
@@ -949,25 +952,24 @@ struct dentry_operations {
949 952
950 d_hash: called when the VFS adds a dentry to the hash table. The first 953 d_hash: called when the VFS adds a dentry to the hash table. The first
951 dentry passed to d_hash is the parent directory that the name is 954 dentry passed to d_hash is the parent directory that the name is
952 to be hashed into. The inode is the dentry's inode. 955 to be hashed into.
953 956
954 Same locking and synchronisation rules as d_compare regarding 957 Same locking and synchronisation rules as d_compare regarding
955 what is safe to dereference etc. 958 what is safe to dereference etc.
956 959
957 d_compare: called to compare a dentry name with a given name. The first 960 d_compare: called to compare a dentry name with a given name. The first
958 dentry is the parent of the dentry to be compared, the second is 961 dentry is the parent of the dentry to be compared, the second is
959 the parent's inode, then the dentry and inode (may be NULL) of the 962 the child dentry. len and name string are properties of the dentry
960 child dentry. len and name string are properties of the dentry to be 963 to be compared. qstr is the name to compare it with.
961 compared. qstr is the name to compare it with.
962 964
963 Must be constant and idempotent, and should not take locks if 965 Must be constant and idempotent, and should not take locks if
964 possible, and should not or store into the dentry or inodes. 966 possible, and should not or store into the dentry.
965 Should not dereference pointers outside the dentry or inodes without 967 Should not dereference pointers outside the dentry without
966 lots of care (eg. d_parent, d_inode, d_name should not be used). 968 lots of care (eg. d_parent, d_inode, d_name should not be used).
967 969
968 However, our vfsmount is pinned, and RCU held, so the dentries and 970 However, our vfsmount is pinned, and RCU held, so the dentries and
969 inodes won't disappear, neither will our sb or filesystem module. 971 inodes won't disappear, neither will our sb or filesystem module.
970 ->i_sb and ->d_sb may be used. 972 ->d_sb may be used.
971 973
972 It is a tricky calling convention because it needs to be called under 974 It is a tricky calling convention because it needs to be called under
973 "rcu-walk", ie. without any locks or references on things. 975 "rcu-walk", ie. without any locks or references on things.