All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/8] xfs: remove xlog_verify_dest_ptr
Date: Thu, 17 Jun 2021 12:24:01 -0400	[thread overview]
Message-ID: <YMt3IaFLalxWWWGc@bfoster> (raw)
In-Reply-To: <20210616163212.1480297-6-hch@lst.de>

On Wed, Jun 16, 2021 at 06:32:09PM +0200, Christoph Hellwig wrote:
> Just check that the offset in xlog_write_vec is smaller than the iclog
> size and remove the expensive cycling through all iclogs.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_log.c      | 35 +----------------------------------
>  fs/xfs/xfs_log_priv.h |  4 ----
>  2 files changed, 1 insertion(+), 38 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 1bc32f056a5bcf..5d55d4fff63035 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -59,10 +59,6 @@ xlog_sync(
>  	struct xlog_ticket	*ticket);
>  #if defined(DEBUG)
>  STATIC void
> -xlog_verify_dest_ptr(
> -	struct xlog		*log,
> -	void			*ptr);
> -STATIC void
>  xlog_verify_grant_tail(
>  	struct xlog *log);
>  STATIC void
> @@ -76,7 +72,6 @@ xlog_verify_tail_lsn(
>  	struct xlog_in_core	*iclog,
>  	xfs_lsn_t		tail_lsn);
>  #else
> -#define xlog_verify_dest_ptr(a,b)
>  #define xlog_verify_grant_tail(a)
>  #define xlog_verify_iclog(a,b,c)
>  #define xlog_verify_tail_lsn(a,b,c)
> @@ -1501,9 +1496,6 @@ xlog_alloc_log(
>  						KM_MAYFAIL | KM_ZERO);
>  		if (!iclog->ic_data)
>  			goto out_free_iclog;
> -#ifdef DEBUG
> -		log->l_iclog_bak[i] = &iclog->ic_header;
> -#endif
>  		head = &iclog->ic_header;
>  		memset(head, 0, sizeof(xlog_rec_header_t));
>  		head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
> @@ -2134,6 +2126,7 @@ xlog_write_iovec(
>  	uint32_t		*record_cnt,
>  	uint32_t		*data_cnt)
>  {
> +	ASSERT(*log_offset < iclog->ic_log->l_iclog_size);
>  	ASSERT(*log_offset % sizeof(int32_t) == 0);
>  	ASSERT(write_len % sizeof(int32_t) == 0);
>  
> @@ -2258,7 +2251,6 @@ xlog_write_partial(
>  	struct xfs_log_vec	*lv = log_vector;
>  	struct xfs_log_iovec	*reg;
>  	struct xlog_op_header	*ophdr;
> -	void			*ptr;
>  	int			index = 0;
>  	uint32_t		rlen;
>  	int			error;
> @@ -2297,7 +2289,6 @@ xlog_write_partial(
>  		if (rlen != reg->i_len)
>  			ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
>  
> -		xlog_verify_dest_ptr(log, iclog->ic_datap + *log_offset);
>  		xlog_write_iovec(iclog, log_offset, reg->i_addr, rlen, len,
>  				 record_cnt, data_cnt);
>  
> @@ -2363,7 +2354,6 @@ xlog_write_partial(
>  			rlen = min_t(uint32_t, rlen, iclog->ic_size - *log_offset);
>  			ophdr->oh_len = cpu_to_be32(rlen);
>  
> -			xlog_verify_dest_ptr(log, iclog->ic_datap + *log_offset);
>  			xlog_write_iovec(iclog, log_offset,
>  					 reg->i_addr + reg_offset, rlen, len,
>  					 record_cnt, data_cnt);
> @@ -3466,29 +3456,6 @@ xlog_ticket_alloc(
>  }
>  
>  #if defined(DEBUG)
> -/*
> - * Make sure that the destination ptr is within the valid data region of
> - * one of the iclogs.  This uses backup pointers stored in a different
> - * part of the log in case we trash the log structure.
> - */
> -STATIC void
> -xlog_verify_dest_ptr(
> -	struct xlog	*log,
> -	void		*ptr)
> -{
> -	int i;
> -	int good_ptr = 0;
> -
> -	for (i = 0; i < log->l_iclog_bufs; i++) {
> -		if (ptr >= log->l_iclog_bak[i] &&
> -		    ptr <= log->l_iclog_bak[i] + log->l_iclog_size)
> -			good_ptr++;
> -	}
> -
> -	if (!good_ptr)
> -		xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
> -}
> -
>  /*
>   * Check to make sure the grant write head didn't just over lap the tail.  If
>   * the cycles are the same, we can't be overlapping.  Otherwise, make sure that
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index 1b3b3d2bb8a5d1..b829d8ba5c6a3f 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -434,10 +434,6 @@ struct xlog {
>  
>  	struct xfs_kobj		l_kobj;
>  
> -	/* The following field are used for debugging; need to hold icloglock */
> -#ifdef DEBUG
> -	void			*l_iclog_bak[XLOG_MAX_ICLOGS];
> -#endif
>  	/* log recovery lsn tracking (for buffer submission */
>  	xfs_lsn_t		l_recovery_lsn;
>  
> -- 
> 2.30.2
> 


  reply	other threads:[~2021-06-17 16:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 16:32 log write cleanups Christoph Hellwig
2021-06-16 16:32 ` [PATCH 1/8] xfs: change the type of ic_datap Christoph Hellwig
2021-06-17 16:22   ` Brian Foster
2021-06-18  5:52   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 2/8] xfs: list entry elements don't need to be initialized Christoph Hellwig
2021-06-17 16:23   ` Brian Foster
2021-06-18  5:59   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 3/8] xfs: factor out a helper to write a log_iovec into the iclog Christoph Hellwig
2021-06-17 16:23   ` Brian Foster
2021-06-18 13:24     ` Christoph Hellwig
2021-06-18  7:42   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 4/8] xfs: remove xlog_write_adv_cnt and simplify xlog_write_partial Christoph Hellwig
2021-06-17 16:23   ` Brian Foster
2021-06-18  7:50   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 5/8] xfs: remove xlog_verify_dest_ptr Christoph Hellwig
2021-06-17 16:24   ` Brian Foster [this message]
2021-06-18 10:31   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 6/8] xfs: simplify the xlog_write_partial calling conventions Christoph Hellwig
2021-06-17 16:24   ` Brian Foster
2021-06-18 11:07   ` Chandan Babu R
2021-06-16 16:32 ` [PATCH 7/8] xfs: factor out a xlog_write_full_log_vec helper Christoph Hellwig
2021-06-17 16:24   ` Brian Foster
2021-06-18 13:33     ` Christoph Hellwig
2021-06-16 16:32 ` [PATCH 8/8] xfs: simplify the list iteration in xlog_write Christoph Hellwig
2021-06-17 16:24   ` Brian Foster
2021-06-18 22:51 ` log write cleanups Dave Chinner

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=YMt3IaFLalxWWWGc@bfoster \
    --to=bfoster@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.