Linux-XFS Archive mirror
 help / color / mirror / Atom feed
From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/9] xfs: convert buffer cache to use high order folios
Date: Mon, 25 Mar 2024 12:17:55 +0100	[thread overview]
Message-ID: <p73usozirhag4kembg43hlfaqwyn2oyjzu3au5p4aw3tdf3cj5@2icixk7z7ltz> (raw)
In-Reply-To: <Zf4Ag349VrT/kv8n@dread.disaster.area>

On Sat, Mar 23, 2024 at 09:04:51AM +1100, Dave Chinner wrote:
> On Fri, Mar 22, 2024 at 09:02:31AM +0100, Pankaj Raghav (Samsung) wrote:
> > >  	 * Bulk filling of pages can take multiple calls. Not filling the entire
> > > @@ -426,7 +484,7 @@ _xfs_buf_map_folios(
> > >  {
> > >  	ASSERT(bp->b_flags & _XBF_FOLIOS);
> > >  	if (bp->b_folio_count == 1) {
> > > -		/* A single page buffer is always mappable */
> > > +		/* A single folio buffer is always mappable */
> > >  		bp->b_addr = folio_address(bp->b_folios[0]);
> > >  	} else if (flags & XBF_UNMAPPED) {
> > >  		bp->b_addr = NULL;
> > > @@ -1525,20 +1583,28 @@ xfs_buf_ioapply_map(
> > >  	int		*count,
> > >  	blk_opf_t	op)
> > >  {
> > > -	int		page_index;
> > > -	unsigned int	total_nr_pages = bp->b_folio_count;
> > > -	int		nr_pages;
> > > +	int		folio_index;
> > > +	unsigned int	total_nr_folios = bp->b_folio_count;
> > > +	int		nr_folios;
> > >  	struct bio	*bio;
> > >  	sector_t	sector =  bp->b_maps[map].bm_bn;
> > >  	int		size;
> > >  	int		offset;
> > >  
> > > -	/* skip the pages in the buffer before the start offset */
> > > -	page_index = 0;
> > > +	/*
> > > +	 * If the start offset if larger than a single page, we need to be
> > > +	 * careful. We might have a high order folio, in which case the indexing
> > > +	 * is from the start of the buffer. However, if we have more than one
> > > +	 * folio single page folio in the buffer, we need to skip the folios in
> > s/folio single page folio/single page folio/
> > 
> > > +	 * the buffer before the start offset.
> > > +	 */
> > > +	folio_index = 0;
> > >  	offset = *buf_offset;
> > > -	while (offset >= PAGE_SIZE) {
> > > -		page_index++;
> > > -		offset -= PAGE_SIZE;
> > > +	if (bp->b_folio_count > 1) {
> > > +		while (offset >= PAGE_SIZE) {
> > > +			folio_index++;
> > > +			offset -= PAGE_SIZE;
> > 
> > Can this be:
> > folio_index = offset >> PAGE_SHIFT;
> > offset = offset_in_page(offset);
> > 
> > instead of a loop?
> 
> It could, but I'm not going to change it or even bother to fix the
> comment as this code goes away later in the patch set.
> 
> See "[PATCH 7/9] xfs: walk b_addr for buffer I/O" later in the
> series - once we can rely on bp->b_addr always being set for buffers
> we convert this code to a simpler and more efficient folio based
> iteration that is not reliant on pages or PAGE_SIZE at all.
> 

Ah, I missed seeing the whole series before replying to individual patches.
Nvm. 

Thanks for the pointer on patch 7, and I agree that it does not make 
sense to change this patch as it goes away later.

--
Pankaj

  reply	other threads:[~2024-03-25 11:23 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) [this message]
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
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=p73usozirhag4kembg43hlfaqwyn2oyjzu3au5p4aw3tdf3cj5@2icixk7z7ltz \
    --to=kernel@pankajraghav.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).