]> git.baikalelectronics.ru Git - kernel.git/commit
efi: Distinguish between "remaining space" and actually used space
authorMatthew Garrett <matthew.garrett@nebula.com>
Mon, 15 Apr 2013 20:09:47 +0000 (13:09 -0700)
committerMatt Fleming <matt.fleming@intel.com>
Mon, 15 Apr 2013 20:33:05 +0000 (21:33 +0100)
commit7fc4095684c06033c981b6053b5f45be179b45ea
tree00a4270a8b9ff7ff561fa75de80dda14dc235583
parentca95a856b7c468af6e33f0ade9a4056b2fa46409
efi: Distinguish between "remaining space" and actually used space

EFI implementations distinguish between space that is actively used by a
variable and space that merely hasn't been garbage collected yet. Space
that hasn't yet been garbage collected isn't available for use and so isn't
counted in the remaining_space field returned by QueryVariableInfo().

Combined with commit e359b3a this can cause problems. Some implementations
don't garbage collect until the remaining space is smaller than the maximum
variable size, and as a result check_var_size() will always fail once more
than 50% of the variable store has been used even if most of that space is
marked as available for garbage collection. The user is unable to create
new variables, and deleting variables doesn't increase the remaining space.

The problem that e359b3a was attempting to avoid was one where certain
platforms fail if the actively used space is greater than 50% of the
available storage space. We should be able to calculate that by simply
summing the size of each available variable and subtracting that from
the total storage space. With luck this will fix the problem described in
https://bugzilla.kernel.org/show_bug.cgi?id=55471 without permitting
damage to occur to the machines e359b3a was attempting to fix.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
arch/x86/platform/efi/efi.c