aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/debugfs.txt2
-rw-r--r--Documentation/filesystems/f2fs.txt7
-rw-r--r--Documentation/filesystems/nfs/Exporting23
-rw-r--r--Documentation/filesystems/overlayfs.txt198
-rw-r--r--Documentation/filesystems/porting8
-rw-r--r--Documentation/filesystems/proc.txt2
-rw-r--r--Documentation/filesystems/seq_file.txt22
-rw-r--r--Documentation/filesystems/squashfs.txt8
-rw-r--r--Documentation/filesystems/vfs.txt9
10 files changed, 247 insertions, 34 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 94d93b1f8b53..b30753cbf431 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -67,6 +67,7 @@ prototypes:
67 struct file *, unsigned open_flag, 67 struct file *, unsigned open_flag,
68 umode_t create_mode, int *opened); 68 umode_t create_mode, int *opened);
69 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 69 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
70 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
70 71
71locking rules: 72locking rules:
72 all may block 73 all may block
@@ -96,6 +97,7 @@ fiemap: no
96update_time: no 97update_time: no
97atomic_open: yes 98atomic_open: yes
98tmpfile: no 99tmpfile: no
100dentry_open: no
99 101
100 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 102 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
101victim. 103victim.
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt
index 3a863f692728..88ab81c79109 100644
--- a/Documentation/filesystems/debugfs.txt
+++ b/Documentation/filesystems/debugfs.txt
@@ -140,7 +140,7 @@ file.
140 struct dentry *parent, 140 struct dentry *parent,
141 struct debugfs_regset32 *regset); 141 struct debugfs_regset32 *regset);
142 142
143 int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs, 143 void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
144 int nregs, void __iomem *base, char *prefix); 144 int nregs, void __iomem *base, char *prefix);
145 145
146The "base" argument may be 0, but you may want to build the reg32 array 146The "base" argument may be 0, but you may want to build the reg32 array
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index 2cca5a25ef89..e0950c483c22 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -122,6 +122,10 @@ disable_ext_identify Disable the extension list configured by mkfs, so f2fs
122inline_xattr Enable the inline xattrs feature. 122inline_xattr Enable the inline xattrs feature.
123inline_data Enable the inline data feature: New created small(<~3.4k) 123inline_data Enable the inline data feature: New created small(<~3.4k)
124 files can be written into inode block. 124 files can be written into inode block.
125inline_dentry Enable the inline dir feature: data in new created
126 directory entries can be written into inode block. The
127 space of inode block which is used to store inline
128 dentries is limited to ~3.4k.
125flush_merge Merge concurrent cache_flush commands as much as possible 129flush_merge Merge concurrent cache_flush commands as much as possible
126 to eliminate redundant command issues. If the underlying 130 to eliminate redundant command issues. If the underlying
127 device handles the cache_flush command relatively slowly, 131 device handles the cache_flush command relatively slowly,
@@ -131,6 +135,9 @@ nobarrier This option can be used if underlying storage guarantees
131 If this option is set, no cache_flush commands are issued 135 If this option is set, no cache_flush commands are issued
132 but f2fs still guarantees the write ordering of all the 136 but f2fs still guarantees the write ordering of all the
133 data writes. 137 data writes.
138fastboot This option is used when a system wants to reduce mount
139 time as much as possible, even though normal performance
140 can be sacrificed.
134 141
135================================================================================ 142================================================================================
136DEBUGFS ENTRIES 143DEBUGFS ENTRIES
diff --git a/Documentation/filesystems/nfs/Exporting b/Documentation/filesystems/nfs/Exporting
index c8f036a9b13f..520a4becb75c 100644
--- a/Documentation/filesystems/nfs/Exporting
+++ b/Documentation/filesystems/nfs/Exporting
@@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach
72 DCACHE_DISCONNECTED) dentry is allocated and attached. 72 DCACHE_DISCONNECTED) dentry is allocated and attached.
73 In the case of a directory, care is taken that only one dentry 73 In the case of a directory, care is taken that only one dentry
74 can ever be attached. 74 can ever be attached.
75 d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) 75 d_splice_alias(inode, dentry) will introduce a new dentry into the tree;
76 will introduce a new dentry into the tree; either the passed-in 76 either the passed-in dentry or a preexisting alias for the given inode
77 dentry or a preexisting alias for the given inode (such as an 77 (such as an anonymous one created by d_obtain_alias), if appropriate.
78 anonymous one created by d_obtain_alias), if appropriate. The two 78 It returns NULL when the passed-in dentry is used, following the calling
79 functions differ in their handling of directories with preexisting 79 convention of ->lookup.
80 aliases:
81 d_splice_alias will use any existing IS_ROOT dentry, but it will
82 return -EIO rather than try to move a dentry with a different
83 parent. This is appropriate for local filesystems, which
84 should never see such an alias unless the filesystem is
85 corrupted somehow (for example, if two on-disk directory
86 entries refer to the same directory.)
87 d_materialise_unique will attempt to move any dentry. This is
88 appropriate for distributed filesystems, where finding a
89 directory other than where we last cached it may be a normal
90 consequence of concurrent operations on other hosts.
91 Both functions return NULL when the passed-in dentry is used,
92 following the calling convention of ->lookup.
93 80
94 81
95Filesystem Issues 82Filesystem Issues
diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt
new file mode 100644
index 000000000000..a27c950ece61
--- /dev/null
+++ b/Documentation/filesystems/overlayfs.txt
@@ -0,0 +1,198 @@
1Written by: Neil Brown <neilb@suse.de>
2
3Overlay Filesystem
4==================
5
6This document describes a prototype for a new approach to providing
7overlay-filesystem functionality in Linux (sometimes referred to as
8union-filesystems). An overlay-filesystem tries to present a
9filesystem which is the result over overlaying one filesystem on top
10of the other.
11
12The result will inevitably fail to look exactly like a normal
13filesystem for various technical reasons. The expectation is that
14many use cases will be able to ignore these differences.
15
16This approach is 'hybrid' because the objects that appear in the
17filesystem do not all appear to belong to that filesystem. In many
18cases an object accessed in the union will be indistinguishable
19from accessing the corresponding object from the original filesystem.
20This is most obvious from the 'st_dev' field returned by stat(2).
21
22While directories will report an st_dev from the overlay-filesystem,
23all non-directory objects will report an st_dev from the lower or
24upper filesystem that is providing the object. Similarly st_ino will
25only be unique when combined with st_dev, and both of these can change
26over the lifetime of a non-directory object. Many applications and
27tools ignore these values and will not be affected.
28
29Upper and Lower
30---------------
31
32An overlay filesystem combines two filesystems - an 'upper' filesystem
33and a 'lower' filesystem. When a name exists in both filesystems, the
34object in the 'upper' filesystem is visible while the object in the
35'lower' filesystem is either hidden or, in the case of directories,
36merged with the 'upper' object.
37
38It would be more correct to refer to an upper and lower 'directory
39tree' rather than 'filesystem' as it is quite possible for both
40directory trees to be in the same filesystem and there is no
41requirement that the root of a filesystem be given for either upper or
42lower.
43
44The lower filesystem can be any filesystem supported by Linux and does
45not need to be writable. The lower filesystem can even be another
46overlayfs. The upper filesystem will normally be writable and if it
47is it must support the creation of trusted.* extended attributes, and
48must provide valid d_type in readdir responses, so NFS is not suitable.
49
50A read-only overlay of two read-only filesystems may use any
51filesystem type.
52
53Directories
54-----------
55
56Overlaying mainly involves directories. If a given name appears in both
57upper and lower filesystems and refers to a non-directory in either,
58then the lower object is hidden - the name refers only to the upper
59object.
60
61Where both upper and lower objects are directories, a merged directory
62is formed.
63
64At mount time, the two directories given as mount options "lowerdir" and
65"upperdir" are combined into a merged directory:
66
67 mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,\
68workdir=/work /merged
69
70The "workdir" needs to be an empty directory on the same filesystem
71as upperdir.
72
73Then whenever a lookup is requested in such a merged directory, the
74lookup is performed in each actual directory and the combined result
75is cached in the dentry belonging to the overlay filesystem. If both
76actual lookups find directories, both are stored and a merged
77directory is created, otherwise only one is stored: the upper if it
78exists, else the lower.
79
80Only the lists of names from directories are merged. Other content
81such as metadata and extended attributes are reported for the upper
82directory only. These attributes of the lower directory are hidden.
83
84whiteouts and opaque directories
85--------------------------------
86
87In order to support rm and rmdir without changing the lower
88filesystem, an overlay filesystem needs to record in the upper filesystem
89that files have been removed. This is done using whiteouts and opaque
90directories (non-directories are always opaque).
91
92A whiteout is created as a character device with 0/0 device number.
93When a whiteout is found in the upper level of a merged directory, any
94matching name in the lower level is ignored, and the whiteout itself
95is also hidden.
96
97A directory is made opaque by setting the xattr "trusted.overlay.opaque"
98to "y". Where the upper filesystem contains an opaque directory, any
99directory in the lower filesystem with the same name is ignored.
100
101readdir
102-------
103
104When a 'readdir' request is made on a merged directory, the upper and
105lower directories are each read and the name lists merged in the
106obvious way (upper is read first, then lower - entries that already
107exist are not re-added). This merged name list is cached in the
108'struct file' and so remains as long as the file is kept open. If the
109directory is opened and read by two processes at the same time, they
110will each have separate caches. A seekdir to the start of the
111directory (offset 0) followed by a readdir will cause the cache to be
112discarded and rebuilt.
113
114This means that changes to the merged directory do not appear while a
115directory is being read. This is unlikely to be noticed by many
116programs.
117
118seek offsets are assigned sequentially when the directories are read.
119Thus if
120 - read part of a directory
121 - remember an offset, and close the directory
122 - re-open the directory some time later
123 - seek to the remembered offset
124
125there may be little correlation between the old and new locations in
126the list of filenames, particularly if anything has changed in the
127directory.
128
129Readdir on directories that are not merged is simply handled by the
130underlying directory (upper or lower).
131
132
133Non-directories
134---------------
135
136Objects that are not directories (files, symlinks, device-special
137files etc.) are presented either from the upper or lower filesystem as
138appropriate. When a file in the lower filesystem is accessed in a way
139the requires write-access, such as opening for write access, changing
140some metadata etc., the file is first copied from the lower filesystem
141to the upper filesystem (copy_up). Note that creating a hard-link
142also requires copy_up, though of course creation of a symlink does
143not.
144
145The copy_up may turn out to be unnecessary, for example if the file is
146opened for read-write but the data is not modified.
147
148The copy_up process first makes sure that the containing directory
149exists in the upper filesystem - creating it and any parents as
150necessary. It then creates the object with the same metadata (owner,
151mode, mtime, symlink-target etc.) and then if the object is a file, the
152data is copied from the lower to the upper filesystem. Finally any
153extended attributes are copied up.
154
155Once the copy_up is complete, the overlay filesystem simply
156provides direct access to the newly created file in the upper
157filesystem - future operations on the file are barely noticed by the
158overlay filesystem (though an operation on the name of the file such as
159rename or unlink will of course be noticed and handled).
160
161
162Non-standard behavior
163---------------------
164
165The copy_up operation essentially creates a new, identical file and
166moves it over to the old name. The new file may be on a different
167filesystem, so both st_dev and st_ino of the file may change.
168
169Any open files referring to this inode will access the old data and
170metadata. Similarly any file locks obtained before copy_up will not
171apply to the copied up file.
172
173On a file opened with O_RDONLY fchmod(2), fchown(2), futimesat(2) and
174fsetxattr(2) will fail with EROFS.
175
176If a file with multiple hard links is copied up, then this will
177"break" the link. Changes will not be propagated to other names
178referring to the same inode.
179
180Symlinks in /proc/PID/ and /proc/PID/fd which point to a non-directory
181object in overlayfs will not contain valid absolute paths, only
182relative paths leading up to the filesystem's root. This will be
183fixed in the future.
184
185Some operations are not atomic, for example a crash during copy_up or
186rename will leave the filesystem in an inconsistent state. This will
187be addressed in the future.
188
189Changes to underlying filesystems
190---------------------------------
191
192Offline changes, when the overlay is not mounted, are allowed to either
193the upper or the lower trees.
194
195Changes to the underlying filesystems while part of a mounted overlay
196filesystem are not allowed. If the underlying filesystem is changed,
197the behavior of the overlay is undefined, though it will not result in
198a crash or deadlock.
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 0f3a1390bf00..fa2db081505e 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -463,3 +463,11 @@ in your dentry operations instead.
463 of the in-tree instances did). inode_hash_lock is still held, 463 of the in-tree instances did). inode_hash_lock is still held,
464 of course, so they are still serialized wrt removal from inode hash, 464 of course, so they are still serialized wrt removal from inode hash,
465 as well as wrt set() callback of iget5_locked(). 465 as well as wrt set() callback of iget5_locked().
466--
467[mandatory]
468 d_materialise_unique() is gone; d_splice_alias() does everything you
469 need now. Remember that they have opposite orders of arguments ;-/
470--
471[mandatory]
472 f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
473 it entirely.
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index eb8a10e22f7c..aae9dd13c91f 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1272,7 +1272,7 @@ softirq.
1272 1272
1273 1273
12741.9 Ext4 file system parameters 12741.9 Ext4 file system parameters
1275------------------------------ 1275-------------------------------
1276 1276
1277Information about mounted ext4 file systems can be found in 1277Information about mounted ext4 file systems can be found in
1278/proc/fs/ext4. Each mounted filesystem will have a directory in 1278/proc/fs/ext4. Each mounted filesystem will have a directory in
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt
index 8ea3e90ace07..b797ed38de46 100644
--- a/Documentation/filesystems/seq_file.txt
+++ b/Documentation/filesystems/seq_file.txt
@@ -180,23 +180,19 @@ output must be passed to the seq_file code. Some utility functions have
180been defined which make this task easy. 180been defined which make this task easy.
181 181
182Most code will simply use seq_printf(), which works pretty much like 182Most code will simply use seq_printf(), which works pretty much like
183printk(), but which requires the seq_file pointer as an argument. It is 183printk(), but which requires the seq_file pointer as an argument.
184common to ignore the return value from seq_printf(), but a function
185producing complicated output may want to check that value and quit if
186something non-zero is returned; an error return means that the seq_file
187buffer has been filled and further output will be discarded.
188 184
189For straight character output, the following functions may be used: 185For straight character output, the following functions may be used:
190 186
191 int seq_putc(struct seq_file *m, char c); 187 seq_putc(struct seq_file *m, char c);
192 int seq_puts(struct seq_file *m, const char *s); 188 seq_puts(struct seq_file *m, const char *s);
193 int seq_escape(struct seq_file *m, const char *s, const char *esc); 189 seq_escape(struct seq_file *m, const char *s, const char *esc);
194 190
195The first two output a single character and a string, just like one would 191The first two output a single character and a string, just like one would
196expect. seq_escape() is like seq_puts(), except that any character in s 192expect. seq_escape() is like seq_puts(), except that any character in s
197which is in the string esc will be represented in octal form in the output. 193which is in the string esc will be represented in octal form in the output.
198 194
199There is also a pair of functions for printing filenames: 195There are also a pair of functions for printing filenames:
200 196
201 int seq_path(struct seq_file *m, struct path *path, char *esc); 197 int seq_path(struct seq_file *m, struct path *path, char *esc);
202 int seq_path_root(struct seq_file *m, struct path *path, 198 int seq_path_root(struct seq_file *m, struct path *path,
@@ -209,6 +205,14 @@ root is desired, it can be used with seq_path_root(). Note that, if it
209turns out that path cannot be reached from root, the value of root will be 205turns out that path cannot be reached from root, the value of root will be
210changed in seq_file_root() to a root which *does* work. 206changed in seq_file_root() to a root which *does* work.
211 207
208A function producing complicated output may want to check
209 bool seq_has_overflowed(struct seq_file *m);
210and avoid further seq_<output> calls if true is returned.
211
212A true return from seq_has_overflowed means that the seq_file buffer will
213be discarded and the seq_show function will attempt to allocate a larger
214buffer and retry printing.
215
212 216
213Making it all work 217Making it all work
214 218
diff --git a/Documentation/filesystems/squashfs.txt b/Documentation/filesystems/squashfs.txt
index 403c090aca39..e5274f84dc56 100644
--- a/Documentation/filesystems/squashfs.txt
+++ b/Documentation/filesystems/squashfs.txt
@@ -2,10 +2,10 @@ SQUASHFS 4.0 FILESYSTEM
2======================= 2=======================
3 3
4Squashfs is a compressed read-only filesystem for Linux. 4Squashfs is a compressed read-only filesystem for Linux.
5It uses zlib/lzo/xz compression to compress files, inodes and directories. 5It uses zlib, lz4, lzo, or xz compression to compress files, inodes and
6Inodes in the system are very small and all blocks are packed to minimise 6directories. Inodes in the system are very small and all blocks are packed to
7data overhead. Block sizes greater than 4K are supported up to a maximum 7minimise data overhead. Block sizes greater than 4K are supported up to a
8of 1Mbytes (default block size 128K). 8maximum of 1Mbytes (default block size 128K).
9 9
10Squashfs is intended for general read-only filesystem use, for archival 10Squashfs is intended for general read-only filesystem use, for archival
11use (i.e. in cases where a .tar.gz file may be used), and in constrained 11use (i.e. in cases where a .tar.gz file may be used), and in constrained
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index fceff7c00a3c..43ce0507ee25 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -364,6 +364,7 @@ struct inode_operations {
364 int (*atomic_open)(struct inode *, struct dentry *, struct file *, 364 int (*atomic_open)(struct inode *, struct dentry *, struct file *,
365 unsigned open_flag, umode_t create_mode, int *opened); 365 unsigned open_flag, umode_t create_mode, int *opened);
366 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 366 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
367 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
367}; 368};
368 369
369Again, all methods are called without any locks being held, unless 370Again, all methods are called without any locks being held, unless
@@ -696,6 +697,12 @@ struct address_space_operations {
696 but instead uses bmap to find out where the blocks in the file 697 but instead uses bmap to find out where the blocks in the file
697 are and uses those addresses directly. 698 are and uses those addresses directly.
698 699
700 dentry_open: *WARNING: probably going away soon, do not use!* This is an
701 alternative to f_op->open(), the difference is that this method may open
702 a file not necessarily originating from the same filesystem as the one
703 i_op->open() was called on. It may be useful for stacking filesystems
704 which want to allow native I/O directly on underlying files.
705
699 706
700 invalidatepage: If a page has PagePrivate set, then invalidatepage 707 invalidatepage: If a page has PagePrivate set, then invalidatepage
701 will be called when part or all of the page is to be removed 708 will be called when part or all of the page is to be removed
@@ -828,7 +835,7 @@ struct file_operations {
828 ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); 835 ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
829 int (*setlease)(struct file *, long arg, struct file_lock **, void **); 836 int (*setlease)(struct file *, long arg, struct file_lock **, void **);
830 long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len); 837 long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len);
831 int (*show_fdinfo)(struct seq_file *m, struct file *f); 838 void (*show_fdinfo)(struct seq_file *m, struct file *f);
832}; 839};
833 840
834Again, all methods are called without any locks being held, unless 841Again, all methods are called without any locks being held, unless