* [PATCH v2] xfs: Output warning message when discard option was enabled even though the device does not support discard
@ 2017-09-18 13:57 Kenjiro Nakayama
2017-09-18 19:06 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Kenjiro Nakayama @ 2017-09-18 13:57 UTC (permalink / raw)
To: linux-xfs; +Cc: bfoster, Kenjiro Nakayama
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.
Changes in v2 (Suggested by Brian Foster):
- Move the unsupported device check into xfs_fs_fill_super().
- Clear the discard flag when device is unsupported.
Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
---
fs/xfs/xfs_super.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index c996f4ae4a5f..584cf2d573ba 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1654,6 +1654,16 @@ xfs_fs_fill_super(
"DAX and reflink have not been tested together!");
}
+ 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");
+ mp->m_flags &= ~XFS_MOUNT_DISCARD;
+ }
+ }
+
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
if (mp->m_sb.sb_rblocks) {
xfs_alert(mp,
--
2.13.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] xfs: Output warning message when discard option was enabled even though the device does not support discard
2017-09-18 13:57 [PATCH v2] xfs: Output warning message when discard option was enabled even though the device does not support discard Kenjiro Nakayama
@ 2017-09-18 19:06 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2017-09-18 19:06 UTC (permalink / raw)
To: Kenjiro Nakayama; +Cc: linux-xfs, bfoster
On Mon, Sep 18, 2017 at 10:57:38PM +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.
>
> Changes in v2 (Suggested by Brian Foster):
> - Move the unsupported device check into xfs_fs_fill_super().
> - Clear the discard flag when device is unsupported.
>
> Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
Looks ok, will test...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_super.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index c996f4ae4a5f..584cf2d573ba 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1654,6 +1654,16 @@ xfs_fs_fill_super(
> "DAX and reflink have not been tested together!");
> }
>
> + 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");
> + mp->m_flags &= ~XFS_MOUNT_DISCARD;
> + }
> + }
> +
> if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
> if (mp->m_sb.sb_rblocks) {
> xfs_alert(mp,
> --
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-18 19:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 13:57 [PATCH v2] xfs: Output warning message when discard option was enabled even though the device does not support discard Kenjiro Nakayama
2017-09-18 19:06 ` Darrick J. Wong
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).