All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Bill O'Donnell <billodo@redhat.com>, linux-xfs@vger.kernel.org
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v2 1/3] xfsprogs: populate fs table with xfs entries first, foreign entries last
Date: Thu, 15 Sep 2016 14:26:24 -0500	[thread overview]
Message-ID: <8f5cd105-ce7f-9338-e657-5c298f2b8ada@sandeen.net> (raw)
In-Reply-To: <1473953386-10242-2-git-send-email-billodo@redhat.com>

On 9/15/16 10:29 AM, Bill O'Donnell wrote:
> Commits b20b6c2 and 29647c8 modified xfs_quota for use on
> non-XFS filesystems. Modifications to fs_initialise_mounts
> (paths.c) resulted in an xfstest fail (xfs/261), due to foreign
> fs paths being picked up first from the fs table. The xfs_quota
> print command then complained about not being able to print the
> foreign paths, instead of previous behavior (quiet).
> 
> This patch restores correct behavior, sorting the table so that
> xfs entries are first, followed by foreign fs entries. The patch
> maintains the order of xfs entries and foreign entries in the
> same order as mtab entries. Then, in functions which print all
> paths we can simply break at the first foreign path if the -f
> switch is not specified.
> 
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>

worksforme, thanks

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  include/path.h  |  1 +
>  libxcmd/paths.c | 12 +++++++++++-
>  quota/path.c    | 24 ++++++++++++++++++------
>  3 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/include/path.h b/include/path.h
> index 39c1a95..d077bac 100644
> --- a/include/path.h
> +++ b/include/path.h
> @@ -44,6 +44,7 @@ typedef struct fs_path {
>  } fs_path_t;
>  
>  extern int fs_count;		/* number of entries in fs table */
> +extern int xfs_fs_count;	/* number of xfs entries in fs table */
>  extern fs_path_t *fs_table;	/* array of entries in fs table  */
>  extern fs_path_t *fs_path;	/* current entry in the fs table */
>  extern char *mtab_file;
> diff --git a/libxcmd/paths.c b/libxcmd/paths.c
> index 4158688..3455217 100644
> --- a/libxcmd/paths.c
> +++ b/libxcmd/paths.c
> @@ -32,6 +32,7 @@
>  extern char *progname;
>  
>  int fs_count;
> +int xfs_fs_count;
>  struct fs_path *fs_table;
>  struct fs_path *fs_path;
>  
> @@ -138,7 +139,16 @@ fs_table_insert(
>  		goto out_norealloc;
>  	fs_table = tmp_fs_table;
>  
> -	fs_path = &fs_table[fs_count];
> +	/* Put foreign filesystems at the end, xfs filesystems at the front */
> +	if (flags & FS_FOREIGN || fs_count == 0) {
> +		fs_path = &fs_table[fs_count];
> +	} else {
> +		/* move foreign fs entries down, insert new one just before */
> +		memmove(&fs_table[xfs_fs_count + 1], &fs_table[xfs_fs_count],
> +			sizeof(fs_path_t)*(fs_count - xfs_fs_count));
> +		fs_path = &fs_table[xfs_fs_count];
> +		xfs_fs_count++;
> +	}
>  	fs_path->fs_dir = dir;
>  	fs_path->fs_prid = prid;
>  	fs_path->fs_flags = flags;
> diff --git a/quota/path.c b/quota/path.c
> index a623d25..01ccab4 100644
> --- a/quota/path.c
> +++ b/quota/path.c
> @@ -75,9 +75,15 @@ static int
>  pathlist_f(void)
>  {
>  	int		i;
> +	struct fs_path	*path;
>  
> -	for (i = 0; i < fs_count; i++)
> -		printpath(&fs_table[i], i, 1, &fs_table[i] == fs_path);
> +	for (i = 0; i < fs_count; i++) {
> +		path = &fs_table[i];
> +		/* Table is ordered xfs first, then foreign */
> +		if (path->fs_flags & FS_FOREIGN && !foreign_allowed)
> +			break;
> +		printpath(path, i, 1, path == fs_path);
> +	}
>  	return 0;
>  }
>  
> @@ -87,9 +93,14 @@ print_f(
>  	char		**argv)
>  {
>  	int		i;
> +	struct fs_path	*path;
>  
> -	for (i = 0; i < fs_count; i++)
> -		printpath(&fs_table[i], i, 0, 0);
> +	for (i = 0; i < fs_count; i++) {
> +		path = &fs_table[i];
> +		if (path->fs_flags & FS_FOREIGN && !foreign_allowed)
> +			break;
> +		printpath(path, i, 0, 0);
> +	}
>  	return 0;
>  }
>  
> @@ -99,6 +110,7 @@ path_f(
>  	char		**argv)
>  {
>  	int	i;
> +	int	max = foreign_allowed ? fs_count : xfs_fs_count;
>  
>  	if (fs_count == 0) {
>  		printf(_("No paths are available\n"));
> @@ -109,9 +121,9 @@ path_f(
>  		return pathlist_f();
>  
>  	i = atoi(argv[1]);
> -	if (i < 0 || i >= fs_count) {
> +	if (i < 0 || i >= max) {
>  		printf(_("value %d is out of range (0-%d)\n"),
> -			i, fs_count-1);
> +			i, max - 1);
>  	} else {
>  		fs_path = &fs_table[i];
>  		pathlist_f();
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-09-15 19:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 15:19 [PATCH 0/3] xfsprogs: xfs_quota foreign fs path handling modifications Bill O'Donnell
2016-09-14 15:19 ` [PATCH 1/3] xfsprogs: populate fs table with xfs entries first, foreign entries last Bill O'Donnell
2016-09-14 17:50   ` Eric Sandeen
2016-09-14 19:54     ` Eric Sandeen
2016-09-14 15:19 ` [PATCH 2/3] xfs_quota: print and path output formatting: maintain reverse compatibility Bill O'Donnell
2016-09-14 22:14   ` Eric Sandeen
2016-09-14 15:19 ` [PATCH 3/3] xfs_quota: add case for foreign fs, disabled regardless of foreign_allowed Bill O'Donnell
2016-09-15 15:29 ` [PATCH v2 0/3] xfsprogs: xfs_quota foreign fs path handling modifications Bill O'Donnell
2016-09-15 15:29   ` [PATCH v2 1/3] xfsprogs: populate fs table with xfs entries first, foreign entries last Bill O'Donnell
2016-09-15 19:26     ` Eric Sandeen [this message]
2016-09-15 15:29   ` [PATCH v2 2/3] xfs_quota: print and path output formatting: maintain reverse compatibility Bill O'Donnell
2016-09-15 19:27     ` Eric Sandeen
2016-09-15 15:29   ` [PATCH v2 3/3] xfs_quota: add case for foreign fs, disabled regardless of foreign_allowed Bill O'Donnell
2016-09-15 19:32     ` Eric Sandeen
2016-09-15 19:57     ` [PATCH v3 " Bill O'Donnell
2016-09-15 20:43       ` Eric Sandeen

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=8f5cd105-ce7f-9338-e657-5c298f2b8ada@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=billodo@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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.