linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Output warning message when discard option was enabled even though the device does not support discard
Date: Mon, 18 Sep 2017 08:44:42 -0400	[thread overview]
Message-ID: <20170918124440.GA29965@bfoster.bfoster> (raw)
In-Reply-To: <20170917073252.15432-1-nakayamakenjiro@gmail.com>

On Sun, Sep 17, 2017 at 04:32:52PM +0900, Kenjiro Nakayama wrote:
> In order to using discard function, it is necessary that not only xfs
> is mounted with discard option, but also the discard function is
> supported by the device. Current code doesn't output any message when
> users mount with discard option on unsupported device, so it is
> difficult to notice that it was not enabled actually.
> 
> This patch adds the warning message to notice that discard option is
> not enabled due to unsupported device when the filesystem is mounted.
> 
> Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
> ---
>  fs/xfs/xfs_super.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index c996f4ae4a5f..60397f9cc786 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -407,6 +407,13 @@ xfs_parseargs(
>  		return -EINVAL;
>  	}
>  #endif
> +	if (mp->m_flags & XFS_MOUNT_DISCARD) {
> +		struct request_queue *q = bdev_get_queue(sb->s_bdev);
> +
> +		if (!blk_queue_discard(q))
> +			xfs_warn(mp, "mounting with \"discard\" option, but "
> +					"the device does not support discard");
> +	}

Seems reasonable to me. Though perhaps we should move this into
xfs_fs_fill_super() (where we have a similar check for DAX support of
the underlying device) and also clear the discard flag so we don't
continue to queue discards that won't ever succeed.

Brian

>  
>  	if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
>  		xfs_warn(mp, "sunit and swidth must be specified together");
> -- 
> 2.13.5
> 
> --
> 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-09-18 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17  7:32 [PATCH] xfs: Output warning message when discard option was enabled even though the device does not support discard Kenjiro Nakayama
2017-09-18 12:44 ` Brian Foster [this message]

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=20170918124440.GA29965@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nakayamakenjiro@gmail.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 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).