diff options
author | Lukas Czerner <lczerner@redhat.com> | 2011-01-10 12:09:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-01-10 12:09:59 -0500 |
commit | 932596366760e3f0dac9998665af1c49afcc4285 (patch) | |
tree | 61c75c933abc0f8c9e2f8b712f785d39d46919d3 | |
parent | 4f531501e44206862735e81ddf2b70d0dcf6acf6 (diff) |
ext4: remove warning message from ext4_issue_discard helper
ext4_issue_discard is supposed to be helper for calling discard, however
in case that underlying device does not support discard it prints out
the warning message and clears the DISCARD t_mount_opt flag. Since it
can be (and is) used by others, it should not do anything and let the
caller to handle the error case.
This commit removes warning message and flag setting from
ext4_issue_discard and use it just in place where it is really needed
(release_blocks_on_commit). FITRIM ioctl should not set any flags nor it
should print out warning messages, so get rid of the warning as well.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
-rw-r--r-- | fs/ext4/mballoc.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 7c603a02633e..12b604abc2fe 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2608,18 +2608,12 @@ int ext4_mb_release(struct super_block *sb) | |||
2608 | static inline int ext4_issue_discard(struct super_block *sb, | 2608 | static inline int ext4_issue_discard(struct super_block *sb, |
2609 | ext4_group_t block_group, ext4_grpblk_t block, int count) | 2609 | ext4_group_t block_group, ext4_grpblk_t block, int count) |
2610 | { | 2610 | { |
2611 | int ret; | ||
2612 | ext4_fsblk_t discard_block; | 2611 | ext4_fsblk_t discard_block; |
2613 | 2612 | ||
2614 | discard_block = block + ext4_group_first_block_no(sb, block_group); | 2613 | discard_block = block + ext4_group_first_block_no(sb, block_group); |
2615 | trace_ext4_discard_blocks(sb, | 2614 | trace_ext4_discard_blocks(sb, |
2616 | (unsigned long long) discard_block, count); | 2615 | (unsigned long long) discard_block, count); |
2617 | ret = sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0); | 2616 | return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0); |
2618 | if (ret == -EOPNOTSUPP) { | ||
2619 | ext4_warning(sb, "discard not supported, disabling"); | ||
2620 | clear_opt(sb, DISCARD); | ||
2621 | } | ||
2622 | return ret; | ||
2623 | } | 2617 | } |
2624 | 2618 | ||
2625 | /* | 2619 | /* |
@@ -2631,7 +2625,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2631 | struct super_block *sb = journal->j_private; | 2625 | struct super_block *sb = journal->j_private; |
2632 | struct ext4_buddy e4b; | 2626 | struct ext4_buddy e4b; |
2633 | struct ext4_group_info *db; | 2627 | struct ext4_group_info *db; |
2634 | int err, count = 0, count2 = 0; | 2628 | int err, ret, count = 0, count2 = 0; |
2635 | struct ext4_free_data *entry; | 2629 | struct ext4_free_data *entry; |
2636 | struct list_head *l, *ltmp; | 2630 | struct list_head *l, *ltmp; |
2637 | 2631 | ||
@@ -2641,9 +2635,15 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2641 | mb_debug(1, "gonna free %u blocks in group %u (0x%p):", | 2635 | mb_debug(1, "gonna free %u blocks in group %u (0x%p):", |
2642 | entry->count, entry->group, entry); | 2636 | entry->count, entry->group, entry); |
2643 | 2637 | ||
2644 | if (test_opt(sb, DISCARD)) | 2638 | if (test_opt(sb, DISCARD)) { |
2645 | ext4_issue_discard(sb, entry->group, | 2639 | ret = ext4_issue_discard(sb, entry->group, |
2646 | entry->start_blk, entry->count); | 2640 | entry->start_blk, entry->count); |
2641 | if (unlikely(ret == -EOPNOTSUPP)) { | ||
2642 | ext4_warning(sb, "discard not supported, " | ||
2643 | "disabling"); | ||
2644 | clear_opt(sb, DISCARD); | ||
2645 | } | ||
2646 | } | ||
2647 | 2647 | ||
2648 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); | 2648 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); |
2649 | /* we expect to find existing buddy because it's pinned */ | 2649 | /* we expect to find existing buddy because it's pinned */ |
@@ -4722,8 +4722,6 @@ static int ext4_trim_extent(struct super_block *sb, int start, int count, | |||
4722 | ext4_unlock_group(sb, group); | 4722 | ext4_unlock_group(sb, group); |
4723 | 4723 | ||
4724 | ret = ext4_issue_discard(sb, group, start, count); | 4724 | ret = ext4_issue_discard(sb, group, start, count); |
4725 | if (ret) | ||
4726 | ext4_std_error(sb, ret); | ||
4727 | 4725 | ||
4728 | ext4_lock_group(sb, group); | 4726 | ext4_lock_group(sb, group); |
4729 | mb_free_blocks(NULL, e4b, start, ex.fe_len); | 4727 | mb_free_blocks(NULL, e4b, start, ex.fe_len); |