ext4: trim allocation requests to group size

am: 8774c73cf6

Change-Id: I7ef4daf4451a8e8373f8e6e0cf07e08c676c9921
This commit is contained in:
Jan Kara 2017-03-12 08:18:07 +00:00 committed by android-build-merger
commit 3e0e74cef5

View file

@ -3121,6 +3121,13 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
if (ar->pright && start + size - 1 >= ar->lright)
size -= start + size - ar->lright;
/*
* Trim allocation request for filesystems with artificially small
* groups.
*/
if (size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb))
size = EXT4_BLOCKS_PER_GROUP(ac->ac_sb);
end = start + size;
/* check we don't cross already preallocated blocks */