@@ -158,9 +158,10 @@ xfs_ialloc_ag_alloc(
158
158
*/
159
159
agi = XFS_BUF_TO_AGI (agbp );
160
160
newino = be32_to_cpu (agi -> agi_newino );
161
- if (likely (newino != NULLAGINO )) {
162
- args .agbno = XFS_AGINO_TO_AGBNO (args .mp , newino ) +
163
- XFS_IALLOC_BLOCKS (args .mp );
161
+ args .agbno = XFS_AGINO_TO_AGBNO (args .mp , newino ) +
162
+ XFS_IALLOC_BLOCKS (args .mp );
163
+ if (likely (newino != NULLAGINO &&
164
+ (args .agbno < be32_to_cpu (agi -> agi_length )))) {
164
165
args .fsbno = XFS_AGB_TO_FSB (args .mp ,
165
166
be32_to_cpu (agi -> agi_seqno ), args .agbno );
166
167
args .type = XFS_ALLOCTYPE_THIS_BNO ;
@@ -182,8 +183,8 @@ xfs_ialloc_ag_alloc(
182
183
* Set the alignment for the allocation.
183
184
* If stripe alignment is turned on then align at stripe unit
184
185
* boundary.
185
- * If the cluster size is smaller than a filesystem block
186
- * then we're doing I/O for inodes in filesystem block size
186
+ * If the cluster size is smaller than a filesystem block
187
+ * then we're doing I/O for inodes in filesystem block size
187
188
* pieces, so don't need alignment anyway.
188
189
*/
189
190
isaligned = 0 ;
@@ -192,7 +193,7 @@ xfs_ialloc_ag_alloc(
192
193
args .alignment = args .mp -> m_dalign ;
193
194
isaligned = 1 ;
194
195
} else if (XFS_SB_VERSION_HASALIGN (& args .mp -> m_sb ) &&
195
- args .mp -> m_sb .sb_inoalignmt >=
196
+ args .mp -> m_sb .sb_inoalignmt >=
196
197
XFS_B_TO_FSBT (args .mp ,
197
198
XFS_INODE_CLUSTER_SIZE (args .mp )))
198
199
args .alignment = args .mp -> m_sb .sb_inoalignmt ;
@@ -220,7 +221,7 @@ xfs_ialloc_ag_alloc(
220
221
if ((error = xfs_alloc_vextent (& args )))
221
222
return error ;
222
223
}
223
-
224
+
224
225
/*
225
226
* If stripe alignment is turned on, then try again with cluster
226
227
* alignment.
0 commit comments