summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-03-12 08:18:07 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-12 08:18:07 +0000
commit3e0e74cef5424866f16f724f54bf7ea29264131f (patch)
treeb98a9c0cc4e6c0e9c8dcfdbfd6878ea4e239a2d3
parent5dc0688be0f972a9a0cc748b6006251acf655196 (diff)
parent8774c73cf6963310395823ed7077ea12943ea0f3 (diff)
ext4: trim allocation requests to group size
am: 8774c73cf6 Change-Id: I7ef4daf4451a8e8373f8e6e0cf07e08c676c9921
-rw-r--r--fs/ext4/mballoc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index be1227c196d8..c2810503eb50 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -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 */