summaryrefslogtreecommitdiff
path: root/sound/isa
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2022-08-08 08:45:41 +0300
committerDavid Sterba <dsterba@suse.com>2022-09-26 13:27:55 +0300
commiteb2fad300550825457bf11d7dd751d9175add39e (patch)
treedf419a91d9608dadcfa4c8b3f698a66e6d5020b4 /sound/isa
parentf3e01e0e3c1f929d2ac39c335b024054b55e445a (diff)
downloadlinux-eb2fad300550825457bf11d7dd751d9175add39e.tar.xz
btrfs: scrub: remove scrub_sector::page and use scrub_block::pages instead
Although scrub currently works for subpage (PAGE_SIZE > sectorsize) cases, it will allocate one page for each scrub_sector, which can cause extra unnecessary memory usage. Utilize scrub_block::pages[] instead of allocating page for each scrub_sector, this allows us to integrate larger extents while using less memory. For example, if our page size is 64K, sectorsize is 4K, and we got an 32K sized extent. We will only allocate one page for scrub_block, and all 8 scrub sectors will point to that page. To do that properly, here we introduce several small helpers: - scrub_page_get_logical() Get the logical bytenr of a page. We store the logical bytenr of the page range into page::private. But for 32bit systems, their (void *) is not large enough to contain a u64, so in that case we will need to allocate extra memory for it. For 64bit systems, we can use page::private directly. - scrub_block_get_logical() Just get the logical bytenr of the first page. - scrub_sector_get_page() Return the page which the scrub_sector points to. - scrub_sector_get_page_offset() Return the offset inside the page which the scrub_sector points to. - scrub_sector_get_kaddr() Return the address which the scrub_sector points to. Just a wrapper using scrub_sector_get_page() and scrub_sector_get_page_offset() - bio_add_scrub_sector() Please note that, even with this patch, we're still allocating one page for one sector for data extents. This is because in scrub_extent() we split the data extent using sectorsize. The memory usage reduction will need extra work to make scrub to work like data read to only use the correct sector(s). Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'sound/isa')
0 files changed, 0 insertions, 0 deletions