Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229114
b: refs/heads/master
c: 9325963
h: refs/heads/master
v: v3
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Jan 10, 2011
1 parent 63d28f8 commit 4bd6eb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4f531501e44206862735e81ddf2b70d0dcf6acf6
refs/heads/master: 932596366760e3f0dac9998665af1c49afcc4285
22 changes: 10 additions & 12 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2608,18 +2608,12 @@ int ext4_mb_release(struct super_block *sb)
static inline int ext4_issue_discard(struct super_block *sb,
ext4_group_t block_group, ext4_grpblk_t block, int count)
{
int ret;
ext4_fsblk_t discard_block;

discard_block = block + ext4_group_first_block_no(sb, block_group);
trace_ext4_discard_blocks(sb,
(unsigned long long) discard_block, count);
ret = sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
if (ret == -EOPNOTSUPP) {
ext4_warning(sb, "discard not supported, disabling");
clear_opt(sb, DISCARD);
}
return ret;
return sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0);
}

/*
Expand All @@ -2631,7 +2625,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
struct super_block *sb = journal->j_private;
struct ext4_buddy e4b;
struct ext4_group_info *db;
int err, count = 0, count2 = 0;
int err, ret, count = 0, count2 = 0;
struct ext4_free_data *entry;
struct list_head *l, *ltmp;

Expand All @@ -2641,9 +2635,15 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
mb_debug(1, "gonna free %u blocks in group %u (0x%p):",
entry->count, entry->group, entry);

if (test_opt(sb, DISCARD))
ext4_issue_discard(sb, entry->group,
if (test_opt(sb, DISCARD)) {
ret = ext4_issue_discard(sb, entry->group,
entry->start_blk, entry->count);
if (unlikely(ret == -EOPNOTSUPP)) {
ext4_warning(sb, "discard not supported, "
"disabling");
clear_opt(sb, DISCARD);
}
}

err = ext4_mb_load_buddy(sb, entry->group, &e4b);
/* we expect to find existing buddy because it's pinned */
Expand Down Expand Up @@ -4722,8 +4722,6 @@ static int ext4_trim_extent(struct super_block *sb, int start, int count,
ext4_unlock_group(sb, group);

ret = ext4_issue_discard(sb, group, start, count);
if (ret)
ext4_std_error(sb, ret);

ext4_lock_group(sb, group);
mb_free_blocks(NULL, e4b, start, ex.fe_len);
Expand Down

0 comments on commit 4bd6eb7

Please sign in to comment.