diff options
author | Eric Sandeen <sandeen@redhat.com> | 2010-05-16 03:00:00 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-05-16 03:00:00 -0400 |
commit | a30eec2a8650a77f754e84b2e15f062fe652baa7 (patch) | |
tree | 7b20063513e534c5c13608df572c77c6975ff900 /fs/ext4 | |
parent | 6b0310fbf087ad6e9e3b8392adca97cd77184084 (diff) |
ext4: stop issuing discards if not supported by device
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 8639d5a637b2..4f2d3a9d4e21 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2534,6 +2534,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2534 | entry->count, entry->group, entry); | 2534 | entry->count, entry->group, entry); |
2535 | 2535 | ||
2536 | if (test_opt(sb, DISCARD)) { | 2536 | if (test_opt(sb, DISCARD)) { |
2537 | int ret; | ||
2537 | ext4_fsblk_t discard_block; | 2538 | ext4_fsblk_t discard_block; |
2538 | 2539 | ||
2539 | discard_block = entry->start_blk + | 2540 | discard_block = entry->start_blk + |
@@ -2541,7 +2542,12 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2541 | trace_ext4_discard_blocks(sb, | 2542 | trace_ext4_discard_blocks(sb, |
2542 | (unsigned long long)discard_block, | 2543 | (unsigned long long)discard_block, |
2543 | entry->count); | 2544 | entry->count); |
2544 | sb_issue_discard(sb, discard_block, entry->count); | 2545 | ret = sb_issue_discard(sb, discard_block, entry->count); |
2546 | if (ret == EOPNOTSUPP) { | ||
2547 | ext4_warning(sb, | ||
2548 | "discard not supported, disabling"); | ||
2549 | clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD); | ||
2550 | } | ||
2545 | } | 2551 | } |
2546 | 2552 | ||
2547 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); | 2553 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); |