From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 13/16] xfs: remove xlog_verify_dest_ptr
Date: Tue, 16 Nov 2021 21:02:41 -0800 [thread overview]
Message-ID: <20211117050241.GT24307@magnolia> (raw)
In-Reply-To: <20211109015055.1547604-14-david@fromorbit.com>
On Tue, Nov 09, 2021 at 12:50:52PM +1100, Dave Chinner wrote:
> From: Christoph Hellwig <hch@lst.de>
>
> 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>
> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
> Signed-off-by: Dave Chinner <david@fromorbit.com>
Took a while to wrap my head around, but I got there.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> 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 02db5a712e76..d6ef555b1310 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -61,10 +61,6 @@ xlog_sync(
> struct xlog_in_core *iclog);
> #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
> @@ -77,7 +73,6 @@ xlog_verify_tail_lsn(
> struct xlog *log,
> struct xlog_in_core *iclog);
> #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)
> @@ -1640,9 +1635,6 @@ xlog_alloc_log(
> GFP_KERNEL | __GFP_RETRY_MAYFAIL);
> 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);
> @@ -2234,6 +2226,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);
>
> @@ -2329,7 +2322,6 @@ xlog_write_partial(
> int *contwr)
> {
> struct xlog_in_core *iclog = *iclogp;
> - struct xlog *log = iclog->ic_log;
> struct xlog_op_header *ophdr;
> int index = 0;
> uint32_t rlen;
> @@ -2368,7 +2360,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);
>
> @@ -2436,7 +2427,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);
> @@ -3560,29 +3550,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 6e9c7d924363..8c98b57e2a63 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -420,10 +420,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.33.0
>
next prev parent reply other threads:[~2021-11-17 5:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 1:50 [PATCH 00/16 v6] xfs: rework xlog_write() Dave Chinner
2021-11-09 1:50 ` [PATCH 01/16] xfs: factor out the CIL transaction header building Dave Chinner
2021-11-09 1:50 ` [PATCH 02/16] xfs: only CIL pushes require a start record Dave Chinner
2021-11-11 7:55 ` Christoph Hellwig
2021-11-18 4:38 ` Dave Chinner
2021-11-09 1:50 ` [PATCH 03/16] xfs: embed the xlog_op_header in the unmount record Dave Chinner
2021-11-09 1:50 ` [PATCH 04/16] xfs: embed the xlog_op_header in the commit record Dave Chinner
2021-11-11 8:00 ` Christoph Hellwig
2021-11-18 4:43 ` Dave Chinner
2021-11-09 1:50 ` [PATCH 05/16] xfs: log tickets don't need log client id Dave Chinner
2021-11-09 1:50 ` [PATCH 06/16] xfs: move log iovec alignment to preparation function Dave Chinner
2021-11-09 1:50 ` [PATCH 07/16] xfs: reserve space and initialise xlog_op_header in item formatting Dave Chinner
2021-11-11 8:10 ` Christoph Hellwig
2021-11-09 1:50 ` [PATCH 08/16] xfs: log ticket region debug is largely useless Dave Chinner
2021-11-09 1:50 ` [PATCH 09/16] xfs: pass lv chain length into xlog_write() Dave Chinner
2021-11-11 8:10 ` Christoph Hellwig
2021-11-09 1:50 ` [PATCH 10/16] xfs: change the type of ic_datap Dave Chinner
2021-11-17 4:50 ` Darrick J. Wong
2021-11-09 1:50 ` [PATCH 11/16] xfs: introduce xlog_write_full() Dave Chinner
2021-11-11 8:12 ` Christoph Hellwig
2021-11-17 4:56 ` Darrick J. Wong
2021-11-09 1:50 ` [PATCH 12/16] xfs:_introduce xlog_write_partial() Dave Chinner
2021-11-11 8:27 ` Christoph Hellwig
2021-11-17 5:21 ` Darrick J. Wong
2021-11-18 5:22 ` Dave Chinner
2021-11-09 1:50 ` [PATCH 13/16] xfs: remove xlog_verify_dest_ptr Dave Chinner
2021-11-17 5:02 ` Darrick J. Wong [this message]
2021-11-09 1:50 ` [PATCH 14/16] xfs: xlog_write() no longer needs contwr state Dave Chinner
2021-11-11 8:28 ` Christoph Hellwig
2021-11-09 1:50 ` [PATCH 15/16] xfs: xlog_write() doesn't need optype anymore Dave Chinner
2021-11-11 8:29 ` Christoph Hellwig
2021-11-09 1:50 ` [PATCH 16/16] xfs: CIL context doesn't need to count iovecs Dave Chinner
2021-11-11 8:29 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2021-11-18 23:13 [PATCH 00/16 v7] xfs: rework xlog_write() Dave Chinner
2021-11-18 23:13 ` [PATCH 13/16] xfs: remove xlog_verify_dest_ptr Dave Chinner
2022-03-09 5:29 [PATCH 00/16 v8] xfs: rework xlog_write() Dave Chinner
2022-03-09 5:29 ` [PATCH 13/16] xfs: remove xlog_verify_dest_ptr 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=20211117050241.GT24307@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.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).