diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2018-06-22 21:20:35 +0200 | 
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2018-06-22 21:20:35 +0200 | 
| commit | 7731b8bc94e599c9a79e428f3359ff2c34b7576a (patch) | |
| tree | 879f18ccbe274122f2d4f095b43cbc7f953e0ada /fs/xfs/xfs_bmap_util.c | |
| parent | 48e315618dc4dc8904182cd221e3d395d5d97005 (diff) | |
| parent | 9ffc59d57228d74809700be6f7ecb1db10292f05 (diff) | |
Merge branch 'linus' into x86/urgent
Required to queue a dependent fix.
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
| -rw-r--r-- | fs/xfs/xfs_bmap_util.c | 36 | 
1 files changed, 14 insertions, 22 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 8cd8c412f52d..c35009a86699 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1,20 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright (c) 2000-2006 Silicon Graphics, Inc.   * Copyright (c) 2012 Red Hat, Inc.   * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA   */  #include "xfs.h"  #include "xfs_fs.h" @@ -92,6 +80,7 @@ xfs_bmap_rtalloc(  	int		error;		/* error return value */  	xfs_mount_t	*mp;		/* mount point structure */  	xfs_extlen_t	prod = 0;	/* product factor for allocators */ +	xfs_extlen_t	mod = 0;	/* product factor for allocators */  	xfs_extlen_t	ralen = 0;	/* realtime allocation length */  	xfs_extlen_t	align;		/* minimum allocation alignment */  	xfs_rtblock_t	rtb; @@ -111,7 +100,8 @@ xfs_bmap_rtalloc(  	 * If the offset & length are not perfectly aligned  	 * then kill prod, it will just get us in trouble.  	 */ -	if (do_mod(ap->offset, align) || ap->length % align) +	div_u64_rem(ap->offset, align, &mod); +	if (mod || ap->length % align)  		prod = 1;  	/*  	 * Set ralen to be the actual requested length in rtextents. @@ -848,7 +838,7 @@ xfs_free_eofblocks(  		/*  		 * Attach the dquots to the inode up front.  		 */ -		error = xfs_qm_dqattach(ip, 0); +		error = xfs_qm_dqattach(ip);  		if (error)  			return error; @@ -871,8 +861,8 @@ xfs_free_eofblocks(  		 * contents of the file are flushed to disk then the files  		 * may be full of holes (ie NULL files bug).  		 */ -		error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, -					      XFS_ISIZE(ip)); +		error = xfs_itruncate_extents_flags(&tp, ip, XFS_DATA_FORK, +					XFS_ISIZE(ip), XFS_BMAPI_NODISCARD);  		if (error) {  			/*  			 * If we get an error at this point we simply don't @@ -918,7 +908,7 @@ xfs_alloc_file_space(  	if (XFS_FORCED_SHUTDOWN(mp))  		return -EIO; -	error = xfs_qm_dqattach(ip, 0); +	error = xfs_qm_dqattach(ip);  	if (error)  		return error; @@ -948,9 +938,11 @@ xfs_alloc_file_space(  			do_div(s, extsz);  			s *= extsz;  			e = startoffset_fsb + allocatesize_fsb; -			if ((temp = do_mod(startoffset_fsb, extsz))) +			div_u64_rem(startoffset_fsb, extsz, &temp); +			if (temp)  				e += temp; -			if ((temp = do_mod(e, extsz))) +			div_u64_rem(e, extsz, &temp); +			if (temp)  				e += extsz - temp;  		} else {  			s = 0; @@ -1111,7 +1103,7 @@ xfs_adjust_extent_unmap_boundaries(  	if (nimap && imap.br_startblock != HOLESTARTBLOCK) {  		ASSERT(imap.br_startblock != DELAYSTARTBLOCK); -		mod = do_mod(imap.br_startblock, mp->m_sb.sb_rextsize); +		div_u64_rem(imap.br_startblock, mp->m_sb.sb_rextsize, &mod);  		if (mod)  			*startoffset_fsb += mp->m_sb.sb_rextsize - mod;  	} @@ -1169,7 +1161,7 @@ xfs_free_file_space(  	trace_xfs_free_file_space(ip); -	error = xfs_qm_dqattach(ip, 0); +	error = xfs_qm_dqattach(ip);  	if (error)  		return error;  | 
