From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/9] xfs: buffer items don't straddle pages anymore
Date: Tue, 19 Mar 2024 10:31:33 -0700 [thread overview]
Message-ID: <20240319173133.GR1927156@frogsfrogsfrogs> (raw)
In-Reply-To: <20240318224715.3367463-6-david@fromorbit.com>
On Tue, Mar 19, 2024 at 09:45:56AM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Unmapped buffers don't exist anymore, so the page straddling
> detection and slow path code can go away now.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
Oh good, I was reading throguh this code just yesterday for other
reasons and now I'll just stop. :)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_buf_item.c | 124 ------------------------------------------
> 1 file changed, 124 deletions(-)
>
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 7b66d3fe4ecd..cbc06605d31c 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -56,31 +56,6 @@ xfs_buf_log_format_size(
> (blfp->blf_map_size * sizeof(blfp->blf_data_map[0]));
> }
>
> -/*
> - * We only have to worry about discontiguous buffer range straddling on unmapped
> - * buffers. Everything else will have a contiguous data region we can copy from.
> - */
> -static inline bool
> -xfs_buf_item_straddle(
> - struct xfs_buf *bp,
> - uint offset,
> - int first_bit,
> - int nbits)
> -{
> - void *first, *last;
> -
> - if (bp->b_folio_count == 1)
> - return false;
> -
> - first = xfs_buf_offset(bp, offset + (first_bit << XFS_BLF_SHIFT));
> - last = xfs_buf_offset(bp,
> - offset + ((first_bit + nbits) << XFS_BLF_SHIFT));
> -
> - if (last - first != nbits * XFS_BLF_CHUNK)
> - return true;
> - return false;
> -}
> -
> /*
> * Return the number of log iovecs and space needed to log the given buf log
> * item segment.
> @@ -97,11 +72,8 @@ xfs_buf_item_size_segment(
> int *nvecs,
> int *nbytes)
> {
> - struct xfs_buf *bp = bip->bli_buf;
> int first_bit;
> int nbits;
> - int next_bit;
> - int last_bit;
>
> first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
> if (first_bit == -1)
> @@ -114,15 +86,6 @@ xfs_buf_item_size_segment(
> nbits = xfs_contig_bits(blfp->blf_data_map,
> blfp->blf_map_size, first_bit);
> ASSERT(nbits > 0);
> -
> - /*
> - * Straddling a page is rare because we don't log contiguous
> - * chunks of unmapped buffers anywhere.
> - */
> - if (nbits > 1 &&
> - xfs_buf_item_straddle(bp, offset, first_bit, nbits))
> - goto slow_scan;
> -
> (*nvecs)++;
> *nbytes += nbits * XFS_BLF_CHUNK;
>
> @@ -137,43 +100,6 @@ xfs_buf_item_size_segment(
> } while (first_bit != -1);
>
> return;
> -
> -slow_scan:
> - ASSERT(bp->b_addr == NULL);
> - last_bit = first_bit;
> - nbits = 1;
> - while (last_bit != -1) {
> -
> - *nbytes += XFS_BLF_CHUNK;
> -
> - /*
> - * This takes the bit number to start looking from and
> - * returns the next set bit from there. It returns -1
> - * if there are no more bits set or the start bit is
> - * beyond the end of the bitmap.
> - */
> - next_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size,
> - last_bit + 1);
> - /*
> - * If we run out of bits, leave the loop,
> - * else if we find a new set of bits bump the number of vecs,
> - * else keep scanning the current set of bits.
> - */
> - if (next_bit == -1) {
> - if (first_bit != last_bit)
> - (*nvecs)++;
> - break;
> - } else if (next_bit != last_bit + 1 ||
> - xfs_buf_item_straddle(bp, offset, first_bit, nbits)) {
> - last_bit = next_bit;
> - first_bit = next_bit;
> - (*nvecs)++;
> - nbits = 1;
> - } else {
> - last_bit++;
> - nbits++;
> - }
> - }
> }
>
> /*
> @@ -286,8 +212,6 @@ xfs_buf_item_format_segment(
> struct xfs_buf *bp = bip->bli_buf;
> uint base_size;
> int first_bit;
> - int last_bit;
> - int next_bit;
> uint nbits;
>
> /* copy the flags across from the base format item */
> @@ -332,15 +256,6 @@ xfs_buf_item_format_segment(
> nbits = xfs_contig_bits(blfp->blf_data_map,
> blfp->blf_map_size, first_bit);
> ASSERT(nbits > 0);
> -
> - /*
> - * Straddling a page is rare because we don't log contiguous
> - * chunks of unmapped buffers anywhere.
> - */
> - if (nbits > 1 &&
> - xfs_buf_item_straddle(bp, offset, first_bit, nbits))
> - goto slow_scan;
> -
> xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
> first_bit, nbits);
> blfp->blf_size++;
> @@ -356,45 +271,6 @@ xfs_buf_item_format_segment(
> } while (first_bit != -1);
>
> return;
> -
> -slow_scan:
> - ASSERT(bp->b_addr == NULL);
> - last_bit = first_bit;
> - nbits = 1;
> - for (;;) {
> - /*
> - * This takes the bit number to start looking from and
> - * returns the next set bit from there. It returns -1
> - * if there are no more bits set or the start bit is
> - * beyond the end of the bitmap.
> - */
> - next_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size,
> - (uint)last_bit + 1);
> - /*
> - * If we run out of bits fill in the last iovec and get out of
> - * the loop. Else if we start a new set of bits then fill in
> - * the iovec for the series we were looking at and start
> - * counting the bits in the new one. Else we're still in the
> - * same set of bits so just keep counting and scanning.
> - */
> - if (next_bit == -1) {
> - xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
> - first_bit, nbits);
> - blfp->blf_size++;
> - break;
> - } else if (next_bit != last_bit + 1 ||
> - xfs_buf_item_straddle(bp, offset, first_bit, nbits)) {
> - xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
> - first_bit, nbits);
> - blfp->blf_size++;
> - first_bit = next_bit;
> - last_bit = next_bit;
> - nbits = 1;
> - } else {
> - last_bit++;
> - nbits++;
> - }
> - }
> }
>
> /*
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-03-19 17:31 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 22:45 [PATCH v2 0/9] xfs: use large folios for buffers Dave Chinner
2024-03-18 22:45 ` [PATCH 1/9] xfs: unmapped buffer item size straddling mismatch Dave Chinner
2024-03-18 22:45 ` [PATCH 2/9] xfs: use folios in the buffer cache Dave Chinner
2024-03-19 6:38 ` Christoph Hellwig
2024-03-19 6:52 ` Dave Chinner
2024-03-19 6:53 ` Christoph Hellwig
2024-03-19 21:42 ` Dave Chinner
2024-03-19 21:42 ` Dave Chinner
2024-03-19 17:15 ` Darrick J. Wong
2024-03-18 22:45 ` [PATCH 3/9] xfs: convert buffer cache to use high order folios Dave Chinner
2024-03-19 6:55 ` Christoph Hellwig
2024-03-19 17:29 ` Darrick J. Wong
2024-03-19 21:32 ` Christoph Hellwig
2024-03-19 21:38 ` Darrick J. Wong
2024-03-19 21:41 ` Christoph Hellwig
2024-03-19 22:23 ` Dave Chinner
2024-03-21 2:12 ` Darrick J. Wong
2024-03-21 2:40 ` Darrick J. Wong
2024-03-21 21:28 ` Christoph Hellwig
2024-03-21 21:39 ` Darrick J. Wong
2024-03-21 22:02 ` Christoph Hellwig
2024-03-19 21:55 ` Dave Chinner
2024-03-22 8:02 ` Pankaj Raghav (Samsung)
2024-03-22 22:04 ` Dave Chinner
2024-03-25 11:17 ` Pankaj Raghav (Samsung)
2024-03-18 22:45 ` [PATCH 4/9] xfs: kill XBF_UNMAPPED Dave Chinner
2024-03-19 17:30 ` Darrick J. Wong
2024-03-19 23:36 ` Dave Chinner
2024-03-18 22:45 ` [PATCH 5/9] xfs: buffer items don't straddle pages anymore Dave Chinner
2024-03-19 6:56 ` Christoph Hellwig
2024-03-19 17:31 ` Darrick J. Wong [this message]
2024-03-18 22:45 ` [PATCH 6/9] xfs: map buffers in xfs_buf_alloc_folios Dave Chinner
2024-03-19 17:34 ` Darrick J. Wong
2024-03-19 21:32 ` Christoph Hellwig
2024-03-19 21:39 ` Darrick J. Wong
2024-03-19 21:41 ` Christoph Hellwig
2024-03-18 22:45 ` [PATCH 7/9] xfs: walk b_addr for buffer I/O Dave Chinner
2024-03-19 17:42 ` Darrick J. Wong
2024-03-19 21:33 ` Christoph Hellwig
2024-03-18 22:45 ` [PATCH 8/9] xfs: use vmalloc for multi-folio buffers Dave Chinner
2024-03-19 17:48 ` Darrick J. Wong
2024-03-20 0:20 ` Dave Chinner
2024-03-18 22:46 ` [PATCH 9/9] xfs: rename bp->b_folio_count Dave Chinner
2024-03-19 7:37 ` Christoph Hellwig
2024-03-19 23:59 ` Dave Chinner
2024-03-19 0:24 ` [PATCH v2 0/9] xfs: use large folios for buffers Christoph Hellwig
2024-03-19 0:44 ` 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=20240319173133.GR1927156@frogsfrogsfrogs \
--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