linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 11/24] xfs: use ->t_dfops for all xfs_bmapi_write() callers
Date: Tue, 3 Jul 2018 16:48:00 -0400	[thread overview]
Message-ID: <20180703204800.GI22789@bfoster> (raw)
In-Reply-To: <20180703204257.GG32415@magnolia>

On Tue, Jul 03, 2018 at 01:42:57PM -0700, Darrick J. Wong wrote:
> On Thu, Jun 28, 2018 at 12:36:23PM -0400, Brian Foster wrote:
> > Attach ->t_dfops for all remaining callers of xfs_bmapi_write().
> > This prepares the latter to no longer require a separate dfops
> > parameter.
> > 
> > Note that xfs_symlink() already uses ->t_dfops. Fix up the local
> > references for consistency.
> > 
> > Signed-off-by: Brian Foster <bfoster@redhat.com>
> 
> Looks ok, though I'm starting to itch for moving all these
> _defer_{init,finish,cancel} calls into _trans_{alloc,commit,cancel} so
> that we can get rid of all the boilerplate code everywhere.
> 

That's the next step after the firstblock fixups. :)

Brian

> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> --D
> 
> > ---
> >  fs/xfs/xfs_bmap_util.c |  5 +++--
> >  fs/xfs/xfs_iomap.c     | 21 ++++++++++++---------
> >  fs/xfs/xfs_reflink.c   |  7 ++++---
> >  fs/xfs/xfs_rtalloc.c   |  7 ++++---
> >  fs/xfs/xfs_symlink.c   |  6 +++---
> >  5 files changed, 26 insertions(+), 20 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> > index 83b1e8c6c18f..e6036f56241c 100644
> > --- a/fs/xfs/xfs_bmap_util.c
> > +++ b/fs/xfs/xfs_bmap_util.c
> > @@ -972,16 +972,17 @@ xfs_alloc_file_space(
> >  		xfs_trans_ijoin(tp, ip, 0);
> >  
> >  		xfs_defer_init(&dfops, &firstfsb);
> > +		tp->t_dfops = &dfops;
> >  		error = xfs_bmapi_write(tp, ip, startoffset_fsb,
> >  					allocatesize_fsb, alloc_type, &firstfsb,
> > -					resblks, imapp, &nimaps, &dfops);
> > +					resblks, imapp, &nimaps, tp->t_dfops);
> >  		if (error)
> >  			goto error0;
> >  
> >  		/*
> >  		 * Complete the transaction
> >  		 */
> > -		error = xfs_defer_finish(&tp, &dfops);
> > +		error = xfs_defer_finish(&tp, tp->t_dfops);
> >  		if (error)
> >  			goto error0;
> >  
> > diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> > index 55876dd02f0c..8e1f3b451ee4 100644
> > --- a/fs/xfs/xfs_iomap.c
> > +++ b/fs/xfs/xfs_iomap.c
> > @@ -255,17 +255,18 @@ xfs_iomap_write_direct(
> >  	 * caller gave to us.
> >  	 */
> >  	xfs_defer_init(&dfops, &firstfsb);
> > +	tp->t_dfops = &dfops;
> >  	nimaps = 1;
> >  	error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
> >  				bmapi_flags, &firstfsb, resblks, imap,
> > -				&nimaps, &dfops);
> > +				&nimaps, tp->t_dfops);
> >  	if (error)
> >  		goto out_bmap_cancel;
> >  
> >  	/*
> >  	 * Complete the transaction
> >  	 */
> > -	error = xfs_defer_finish(&tp, &dfops);
> > +	error = xfs_defer_finish(&tp, tp->t_dfops);
> >  	if (error)
> >  		goto out_bmap_cancel;
> >  
> > @@ -289,7 +290,7 @@ xfs_iomap_write_direct(
> >  	return error;
> >  
> >  out_bmap_cancel:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  	xfs_trans_unreserve_quota_nblks(tp, ip, (long)qblocks, 0, quota_flag);
> >  out_trans_cancel:
> >  	xfs_trans_cancel(tp);
> > @@ -717,6 +718,7 @@ xfs_iomap_write_allocate(
> >  			xfs_trans_ijoin(tp, ip, 0);
> >  
> >  			xfs_defer_init(&dfops, &first_block);
> > +			tp->t_dfops = &dfops;
> >  
> >  			/*
> >  			 * it is possible that the extents have changed since
> > @@ -772,11 +774,11 @@ xfs_iomap_write_allocate(
> >  			error = xfs_bmapi_write(tp, ip, map_start_fsb,
> >  						count_fsb, flags, &first_block,
> >  						nres, imap, &nimaps,
> > -						&dfops);
> > +						tp->t_dfops);
> >  			if (error)
> >  				goto trans_cancel;
> >  
> > -			error = xfs_defer_finish(&tp, &dfops);
> > +			error = xfs_defer_finish(&tp, tp->t_dfops);
> >  			if (error)
> >  				goto trans_cancel;
> >  
> > @@ -810,7 +812,7 @@ xfs_iomap_write_allocate(
> >  	}
> >  
> >  trans_cancel:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  	xfs_trans_cancel(tp);
> >  error0:
> >  	xfs_iunlock(ip, XFS_ILOCK_EXCL);
> > @@ -878,10 +880,11 @@ xfs_iomap_write_unwritten(
> >  		 * Modify the unwritten extent state of the buffer.
> >  		 */
> >  		xfs_defer_init(&dfops, &firstfsb);
> > +		tp->t_dfops = &dfops;
> >  		nimaps = 1;
> >  		error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
> >  					XFS_BMAPI_CONVERT, &firstfsb, resblks,
> > -					&imap, &nimaps, &dfops);
> > +					&imap, &nimaps, tp->t_dfops);
> >  		if (error)
> >  			goto error_on_bmapi_transaction;
> >  
> > @@ -901,7 +904,7 @@ xfs_iomap_write_unwritten(
> >  			xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> >  		}
> >  
> > -		error = xfs_defer_finish(&tp, &dfops);
> > +		error = xfs_defer_finish(&tp, tp->t_dfops);
> >  		if (error)
> >  			goto error_on_bmapi_transaction;
> >  
> > @@ -928,7 +931,7 @@ xfs_iomap_write_unwritten(
> >  	return 0;
> >  
> >  error_on_bmapi_transaction:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  	xfs_trans_cancel(tp);
> >  	xfs_iunlock(ip, XFS_ILOCK_EXCL);
> >  	return error;
> > diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> > index ff10b5e70029..1ff9ef1d65ba 100644
> > --- a/fs/xfs/xfs_reflink.c
> > +++ b/fs/xfs/xfs_reflink.c
> > @@ -429,19 +429,20 @@ xfs_reflink_allocate_cow(
> >  	xfs_trans_ijoin(tp, ip, 0);
> >  
> >  	xfs_defer_init(&dfops, &first_block);
> > +	tp->t_dfops = &dfops;
> >  	nimaps = 1;
> >  
> >  	/* Allocate the entire reservation as unwritten blocks. */
> >  	error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,
> >  			XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, &first_block,
> > -			resblks, imap, &nimaps, &dfops);
> > +			resblks, imap, &nimaps, tp->t_dfops);
> >  	if (error)
> >  		goto out_bmap_cancel;
> >  
> >  	xfs_inode_set_cowblocks_tag(ip);
> >  
> >  	/* Finish up. */
> > -	error = xfs_defer_finish(&tp, &dfops);
> > +	error = xfs_defer_finish(&tp, tp->t_dfops);
> >  	if (error)
> >  		goto out_bmap_cancel;
> >  
> > @@ -458,7 +459,7 @@ xfs_reflink_allocate_cow(
> >  convert:
> >  	return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
> >  out_bmap_cancel:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  	xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
> >  			XFS_QMOPT_RES_REGBLKS);
> >  out:
> > diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> > index 329d4d26c13e..312d410d91fb 100644
> > --- a/fs/xfs/xfs_rtalloc.c
> > +++ b/fs/xfs/xfs_rtalloc.c
> > @@ -788,13 +788,14 @@ xfs_growfs_rt_alloc(
> >  		xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
> >  
> >  		xfs_defer_init(&dfops, &firstblock);
> > +		tp->t_dfops = &dfops;
> >  		/*
> >  		 * Allocate blocks to the bitmap file.
> >  		 */
> >  		nmap = 1;
> >  		error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks,
> >  					XFS_BMAPI_METADATA, &firstblock,
> > -					resblks, &map, &nmap, &dfops);
> > +					resblks, &map, &nmap, tp->t_dfops);
> >  		if (!error && nmap < 1)
> >  			error = -ENOSPC;
> >  		if (error)
> > @@ -802,7 +803,7 @@ xfs_growfs_rt_alloc(
> >  		/*
> >  		 * Free any blocks freed up in the transaction, then commit.
> >  		 */
> > -		error = xfs_defer_finish(&tp, &dfops);
> > +		error = xfs_defer_finish(&tp, tp->t_dfops);
> >  		if (error)
> >  			goto out_bmap_cancel;
> >  		error = xfs_trans_commit(tp);
> > @@ -855,7 +856,7 @@ xfs_growfs_rt_alloc(
> >  	return 0;
> >  
> >  out_bmap_cancel:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  out_trans_cancel:
> >  	xfs_trans_cancel(tp);
> >  	return error;
> > diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
> > index e347a3db018f..6825a31727d1 100644
> > --- a/fs/xfs/xfs_symlink.c
> > +++ b/fs/xfs/xfs_symlink.c
> > @@ -291,7 +291,7 @@ xfs_symlink(
> >  
> >  		error = xfs_bmapi_write(tp, ip, first_fsb, fs_blocks,
> >  				  XFS_BMAPI_METADATA, &first_block, resblks,
> > -				  mval, &nmaps, &dfops);
> > +				  mval, &nmaps, tp->t_dfops);
> >  		if (error)
> >  			goto out_bmap_cancel;
> >  
> > @@ -354,7 +354,7 @@ xfs_symlink(
> >  		xfs_trans_set_sync(tp);
> >  	}
> >  
> > -	error = xfs_defer_finish(&tp, &dfops);
> > +	error = xfs_defer_finish(&tp, tp->t_dfops);
> >  	if (error)
> >  		goto out_bmap_cancel;
> >  
> > @@ -370,7 +370,7 @@ xfs_symlink(
> >  	return 0;
> >  
> >  out_bmap_cancel:
> > -	xfs_defer_cancel(&dfops);
> > +	xfs_defer_cancel(tp->t_dfops);
> >  out_trans_cancel:
> >  	xfs_trans_cancel(tp);
> >  out_release_inode:
> > -- 
> > 2.17.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-07-03 20:48 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 16:36 [PATCH 00/24] xfs: broad enablement of deferred agfl frees Brian Foster
2018-06-28 16:36 ` [PATCH 01/24] xfs: cow unwritten conversion uses uninitialized dfops Brian Foster
2018-07-02 13:43   ` Christoph Hellwig
2018-07-02 17:32     ` Brian Foster
2018-07-03 14:59       ` Darrick J. Wong
2018-07-03 15:10         ` Brian Foster
2018-07-03 15:21           ` Darrick J. Wong
2018-07-03 16:14             ` Brian Foster
2018-07-03 16:35               ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 02/24] xfs: rename xfs_trans ->t_agfl_dfops to ->t_dfops Brian Foster
2018-07-02 13:43   ` Christoph Hellwig
2018-07-03 15:36   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 03/24] xfs: remove dfops parameter from ifree call stack Brian Foster
2018-07-02 13:43   ` Christoph Hellwig
2018-07-03 15:36   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 04/24] xfs: remove dfops param from high level dirname calls Brian Foster
2018-07-02 13:45   ` Christoph Hellwig
2018-07-02 17:32     ` Brian Foster
2018-07-02 17:37   ` [PATCH v2] " Brian Foster
2018-07-03 15:19     ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 05/24] xfs: use ->t_dfops for recovery of [b|c]ui log items Brian Foster
2018-07-02 13:45   ` Christoph Hellwig
2018-07-02 17:33     ` Brian Foster
2018-07-02 17:38   ` [PATCH v2] " Brian Foster
2018-07-03 15:15     ` Darrick J. Wong
2018-07-03 16:11       ` Brian Foster
2018-07-03 16:17         ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 06/24] xfs: use ->t_dfops for attr set/remove operations Brian Foster
2018-07-02 13:46   ` Christoph Hellwig
2018-07-03 20:26   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 07/24] xfs: remove dfops param in attr fork add path Brian Foster
2018-07-02 13:47   ` Christoph Hellwig
2018-07-03 20:27   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 08/24] xfs: use ->t_dfops in extent split tx and remove param Brian Foster
2018-07-02 13:48   ` Christoph Hellwig
2018-07-03 20:30   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 09/24] xfs: replace xfs_da_args->dfops accesses with ->t_dfops and remove Brian Foster
2018-07-02 13:48   ` Christoph Hellwig
2018-07-03 20:38   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 10/24] xfs: use ->t_dfops in dqalloc transaction Brian Foster
2018-07-02 13:49   ` Christoph Hellwig
2018-07-03 19:59   ` Darrick J. Wong
2018-07-03 20:47     ` Brian Foster
2018-06-28 16:36 ` [PATCH 11/24] xfs: use ->t_dfops for all xfs_bmapi_write() callers Brian Foster
2018-07-02 13:49   ` Christoph Hellwig
2018-07-03 20:42   ` Darrick J. Wong
2018-07-03 20:48     ` Brian Foster [this message]
2018-06-28 16:36 ` [PATCH 12/24] xfs: remove xfs_bmapi_write() dfops param Brian Foster
2018-07-02 13:50   ` Christoph Hellwig
2018-07-03 20:43   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 13/24] xfs: use ->t_dfops for all xfs_bunmapi() callers Brian Foster
2018-07-02 13:51   ` Christoph Hellwig
2018-07-03 20:55   ` Darrick J. Wong
2018-07-03 21:16     ` Brian Foster
2018-06-28 16:36 ` [PATCH 14/24] xfs: remove xfs_bunmapi() dfops param Brian Foster
2018-07-02 13:52   ` Christoph Hellwig
2018-07-03 20:59   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 15/24] xfs: remove xfs_bmapi_remap() " Brian Foster
2018-07-02 13:52   ` Christoph Hellwig
2018-07-03 21:02   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 16/24] xfs: remove struct xfs_bmalloca dfops field Brian Foster
2018-07-02 13:52   ` Christoph Hellwig
2018-07-03 21:02   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 17/24] xfs: use ->t_dfops for collapse/insert range operations Brian Foster
2018-07-02 13:53   ` Christoph Hellwig
2018-07-03 21:03   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 18/24] xfs: remove dfops param from internal bmap extent helpers Brian Foster
2018-07-02 13:53   ` Christoph Hellwig
2018-07-03 21:07   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 19/24] xfs: remove xfs_btree_cur bmbt dfops field Brian Foster
2018-07-02 13:53   ` Christoph Hellwig
2018-07-03 21:07   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 20/24] xfs: remove unused btree cursor bc_private.a.dfops field Brian Foster
2018-07-02 13:54   ` Christoph Hellwig
2018-07-03 21:09   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 21/24] xfs: use ->t_dfops for rmap extent swap operations Brian Foster
2018-07-02 13:54   ` Christoph Hellwig
2018-07-03 21:22   ` Darrick J. Wong
2018-07-03 21:56     ` Brian Foster
2018-06-28 16:36 ` [PATCH 22/24] xfs: use ->t_dfops in cancel cow blocks operation Brian Foster
2018-07-02 13:55   ` Christoph Hellwig
2018-07-03 21:25   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 23/24] xfs: use ->t_dfops in reflink cow recover path Brian Foster
2018-07-02 13:55   ` Christoph Hellwig
2018-07-03 21:25   ` Darrick J. Wong
2018-06-28 16:36 ` [PATCH 24/24] xfs: refactor dfops init to attach to transaction Brian Foster
2018-07-02 13:55   ` Christoph Hellwig
2018-07-03 21:26   ` Darrick J. Wong
2018-07-02 14:51 ` [PATCH 00/24] xfs: broad enablement of deferred agfl frees Christoph Hellwig
2018-07-02 17:40   ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180703204800.GI22789@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).