Skip to content

Commit

Permalink
staging: exfat: properly support discard in clr_alloc_bitmap()
Browse files Browse the repository at this point in the history
Currently the discard code in clr_alloc_bitmap() is just dead code.
Move code around so that the discard operation is properly attempted
when enabled.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Link: https://lore.kernel.org/r/20191205152913.GJ3276@xps-13
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andrea Righi authored and Greg Kroah-Hartman committed Dec 10, 2019
1 parent 7d42b79 commit 1184fd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/exfat/exfat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu)

exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b);

return sector_write(sb, sector, p_fs->vol_amap[i], 0);

#ifdef CONFIG_EXFAT_DISCARD
if (opts->discard) {
ret = sb_issue_discard(sb, START_SECTOR(clu),
Expand All @@ -202,9 +200,13 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu)
if (ret == -EOPNOTSUPP) {
pr_warn("discard not supported by device, disabling");
opts->discard = 0;
} else {
return ret;
}
}
#endif /* CONFIG_EXFAT_DISCARD */

return sector_write(sb, sector, p_fs->vol_amap[i], 0);
}

static u32 test_alloc_bitmap(struct super_block *sb, u32 clu)
Expand Down

0 comments on commit 1184fd9

Please sign in to comment.