All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] xfs: convert drop_writes to use the errortag mechanism
Date: Wed, 21 Jun 2017 14:19:42 -0400	[thread overview]
Message-ID: <20170621181941.GE29843@bfoster.bfoster> (raw)
In-Reply-To: <149800750838.23118.17160603017676771034.stgit@birch.djwong.org>

On Tue, Jun 20, 2017 at 06:11:48PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> We now have enhanced error injection that can control the frequency
> with which errors happen, so convert drop_writes to use this.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Nice. Looks like a simple tweak to xfs/196 too...

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

>  fs/xfs/xfs_error.c |    3 +++
>  fs/xfs/xfs_error.h |   14 +++++++++++++-
>  fs/xfs/xfs_iomap.c |    2 +-
>  fs/xfs/xfs_mount.h |   24 ------------------------
>  fs/xfs/xfs_sysfs.c |   42 ------------------------------------------
>  5 files changed, 17 insertions(+), 68 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index 81f260f..40a15e2 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -55,6 +55,7 @@ static unsigned int xfs_errortag_random_default[] = {
>  	XFS_RANDOM_REFCOUNT_FINISH_ONE,
>  	XFS_RANDOM_BMAP_FINISH_ONE,
>  	XFS_RANDOM_AG_RESV_CRITICAL,
> +	XFS_RANDOM_DROP_WRITES,
>  };
>  
>  struct xfs_errortag_attr {
> @@ -157,6 +158,7 @@ XFS_ERRORTAG_ATTR_RW(refcount_continue_update,	XFS_ERRTAG_REFCOUNT_CONTINUE_UPDA
>  XFS_ERRORTAG_ATTR_RW(refcount_finish_one,	XFS_ERRTAG_REFCOUNT_FINISH_ONE);
>  XFS_ERRORTAG_ATTR_RW(bmap_finish_one,	XFS_ERRTAG_BMAP_FINISH_ONE);
>  XFS_ERRORTAG_ATTR_RW(ag_resv_critical,	XFS_ERRTAG_AG_RESV_CRITICAL);
> +XFS_ERRORTAG_ATTR_RW(drop_writes,	XFS_ERRTAG_DROP_WRITES);
>  
>  static struct attribute *xfs_errortag_attrs[] = {
>  	XFS_ERRORTAG_ATTR_LIST(noerror),
> @@ -187,6 +189,7 @@ static struct attribute *xfs_errortag_attrs[] = {
>  	XFS_ERRORTAG_ATTR_LIST(refcount_finish_one),
>  	XFS_ERRORTAG_ATTR_LIST(bmap_finish_one),
>  	XFS_ERRORTAG_ATTR_LIST(ag_resv_critical),
> +	XFS_ERRORTAG_ATTR_LIST(drop_writes),
>  	NULL,
>  };
>  
> diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
> index 083a6fc..cd7881f 100644
> --- a/fs/xfs/xfs_error.h
> +++ b/fs/xfs/xfs_error.h
> @@ -96,7 +96,18 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
>  #define XFS_ERRTAG_REFCOUNT_FINISH_ONE			25
>  #define XFS_ERRTAG_BMAP_FINISH_ONE			26
>  #define XFS_ERRTAG_AG_RESV_CRITICAL			27
> -#define XFS_ERRTAG_MAX					28
> +
> +/*
> + * DEBUG mode instrumentation to test and/or trigger delayed allocation
> + * block killing in the event of failed writes. When enabled, all
> + * buffered writes are silenty dropped and handled as if they failed.
> + * All delalloc blocks in the range of the write (including pre-existing
> + * delalloc blocks!) are tossed as part of the write failure error
> + * handling sequence.
> + */
> +#define XFS_ERRTAG_DROP_WRITES				28
> +
> +#define XFS_ERRTAG_MAX					29
>  
>  /*
>   * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
> @@ -129,6 +140,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
>  #define XFS_RANDOM_REFCOUNT_FINISH_ONE			1
>  #define XFS_RANDOM_BMAP_FINISH_ONE			1
>  #define XFS_RANDOM_AG_RESV_CRITICAL			4
> +#define XFS_RANDOM_DROP_WRITES				1
>  
>  #ifdef DEBUG
>  extern int xfs_errortag_init(struct xfs_mount *mp);
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 304b79d..86f1a9f 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -1097,7 +1097,7 @@ xfs_file_iomap_end_delalloc(
>  	 * Behave as if the write failed if drop writes is enabled. Set the NEW
>  	 * flag to force delalloc cleanup.
>  	 */
> -	if (xfs_mp_drop_writes(mp)) {
> +	if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_DROP_WRITES)) {
>  		iomap->flags |= IOMAP_F_NEW;
>  		written = 0;
>  	}
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 931e9fc..e0792d0 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -205,16 +205,6 @@ typedef struct xfs_mount {
>  	 */
>  	unsigned int		*m_errortag;
>  	struct xfs_kobj		m_errortag_kobj;
> -
> -	/*
> -	 * DEBUG mode instrumentation to test and/or trigger delayed allocation
> -	 * block killing in the event of failed writes. When enabled, all
> -	 * buffered writes are silenty dropped and handled as if they failed.
> -	 * All delalloc blocks in the range of the write (including pre-existing
> -	 * delalloc blocks!) are tossed as part of the write failure error
> -	 * handling sequence.
> -	 */
> -	bool			m_drop_writes;
>  #endif
>  } xfs_mount_t;
>  
> @@ -333,20 +323,6 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
>  	return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
>  }
>  
> -#ifdef DEBUG
> -static inline bool
> -xfs_mp_drop_writes(struct xfs_mount *mp)
> -{
> -	return mp->m_drop_writes;
> -}
> -#else
> -static inline bool
> -xfs_mp_drop_writes(struct xfs_mount *mp)
> -{
> -	return 0;
> -}
> -#endif
> -
>  /* per-AG block reservation data structures*/
>  enum xfs_ag_resv_type {
>  	XFS_AG_RESV_NONE = 0,
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index b86148a..3e52662 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -90,49 +90,7 @@ to_mp(struct kobject *kobject)
>  	return container_of(kobj, struct xfs_mount, m_kobj);
>  }
>  
> -#ifdef DEBUG
> -
> -STATIC ssize_t
> -drop_writes_store(
> -	struct kobject		*kobject,
> -	const char		*buf,
> -	size_t			count)
> -{
> -	struct xfs_mount	*mp = to_mp(kobject);
> -	int			ret;
> -	int			val;
> -
> -	ret = kstrtoint(buf, 0, &val);
> -	if (ret)
> -		return ret;
> -
> -	if (val == 1)
> -		mp->m_drop_writes = true;
> -	else if (val == 0)
> -		mp->m_drop_writes = false;
> -	else
> -		return -EINVAL;
> -
> -	return count;
> -}
> -
> -STATIC ssize_t
> -drop_writes_show(
> -	struct kobject		*kobject,
> -	char			*buf)
> -{
> -	struct xfs_mount	*mp = to_mp(kobject);
> -
> -	return snprintf(buf, PAGE_SIZE, "%d\n", mp->m_drop_writes ? 1 : 0);
> -}
> -XFS_SYSFS_ATTR_RW(drop_writes);
> -
> -#endif /* DEBUG */
> -
>  static struct attribute *xfs_mp_attrs[] = {
> -#ifdef DEBUG
> -	ATTR_LIST(drop_writes),
> -#endif
>  	NULL,
>  };
>  
> 
> --
> 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-06-21 18:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  1:11 [RFC PATCH 0/4] xfs: more configurable error injection Darrick J. Wong
2017-06-21  1:11 ` [PATCH 1/4] xfs: make errortag a per-mountpoint structure Darrick J. Wong
2017-06-21 18:18   ` Brian Foster
2017-06-21 18:46     ` Darrick J. Wong
2017-06-21 19:05       ` Brian Foster
2017-06-21  1:11 ` [PATCH 2/4] xfs: expose errortag knobs via sysfs Darrick J. Wong
2017-06-21 18:19   ` Brian Foster
2017-06-21 18:39     ` Darrick J. Wong
2017-06-21 18:53       ` Brian Foster
2017-06-21 20:45         ` Darrick J. Wong
2017-06-22 15:15           ` Carlos Maiolino
2017-06-22 17:29             ` Darrick J. Wong
2017-06-23  9:16               ` Carlos Maiolino
2017-06-23 16:13                 ` Darrick J. Wong
2017-06-21  1:11 ` [PATCH 3/4] xfs: remove unneeded parameter from XFS_TEST_ERROR Darrick J. Wong
2017-06-21 18:19   ` Brian Foster
2017-06-21  1:11 ` [PATCH 4/4] xfs: convert drop_writes to use the errortag mechanism Darrick J. Wong
2017-06-21 18:19   ` Brian Foster [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-06-23 16:35 [PATCH v2 0/4] xfs: more configurable error injection Darrick J. Wong
2017-06-23 16:35 ` [PATCH 4/4] xfs: convert drop_writes to use the errortag mechanism Darrick J. Wong
2017-06-27 10:51   ` Carlos Maiolino

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=20170621181941.GE29843@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.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 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.