public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 07/11] xfs_scrub: request fewer bmaps when we can
Date: Mon, 21 Oct 2019 11:15:11 -0700	[thread overview]
Message-ID: <20191021181511.GE913374@magnolia> (raw)
In-Reply-To: <220f16b6-8604-7f83-924c-3a148e0dd5cb@sandeen.net>

On Mon, Oct 21, 2019 at 01:05:06PM -0500, Eric Sandeen wrote:
> On 9/25/19 4:36 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > In xfs_iterate_filemaps, we query the number of bmaps for a given file
> > that we're going to iterate, so feed that information to bmap so that
> > the kernel won't waste time allocating in-kernel memory unnecessarily.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  scrub/filemap.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 
> > diff --git a/scrub/filemap.c b/scrub/filemap.c
> > index bdc6d8f9..aaaa0521 100644
> > --- a/scrub/filemap.c
> > +++ b/scrub/filemap.c
> > @@ -71,7 +71,6 @@ xfs_iterate_filemaps(
> >  		map->bmv_length = ULLONG_MAX;
> >  	else
> >  		map->bmv_length = BTOBB(key->bm_length);
> > -	map->bmv_count = BMAP_NR;
> >  	map->bmv_iflags = BMV_IF_NO_DMAPI_READ | BMV_IF_PREALLOC |
> >  			  BMV_IF_NO_HOLES;
> >  	switch (whichfork) {
> > @@ -96,6 +95,7 @@ xfs_iterate_filemaps(
> >  		moveon = false;
> >  		goto out;
> >  	}
> > +	map->bmv_count = min(fsx.fsx_nextents + 2, BMAP_NR);
> 
> Was going to ask you to document the magical +2 here but IRC discussion suggests
> that it is in case fsx_nextents is 0, and we need to send in a count of at least
> 2 (header + 1 structure?)
> 
> But if there are no extents, what are we trying to map in the loop below,
> anyway?

Nothing.  Will rework it with:

if (fsx_nextents == 0)
	return 0;

bmv_count = min(fsx_nextents + 1, BMAP_NR);

while ((error = ioctl(...))) {

--D

> >  
> >  	while ((error = ioctl(fd, XFS_IOC_GETBMAPX, map)) == 0) {
> >  		for (i = 0, p = &map[i + 1]; i < map->bmv_entries; i++, p++) {
> > 

  reply	other threads:[~2019-10-21 18:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 21:36 [PATCH 00/11] xfs_scrub: fix IO error reporting Darrick J. Wong
2019-09-25 21:36 ` [PATCH 01/11] xfs_scrub: separate media error reporting for attribute forks Darrick J. Wong
2019-10-21 16:18   ` Eric Sandeen
2019-10-21 17:32     ` Darrick J. Wong
2019-09-25 21:36 ` [PATCH 02/11] xfs_scrub: improve reporting of file data media errors Darrick J. Wong
2019-10-21 16:33   ` Eric Sandeen
2019-10-21 17:56     ` Darrick J. Wong
2019-09-25 21:36 ` [PATCH 03/11] xfs_scrub: better reporting of metadata " Darrick J. Wong
2019-10-21 16:46   ` Eric Sandeen
2019-10-21 18:10     ` Darrick J. Wong
2019-09-25 21:36 ` [PATCH 04/11] xfs_scrub: improve reporting of file " Darrick J. Wong
2019-10-21 16:53   ` Eric Sandeen
2019-09-25 21:36 ` [PATCH 05/11] xfs_scrub: don't report media errors on unwritten extents Darrick J. Wong
2019-10-21 16:54   ` Eric Sandeen
2019-09-25 21:36 ` [PATCH 06/11] xfs_scrub: reduce fsmap activity for media errors Darrick J. Wong
2019-10-21 17:17   ` Eric Sandeen
2019-10-21 18:14     ` Darrick J. Wong
2019-09-25 21:36 ` [PATCH 07/11] xfs_scrub: request fewer bmaps when we can Darrick J. Wong
2019-10-21 18:05   ` Eric Sandeen
2019-10-21 18:15     ` Darrick J. Wong [this message]
2019-09-25 21:36 ` [PATCH 08/11] xfs_scrub: fix media verification thread pool size calculations Darrick J. Wong
2019-10-21 19:28   ` Eric Sandeen
2019-09-25 21:37 ` [PATCH 09/11] libfrog: clean up platform_nproc Darrick J. Wong
2019-10-21 19:31   ` Eric Sandeen
2019-10-21 20:13     ` Darrick J. Wong
2019-09-25 21:37 ` [PATCH 10/11] xfs_scrub: clean out the nproc global variable Darrick J. Wong
2019-10-21 19:32   ` Eric Sandeen
2019-09-25 21:37 ` [PATCH 11/11] xfs_scrub: create a new category for unfixable errors Darrick J. Wong
2019-10-21 19:45   ` Eric Sandeen
2019-10-21 20:29     ` Darrick J. Wong
2019-10-21 20:38       ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2019-09-06  3:38 [PATCH 00/11] xfs_scrub: fix IO error reporting Darrick J. Wong
2019-09-06  3:39 ` [PATCH 07/11] xfs_scrub: request fewer bmaps when we can Darrick J. Wong
2019-08-26 21:31 [PATCH 00/11] xfs_scrub: fix IO error reporting Darrick J. Wong
2019-08-26 21:31 ` [PATCH 07/11] xfs_scrub: request fewer bmaps when we can Darrick J. Wong

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=20191021181511.GE913374@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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