Fix trim-related issues

Fixes:
* Use uint64 instead of off_t when handling offset and size
  of the trimmed range in the fs_trim_data structure
* BlockAllocator::Trim: Correct the size of a buffer
* ram_disk, mmc: Do not trim past device capacity

Improvements:
* BlockAllocator::Trim: Because the received offset and size
  are ignored by BFS (the functionality is not implemented yet),
  return B_UNSUPPORTED if the range does not cover the whole
  partition
* ram_disk, mmc: More accurate calculation of the number
  of trimmed bytes
* devfs: Add a uint64 version of translate_partition_access()

Change-Id: I24f4c08674f123ad33a5fef6e28996a4ada6ff0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4155
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
David Sebek
2021-07-16 18:35:34 +00:00
committed by Adrien Destugues
parent 354b6bcfbd
commit bd02d81c24
7 changed files with 164 additions and 39 deletions
+2 -2
View File
@@ -175,8 +175,8 @@ typedef struct {
uint32 range_count;
uint64 trimmed_size; /* filled on return */
struct range {
off_t offset; /* offset (in bytes) */
off_t size;
uint64 offset; /* offset (in bytes) */
uint64 size;
} ranges[1];
} fs_trim_data;