Skip to content

Commit

Permalink
ext4: stop issuing discards if not supported by device
Browse files Browse the repository at this point in the history
Turn off issuance of discard requests if the device does
not support it - similar to the action we take for barriers.
This will save a little computation time if a non-discardable
device is mounted with -o discard, and also makes it obvious
that it's not doing what was asked at mount time ...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Eric Sandeen authored and Theodore Ts'o committed May 16, 2010
1 parent 6b0310f commit a30eec2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2534,14 +2534,20 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
entry->count, entry->group, entry);

if (test_opt(sb, DISCARD)) {
int ret;
ext4_fsblk_t discard_block;

discard_block = entry->start_blk +
ext4_group_first_block_no(sb, entry->group);
trace_ext4_discard_blocks(sb,
(unsigned long long)discard_block,
entry->count);
sb_issue_discard(sb, discard_block, entry->count);
ret = sb_issue_discard(sb, discard_block, entry->count);
if (ret == EOPNOTSUPP) {
ext4_warning(sb,
"discard not supported, disabling");
clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD);
}
}

err = ext4_mb_load_buddy(sb, entry->group, &e4b);
Expand Down

0 comments on commit a30eec2

Please sign in to comment.