diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-06 09:50:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-06 09:50:36 -0400 |
commit | 0cbbc422d56668528f6efd1234fe908010284082 (patch) | |
tree | d4bebf90c29044b4a6180053fc18f9e927361012 /fs/xfs/libxfs/xfs_defer.h | |
parent | 835c92d43b29eb354abdbd5475308a474d7efdfa (diff) | |
parent | 3481b68285238054be519ad0c8cad5cc2425e26c (diff) |
Merge tag 'xfs-rmap-for-linus-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs
Pull more xfs updates from Dave Chinner:
"This is the second part of the XFS updates for this merge cycle, and
contains the new reverse block mapping feature for XFS.
Reverse mapping allows us to track the owner of a specific block on
disk precisely. It is implemented as a set of btrees (one per
allocation group) that track the owners of allocated extents.
Effectively it is a "used space tree" that is updated when we allocate
or free extents. i.e. it is coherent with the free space btrees we
already maintain and never overlaps with them.
This reverse mapping infrastructure is the building block of several
upcoming features - reflink, copy-on-write data, dedupe, online
metadata and data scrubbing, highly accurate bad sector/data loss
reporting to users, and significantly improved reconstruction of
damaged and corrupted filesystems. There's a lot of new stuff coming
along in the next couple of cycles,a nd it all builds in the rmap
infrastructure.
As such, it's a huge chunk of new code with new on-disk format
features and internal infrastructure. It warns at mount time as an
experimental feature and that it may eat data (as we do with all new
on-disk features until they stabilise). We have not released
userspace suport for it yet - userspace support currently requires
download from Darrick's xfsprogs repo and build from source, so the
access to this feature is really developer/tester only at this point.
Initial userspace support will be released at the same time kernel
with this code in it is released.
The new rmap enabled code regresses 3 xfstests - all are ENOSPC
related corner cases, one of which Darrick posted a fix for a few
hours ago. The other two are fixed by infrastructure that is part of
the upcoming reflink patchset. This new ENOSPC infrastructure
requires a on-disk format tweak required to keep mount times in
check - we need to keep an on-disk count of allocated rmapbt blocks so
we don't have to scan the entire btrees at mount time to count them.
This is currently being tested and will be part of the fixes sent in
the next week or two so users will not be exposed to this change"
* tag 'xfs-rmap-for-linus-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs: (52 commits)
xfs: move (and rename) the deferred bmap-free tracepoints
xfs: collapse single use static functions
xfs: remove unnecessary parentheses from log redo item recovery functions
xfs: remove the extents array from the rmap update done log item
xfs: in btree_lshift, only allocate temporary cursor when needed
xfs: remove unnecesary lshift/rshift key initialization
xfs: remove the get*keys and update_keys btree ops pointers
xfs: enable the rmap btree functionality
xfs: don't update rmapbt when fixing agfl
xfs: disable XFS_IOC_SWAPEXT when rmap btree is enabled
xfs: add rmap btree block detection to log recovery
xfs: add rmap btree geometry feature flag
xfs: propagate bmap updates to rmapbt
xfs: enable the xfs_defer mechanism to process rmaps to update
xfs: log rmap intent items
xfs: create rmap update intent log items
xfs: add rmap btree insert and delete helpers
xfs: convert unwritten status of reverse mappings
xfs: remove an extent from the rmap btree
xfs: add an extent to the rmap btree
...
Diffstat (limited to 'fs/xfs/libxfs/xfs_defer.h')
-rw-r--r-- | fs/xfs/libxfs/xfs_defer.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h new file mode 100644 index 000000000000..cc3981c48296 --- /dev/null +++ b/fs/xfs/libxfs/xfs_defer.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Oracle. All Rights Reserved. | ||
3 | * | ||
4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version 2 | ||
9 | * of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it would be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write the Free Software Foundation, | ||
18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | #ifndef __XFS_DEFER_H__ | ||
21 | #define __XFS_DEFER_H__ | ||
22 | |||
23 | struct xfs_defer_op_type; | ||
24 | |||
25 | /* | ||
26 | * Save a log intent item and a list of extents, so that we can replay | ||
27 | * whatever action had to happen to the extent list and file the log done | ||
28 | * item. | ||
29 | */ | ||
30 | struct xfs_defer_pending { | ||
31 | const struct xfs_defer_op_type *dfp_type; /* function pointers */ | ||
32 | struct list_head dfp_list; /* pending items */ | ||
33 | bool dfp_committed; /* committed trans? */ | ||
34 | void *dfp_intent; /* log intent item */ | ||
35 | struct list_head dfp_work; /* work items */ | ||
36 | unsigned int dfp_count; /* # extent items */ | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Header for deferred operation list. | ||
41 | * | ||
42 | * dop_low is used by the allocator to activate the lowspace algorithm - | ||
43 | * when free space is running low the extent allocator may choose to | ||
44 | * allocate an extent from an AG without leaving sufficient space for | ||
45 | * a btree split when inserting the new extent. In this case the allocator | ||
46 | * will enable the lowspace algorithm which is supposed to allow further | ||
47 | * allocations (such as btree splits and newroots) to allocate from | ||
48 | * sequential AGs. In order to avoid locking AGs out of order the lowspace | ||
49 | * algorithm will start searching for free space from AG 0. If the correct | ||
50 | * transaction reservations have been made then this algorithm will eventually | ||
51 | * find all the space it needs. | ||
52 | */ | ||
53 | enum xfs_defer_ops_type { | ||
54 | XFS_DEFER_OPS_TYPE_RMAP, | ||
55 | XFS_DEFER_OPS_TYPE_FREE, | ||
56 | XFS_DEFER_OPS_TYPE_MAX, | ||
57 | }; | ||
58 | |||
59 | #define XFS_DEFER_OPS_NR_INODES 2 /* join up to two inodes */ | ||
60 | |||
61 | struct xfs_defer_ops { | ||
62 | bool dop_committed; /* did any trans commit? */ | ||
63 | bool dop_low; /* alloc in low mode */ | ||
64 | struct list_head dop_intake; /* unlogged pending work */ | ||
65 | struct list_head dop_pending; /* logged pending work */ | ||
66 | |||
67 | /* relog these inodes with each roll */ | ||
68 | struct xfs_inode *dop_inodes[XFS_DEFER_OPS_NR_INODES]; | ||
69 | }; | ||
70 | |||
71 | void xfs_defer_add(struct xfs_defer_ops *dop, enum xfs_defer_ops_type type, | ||
72 | struct list_head *h); | ||
73 | int xfs_defer_finish(struct xfs_trans **tp, struct xfs_defer_ops *dop, | ||
74 | struct xfs_inode *ip); | ||
75 | void xfs_defer_cancel(struct xfs_defer_ops *dop); | ||
76 | void xfs_defer_init(struct xfs_defer_ops *dop, xfs_fsblock_t *fbp); | ||
77 | bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop); | ||
78 | int xfs_defer_join(struct xfs_defer_ops *dop, struct xfs_inode *ip); | ||
79 | |||
80 | /* Description of a deferred type. */ | ||
81 | struct xfs_defer_op_type { | ||
82 | enum xfs_defer_ops_type type; | ||
83 | unsigned int max_items; | ||
84 | void (*abort_intent)(void *); | ||
85 | void *(*create_done)(struct xfs_trans *, void *, unsigned int); | ||
86 | int (*finish_item)(struct xfs_trans *, struct xfs_defer_ops *, | ||
87 | struct list_head *, void *, void **); | ||
88 | void (*finish_cleanup)(struct xfs_trans *, void *, int); | ||
89 | void (*cancel_item)(struct list_head *); | ||
90 | int (*diff_items)(void *, struct list_head *, struct list_head *); | ||
91 | void *(*create_intent)(struct xfs_trans *, uint); | ||
92 | void (*log_item)(struct xfs_trans *, void *, struct list_head *); | ||
93 | }; | ||
94 | |||
95 | void xfs_defer_init_op_type(const struct xfs_defer_op_type *type); | ||
96 | |||
97 | #endif /* __XFS_DEFER_H__ */ | ||