diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-08-02 22:30:31 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-08-02 22:30:31 -0400 |
commit | 51ce9d000c0a80bddf9a93a4232283cc9a4564c0 (patch) | |
tree | 9986b59cc53e7bec56f5b14468204e22ba33ad13 /fs/xfs | |
parent | e127fafd1d3c46532903d530dfa69822d3d35d8a (diff) |
xfs: collapse single use static functions
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_trans_extfree.c | 88 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_rmap.c | 103 |
2 files changed, 63 insertions, 128 deletions
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c index 3aca3a7578c2..7d1e84c1b848 100644 --- a/fs/xfs/xfs_trans_extfree.c +++ b/fs/xfs/xfs_trans_extfree.c | |||
@@ -30,61 +30,6 @@ | |||
30 | #include "xfs_bmap.h" | 30 | #include "xfs_bmap.h" |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * This routine is called to allocate an "extent free intention" | ||
34 | * log item that will hold nextents worth of extents. The | ||
35 | * caller must use all nextents extents, because we are not | ||
36 | * flexible about this at all. | ||
37 | */ | ||
38 | STATIC struct xfs_efi_log_item * | ||
39 | xfs_trans_get_efi(struct xfs_trans *tp, | ||
40 | uint nextents) | ||
41 | { | ||
42 | struct xfs_efi_log_item *efip; | ||
43 | |||
44 | ASSERT(tp != NULL); | ||
45 | ASSERT(nextents > 0); | ||
46 | |||
47 | efip = xfs_efi_init(tp->t_mountp, nextents); | ||
48 | ASSERT(efip != NULL); | ||
49 | |||
50 | /* | ||
51 | * Get a log_item_desc to point at the new item. | ||
52 | */ | ||
53 | xfs_trans_add_item(tp, &efip->efi_item); | ||
54 | return efip; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * This routine is called to indicate that the described | ||
59 | * extent is to be logged as needing to be freed. It should | ||
60 | * be called once for each extent to be freed. | ||
61 | */ | ||
62 | STATIC void | ||
63 | xfs_trans_log_efi_extent(struct xfs_trans *tp, | ||
64 | struct xfs_efi_log_item *efip, | ||
65 | xfs_fsblock_t start_block, | ||
66 | xfs_extlen_t ext_len) | ||
67 | { | ||
68 | uint next_extent; | ||
69 | struct xfs_extent *extp; | ||
70 | |||
71 | tp->t_flags |= XFS_TRANS_DIRTY; | ||
72 | efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY; | ||
73 | |||
74 | /* | ||
75 | * atomic_inc_return gives us the value after the increment; | ||
76 | * we want to use it as an array index so we need to subtract 1 from | ||
77 | * it. | ||
78 | */ | ||
79 | next_extent = atomic_inc_return(&efip->efi_next_extent) - 1; | ||
80 | ASSERT(next_extent < efip->efi_format.efi_nextents); | ||
81 | extp = &(efip->efi_format.efi_extents[next_extent]); | ||
82 | extp->ext_start = start_block; | ||
83 | extp->ext_len = ext_len; | ||
84 | } | ||
85 | |||
86 | |||
87 | /* | ||
88 | * This routine is called to allocate an "extent free done" | 33 | * This routine is called to allocate an "extent free done" |
89 | * log item that will hold nextents worth of extents. The | 34 | * log item that will hold nextents worth of extents. The |
90 | * caller must use all nextents extents, because we are not | 35 | * caller must use all nextents extents, because we are not |
@@ -172,7 +117,19 @@ xfs_extent_free_create_intent( | |||
172 | struct xfs_trans *tp, | 117 | struct xfs_trans *tp, |
173 | unsigned int count) | 118 | unsigned int count) |
174 | { | 119 | { |
175 | return xfs_trans_get_efi(tp, count); | 120 | struct xfs_efi_log_item *efip; |
121 | |||
122 | ASSERT(tp != NULL); | ||
123 | ASSERT(count > 0); | ||
124 | |||
125 | efip = xfs_efi_init(tp->t_mountp, count); | ||
126 | ASSERT(efip != NULL); | ||
127 | |||
128 | /* | ||
129 | * Get a log_item_desc to point at the new item. | ||
130 | */ | ||
131 | xfs_trans_add_item(tp, &efip->efi_item); | ||
132 | return efip; | ||
176 | } | 133 | } |
177 | 134 | ||
178 | /* Log a free extent to the intent item. */ | 135 | /* Log a free extent to the intent item. */ |
@@ -182,11 +139,26 @@ xfs_extent_free_log_item( | |||
182 | void *intent, | 139 | void *intent, |
183 | struct list_head *item) | 140 | struct list_head *item) |
184 | { | 141 | { |
142 | struct xfs_efi_log_item *efip = intent; | ||
185 | struct xfs_extent_free_item *free; | 143 | struct xfs_extent_free_item *free; |
144 | uint next_extent; | ||
145 | struct xfs_extent *extp; | ||
186 | 146 | ||
187 | free = container_of(item, struct xfs_extent_free_item, xefi_list); | 147 | free = container_of(item, struct xfs_extent_free_item, xefi_list); |
188 | xfs_trans_log_efi_extent(tp, intent, free->xefi_startblock, | 148 | |
189 | free->xefi_blockcount); | 149 | tp->t_flags |= XFS_TRANS_DIRTY; |
150 | efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY; | ||
151 | |||
152 | /* | ||
153 | * atomic_inc_return gives us the value after the increment; | ||
154 | * we want to use it as an array index so we need to subtract 1 from | ||
155 | * it. | ||
156 | */ | ||
157 | next_extent = atomic_inc_return(&efip->efi_next_extent) - 1; | ||
158 | ASSERT(next_extent < efip->efi_format.efi_nextents); | ||
159 | extp = &efip->efi_format.efi_extents[next_extent]; | ||
160 | extp->ext_start = free->xefi_startblock; | ||
161 | extp->ext_len = free->xefi_blockcount; | ||
190 | } | 162 | } |
191 | 163 | ||
192 | /* Get an EFD so we can process all the free extents. */ | 164 | /* Get an EFD so we can process all the free extents. */ |
diff --git a/fs/xfs/xfs_trans_rmap.c b/fs/xfs/xfs_trans_rmap.c index 35650d6b2606..5a50ef881568 100644 --- a/fs/xfs/xfs_trans_rmap.c +++ b/fs/xfs/xfs_trans_rmap.c | |||
@@ -31,32 +31,6 @@ | |||
31 | #include "xfs_alloc.h" | 31 | #include "xfs_alloc.h" |
32 | #include "xfs_rmap.h" | 32 | #include "xfs_rmap.h" |
33 | 33 | ||
34 | /* | ||
35 | * This routine is called to allocate an "rmap update intent" | ||
36 | * log item that will hold nextents worth of extents. The | ||
37 | * caller must use all nextents extents, because we are not | ||
38 | * flexible about this at all. | ||
39 | */ | ||
40 | STATIC struct xfs_rui_log_item * | ||
41 | xfs_trans_get_rui( | ||
42 | struct xfs_trans *tp, | ||
43 | uint nextents) | ||
44 | { | ||
45 | struct xfs_rui_log_item *ruip; | ||
46 | |||
47 | ASSERT(tp != NULL); | ||
48 | ASSERT(nextents > 0); | ||
49 | |||
50 | ruip = xfs_rui_init(tp->t_mountp, nextents); | ||
51 | ASSERT(ruip != NULL); | ||
52 | |||
53 | /* | ||
54 | * Get a log_item_desc to point at the new item. | ||
55 | */ | ||
56 | xfs_trans_add_item(tp, &ruip->rui_item); | ||
57 | return ruip; | ||
58 | } | ||
59 | |||
60 | /* Set the map extent flags for this reverse mapping. */ | 34 | /* Set the map extent flags for this reverse mapping. */ |
61 | static void | 35 | static void |
62 | xfs_trans_set_rmap_flags( | 36 | xfs_trans_set_rmap_flags( |
@@ -91,44 +65,6 @@ xfs_trans_set_rmap_flags( | |||
91 | } | 65 | } |
92 | } | 66 | } |
93 | 67 | ||
94 | /* | ||
95 | * This routine is called to indicate that the described reverse | ||
96 | * mapping is to be logged as needing to be updated. It should be | ||
97 | * called once for each mapping. | ||
98 | */ | ||
99 | STATIC void | ||
100 | xfs_trans_log_start_rmap_update( | ||
101 | struct xfs_trans *tp, | ||
102 | struct xfs_rui_log_item *ruip, | ||
103 | enum xfs_rmap_intent_type type, | ||
104 | __uint64_t owner, | ||
105 | int whichfork, | ||
106 | xfs_fileoff_t startoff, | ||
107 | xfs_fsblock_t startblock, | ||
108 | xfs_filblks_t blockcount, | ||
109 | xfs_exntst_t state) | ||
110 | { | ||
111 | uint next_extent; | ||
112 | struct xfs_map_extent *rmap; | ||
113 | |||
114 | tp->t_flags |= XFS_TRANS_DIRTY; | ||
115 | ruip->rui_item.li_desc->lid_flags |= XFS_LID_DIRTY; | ||
116 | |||
117 | /* | ||
118 | * atomic_inc_return gives us the value after the increment; | ||
119 | * we want to use it as an array index so we need to subtract 1 from | ||
120 | * it. | ||
121 | */ | ||
122 | next_extent = atomic_inc_return(&ruip->rui_next_extent) - 1; | ||
123 | ASSERT(next_extent < ruip->rui_format.rui_nextents); | ||
124 | rmap = &(ruip->rui_format.rui_extents[next_extent]); | ||
125 | rmap->me_owner = owner; | ||
126 | rmap->me_startblock = startblock; | ||
127 | rmap->me_startoff = startoff; | ||
128 | rmap->me_len = blockcount; | ||
129 | xfs_trans_set_rmap_flags(rmap, type, whichfork, state); | ||
130 | } | ||
131 | |||
132 | struct xfs_rud_log_item * | 68 | struct xfs_rud_log_item * |
133 | xfs_trans_get_rud( | 69 | xfs_trans_get_rud( |
134 | struct xfs_trans *tp, | 70 | struct xfs_trans *tp, |
@@ -200,7 +136,19 @@ xfs_rmap_update_create_intent( | |||
200 | struct xfs_trans *tp, | 136 | struct xfs_trans *tp, |
201 | unsigned int count) | 137 | unsigned int count) |
202 | { | 138 | { |
203 | return xfs_trans_get_rui(tp, count); | 139 | struct xfs_rui_log_item *ruip; |
140 | |||
141 | ASSERT(tp != NULL); | ||
142 | ASSERT(count > 0); | ||
143 | |||
144 | ruip = xfs_rui_init(tp->t_mountp, count); | ||
145 | ASSERT(ruip != NULL); | ||
146 | |||
147 | /* | ||
148 | * Get a log_item_desc to point at the new item. | ||
149 | */ | ||
150 | xfs_trans_add_item(tp, &ruip->rui_item); | ||
151 | return ruip; | ||
204 | } | 152 | } |
205 | 153 | ||
206 | /* Log rmap updates in the intent item. */ | 154 | /* Log rmap updates in the intent item. */ |
@@ -210,14 +158,29 @@ xfs_rmap_update_log_item( | |||
210 | void *intent, | 158 | void *intent, |
211 | struct list_head *item) | 159 | struct list_head *item) |
212 | { | 160 | { |
161 | struct xfs_rui_log_item *ruip = intent; | ||
213 | struct xfs_rmap_intent *rmap; | 162 | struct xfs_rmap_intent *rmap; |
163 | uint next_extent; | ||
164 | struct xfs_map_extent *map; | ||
214 | 165 | ||
215 | rmap = container_of(item, struct xfs_rmap_intent, ri_list); | 166 | rmap = container_of(item, struct xfs_rmap_intent, ri_list); |
216 | xfs_trans_log_start_rmap_update(tp, intent, rmap->ri_type, | 167 | |
217 | rmap->ri_owner, rmap->ri_whichfork, | 168 | tp->t_flags |= XFS_TRANS_DIRTY; |
218 | rmap->ri_bmap.br_startoff, | 169 | ruip->rui_item.li_desc->lid_flags |= XFS_LID_DIRTY; |
219 | rmap->ri_bmap.br_startblock, | 170 | |
220 | rmap->ri_bmap.br_blockcount, | 171 | /* |
172 | * atomic_inc_return gives us the value after the increment; | ||
173 | * we want to use it as an array index so we need to subtract 1 from | ||
174 | * it. | ||
175 | */ | ||
176 | next_extent = atomic_inc_return(&ruip->rui_next_extent) - 1; | ||
177 | ASSERT(next_extent < ruip->rui_format.rui_nextents); | ||
178 | map = &ruip->rui_format.rui_extents[next_extent]; | ||
179 | map->me_owner = rmap->ri_owner; | ||
180 | map->me_startblock = rmap->ri_bmap.br_startblock; | ||
181 | map->me_startoff = rmap->ri_bmap.br_startoff; | ||
182 | map->me_len = rmap->ri_bmap.br_blockcount; | ||
183 | xfs_trans_set_rmap_flags(map, rmap->ri_type, rmap->ri_whichfork, | ||
221 | rmap->ri_bmap.br_state); | 184 | rmap->ri_bmap.br_state); |
222 | } | 185 | } |
223 | 186 | ||