DelayedAllocation
From Ext4
(Difference between revisions)
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
== Status == | == Status == | ||
− | + | Complete. | |
+ | |||
+ | (This page and everything below is horribly out of date. It needs to be updated to reflect the implementation.) | ||
+ | |||
== Design == | == Design == | ||
Line 9: | Line 12: | ||
In write path, VFS's function __block_write_full_page() is called with special ''get_block()'' method which doesn't allocate block immediately, but reserve it only and mark bh '''Delay'''. | In write path, VFS's function __block_write_full_page() is called with special ''get_block()'' method which doesn't allocate block immediately, but reserve it only and mark bh '''Delay'''. | ||
− | In flush path, VFS's function mpage_da_writepages() scans mapping for dirty pages, collects dirty non-allocated bhs, tries to allocate them with minimal calls to ''get_block()'' method, applies allocated blocks to delayed bhs and drops '''Delay''' state. | + | In flush path, VFS's function mpage_da_writepages() scans mapping for dirty pages, collects dirty non-allocated bhs, tries to allocate them with minimal calls to ''get_block()'' method, applies allocated blocks to delayed bhs and drops '''Delay''' state. |
=== ext4 part === | === ext4 part === | ||
Line 22: | Line 25: | ||
* updates on-disk size | * updates on-disk size | ||
* closes transaction | * closes transaction | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 20:24, 6 July 2010
Contents |
[edit] Status
Complete.
(This page and everything below is horribly out of date. It needs to be updated to reflect the implementation.)
[edit] Design
[edit] VFS part
In write path, VFS's function __block_write_full_page() is called with special get_block() method which doesn't allocate block immediately, but reserve it only and mark bh Delay.
In flush path, VFS's function mpage_da_writepages() scans mapping for dirty pages, collects dirty non-allocated bhs, tries to allocate them with minimal calls to get_block() method, applies allocated blocks to delayed bhs and drops Delay state.
[edit] ext4 part
ext4 implements two different get_block() methods:
- one for write(2) path
* checks whether block is already allocated * if it's not, then reserves block(s) needed for data and metadata and mark bh Delay
- another one for flush path
* starts transaction * allocates blocks * updates on-disk size * closes transaction