mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	xfs: bmap code cleanup
Remove the extent size hint and realtime inode relevant code from the xfs_bmapi_reserve_delalloc since it is not called on the inode with extent size hint set or on a realtime inode. Signed-off-by: Shan Hai <shan.hai@oracle.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
		
							parent
							
								
									643c8c05e7
								
							
						
					
					
						commit
						6ca30729c2
					
				
					 1 changed files with 8 additions and 24 deletions
				
			
		| 
						 | 
					@ -3876,8 +3876,6 @@ xfs_bmapi_reserve_delalloc(
 | 
				
			||||||
	struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
 | 
						struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
 | 
				
			||||||
	xfs_extlen_t		alen;
 | 
						xfs_extlen_t		alen;
 | 
				
			||||||
	xfs_extlen_t		indlen;
 | 
						xfs_extlen_t		indlen;
 | 
				
			||||||
	char			rt = XFS_IS_REALTIME_INODE(ip);
 | 
					 | 
				
			||||||
	xfs_extlen_t		extsz;
 | 
					 | 
				
			||||||
	int			error;
 | 
						int			error;
 | 
				
			||||||
	xfs_fileoff_t		aoff = off;
 | 
						xfs_fileoff_t		aoff = off;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3892,31 +3890,25 @@ xfs_bmapi_reserve_delalloc(
 | 
				
			||||||
		prealloc = alen - len;
 | 
							prealloc = alen - len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Figure out the extent size, adjust alen */
 | 
						/* Figure out the extent size, adjust alen */
 | 
				
			||||||
	if (whichfork == XFS_COW_FORK)
 | 
						if (whichfork == XFS_COW_FORK) {
 | 
				
			||||||
		extsz = xfs_get_cowextsz_hint(ip);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		extsz = xfs_get_extsz_hint(ip);
 | 
					 | 
				
			||||||
	if (extsz) {
 | 
					 | 
				
			||||||
		struct xfs_bmbt_irec	prev;
 | 
							struct xfs_bmbt_irec	prev;
 | 
				
			||||||
 | 
							xfs_extlen_t		extsz = xfs_get_cowextsz_hint(ip);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!xfs_iext_peek_prev_extent(ifp, icur, &prev))
 | 
							if (!xfs_iext_peek_prev_extent(ifp, icur, &prev))
 | 
				
			||||||
			prev.br_startoff = NULLFILEOFF;
 | 
								prev.br_startoff = NULLFILEOFF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		error = xfs_bmap_extsize_align(mp, got, &prev, extsz, rt, eof,
 | 
							error = xfs_bmap_extsize_align(mp, got, &prev, extsz, 0, eof,
 | 
				
			||||||
					       1, 0, &aoff, &alen);
 | 
										       1, 0, &aoff, &alen);
 | 
				
			||||||
		ASSERT(!error);
 | 
							ASSERT(!error);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (rt)
 | 
					 | 
				
			||||||
		extsz = alen / mp->m_sb.sb_rextsize;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Make a transaction-less quota reservation for delayed allocation
 | 
						 * Make a transaction-less quota reservation for delayed allocation
 | 
				
			||||||
	 * blocks.  This number gets adjusted later.  We return if we haven't
 | 
						 * blocks.  This number gets adjusted later.  We return if we haven't
 | 
				
			||||||
	 * allocated blocks already inside this loop.
 | 
						 * allocated blocks already inside this loop.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	error = xfs_trans_reserve_quota_nblks(NULL, ip, (long)alen, 0,
 | 
						error = xfs_trans_reserve_quota_nblks(NULL, ip, (long)alen, 0,
 | 
				
			||||||
			rt ? XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);
 | 
											XFS_QMOPT_RES_REGBLKS);
 | 
				
			||||||
	if (error)
 | 
						if (error)
 | 
				
			||||||
		return error;
 | 
							return error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3927,12 +3919,7 @@ xfs_bmapi_reserve_delalloc(
 | 
				
			||||||
	indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen);
 | 
						indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen);
 | 
				
			||||||
	ASSERT(indlen > 0);
 | 
						ASSERT(indlen > 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (rt) {
 | 
						error = xfs_mod_fdblocks(mp, -((int64_t)alen), false);
 | 
				
			||||||
		error = xfs_mod_frextents(mp, -((int64_t)extsz));
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		error = xfs_mod_fdblocks(mp, -((int64_t)alen), false);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (error)
 | 
						if (error)
 | 
				
			||||||
		goto out_unreserve_quota;
 | 
							goto out_unreserve_quota;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3963,14 +3950,11 @@ xfs_bmapi_reserve_delalloc(
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out_unreserve_blocks:
 | 
					out_unreserve_blocks:
 | 
				
			||||||
	if (rt)
 | 
						xfs_mod_fdblocks(mp, alen, false);
 | 
				
			||||||
		xfs_mod_frextents(mp, extsz);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		xfs_mod_fdblocks(mp, alen, false);
 | 
					 | 
				
			||||||
out_unreserve_quota:
 | 
					out_unreserve_quota:
 | 
				
			||||||
	if (XFS_IS_QUOTA_ON(mp))
 | 
						if (XFS_IS_QUOTA_ON(mp))
 | 
				
			||||||
		xfs_trans_unreserve_quota_nblks(NULL, ip, (long)alen, 0, rt ?
 | 
							xfs_trans_unreserve_quota_nblks(NULL, ip, (long)alen, 0,
 | 
				
			||||||
				XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);
 | 
											XFS_QMOPT_RES_REGBLKS);
 | 
				
			||||||
	return error;
 | 
						return error;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue