]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - Documentation/filesystems/aufs/design/10dynop.txt
4ab46ffc271c09e39ab8a892f708609047c9c700
[mirror_ubuntu-zesty-kernel.git] / Documentation / filesystems / aufs / design / 10dynop.txt
1
2 # Copyright (C) 2010-2016 Junjiro R. Okajima
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 Dynamically customizable FS operations
18 ----------------------------------------------------------------------
19 Generally FS operations (struct inode_operations, struct
20 address_space_operations, struct file_operations, etc.) are defined as
21 "static const", but it never means that FS have only one set of
22 operation. Some FS have multiple sets of them. For instance, ext2 has
23 three sets, one for XIP, for NOBH, and for normal.
24 Since aufs overrides and redirects these operations, sometimes aufs has
25 to change its behaviour according to the branch FS type. More importantly
26 VFS acts differently if a function (member in the struct) is set or
27 not. It means aufs should have several sets of operations and select one
28 among them according to the branch FS definition.
29
30 In order to solve this problem and not to affect the behaviour of VFS,
31 aufs defines these operations dynamically. For instance, aufs defines
32 dummy direct_IO function for struct address_space_operations, but it may
33 not be set to the address_space_operations actually. When the branch FS
34 doesn't have it, aufs doesn't set it to its address_space_operations
35 while the function definition itself is still alive. So the behaviour
36 itself will not change, and it will return an error when direct_IO is
37 not set.
38
39 The lifetime of these dynamically generated operation object is
40 maintained by aufs branch object. When the branch is removed from aufs,
41 the reference counter of the object is decremented. When it reaches
42 zero, the dynamically generated operation object will be freed.
43
44 This approach is designed to support AIO (io_submit), Direct I/O and
45 XIP (DAX) mainly.
46 Currently this approach is applied to address_space_operations for
47 regular files only.