Whamcloud - gitweb
AOSP: e2fsdroid: Don't over-reserve blocks for files in Base FS.
authorDavid Anderson <dvander@google.com>
Sat, 7 Dec 2019 01:05:54 +0000 (17:05 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Jul 2021 01:09:09 +0000 (21:09 -0400)
commit83782a687791f98237598d1ef9ff161a8b3a3c13
tree475cf752839d073d1dc688e53f6c75f24e0a2568
parent942b00cb9d2f2b52f4c58877d523145ee59a89b0
AOSP: e2fsdroid: Don't over-reserve blocks for files in Base FS.

If a large number of blocks move from one file to another file,
e2fsdroid will inadvertently reserve the moved blocks for the source
file. If the larger file is visited first, it can fail to acquire blocks
because they're reserved by the smaller file.

This patch only reserves the first N blocks of a file in Base FS, where N
is large enough to satisfy the |st_size| property from lstat(2). We only
consider "owned" blocks rather than deduplicated blocks, in case the new
file cannot be deduplicated.

Google-Bug-Id: 145316683
Test: e2fsdroid with dynamic partitions
Change-Id: I32e255a19550d52d90342c21d7218981108a71b1
From AOSP commit: 2985b26cdbe674084fa02b211503eef9bf970023
contrib/android/basefs_allocator.c