Project import generated by Copybara.
GitOrigin-RevId: 0acb173e07e155358594d3ce7b5f19e91bb9fec3
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 3c3166b..cd69510 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1542,11 +1542,10 @@ static int mb_find_extent(struct ext4_buddy *e4b, int block,
if (ex->fe_start + ex->fe_len > EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) {
/* Should never happen! (but apparently sometimes does?!?) */
WARN_ON(1);
- ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0,
- "corruption or bug in mb_find_extent "
- "block=%d, order=%d needed=%d ex=%u/%d/%d@%u",
- block, order, needed, ex->fe_group, ex->fe_start,
- ex->fe_len, ex->fe_logical);
+ ext4_error(e4b->bd_sb, "corruption or bug in mb_find_extent "
+ "block=%d, order=%d needed=%d ex=%u/%d/%d@%u",
+ block, order, needed, ex->fe_group, ex->fe_start,
+ ex->fe_len, ex->fe_logical);
ex->fe_len = 0;
ex->fe_start = 0;
ex->fe_group = 0;
@@ -3172,15 +3171,6 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
size = size >> bsbits;
start = start_off >> bsbits;
- /*
- * For tiny groups (smaller than 8MB) the chosen allocation
- * alignment may be larger than group size. Make sure the
- * alignment does not move allocation to a different group which
- * makes mballoc fail assertions later.
- */
- start = max(start, rounddown(ac->ac_o_ex.fe_logical,
- (ext4_lblk_t)EXT4_BLOCKS_PER_GROUP(ac->ac_sb)));
-
/* don't cover already allocated blocks in selected range */
if (ar->pleft && start <= ar->lleft) {
size -= ar->lleft + 1 - start;
@@ -5279,7 +5269,6 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
*/
int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
{
- struct request_queue *q = bdev_get_queue(sb->s_bdev);
struct ext4_group_info *grp;
ext4_group_t group, first_group, last_group;
ext4_grpblk_t cnt = 0, first_cluster, last_cluster;
@@ -5298,13 +5287,6 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
start >= max_blks ||
range->len < sb->s_blocksize)
return -EINVAL;
- /* No point to try to trim less than discard granularity */
- if (range->minlen < q->limits.discard_granularity) {
- minlen = EXT4_NUM_B2C(EXT4_SB(sb),
- q->limits.discard_granularity >> sb->s_blocksize_bits);
- if (minlen > EXT4_CLUSTERS_PER_GROUP(sb))
- goto out;
- }
if (end >= max_blks)
end = max_blks - 1;
if (end <= first_data_blk)