Skip to content

Commit fa60629

Browse files
jankaratytso
authored andcommitted
ext4: don't report EOPNOTSUPP errors from discard
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. Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 7f48212 commit fa60629

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/ext4/mballoc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6496,7 +6496,13 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
64966496
if (test_opt(sb, DISCARD)) {
64976497
err = ext4_issue_discard(sb, block_group, bit,
64986498
count_clusters, NULL);
6499-
if (err && err != -EOPNOTSUPP)
6499+
/*
6500+
* Ignore EOPNOTSUPP error. This is consistent with
6501+
* what happens when using journal.
6502+
*/
6503+
if (err == -EOPNOTSUPP)
6504+
err = 0;
6505+
if (err)
65006506
ext4_msg(sb, KERN_WARNING, "discard request in"
65016507
" group:%u block:%d count:%lu failed"
65026508
" with %d", block_group, bit, count,

0 commit comments

Comments
 (0)