aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 21:05:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 21:05:23 -0500
commita27fcb0cd1bcc812017192bdde41cc456dcd6afe (patch)
tree95f3ac980e2a50d9132074fd07c0cd684bbbf124 /fs/xfs/xfs_rtalloc.c
parent7d91de74436a69c2b78a7a72f1e7f97f8b4396fa (diff)
parent8d242e932fb7660c24b3a534197e69c241067e0d (diff)
Merge tag 'xfs-4.11-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Darrick Wong: "Here are the XFS changes for 4.11. We aren't introducing any major features in this release cycle except for this being the first merge window I've managed on my own. :) Changes since last update: - Various cleanups - Livelock fixes for eofblocks scanning - Improved input verification for on-disk metadata - Fix races in the copy on write remap mechanism - Fix buffer io error timeout controls - Streamlining of directio copy on write - Asynchronous discard support - Fix asserts when splitting delalloc reservations - Don't bloat bmbt when right shifting extents - Inode alignment fixes for 32k block sizes" * tag 'xfs-4.11-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (39 commits) xfs: remove XFS_ALLOCTYPE_ANY_AG and XFS_ALLOCTYPE_START_AG xfs: simplify xfs_rtallocate_extent xfs: tune down agno asserts in the bmap code xfs: Use xfs_icluster_size_fsb() to calculate inode chunk alignment xfs: don't reserve blocks for right shift transactions xfs: fix len comparison in xfs_extent_busy_trim xfs: fix uninitialized variable in _reflink_convert_cow xfs: split indlen reservations fairly when under reserved xfs: handle indlen shortage on delalloc extent merge xfs: resurrect debug mode drop buffered writes mechanism xfs: clear delalloc and cache on buffered write failure xfs: don't block the log commit handler for discards xfs: improve busy extent sorting xfs: improve handling of busy extents in the low-level allocator xfs: don't fail xfs_extent_busy allocation xfs: correct null checks and error processing in xfs_initialize_perag xfs: update ctime and mtime on clone destinatation inodes xfs: allocate direct I/O COW blocks in iomap_begin xfs: go straight to real allocations for direct I/O COW writes xfs: return the converted extent in __xfs_reflink_convert_cow ...
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 802bcc326d9f..c57aa7f18087 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1093,7 +1093,6 @@ xfs_rtallocate_extent(
1093 xfs_extlen_t minlen, /* minimum length to allocate */ 1093 xfs_extlen_t minlen, /* minimum length to allocate */
1094 xfs_extlen_t maxlen, /* maximum length to allocate */ 1094 xfs_extlen_t maxlen, /* maximum length to allocate */
1095 xfs_extlen_t *len, /* out: actual length allocated */ 1095 xfs_extlen_t *len, /* out: actual length allocated */
1096 xfs_alloctype_t type, /* allocation type XFS_ALLOCTYPE... */
1097 int wasdel, /* was a delayed allocation extent */ 1096 int wasdel, /* was a delayed allocation extent */
1098 xfs_extlen_t prod, /* extent product factor */ 1097 xfs_extlen_t prod, /* extent product factor */
1099 xfs_rtblock_t *rtblock) /* out: start block allocated */ 1098 xfs_rtblock_t *rtblock) /* out: start block allocated */
@@ -1123,27 +1122,16 @@ xfs_rtallocate_extent(
1123 } 1122 }
1124 } 1123 }
1125 1124
1125retry:
1126 sumbp = NULL; 1126 sumbp = NULL;
1127 /* 1127 if (bno == 0) {
1128 * Allocate by size, or near another block, or exactly at some block.
1129 */
1130 switch (type) {
1131 case XFS_ALLOCTYPE_ANY_AG:
1132 error = xfs_rtallocate_extent_size(mp, tp, minlen, maxlen, len, 1128 error = xfs_rtallocate_extent_size(mp, tp, minlen, maxlen, len,
1133 &sumbp, &sb, prod, &r); 1129 &sumbp, &sb, prod, &r);
1134 break; 1130 } else {
1135 case XFS_ALLOCTYPE_NEAR_BNO:
1136 error = xfs_rtallocate_extent_near(mp, tp, bno, minlen, maxlen, 1131 error = xfs_rtallocate_extent_near(mp, tp, bno, minlen, maxlen,
1137 len, &sumbp, &sb, prod, &r); 1132 len, &sumbp, &sb, prod, &r);
1138 break;
1139 case XFS_ALLOCTYPE_THIS_BNO:
1140 error = xfs_rtallocate_extent_exact(mp, tp, bno, minlen, maxlen,
1141 len, &sumbp, &sb, prod, &r);
1142 break;
1143 default:
1144 error = -EIO;
1145 ASSERT(0);
1146 } 1133 }
1134
1147 if (error) 1135 if (error)
1148 return error; 1136 return error;
1149 1137
@@ -1158,7 +1146,11 @@ xfs_rtallocate_extent(
1158 xfs_trans_mod_sb(tp, XFS_TRANS_SB_RES_FREXTENTS, -slen); 1146 xfs_trans_mod_sb(tp, XFS_TRANS_SB_RES_FREXTENTS, -slen);
1159 else 1147 else
1160 xfs_trans_mod_sb(tp, XFS_TRANS_SB_FREXTENTS, -slen); 1148 xfs_trans_mod_sb(tp, XFS_TRANS_SB_FREXTENTS, -slen);
1149 } else if (prod > 1) {
1150 prod = 1;
1151 goto retry;
1161 } 1152 }
1153
1162 *rtblock = r; 1154 *rtblock = r;
1163 return 0; 1155 return 0;
1164} 1156}