We are manually mapping the folio, copying from it with memcpy() and then
unmapping, but this can all simply be done with memcpy_from_folio() that
is provided by the MM layer. So use memcpy_from_folio() instead.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshrin@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
while (cur < filepos + length) {
struct folio *folio;
- void *data_in;
unsigned int offset;
unsigned long copy_length;
int ret;
copy_length = min(folio_size(folio) - offset,
filepos + length - cur);
- data_in = kmap_local_folio(folio, offset);
- memcpy(workspace->buf + cur - filepos, data_in, copy_length);
- kunmap_local(data_in);
+ memcpy_from_folio(workspace->buf + cur - filepos, folio, offset,
+ copy_length);
folio_put(folio);
cur += copy_length;
}