linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 14/15] xfs: remove xfs_getsb
Date: Tue, 1 Sep 2020 09:58:50 -0700	[thread overview]
Message-ID: <20200901165850.GG6096@magnolia> (raw)
In-Reply-To: <20200901155018.2524-15-hch@lst.de>

On Tue, Sep 01, 2020 at 05:50:17PM +0200, Christoph Hellwig wrote:
> Merge xfs_getsb into its only caller, and clean that one up a little bit
> as well.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Nice cleanup.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_log_recover.c | 26 +++++++++++++-------------
>  fs/xfs/xfs_mount.c       | 17 -----------------
>  fs/xfs/xfs_mount.h       |  1 -
>  3 files changed, 13 insertions(+), 31 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 5449cba657352c..4f5569aab89a08 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -3268,14 +3268,14 @@ xlog_do_log_recovery(
>   */
>  STATIC int
>  xlog_do_recover(
> -	struct xlog	*log,
> -	xfs_daddr_t	head_blk,
> -	xfs_daddr_t	tail_blk)
> +	struct xlog		*log,
> +	xfs_daddr_t		head_blk,
> +	xfs_daddr_t		tail_blk)
>  {
> -	struct xfs_mount *mp = log->l_mp;
> -	int		error;
> -	xfs_buf_t	*bp;
> -	xfs_sb_t	*sbp;
> +	struct xfs_mount	*mp = log->l_mp;
> +	struct xfs_buf		*bp = mp->m_sb_bp;
> +	struct xfs_sb		*sbp = &mp->m_sb;
> +	int			error;
>  
>  	trace_xfs_log_recover(log, head_blk, tail_blk);
>  
> @@ -3289,9 +3289,8 @@ xlog_do_recover(
>  	/*
>  	 * If IO errors happened during recovery, bail out.
>  	 */
> -	if (XFS_FORCED_SHUTDOWN(mp)) {
> +	if (XFS_FORCED_SHUTDOWN(mp))
>  		return -EIO;
> -	}
>  
>  	/*
>  	 * We now update the tail_lsn since much of the recovery has completed
> @@ -3305,10 +3304,12 @@ xlog_do_recover(
>  	xlog_assign_tail_lsn(mp);
>  
>  	/*
> -	 * Now that we've finished replaying all buffer and inode
> -	 * updates, re-read in the superblock and reverify it.
> +	 * Now that we've finished replaying all buffer and inode updates,
> +	 * re-read the superblock and reverify it.
>  	 */
> -	bp = xfs_getsb(mp);
> +	xfs_buf_lock(bp);
> +	xfs_buf_hold(bp);
> +	ASSERT(bp->b_flags & XBF_DONE);
>  	bp->b_flags &= ~(XBF_DONE | XBF_ASYNC);
>  	ASSERT(!(bp->b_flags & XBF_WRITE));
>  	bp->b_flags |= XBF_READ;
> @@ -3325,7 +3326,6 @@ xlog_do_recover(
>  	}
>  
>  	/* Convert superblock from on-disk format */
> -	sbp = &mp->m_sb;
>  	xfs_sb_from_disk(sbp, bp->b_addr);
>  	xfs_buf_relse(bp);
>  
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index c8ae49a1e99c35..09cc7ca91cd398 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -1288,23 +1288,6 @@ xfs_mod_frextents(
>  	return ret;
>  }
>  
> -/*
> - * xfs_getsb() is called to obtain the buffer for the superblock.
> - * The buffer is returned locked and read in from disk.
> - * The buffer should be released with a call to xfs_brelse().
> - */
> -struct xfs_buf *
> -xfs_getsb(
> -	struct xfs_mount	*mp)
> -{
> -	struct xfs_buf		*bp = mp->m_sb_bp;
> -
> -	xfs_buf_lock(bp);
> -	xfs_buf_hold(bp);
> -	ASSERT(bp->b_flags & XBF_DONE);
> -	return bp;
> -}
> -
>  /*
>   * Used to free the superblock along various error paths.
>   */
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index a72cfcaa4ad12e..dfa429b77ee285 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -410,7 +410,6 @@ extern int	xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta,
>  				 bool reserved);
>  extern int	xfs_mod_frextents(struct xfs_mount *mp, int64_t delta);
>  
> -extern struct xfs_buf *xfs_getsb(xfs_mount_t *);
>  extern int	xfs_readsb(xfs_mount_t *, int);
>  extern void	xfs_freesb(xfs_mount_t *);
>  extern bool	xfs_fs_writable(struct xfs_mount *mp, int level);
> -- 
> 2.28.0
> 

  reply	other threads:[~2020-09-01 16:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 15:50 tidy up the buffer cache implementation v3 Christoph Hellwig
2020-09-01 15:50 ` [PATCH 01/15] xfs: refactor the buf ioend disposition code Christoph Hellwig
2020-09-01 15:50 ` [PATCH 02/15] xfs: mark xfs_buf_ioend static Christoph Hellwig
2020-09-01 15:50 ` [PATCH 03/15] xfs: refactor xfs_buf_ioend Christoph Hellwig
2020-09-01 15:50 ` [PATCH 04/15] xfs: move the buffer retry logic to xfs_buf.c Christoph Hellwig
2020-09-01 15:50 ` [PATCH 05/15] xfs: fold xfs_buf_ioend_finish into xfs_ioend Christoph Hellwig
2020-09-01 15:50 ` [PATCH 06/15] xfs: refactor xfs_buf_ioerror_fail_without_retry Christoph Hellwig
2020-09-01 15:50 ` [PATCH 07/15] xfs: remove xfs_buf_ioerror_retry Christoph Hellwig
2020-09-01 15:50 ` [PATCH 08/15] xfs: lift the XBF_IOEND_FAIL handling into xfs_buf_ioend_disposition Christoph Hellwig
2020-09-01 15:50 ` [PATCH 09/15] xfs: simplify the xfs_buf_ioend_disposition calling convention Christoph Hellwig
2020-09-01 15:50 ` [PATCH 10/15] xfs: use xfs_buf_item_relse in xfs_buf_item_done Christoph Hellwig
2020-09-01 15:50 ` [PATCH 11/15] xfs: clear the read/write flags later in xfs_buf_ioend Christoph Hellwig
2020-09-01 15:50 ` [PATCH 12/15] xfs: remove xlog_recover_iodone Christoph Hellwig
2020-09-01 15:50 ` [PATCH 13/15] xfs: simplify xfs_trans_getsb Christoph Hellwig
2020-09-01 16:58   ` Darrick J. Wong
2020-09-01 15:50 ` [PATCH 14/15] xfs: remove xfs_getsb Christoph Hellwig
2020-09-01 16:58   ` Darrick J. Wong [this message]
2020-09-01 15:50 ` [PATCH 15/15] xfs: reuse _xfs_buf_read for re-reading the superblock Christoph Hellwig
2020-09-01 17:02   ` Darrick J. Wong
2020-09-01 17:12     ` Christoph Hellwig

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=20200901165850.GG6096@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --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).