]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - Documentation/filesystems/aufs/design/10dynop.txt
UBUNTU: ubuntu: vbox -- update to 5.2.6-dfsg-5
[mirror_ubuntu-bionic-kernel.git] / Documentation / filesystems / aufs / design / 10dynop.txt
CommitLineData
0006ebb4
SF
1
2# Copyright (C) 2010-2017 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
17Dynamically customizable FS operations
18----------------------------------------------------------------------
19Generally FS operations (struct inode_operations, struct
20address_space_operations, struct file_operations, etc.) are defined as
21"static const", but it never means that FS have only one set of
22operation. Some FS have multiple sets of them. For instance, ext2 has
23three sets, one for XIP, for NOBH, and for normal.
24Since aufs overrides and redirects these operations, sometimes aufs has
25to change its behaviour according to the branch FS type. More importantly
26VFS acts differently if a function (member in the struct) is set or
27not. It means aufs should have several sets of operations and select one
28among them according to the branch FS definition.
29
30In order to solve this problem and not to affect the behaviour of VFS,
31aufs defines these operations dynamically. For instance, aufs defines
32dummy direct_IO function for struct address_space_operations, but it may
33not be set to the address_space_operations actually. When the branch FS
34doesn't have it, aufs doesn't set it to its address_space_operations
35while the function definition itself is still alive. So the behaviour
36itself will not change, and it will return an error when direct_IO is
37not set.
38
39The lifetime of these dynamically generated operation object is
40maintained by aufs branch object. When the branch is removed from aufs,
41the reference counter of the object is decremented. When it reaches
42zero, the dynamically generated operation object will be freed.
43
44This approach is designed to support AIO (io_submit), Direct I/O and
45XIP (DAX) mainly.
46Currently this approach is applied to address_space_operations for
47regular files only.