ftl: compute length after determining the offset
This commit is contained in:
parent
631cc1e33a
commit
7172423f05
1 changed files with 1 additions and 2 deletions
|
@ -28,11 +28,10 @@ size_t ftl_read(struct ftl_map *map, void *data, size_t len, uint32_t va)
|
|||
if (!data)
|
||||
return 0;
|
||||
|
||||
len = min(len, (1 << map->log2_page_size) - offset);
|
||||
|
||||
mask = ((1 << map->log2_page_size) - 1);
|
||||
offset = va & mask;
|
||||
va >>= map->log2_page_size;
|
||||
len = min(len, (1 << map->log2_page_size) - offset);
|
||||
|
||||
if ((ret = trace_path(map, NULL, &page, va)) < 0) {
|
||||
memset(data, 0, len);
|
||||
|
|
Loading…
Add table
Reference in a new issue