linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/4] xfs: move more RT specific code under CONFIG_XFS_RT
Date: Mon, 9 Oct 2017 10:24:37 -0400	[thread overview]
Message-ID: <20171009142436.GC18663@bfoster.bfoster> (raw)
In-Reply-To: <20171008235414.13866-3-david@fromorbit.com>

On Mon, Oct 09, 2017 at 10:54:12AM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Various utility functions and interfaces that iterate internal
> devices try to reference the realtime device even when RT support is
> not compiled into the kernel.
> 
> Make sure this code is excluded from the CONFIG_XFS_RT=n build,
> and where appropriate stub functions to return fatal errors if
> they ever get called when RT support is not present.
> 
> Signed-Off-By: Dave Chinner <dchinner@redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_bmap_util.c |  2 ++
>  fs/xfs/xfs_bmap_util.h | 13 +++++++++++++
>  fs/xfs/xfs_fsmap.c     | 12 ++++++++++++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index e9db7fc95b70..6503cfa44262 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -84,6 +84,7 @@ xfs_zero_extent(
>  		GFP_NOFS, 0);
>  }
>  
> +#ifdef CONFIG_XFS_RT
>  int
>  xfs_bmap_rtalloc(
>  	struct xfs_bmalloca	*ap)	/* bmap alloc argument struct */
> @@ -190,6 +191,7 @@ xfs_bmap_rtalloc(
>  	}
>  	return 0;
>  }
> +#endif /* CONFIG_XFS_RT */
>  
>  /*
>   * Check if the endoff is outside the last extent. If so the caller will grow
> diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h
> index 0eaa81dc49be..7d330b3c77c3 100644
> --- a/fs/xfs/xfs_bmap_util.h
> +++ b/fs/xfs/xfs_bmap_util.h
> @@ -28,7 +28,20 @@ struct xfs_mount;
>  struct xfs_trans;
>  struct xfs_bmalloca;
>  
> +#ifdef CONFIG_XFS_RT
>  int	xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
> +#else /* !CONFIG_XFS_RT */
> +/*
> + * Attempts to allocate RT extents when RT is disable indicates corruption and
> + * should trigger a shutdown.
> + */
> +static inline int
> +xfs_bmap_rtalloc(struct xfs_bmalloca *ap)
> +{
> +	return -EFSCORRUPTED;
> +}
> +#endif /* CONFIG_XFS_RT */
> +
>  int	xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
>  		     int whichfork, int *eof);
>  int	xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
> diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
> index 814ed729881d..560e0b40ac1b 100644
> --- a/fs/xfs/xfs_fsmap.c
> +++ b/fs/xfs/xfs_fsmap.c
> @@ -521,6 +521,7 @@ __xfs_getfsmap_rtdev(
>  	return query_fn(tp, info);
>  }
>  
> +#ifdef CONFIG_XFS_RT
>  /* Actually query the realtime bitmap. */
>  STATIC int
>  xfs_getfsmap_rtdev_rtbitmap_query(
> @@ -561,6 +562,7 @@ xfs_getfsmap_rtdev_rtbitmap(
>  	return __xfs_getfsmap_rtdev(tp, keys, xfs_getfsmap_rtdev_rtbitmap_query,
>  			info);
>  }
> +#endif /* CONFIG_XFS_RT */
>  
>  /* Execute a getfsmap query against the regular data device. */
>  STATIC int
> @@ -795,7 +797,15 @@ xfs_getfsmap_check_keys(
>  	return false;
>  }
>  
> +/*
> + * There are only two devices if we didn't configure RT devices at build time.
> + */
> +#ifdef CONFIG_XFS_RT
>  #define XFS_GETFSMAP_DEVS	3
> +#else
> +#define XFS_GETFSMAP_DEVS	2
> +#endif /* CONFIG_XFS_RT */
> +
>  /*
>   * Get filesystem's extents as described in head, and format for
>   * output.  Calls formatter to fill the user's buffer until all
> @@ -853,10 +863,12 @@ xfs_getfsmap(
>  		handlers[1].dev = new_encode_dev(mp->m_logdev_targp->bt_dev);
>  		handlers[1].fn = xfs_getfsmap_logdev;
>  	}
> +#ifdef CONFIG_XFS_RT
>  	if (mp->m_rtdev_targp) {
>  		handlers[2].dev = new_encode_dev(mp->m_rtdev_targp->bt_dev);
>  		handlers[2].fn = xfs_getfsmap_rtdev_rtbitmap;
>  	}
> +#endif /* CONFIG_XFS_RT */
>  
>  	xfs_sort(handlers, XFS_GETFSMAP_DEVS, sizeof(struct xfs_getfsmap_dev),
>  			xfs_getfsmap_dev_compare);
> -- 
> 2.14.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-10-09 14:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08 23:54 [PATCH 0/4] xfs: miscellaneous fixes Dave Chinner
2017-10-08 23:54 ` [PATCH 1/4] xfs: Don't log uninitialised fields in inode structures Dave Chinner
2017-10-09 14:24   ` Brian Foster
2017-10-08 23:54 ` [PATCH 2/4] xfs: move more RT specific code under CONFIG_XFS_RT Dave Chinner
2017-10-09 14:24   ` Brian Foster [this message]
2017-10-08 23:54 ` [PATCH 3/4] xfs: don't change inode mode if ACL update fails Dave Chinner
2017-10-09 14:24   ` Brian Foster
2017-10-08 23:54 ` [PATCH 4/4] xfs: cancel dirty pages on invalidation Dave Chinner
2017-10-09 14:24   ` Brian Foster
2017-10-09 20:48     ` Dave Chinner
2017-10-10 12:29       ` Brian Foster
2017-10-11  0:04         ` Dave Chinner
2017-10-11  9:02           ` Brian Foster
2017-10-11 11:58             ` Dave Chinner
2017-10-11 13:02               ` Brian Foster
2017-10-12  0:56                 ` Dave Chinner
2017-10-12 10:39                   ` Brian Foster
2017-10-16 19:39   ` Darrick J. Wong
2017-10-09 18:47 ` [PATCH 0/4] xfs: miscellaneous fixes 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=20171009142436.GC18663@bfoster.bfoster \
    --to=bfoster@redhat.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 NNTP newsgroup(s).