@@ -4176,43 +4176,6 @@ xfs_bmapi_reserve_delalloc(
4176
4176
return error ;
4177
4177
}
4178
4178
4179
- static int
4180
- xfs_bmap_alloc_userdata (
4181
- struct xfs_bmalloca * bma )
4182
- {
4183
- struct xfs_mount * mp = bma -> ip -> i_mount ;
4184
- int whichfork = xfs_bmapi_whichfork (bma -> flags );
4185
- int error ;
4186
-
4187
- /*
4188
- * Set the data type being allocated. For the data fork, the first data
4189
- * in the file is treated differently to all other allocations. For the
4190
- * attribute fork, we only need to ensure the allocated range is not on
4191
- * the busy list.
4192
- */
4193
- bma -> datatype = XFS_ALLOC_NOBUSY ;
4194
- if (whichfork == XFS_DATA_FORK || whichfork == XFS_COW_FORK ) {
4195
- bma -> datatype |= XFS_ALLOC_USERDATA ;
4196
- if (bma -> offset == 0 )
4197
- bma -> datatype |= XFS_ALLOC_INITIAL_USER_DATA ;
4198
-
4199
- if (mp -> m_dalign && bma -> length >= mp -> m_dalign ) {
4200
- error = xfs_bmap_isaeof (bma , whichfork );
4201
- if (error )
4202
- return error ;
4203
- }
4204
-
4205
- if (XFS_IS_REALTIME_INODE (bma -> ip ))
4206
- return xfs_bmap_rtalloc (bma );
4207
- }
4208
-
4209
- if (unlikely (XFS_TEST_ERROR (false, mp ,
4210
- XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT )))
4211
- return xfs_bmap_exact_minlen_extent_alloc (bma );
4212
-
4213
- return xfs_bmap_btalloc (bma );
4214
- }
4215
-
4216
4179
static int
4217
4180
xfs_bmapi_allocate (
4218
4181
struct xfs_bmalloca * bma )
@@ -4230,15 +4193,35 @@ xfs_bmapi_allocate(
4230
4193
else
4231
4194
bma -> minlen = 1 ;
4232
4195
4233
- if (bma -> flags & XFS_BMAPI_METADATA ) {
4234
- if (unlikely (XFS_TEST_ERROR (false, mp ,
4235
- XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT )))
4236
- error = xfs_bmap_exact_minlen_extent_alloc (bma );
4237
- else
4238
- error = xfs_bmap_btalloc (bma );
4239
- } else {
4240
- error = xfs_bmap_alloc_userdata (bma );
4196
+ if (!(bma -> flags & XFS_BMAPI_METADATA )) {
4197
+ /*
4198
+ * For the data and COW fork, the first data in the file is
4199
+ * treated differently to all other allocations. For the
4200
+ * attribute fork, we only need to ensure the allocated range
4201
+ * is not on the busy list.
4202
+ */
4203
+ bma -> datatype = XFS_ALLOC_NOBUSY ;
4204
+ if (whichfork == XFS_DATA_FORK || whichfork == XFS_COW_FORK ) {
4205
+ bma -> datatype |= XFS_ALLOC_USERDATA ;
4206
+ if (bma -> offset == 0 )
4207
+ bma -> datatype |= XFS_ALLOC_INITIAL_USER_DATA ;
4208
+
4209
+ if (mp -> m_dalign && bma -> length >= mp -> m_dalign ) {
4210
+ error = xfs_bmap_isaeof (bma , whichfork );
4211
+ if (error )
4212
+ return error ;
4213
+ }
4214
+ }
4241
4215
}
4216
+
4217
+ if ((bma -> datatype & XFS_ALLOC_USERDATA ) &&
4218
+ XFS_IS_REALTIME_INODE (bma -> ip ))
4219
+ error = xfs_bmap_rtalloc (bma );
4220
+ else if (unlikely (XFS_TEST_ERROR (false, mp ,
4221
+ XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT )))
4222
+ error = xfs_bmap_exact_minlen_extent_alloc (bma );
4223
+ else
4224
+ error = xfs_bmap_btalloc (bma );
4242
4225
if (error )
4243
4226
return error ;
4244
4227
if (bma -> blkno == NULLFSBLOCK )
0 commit comments