[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9acdeec0-e5d6-4139-329d-57f1f4dee1a5@huawei.com>
Date: Sat, 17 Feb 2024 19:53:53 +0800
From: Zhang Yi <yi.zhang@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: <linux-ext4@...r.kernel.org>, Ted Tso <tytso@....edu>
Subject: Re: [PATCH] ext4: Don't report EOPNOTSUPP errors from discard
On 2024/2/13 18:16, Jan Kara wrote:
> When ext4 is mounted without journal, with discard mount option, and on
> a device not supporting trim, we print error for each and every freed
> extent. This is not only useless but actively harmful. Instead ignore
> the EOPNOTSUPP error. Trim is only advisory anyway and when the
> filesystem has journal we silently ignore trim error as well.
>
Make sense, call ext4_std_error() since EOPNOTSUPP is really harmful.
Reviewed-by: Zhang Yi <yi.zhang@...wei.com>
> Signed-off-by: Jan Kara <jack@...e.cz>
> ---
> fs/ext4/mballoc.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index e4f7cf9d89c4..aed620cf4d40 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -6488,7 +6488,13 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
> if (test_opt(sb, DISCARD)) {
> err = ext4_issue_discard(sb, block_group, bit,
> count_clusters, NULL);
> - if (err && err != -EOPNOTSUPP)
> + /*
> + * Ignore EOPNOTSUPP error. This is consistent with
> + * what happens when using journal.
> + */
> + if (err == -EOPNOTSUPP)
> + err = 0;
> + if (err)
> ext4_msg(sb, KERN_WARNING, "discard request in"
> " group:%u block:%d count:%lu failed"
> " with %d", block_group, bit, count,
>
Powered by blists - more mailing lists