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