All of lore.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 09/11] libfrog: clean up platform_nproc
Date: Mon, 21 Oct 2019 13:13:44 -0700	[thread overview]
Message-ID: <20191021201344.GF913374@magnolia> (raw)
In-Reply-To: <dfa0af2b-1f72-40e4-6877-4296e51c7fd9@sandeen.net>

On Mon, Oct 21, 2019 at 02:31:52PM -0500, Eric Sandeen wrote:
> On 9/25/19 4:37 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > The platform_nproc function should check for error returns and obviously
> > garbage values and deal with them appropriately.  Fix the header
> > declaration since it's part of the libfrog platform support code, not
> > libxfs.  xfs_scrub will make use of it in the next patch.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  include/libxfs.h           |    1 -
> >  include/platform_defs.h.in |    2 ++
> >  libfrog/linux.c            |    9 ++++++++-
> >  3 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/include/libxfs.h b/include/libxfs.h
> > index 63696df5..227084ae 100644
> > --- a/include/libxfs.h
> > +++ b/include/libxfs.h
> > @@ -135,7 +135,6 @@ extern void	libxfs_device_close (dev_t);
> >  extern int	libxfs_device_alignment (void);
> >  extern void	libxfs_report(FILE *);
> >  extern void	platform_findsizes(char *path, int fd, long long *sz, int *bsz);
> > -extern int	platform_nproc(void);
> >  
> >  /* check or write log footer: specify device, log size in blocks & uuid */
> >  typedef char	*(libxfs_get_block_t)(char *, int, void *);
> > diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
> > index d111ec6d..adb00181 100644
> > --- a/include/platform_defs.h.in
> > +++ b/include/platform_defs.h.in
> > @@ -77,4 +77,6 @@ typedef unsigned short umode_t;
> >  # define ASSERT(EX)	((void) 0)
> >  #endif
> >  
> > +extern int	platform_nproc(void);
> > +
> >  #endif	/* __XFS_PLATFORM_DEFS_H__ */
> > diff --git a/libfrog/linux.c b/libfrog/linux.c
> > index b6c24879..79bd79eb 100644
> > --- a/libfrog/linux.c
> > +++ b/libfrog/linux.c
> > @@ -242,10 +242,17 @@ platform_align_blockdev(void)
> >  	return max_block_alignment;
> >  }
> >  
> > +/* How many CPUs are online? */
> >  int
> >  platform_nproc(void)
> >  {
> > -	return sysconf(_SC_NPROCESSORS_ONLN);
> > +	long nproc = sysconf(_SC_NPROCESSORS_ONLN);
> > +
> > +	if (nproc < 1)
> > +		return 1;
> > +	if (nproc >= INT_MAX)
> > +		return INT_MAX;
> > +	return nproc;
> >  }
> 
> hm, may as well remove the test from libxfs then?
> 
> int
> libxfs_nproc(void)
> {
>         int     nr;
> 
>         nr = platform_nproc();
>         if (nr < 1)
>                 nr = 1;
>         return nr;
> }

Eh, I'll just remove libxfs_nproc since it's now just a shallow wrapper
to another library.

--D

  reply	other threads:[~2019-10-21 20:14 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
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 [this message]
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 09/11] libfrog: clean up platform_nproc Darrick J. Wong
2019-08-26 21:31 [PATCH 00/11] xfs_scrub: fix IO error reporting Darrick J. Wong
2019-08-26 21:32 ` [PATCH 09/11] libfrog: clean up platform_nproc 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=20191021201344.GF913374@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 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.