diff options
| author | Takashi Iwai <tiwai@suse.de> | 2015-11-27 13:40:20 +0100 | 
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2015-11-27 13:40:20 +0100 | 
| commit | 06a691e64b11323a735db3c3bd909d3c0712698f (patch) | |
| tree | e60b5a230fc2ea6e0f514d878d322a1f8e101c57 /fs/xfs/libxfs/xfs_bmap.c | |
| parent | 0c25ad80408e95e0a4fbaf0056950206e95f726f (diff) | |
| parent | 923f1cbf2e45f6292a01de959031a8efeabede78 (diff) | |
Merge tag 'asoc-fix-v4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.4
Quite a large batch of fixes have come in since the merge window, mainly
driver specific ones but there's a couple of core ones:
 - A fix for DAPM resume on active streams to ensure everything ends up
   cleanly in the right state.
 - Reset the DAPM cache when freeing widgets to fix a crash on driver
   remove and reload.
The PM functions for nau8825 are new code which fix crashes on resume.
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
| -rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 65 | 
1 files changed, 49 insertions, 16 deletions
| diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 8e2010d53b07..119c2422aac7 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -948,14 +948,16 @@ xfs_bmap_local_to_extents(  	bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0);  	/* -	 * Initialise the block and copy the data +	 * Initialize the block, copy the data and log the remote buffer.  	 * -	 * Note: init_fn must set the buffer log item type correctly! +	 * The callout is responsible for logging because the remote format +	 * might differ from the local format and thus we don't know how much to +	 * log here. Note that init_fn must also set the buffer log item type +	 * correctly.  	 */  	init_fn(tp, bp, ip, ifp); -	/* account for the change in fork size and log everything */ -	xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); +	/* account for the change in fork size */  	xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);  	xfs_bmap_local_to_extents_empty(ip, whichfork);  	flags |= XFS_ILOG_CORE; @@ -1435,7 +1437,7 @@ xfs_bmap_search_extents(  	xfs_ifork_t	*ifp;		/* inode fork pointer */  	xfs_bmbt_rec_host_t  *ep;            /* extent record pointer */ -	XFS_STATS_INC(xs_look_exlist); +	XFS_STATS_INC(ip->i_mount, xs_look_exlist);  	ifp = XFS_IFORK_PTR(ip, fork);  	ep = xfs_bmap_search_multi_extents(ifp, bno, eofp, lastxp, gotp, prevp); @@ -1732,7 +1734,7 @@ xfs_bmap_add_extent_delay_real(  	ASSERT(!bma->cur ||  	       (bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); -	XFS_STATS_INC(xs_add_exlist); +	XFS_STATS_INC(mp, xs_add_exlist);  #define	LEFT		r[0]  #define	RIGHT		r[1] @@ -2286,7 +2288,7 @@ xfs_bmap_add_extent_unwritten_real(  	ASSERT(*idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec));  	ASSERT(!isnullstartblock(new->br_startblock)); -	XFS_STATS_INC(xs_add_exlist); +	XFS_STATS_INC(mp, xs_add_exlist);  #define	LEFT		r[0]  #define	RIGHT		r[1] @@ -2946,7 +2948,7 @@ xfs_bmap_add_extent_hole_real(  	ASSERT(!bma->cur ||  	       !(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); -	XFS_STATS_INC(xs_add_exlist); +	XFS_STATS_INC(mp, xs_add_exlist);  	state = 0;  	if (whichfork == XFS_ATTR_FORK) @@ -3800,8 +3802,13 @@ xfs_bmap_btalloc(  	args.wasdel = ap->wasdel;  	args.isfl = 0;  	args.userdata = ap->userdata; -	if ((error = xfs_alloc_vextent(&args))) +	if (ap->userdata & XFS_ALLOC_USERDATA_ZERO) +		args.ip = ap->ip; + +	error = xfs_alloc_vextent(&args); +	if (error)  		return error; +  	if (tryagain && args.fsbno == NULLFSBLOCK) {  		/*  		 * Exact allocation failed. Now try with alignment @@ -4036,7 +4043,7 @@ xfs_bmapi_read(  	if (XFS_FORCED_SHUTDOWN(mp))  		return -EIO; -	XFS_STATS_INC(xs_blk_mapr); +	XFS_STATS_INC(mp, xs_blk_mapr);  	ifp = XFS_IFORK_PTR(ip, whichfork); @@ -4221,7 +4228,7 @@ xfs_bmapi_delay(  	if (XFS_FORCED_SHUTDOWN(mp))  		return -EIO; -	XFS_STATS_INC(xs_blk_mapw); +	XFS_STATS_INC(mp, xs_blk_mapw);  	if (!(ifp->if_flags & XFS_IFEXTENTS)) {  		error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK); @@ -4300,11 +4307,14 @@ xfs_bmapi_allocate(  	/*  	 * Indicate if this is the first user data in the file, or just any -	 * user data. +	 * user data. And if it is userdata, indicate whether it needs to +	 * be initialised to zero during allocation.  	 */  	if (!(bma->flags & XFS_BMAPI_METADATA)) {  		bma->userdata = (bma->offset == 0) ?  			XFS_ALLOC_INITIAL_USER_DATA : XFS_ALLOC_USERDATA; +		if (bma->flags & XFS_BMAPI_ZERO) +			bma->userdata |= XFS_ALLOC_USERDATA_ZERO;  	}  	bma->minlen = (bma->flags & XFS_BMAPI_CONTIG) ? bma->length : 1; @@ -4419,6 +4429,17 @@ xfs_bmapi_convert_unwritten(  	mval->br_state = (mval->br_state == XFS_EXT_UNWRITTEN)  				? XFS_EXT_NORM : XFS_EXT_UNWRITTEN; +	/* +	 * Before insertion into the bmbt, zero the range being converted +	 * if required. +	 */ +	if (flags & XFS_BMAPI_ZERO) { +		error = xfs_zero_extent(bma->ip, mval->br_startblock, +					mval->br_blockcount); +		if (error) +			return error; +	} +  	error = xfs_bmap_add_extent_unwritten_real(bma->tp, bma->ip, &bma->idx,  			&bma->cur, mval, bma->firstblock, bma->flist,  			&tmp_logflags); @@ -4512,6 +4533,18 @@ xfs_bmapi_write(  	ASSERT(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL);  	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); +	/* zeroing is for currently only for data extents, not metadata */ +	ASSERT((flags & (XFS_BMAPI_METADATA | XFS_BMAPI_ZERO)) != +			(XFS_BMAPI_METADATA | XFS_BMAPI_ZERO)); +	/* +	 * we can allocate unwritten extents or pre-zero allocated blocks, +	 * but it makes no sense to do both at once. This would result in +	 * zeroing the unwritten extent twice, but it still being an +	 * unwritten extent.... +	 */ +	ASSERT((flags & (XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO)) != +			(XFS_BMAPI_PREALLOC | XFS_BMAPI_ZERO)); +  	if (unlikely(XFS_TEST_ERROR(  	    (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&  	     XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE), @@ -4525,7 +4558,7 @@ xfs_bmapi_write(  	ifp = XFS_IFORK_PTR(ip, whichfork); -	XFS_STATS_INC(xs_blk_mapw); +	XFS_STATS_INC(mp, xs_blk_mapw);  	if (*firstblock == NULLFSBLOCK) {  		if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) @@ -4718,12 +4751,12 @@ xfs_bmap_del_extent(  	xfs_filblks_t		temp2;	/* for indirect length calculations */  	int			state = 0; -	XFS_STATS_INC(xs_del_exlist); +	mp = ip->i_mount; +	XFS_STATS_INC(mp, xs_del_exlist);  	if (whichfork == XFS_ATTR_FORK)  		state |= BMAP_ATTRFORK; -	mp = ip->i_mount;  	ifp = XFS_IFORK_PTR(ip, whichfork);  	ASSERT((*idx >= 0) && (*idx < ifp->if_bytes /  		(uint)sizeof(xfs_bmbt_rec_t))); @@ -5070,7 +5103,7 @@ xfs_bunmapi(  		*done = 1;  		return 0;  	} -	XFS_STATS_INC(xs_blk_unmap); +	XFS_STATS_INC(mp, xs_blk_unmap);  	isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip);  	start = bno;  	bno = start + len - 1; | 
